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>
26 #include <plat/common.h>
29 /*****************************************************************************
31 ****************************************************************************/
32 static struct map_desc loki_io_desc[] __initdata = {
34 .virtual = LOKI_REGS_VIRT_BASE,
35 .pfn = __phys_to_pfn(LOKI_REGS_PHYS_BASE),
36 .length = LOKI_REGS_SIZE,
41 void __init loki_map_io(void)
43 iotable_init(loki_io_desc, ARRAY_SIZE(loki_io_desc));
47 /*****************************************************************************
49 ****************************************************************************/
50 struct mv643xx_eth_shared_platform_data loki_ge0_shared_data = {
52 .dram = &loki_mbus_dram_info,
55 static struct resource loki_ge0_shared_resources[] = {
58 .start = GE0_PHYS_BASE + 0x2000,
59 .end = GE0_PHYS_BASE + SZ_16K - 1,
60 .flags = IORESOURCE_MEM,
64 static struct platform_device loki_ge0_shared = {
65 .name = MV643XX_ETH_SHARED_NAME,
68 .platform_data = &loki_ge0_shared_data,
71 .resource = loki_ge0_shared_resources,
74 static struct resource loki_ge0_resources[] = {
77 .start = IRQ_LOKI_GBE_A_INT,
78 .end = IRQ_LOKI_GBE_A_INT,
79 .flags = IORESOURCE_IRQ,
83 static struct platform_device loki_ge0 = {
84 .name = MV643XX_ETH_NAME,
87 .resource = loki_ge0_resources,
89 .coherent_dma_mask = DMA_BIT_MASK(32),
93 void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data)
95 eth_data->shared = &loki_ge0_shared;
96 loki_ge0.dev.platform_data = eth_data;
98 writel(0x00079220, GE0_VIRT_BASE + 0x20b0);
99 platform_device_register(&loki_ge0_shared);
100 platform_device_register(&loki_ge0);
104 /*****************************************************************************
106 ****************************************************************************/
107 struct mv643xx_eth_shared_platform_data loki_ge1_shared_data = {
109 .dram = &loki_mbus_dram_info,
112 static struct resource loki_ge1_shared_resources[] = {
115 .start = GE1_PHYS_BASE + 0x2000,
116 .end = GE1_PHYS_BASE + SZ_16K - 1,
117 .flags = IORESOURCE_MEM,
121 static struct platform_device loki_ge1_shared = {
122 .name = MV643XX_ETH_SHARED_NAME,
125 .platform_data = &loki_ge1_shared_data,
128 .resource = loki_ge1_shared_resources,
131 static struct resource loki_ge1_resources[] = {
134 .start = IRQ_LOKI_GBE_B_INT,
135 .end = IRQ_LOKI_GBE_B_INT,
136 .flags = IORESOURCE_IRQ,
140 static struct platform_device loki_ge1 = {
141 .name = MV643XX_ETH_NAME,
144 .resource = loki_ge1_resources,
146 .coherent_dma_mask = DMA_BIT_MASK(32),
150 void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data)
152 eth_data->shared = &loki_ge1_shared;
153 loki_ge1.dev.platform_data = eth_data;
155 writel(0x00079220, GE1_VIRT_BASE + 0x20b0);
156 platform_device_register(&loki_ge1_shared);
157 platform_device_register(&loki_ge1);
161 /*****************************************************************************
163 ****************************************************************************/
164 static struct resource loki_sas_resources[] = {
166 .name = "mvsas0 mem",
167 .start = SAS0_PHYS_BASE,
168 .end = SAS0_PHYS_BASE + 0x01ff,
169 .flags = IORESOURCE_MEM,
171 .name = "mvsas0 irq",
172 .start = IRQ_LOKI_SAS_A,
173 .end = IRQ_LOKI_SAS_A,
174 .flags = IORESOURCE_IRQ,
176 .name = "mvsas1 mem",
177 .start = SAS1_PHYS_BASE,
178 .end = SAS1_PHYS_BASE + 0x01ff,
179 .flags = IORESOURCE_MEM,
181 .name = "mvsas1 irq",
182 .start = IRQ_LOKI_SAS_B,
183 .end = IRQ_LOKI_SAS_B,
184 .flags = IORESOURCE_IRQ,
188 static struct platform_device loki_sas = {
192 .coherent_dma_mask = DMA_BIT_MASK(32),
194 .num_resources = ARRAY_SIZE(loki_sas_resources),
195 .resource = loki_sas_resources,
198 void __init loki_sas_init(void)
200 writel(0x8300f707, DDR_REG(0x1424));
201 platform_device_register(&loki_sas);
205 /*****************************************************************************
207 ****************************************************************************/
208 void __init loki_uart0_init(void)
210 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
211 IRQ_LOKI_UART0, LOKI_TCLK);
214 /*****************************************************************************
216 ****************************************************************************/
217 void __init loki_uart1_init(void)
219 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
220 IRQ_LOKI_UART1, LOKI_TCLK);
224 /*****************************************************************************
226 ****************************************************************************/
227 void __init loki_init_early(void)
229 orion_time_set_base(TIMER_VIRT_BASE);
232 static void loki_timer_init(void)
234 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
235 IRQ_LOKI_BRIDGE, LOKI_TCLK);
238 struct sys_timer loki_timer = {
239 .init = loki_timer_init,
243 /*****************************************************************************
245 ****************************************************************************/
246 void __init loki_init(void)
248 printk(KERN_INFO "Loki ID: 88RC8480. TCLK=%d.\n", LOKI_TCLK);
250 loki_setup_cpu_mbus();