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>
18 #include <asm/timex.h>
19 #include <asm/mach/map.h>
20 #include <asm/mach/time.h>
21 #include <asm/arch/loki.h>
22 #include <asm/plat-orion/orion_nand.h>
23 #include <asm/plat-orion/time.h>
26 /*****************************************************************************
28 ****************************************************************************/
29 static struct map_desc loki_io_desc[] __initdata = {
31 .virtual = LOKI_REGS_VIRT_BASE,
32 .pfn = __phys_to_pfn(LOKI_REGS_PHYS_BASE),
33 .length = LOKI_REGS_SIZE,
38 void __init loki_map_io(void)
40 iotable_init(loki_io_desc, ARRAY_SIZE(loki_io_desc));
44 /*****************************************************************************
46 ****************************************************************************/
47 struct mv643xx_eth_shared_platform_data loki_ge0_shared_data = {
49 .dram = &loki_mbus_dram_info,
52 static struct resource loki_ge0_shared_resources[] = {
55 .start = GE0_PHYS_BASE + 0x2000,
56 .end = GE0_PHYS_BASE + 0x3fff,
57 .flags = IORESOURCE_MEM,
61 static struct platform_device loki_ge0_shared = {
62 .name = MV643XX_ETH_SHARED_NAME,
65 .platform_data = &loki_ge0_shared_data,
68 .resource = loki_ge0_shared_resources,
71 static struct resource loki_ge0_resources[] = {
74 .start = IRQ_LOKI_GBE_A_INT,
75 .end = IRQ_LOKI_GBE_A_INT,
76 .flags = IORESOURCE_IRQ,
80 static struct platform_device loki_ge0 = {
81 .name = MV643XX_ETH_NAME,
84 .resource = loki_ge0_resources,
87 void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data)
89 eth_data->shared = &loki_ge0_shared;
90 loki_ge0.dev.platform_data = eth_data;
92 writel(0x00079220, GE0_VIRT_BASE + 0x20b0);
93 platform_device_register(&loki_ge0_shared);
94 platform_device_register(&loki_ge0);
98 /*****************************************************************************
100 ****************************************************************************/
101 struct mv643xx_eth_shared_platform_data loki_ge1_shared_data = {
103 .dram = &loki_mbus_dram_info,
106 static struct resource loki_ge1_shared_resources[] = {
109 .start = GE1_PHYS_BASE + 0x2000,
110 .end = GE1_PHYS_BASE + 0x3fff,
111 .flags = IORESOURCE_MEM,
115 static struct platform_device loki_ge1_shared = {
116 .name = MV643XX_ETH_SHARED_NAME,
119 .platform_data = &loki_ge1_shared_data,
122 .resource = loki_ge1_shared_resources,
125 static struct resource loki_ge1_resources[] = {
128 .start = IRQ_LOKI_GBE_B_INT,
129 .end = IRQ_LOKI_GBE_B_INT,
130 .flags = IORESOURCE_IRQ,
134 static struct platform_device loki_ge1 = {
135 .name = MV643XX_ETH_NAME,
138 .resource = loki_ge1_resources,
141 void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data)
143 eth_data->shared = &loki_ge1_shared;
144 loki_ge1.dev.platform_data = eth_data;
146 writel(0x00079220, GE1_VIRT_BASE + 0x20b0);
147 platform_device_register(&loki_ge1_shared);
148 platform_device_register(&loki_ge1);
152 /*****************************************************************************
154 ****************************************************************************/
155 static struct resource loki_sas_resources[] = {
157 .name = "mvsas0 mem",
158 .start = SAS0_PHYS_BASE,
159 .end = SAS0_PHYS_BASE + 0x01ff,
160 .flags = IORESOURCE_MEM,
162 .name = "mvsas0 irq",
163 .start = IRQ_LOKI_SAS_A,
164 .end = IRQ_LOKI_SAS_A,
165 .flags = IORESOURCE_IRQ,
167 .name = "mvsas1 mem",
168 .start = SAS1_PHYS_BASE,
169 .end = SAS1_PHYS_BASE + 0x01ff,
170 .flags = IORESOURCE_MEM,
172 .name = "mvsas1 irq",
173 .start = IRQ_LOKI_SAS_B,
174 .end = IRQ_LOKI_SAS_B,
175 .flags = IORESOURCE_IRQ,
179 static struct platform_device loki_sas = {
183 .coherent_dma_mask = 0xffffffff,
185 .num_resources = ARRAY_SIZE(loki_sas_resources),
186 .resource = loki_sas_resources,
189 void __init loki_sas_init(void)
191 writel(0x8300f707, DDR_REG(0x1424));
192 platform_device_register(&loki_sas);
196 /*****************************************************************************
198 ****************************************************************************/
199 static struct plat_serial8250_port loki_uart0_data[] = {
201 .mapbase = UART0_PHYS_BASE,
202 .membase = (char *)UART0_VIRT_BASE,
203 .irq = IRQ_LOKI_UART0,
204 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
207 .uartclk = LOKI_TCLK,
212 static struct resource loki_uart0_resources[] = {
214 .start = UART0_PHYS_BASE,
215 .end = UART0_PHYS_BASE + 0xff,
216 .flags = IORESOURCE_MEM,
218 .start = IRQ_LOKI_UART0,
219 .end = IRQ_LOKI_UART0,
220 .flags = IORESOURCE_IRQ,
224 static struct platform_device loki_uart0 = {
225 .name = "serial8250",
228 .platform_data = loki_uart0_data,
230 .resource = loki_uart0_resources,
231 .num_resources = ARRAY_SIZE(loki_uart0_resources),
234 void __init loki_uart0_init(void)
236 platform_device_register(&loki_uart0);
240 /*****************************************************************************
242 ****************************************************************************/
243 static struct plat_serial8250_port loki_uart1_data[] = {
245 .mapbase = UART1_PHYS_BASE,
246 .membase = (char *)UART1_VIRT_BASE,
247 .irq = IRQ_LOKI_UART1,
248 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
251 .uartclk = LOKI_TCLK,
256 static struct resource loki_uart1_resources[] = {
258 .start = UART1_PHYS_BASE,
259 .end = UART1_PHYS_BASE + 0xff,
260 .flags = IORESOURCE_MEM,
262 .start = IRQ_LOKI_UART1,
263 .end = IRQ_LOKI_UART1,
264 .flags = IORESOURCE_IRQ,
268 static struct platform_device loki_uart1 = {
269 .name = "serial8250",
272 .platform_data = loki_uart1_data,
274 .resource = loki_uart1_resources,
275 .num_resources = ARRAY_SIZE(loki_uart1_resources),
278 void __init loki_uart1_init(void)
280 platform_device_register(&loki_uart1);
284 /*****************************************************************************
286 ****************************************************************************/
287 static void loki_timer_init(void)
289 orion_time_init(IRQ_LOKI_BRIDGE, LOKI_TCLK);
292 struct sys_timer loki_timer = {
293 .init = loki_timer_init,
297 /*****************************************************************************
299 ****************************************************************************/
300 void __init loki_init(void)
302 printk(KERN_INFO "Loki ID: 88RC8480. TCLK=%d.\n", LOKI_TCLK);
304 loki_setup_cpu_mbus();