aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-realview/realview_eb.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-realview/realview_eb.c')
-rw-r--r--arch/arm/mach-realview/realview_eb.c149
1 files changed, 92 insertions, 57 deletions
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 60d9eb810246..5782d83fd886 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -51,13 +51,13 @@ static struct map_desc realview_eb_io_desc[] __initdata = {
51 .length = SZ_4K, 51 .length = SZ_4K,
52 .type = MT_DEVICE, 52 .type = MT_DEVICE,
53 }, { 53 }, {
54 .virtual = IO_ADDRESS(REALVIEW_GIC_CPU_BASE), 54 .virtual = IO_ADDRESS(REALVIEW_EB_GIC_CPU_BASE),
55 .pfn = __phys_to_pfn(REALVIEW_GIC_CPU_BASE), 55 .pfn = __phys_to_pfn(REALVIEW_EB_GIC_CPU_BASE),
56 .length = SZ_4K, 56 .length = SZ_4K,
57 .type = MT_DEVICE, 57 .type = MT_DEVICE,
58 }, { 58 }, {
59 .virtual = IO_ADDRESS(REALVIEW_GIC_DIST_BASE), 59 .virtual = IO_ADDRESS(REALVIEW_EB_GIC_DIST_BASE),
60 .pfn = __phys_to_pfn(REALVIEW_GIC_DIST_BASE), 60 .pfn = __phys_to_pfn(REALVIEW_EB_GIC_DIST_BASE),
61 .length = SZ_4K, 61 .length = SZ_4K,
62 .type = MT_DEVICE, 62 .type = MT_DEVICE,
63 }, { 63 }, {
@@ -66,20 +66,20 @@ static struct map_desc realview_eb_io_desc[] __initdata = {
66 .length = SZ_4K, 66 .length = SZ_4K,
67 .type = MT_DEVICE, 67 .type = MT_DEVICE,
68 }, { 68 }, {
69 .virtual = IO_ADDRESS(REALVIEW_TIMER0_1_BASE), 69 .virtual = IO_ADDRESS(REALVIEW_EB_TIMER0_1_BASE),
70 .pfn = __phys_to_pfn(REALVIEW_TIMER0_1_BASE), 70 .pfn = __phys_to_pfn(REALVIEW_EB_TIMER0_1_BASE),
71 .length = SZ_4K, 71 .length = SZ_4K,
72 .type = MT_DEVICE, 72 .type = MT_DEVICE,
73 }, { 73 }, {
74 .virtual = IO_ADDRESS(REALVIEW_TIMER2_3_BASE), 74 .virtual = IO_ADDRESS(REALVIEW_EB_TIMER2_3_BASE),
75 .pfn = __phys_to_pfn(REALVIEW_TIMER2_3_BASE), 75 .pfn = __phys_to_pfn(REALVIEW_EB_TIMER2_3_BASE),
76 .length = SZ_4K, 76 .length = SZ_4K,
77 .type = MT_DEVICE, 77 .type = MT_DEVICE,
78 }, 78 },
79#ifdef CONFIG_DEBUG_LL 79#ifdef CONFIG_DEBUG_LL
80 { 80 {
81 .virtual = IO_ADDRESS(REALVIEW_UART0_BASE), 81 .virtual = IO_ADDRESS(REALVIEW_EB_UART0_BASE),
82 .pfn = __phys_to_pfn(REALVIEW_UART0_BASE), 82 .pfn = __phys_to_pfn(REALVIEW_EB_UART0_BASE),
83 .length = SZ_4K, 83 .length = SZ_4K,
84 .type = MT_DEVICE, 84 .type = MT_DEVICE,
85 } 85 }
@@ -136,12 +136,12 @@ static void __init realview_eb_map_io(void)
136/* 136/*
137 * These devices are connected directly to the multi-layer AHB switch 137 * These devices are connected directly to the multi-layer AHB switch
138 */ 138 */
139#define SMC_IRQ { NO_IRQ, NO_IRQ } 139#define EB_SMC_IRQ { NO_IRQ, NO_IRQ }
140#define SMC_DMA { 0, 0 } 140#define EB_SMC_DMA { 0, 0 }
141#define MPMC_IRQ { NO_IRQ, NO_IRQ } 141#define MPMC_IRQ { NO_IRQ, NO_IRQ }
142#define MPMC_DMA { 0, 0 } 142#define MPMC_DMA { 0, 0 }
143#define CLCD_IRQ { IRQ_EB_CLCD, NO_IRQ } 143#define EB_CLCD_IRQ { IRQ_EB_CLCD, NO_IRQ }
144#define CLCD_DMA { 0, 0 } 144#define EB_CLCD_DMA { 0, 0 }
145#define DMAC_IRQ { IRQ_EB_DMA, NO_IRQ } 145#define DMAC_IRQ { IRQ_EB_DMA, NO_IRQ }
146#define DMAC_DMA { 0, 0 } 146#define DMAC_DMA { 0, 0 }
147 147
@@ -150,53 +150,53 @@ static void __init realview_eb_map_io(void)
150 */ 150 */
151#define SCTL_IRQ { NO_IRQ, NO_IRQ } 151#define SCTL_IRQ { NO_IRQ, NO_IRQ }
152#define SCTL_DMA { 0, 0 } 152#define SCTL_DMA { 0, 0 }
153#define WATCHDOG_IRQ { IRQ_EB_WDOG, NO_IRQ } 153#define EB_WATCHDOG_IRQ { IRQ_EB_WDOG, NO_IRQ }
154#define WATCHDOG_DMA { 0, 0 } 154#define EB_WATCHDOG_DMA { 0, 0 }
155#define GPIO0_IRQ { IRQ_EB_GPIO0, NO_IRQ } 155#define EB_GPIO0_IRQ { IRQ_EB_GPIO0, NO_IRQ }
156#define GPIO0_DMA { 0, 0 } 156#define EB_GPIO0_DMA { 0, 0 }
157#define GPIO1_IRQ { IRQ_EB_GPIO1, NO_IRQ } 157#define GPIO1_IRQ { IRQ_EB_GPIO1, NO_IRQ }
158#define GPIO1_DMA { 0, 0 } 158#define GPIO1_DMA { 0, 0 }
159#define RTC_IRQ { IRQ_EB_RTC, NO_IRQ } 159#define EB_RTC_IRQ { IRQ_EB_RTC, NO_IRQ }
160#define RTC_DMA { 0, 0 } 160#define EB_RTC_DMA { 0, 0 }
161 161
162/* 162/*
163 * These devices are connected via the DMA APB bridge 163 * These devices are connected via the DMA APB bridge
164 */ 164 */
165#define SCI_IRQ { IRQ_EB_SCI, NO_IRQ } 165#define SCI_IRQ { IRQ_EB_SCI, NO_IRQ }
166#define SCI_DMA { 7, 6 } 166#define SCI_DMA { 7, 6 }
167#define UART0_IRQ { IRQ_EB_UART0, NO_IRQ } 167#define EB_UART0_IRQ { IRQ_EB_UART0, NO_IRQ }
168#define UART0_DMA { 15, 14 } 168#define EB_UART0_DMA { 15, 14 }
169#define UART1_IRQ { IRQ_EB_UART1, NO_IRQ } 169#define EB_UART1_IRQ { IRQ_EB_UART1, NO_IRQ }
170#define UART1_DMA { 13, 12 } 170#define EB_UART1_DMA { 13, 12 }
171#define UART2_IRQ { IRQ_EB_UART2, NO_IRQ } 171#define EB_UART2_IRQ { IRQ_EB_UART2, NO_IRQ }
172#define UART2_DMA { 11, 10 } 172#define EB_UART2_DMA { 11, 10 }
173#define UART3_IRQ { IRQ_EB_UART3, NO_IRQ } 173#define EB_UART3_IRQ { IRQ_EB_UART3, NO_IRQ }
174#define UART3_DMA { 0x86, 0x87 } 174#define EB_UART3_DMA { 0x86, 0x87 }
175#define SSP_IRQ { IRQ_EB_SSP, NO_IRQ } 175#define EB_SSP_IRQ { IRQ_EB_SSP, NO_IRQ }
176#define SSP_DMA { 9, 8 } 176#define EB_SSP_DMA { 9, 8 }
177 177
178/* FPGA Primecells */ 178/* FPGA Primecells */
179AMBA_DEVICE(aaci, "fpga:04", AACI, NULL); 179AMBA_DEVICE(aaci, "fpga:04", AACI, NULL);
180AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &realview_mmc0_plat_data); 180AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &realview_mmc0_plat_data);
181AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL); 181AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL);
182AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL); 182AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL);
183AMBA_DEVICE(uart3, "fpga:09", UART3, NULL); 183AMBA_DEVICE(uart3, "fpga:09", EB_UART3, NULL);
184 184
185/* DevChip Primecells */ 185/* DevChip Primecells */
186AMBA_DEVICE(smc, "dev:00", SMC, NULL); 186AMBA_DEVICE(smc, "dev:00", EB_SMC, NULL);
187AMBA_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data); 187AMBA_DEVICE(clcd, "dev:20", EB_CLCD, &clcd_plat_data);
188AMBA_DEVICE(dmac, "dev:30", DMAC, NULL); 188AMBA_DEVICE(dmac, "dev:30", DMAC, NULL);
189AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL); 189AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL);
190AMBA_DEVICE(wdog, "dev:e1", WATCHDOG, NULL); 190AMBA_DEVICE(wdog, "dev:e1", EB_WATCHDOG, NULL);
191AMBA_DEVICE(gpio0, "dev:e4", GPIO0, NULL); 191AMBA_DEVICE(gpio0, "dev:e4", EB_GPIO0, NULL);
192AMBA_DEVICE(gpio1, "dev:e5", GPIO1, NULL); 192AMBA_DEVICE(gpio1, "dev:e5", GPIO1, NULL);
193AMBA_DEVICE(gpio2, "dev:e6", GPIO2, NULL); 193AMBA_DEVICE(gpio2, "dev:e6", GPIO2, NULL);
194AMBA_DEVICE(rtc, "dev:e8", RTC, NULL); 194AMBA_DEVICE(rtc, "dev:e8", EB_RTC, NULL);
195AMBA_DEVICE(sci0, "dev:f0", SCI, NULL); 195AMBA_DEVICE(sci0, "dev:f0", SCI, NULL);
196AMBA_DEVICE(uart0, "dev:f1", UART0, NULL); 196AMBA_DEVICE(uart0, "dev:f1", EB_UART0, NULL);
197AMBA_DEVICE(uart1, "dev:f2", UART1, NULL); 197AMBA_DEVICE(uart1, "dev:f2", EB_UART1, NULL);
198AMBA_DEVICE(uart2, "dev:f3", UART2, NULL); 198AMBA_DEVICE(uart2, "dev:f3", EB_UART2, NULL);
199AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL); 199AMBA_DEVICE(ssp0, "dev:f4", EB_SSP, NULL);
200 200
201static struct amba_device *amba_devs[] __initdata = { 201static struct amba_device *amba_devs[] __initdata = {
202 &dmac_device, 202 &dmac_device,
@@ -223,11 +223,16 @@ static struct amba_device *amba_devs[] __initdata = {
223/* 223/*
224 * RealView EB platform devices 224 * RealView EB platform devices
225 */ 225 */
226static struct resource realview_eb_flash_resource = {
227 .start = REALVIEW_EB_FLASH_BASE,
228 .end = REALVIEW_EB_FLASH_BASE + REALVIEW_EB_FLASH_SIZE - 1,
229 .flags = IORESOURCE_MEM,
230};
226 231
227static struct resource realview_eb_smc91x_resources[] = { 232static struct resource realview_eb_eth_resources[] = {
228 [0] = { 233 [0] = {
229 .start = REALVIEW_ETH_BASE, 234 .start = REALVIEW_EB_ETH_BASE,
230 .end = REALVIEW_ETH_BASE + SZ_64K - 1, 235 .end = REALVIEW_EB_ETH_BASE + SZ_64K - 1,
231 .flags = IORESOURCE_MEM, 236 .flags = IORESOURCE_MEM,
232 }, 237 },
233 [1] = { 238 [1] = {
@@ -237,13 +242,36 @@ static struct resource realview_eb_smc91x_resources[] = {
237 }, 242 },
238}; 243};
239 244
240static struct platform_device realview_eb_smc91x_device = { 245static struct platform_device realview_eb_eth_device = {
241 .name = "smc91x",
242 .id = 0, 246 .id = 0,
243 .num_resources = ARRAY_SIZE(realview_eb_smc91x_resources), 247 .num_resources = ARRAY_SIZE(realview_eb_eth_resources),
244 .resource = realview_eb_smc91x_resources, 248 .resource = realview_eb_eth_resources,
245}; 249};
246 250
251/*
252 * Detect and register the correct Ethernet device. RealView/EB rev D
253 * platforms use the newer SMSC LAN9118 Ethernet chip
254 */
255static int eth_device_register(void)
256{
257 void __iomem *eth_addr = ioremap(REALVIEW_EB_ETH_BASE, SZ_4K);
258 u32 idrev;
259
260 if (!eth_addr)
261 return -ENOMEM;
262
263 idrev = readl(eth_addr + 0x50);
264 if ((idrev & 0xFFFF0000) == 0x01180000)
265 /* SMSC LAN9118 chip present */
266 realview_eb_eth_device.name = "smc911x";
267 else
268 /* SMSC 91C111 chip present */
269 realview_eb_eth_device.name = "smc91x";
270
271 iounmap(eth_addr);
272 return platform_device_register(&realview_eb_eth_device);
273}
274
247static void __init gic_init_irq(void) 275static void __init gic_init_irq(void)
248{ 276{
249 if (core_tile_eb11mp()) { 277 if (core_tile_eb11mp()) {
@@ -263,14 +291,14 @@ static void __init gic_init_irq(void)
263 291
264#ifndef CONFIG_REALVIEW_EB_ARM11MP_REVB 292#ifndef CONFIG_REALVIEW_EB_ARM11MP_REVB
265 /* board GIC, secondary */ 293 /* board GIC, secondary */
266 gic_dist_init(1, __io_address(REALVIEW_GIC_DIST_BASE), 64); 294 gic_dist_init(1, __io_address(REALVIEW_EB_GIC_DIST_BASE), 64);
267 gic_cpu_init(1, __io_address(REALVIEW_GIC_CPU_BASE)); 295 gic_cpu_init(1, __io_address(REALVIEW_EB_GIC_CPU_BASE));
268 gic_cascade_irq(1, IRQ_EB11MP_EB_IRQ1); 296 gic_cascade_irq(1, IRQ_EB11MP_EB_IRQ1);
269#endif 297#endif
270 } else { 298 } else {
271 /* board GIC, primary */ 299 /* board GIC, primary */
272 gic_cpu_base_addr = __io_address(REALVIEW_GIC_CPU_BASE); 300 gic_cpu_base_addr = __io_address(REALVIEW_EB_GIC_CPU_BASE);
273 gic_dist_init(0, __io_address(REALVIEW_GIC_DIST_BASE), 29); 301 gic_dist_init(0, __io_address(REALVIEW_EB_GIC_DIST_BASE), 29);
274 gic_cpu_init(0, gic_cpu_base_addr); 302 gic_cpu_init(0, gic_cpu_base_addr);
275 } 303 }
276} 304}
@@ -301,14 +329,19 @@ static void realview_eb11mp_fixup(void)
301 kmi1_device.irq[0] = IRQ_EB11MP_KMI1; 329 kmi1_device.irq[0] = IRQ_EB11MP_KMI1;
302 330
303 /* platform devices */ 331 /* platform devices */
304 realview_eb_smc91x_resources[1].start = IRQ_EB11MP_ETH; 332 realview_eb_eth_resources[1].start = IRQ_EB11MP_ETH;
305 realview_eb_smc91x_resources[1].end = IRQ_EB11MP_ETH; 333 realview_eb_eth_resources[1].end = IRQ_EB11MP_ETH;
306} 334}
307 335
308static void __init realview_eb_timer_init(void) 336static void __init realview_eb_timer_init(void)
309{ 337{
310 unsigned int timer_irq; 338 unsigned int timer_irq;
311 339
340 timer0_va_base = __io_address(REALVIEW_EB_TIMER0_1_BASE);
341 timer1_va_base = __io_address(REALVIEW_EB_TIMER0_1_BASE) + 0x20;
342 timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE);
343 timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20;
344
312 if (core_tile_eb11mp()) { 345 if (core_tile_eb11mp()) {
313#ifdef CONFIG_LOCAL_TIMERS 346#ifdef CONFIG_LOCAL_TIMERS
314 twd_base_addr = __io_address(REALVIEW_EB11MP_TWD_BASE); 347 twd_base_addr = __io_address(REALVIEW_EB11MP_TWD_BASE);
@@ -332,16 +365,18 @@ static void __init realview_eb_init(void)
332 if (core_tile_eb11mp()) { 365 if (core_tile_eb11mp()) {
333 realview_eb11mp_fixup(); 366 realview_eb11mp_fixup();
334 367
368#ifdef CONFIG_CACHE_L2X0
335 /* 1MB (128KB/way), 8-way associativity, evmon/parity/share enabled 369 /* 1MB (128KB/way), 8-way associativity, evmon/parity/share enabled
336 * Bits: .... ...0 0111 1001 0000 .... .... .... */ 370 * Bits: .... ...0 0111 1001 0000 .... .... .... */
337 l2x0_init(__io_address(REALVIEW_EB11MP_L220_BASE), 0x00790000, 0xfe000fff); 371 l2x0_init(__io_address(REALVIEW_EB11MP_L220_BASE), 0x00790000, 0xfe000fff);
372#endif
338 } 373 }
339 374
340 clk_register(&realview_clcd_clk); 375 clk_register(&realview_clcd_clk);
341 376
342 platform_device_register(&realview_flash_device); 377 realview_flash_register(&realview_eb_flash_resource, 1);
343 platform_device_register(&realview_eb_smc91x_device);
344 platform_device_register(&realview_i2c_device); 378 platform_device_register(&realview_i2c_device);
379 eth_device_register();
345 380
346 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 381 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
347 struct amba_device *d = amba_devs[i]; 382 struct amba_device *d = amba_devs[i];
@@ -355,8 +390,8 @@ static void __init realview_eb_init(void)
355 390
356MACHINE_START(REALVIEW_EB, "ARM-RealView EB") 391MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
357 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 392 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
358 .phys_io = REALVIEW_UART0_BASE, 393 .phys_io = REALVIEW_EB_UART0_BASE,
359 .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc, 394 .io_pg_offst = (IO_ADDRESS(REALVIEW_EB_UART0_BASE) >> 18) & 0xfffc,
360 .boot_params = 0x00000100, 395 .boot_params = 0x00000100,
361 .map_io = realview_eb_map_io, 396 .map_io = realview_eb_map_io,
362 .init_irq = gic_init_irq, 397 .init_irq = gic_init_irq,