2 * arch/arm/mach-loki/common.c
4 * Core functions for Marvell Loki (88RC8480) SoCs
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/serial_8250.h>
15 #include <linux/mbus.h>
16 #include <linux/mv643xx_eth.h>
17 #include <linux/dma-mapping.h>
19 #include <asm/timex.h>
20 #include <asm/mach/map.h>
21 #include <asm/mach/time.h>
22 #include <mach/bridge-regs.h>
23 #include <mach/loki.h>
24 #include <plat/orion_nand.h>
25 #include <plat/time.h>
28 /*****************************************************************************
30 ****************************************************************************/
31 static struct map_desc loki_io_desc[] __initdata = {
33 .virtual = LOKI_REGS_VIRT_BASE,
34 .pfn = __phys_to_pfn(LOKI_REGS_PHYS_BASE),
35 .length = LOKI_REGS_SIZE,
40 void __init loki_map_io(void)
42 iotable_init(loki_io_desc, ARRAY_SIZE(loki_io_desc));
46 /*****************************************************************************
48 ****************************************************************************/
49 struct mv643xx_eth_shared_platform_data loki_ge0_shared_data = {
51 .dram = &loki_mbus_dram_info,
54 static struct resource loki_ge0_shared_resources[] = {
57 .start = GE0_PHYS_BASE + 0x2000,
58 .end = GE0_PHYS_BASE + SZ_16K - 1,
59 .flags = IORESOURCE_MEM,
63 static struct platform_device loki_ge0_shared = {
64 .name = MV643XX_ETH_SHARED_NAME,
67 .platform_data = &loki_ge0_shared_data,
70 .resource = loki_ge0_shared_resources,
73 static struct resource loki_ge0_resources[] = {
76 .start = IRQ_LOKI_GBE_A_INT,
77 .end = IRQ_LOKI_GBE_A_INT,
78 .flags = IORESOURCE_IRQ,
82 static struct platform_device loki_ge0 = {
83 .name = MV643XX_ETH_NAME,
86 .resource = loki_ge0_resources,
88 .coherent_dma_mask = DMA_BIT_MASK(32),
92 void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data)
94 eth_data->shared = &loki_ge0_shared;
95 loki_ge0.dev.platform_data = eth_data;
97 writel(0x00079220, GE0_VIRT_BASE + 0x20b0);
98 platform_device_register(&loki_ge0_shared);
99 platform_device_register(&loki_ge0);
103 /*****************************************************************************
105 ****************************************************************************/
106 struct mv643xx_eth_shared_platform_data loki_ge1_shared_data = {
108 .dram = &loki_mbus_dram_info,
111 static struct resource loki_ge1_shared_resources[] = {
114 .start = GE1_PHYS_BASE + 0x2000,
115 .end = GE1_PHYS_BASE + SZ_16K - 1,
116 .flags = IORESOURCE_MEM,
120 static struct platform_device loki_ge1_shared = {
121 .name = MV643XX_ETH_SHARED_NAME,
124 .platform_data = &loki_ge1_shared_data,
127 .resource = loki_ge1_shared_resources,
130 static struct resource loki_ge1_resources[] = {
133 .start = IRQ_LOKI_GBE_B_INT,
134 .end = IRQ_LOKI_GBE_B_INT,
135 .flags = IORESOURCE_IRQ,
139 static struct platform_device loki_ge1 = {
140 .name = MV643XX_ETH_NAME,
143 .resource = loki_ge1_resources,
145 .coherent_dma_mask = DMA_BIT_MASK(32),
149 void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data)
151 eth_data->shared = &loki_ge1_shared;
152 loki_ge1.dev.platform_data = eth_data;
154 writel(0x00079220, GE1_VIRT_BASE + 0x20b0);
155 platform_device_register(&loki_ge1_shared);
156 platform_device_register(&loki_ge1);
160 /*****************************************************************************
162 ****************************************************************************/
163 static struct resource loki_sas_resources[] = {
165 .name = "mvsas0 mem",
166 .start = SAS0_PHYS_BASE,
167 .end = SAS0_PHYS_BASE + 0x01ff,
168 .flags = IORESOURCE_MEM,
170 .name = "mvsas0 irq",
171 .start = IRQ_LOKI_SAS_A,
172 .end = IRQ_LOKI_SAS_A,
173 .flags = IORESOURCE_IRQ,
175 .name = "mvsas1 mem",
176 .start = SAS1_PHYS_BASE,
177 .end = SAS1_PHYS_BASE + 0x01ff,
178 .flags = IORESOURCE_MEM,
180 .name = "mvsas1 irq",
181 .start = IRQ_LOKI_SAS_B,
182 .end = IRQ_LOKI_SAS_B,
183 .flags = IORESOURCE_IRQ,
187 static struct platform_device loki_sas = {
191 .coherent_dma_mask = DMA_BIT_MASK(32),
193 .num_resources = ARRAY_SIZE(loki_sas_resources),
194 .resource = loki_sas_resources,
197 void __init loki_sas_init(void)
199 writel(0x8300f707, DDR_REG(0x1424));
200 platform_device_register(&loki_sas);
204 /*****************************************************************************
206 ****************************************************************************/
207 static struct plat_serial8250_port loki_uart0_data[] = {
209 .mapbase = UART0_PHYS_BASE,
210 .membase = (char *)UART0_VIRT_BASE,
211 .irq = IRQ_LOKI_UART0,
212 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
215 .uartclk = LOKI_TCLK,
220 static struct resource loki_uart0_resources[] = {
222 .start = UART0_PHYS_BASE,
223 .end = UART0_PHYS_BASE + 0xff,
224 .flags = IORESOURCE_MEM,
226 .start = IRQ_LOKI_UART0,
227 .end = IRQ_LOKI_UART0,
228 .flags = IORESOURCE_IRQ,
232 static struct platform_device loki_uart0 = {
233 .name = "serial8250",
234 .id = PLAT8250_DEV_PLATFORM,
236 .platform_data = loki_uart0_data,
238 .resource = loki_uart0_resources,
239 .num_resources = ARRAY_SIZE(loki_uart0_resources),
242 void __init loki_uart0_init(void)
244 platform_device_register(&loki_uart0);
248 /*****************************************************************************
250 ****************************************************************************/
251 static struct plat_serial8250_port loki_uart1_data[] = {
253 .mapbase = UART1_PHYS_BASE,
254 .membase = (char *)UART1_VIRT_BASE,
255 .irq = IRQ_LOKI_UART1,
256 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
259 .uartclk = LOKI_TCLK,
264 static struct resource loki_uart1_resources[] = {
266 .start = UART1_PHYS_BASE,
267 .end = UART1_PHYS_BASE + 0xff,
268 .flags = IORESOURCE_MEM,
270 .start = IRQ_LOKI_UART1,
271 .end = IRQ_LOKI_UART1,
272 .flags = IORESOURCE_IRQ,
276 static struct platform_device loki_uart1 = {
277 .name = "serial8250",
278 .id = PLAT8250_DEV_PLATFORM1,
280 .platform_data = loki_uart1_data,
282 .resource = loki_uart1_resources,
283 .num_resources = ARRAY_SIZE(loki_uart1_resources),
286 void __init loki_uart1_init(void)
288 platform_device_register(&loki_uart1);
292 /*****************************************************************************
294 ****************************************************************************/
295 void __init loki_init_early(void)
297 orion_time_set_base(TIMER_VIRT_BASE);
300 static void loki_timer_init(void)
302 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
303 IRQ_LOKI_BRIDGE, LOKI_TCLK);
306 struct sys_timer loki_timer = {
307 .init = loki_timer_init,
311 /*****************************************************************************
313 ****************************************************************************/
314 void __init loki_init(void)
316 printk(KERN_INFO "Loki ID: 88RC8480. TCLK=%d.\n", LOKI_TCLK);
318 loki_setup_cpu_mbus();