diff options
Diffstat (limited to 'arch/arm/mach-vexpress/v2m.c')
-rw-r--r-- | arch/arm/mach-vexpress/v2m.c | 90 |
1 files changed, 80 insertions, 10 deletions
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index 1edae65a0e72..ba46e8e07437 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c | |||
@@ -7,13 +7,16 @@ | |||
7 | #include <linux/io.h> | 7 | #include <linux/io.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/platform_device.h> | 9 | #include <linux/platform_device.h> |
10 | #include <linux/ata_platform.h> | ||
10 | #include <linux/smsc911x.h> | 11 | #include <linux/smsc911x.h> |
11 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
12 | #include <linux/sysdev.h> | 13 | #include <linux/sysdev.h> |
13 | #include <linux/usb/isp1760.h> | 14 | #include <linux/usb/isp1760.h> |
14 | #include <linux/clkdev.h> | 15 | #include <linux/clkdev.h> |
15 | 16 | ||
17 | #include <asm/mach-types.h> | ||
16 | #include <asm/sizes.h> | 18 | #include <asm/sizes.h> |
19 | #include <asm/mach/arch.h> | ||
17 | #include <asm/mach/flash.h> | 20 | #include <asm/mach/flash.h> |
18 | #include <asm/mach/map.h> | 21 | #include <asm/mach/map.h> |
19 | #include <asm/mach/time.h> | 22 | #include <asm/mach/time.h> |
@@ -21,6 +24,7 @@ | |||
21 | #include <asm/hardware/timer-sp.h> | 24 | #include <asm/hardware/timer-sp.h> |
22 | #include <asm/hardware/sp810.h> | 25 | #include <asm/hardware/sp810.h> |
23 | 26 | ||
27 | #include <mach/ct-ca9x4.h> | ||
24 | #include <mach/motherboard.h> | 28 | #include <mach/motherboard.h> |
25 | 29 | ||
26 | #include <plat/sched_clock.h> | 30 | #include <plat/sched_clock.h> |
@@ -42,19 +46,16 @@ static struct map_desc v2m_io_desc[] __initdata = { | |||
42 | }, | 46 | }, |
43 | }; | 47 | }; |
44 | 48 | ||
45 | void __init v2m_map_io(struct map_desc *tile, size_t num) | 49 | static void __init v2m_init_early(void) |
46 | { | 50 | { |
47 | iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc)); | 51 | ct_desc->init_early(); |
48 | iotable_init(tile, num); | 52 | versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000); |
49 | } | 53 | } |
50 | 54 | ||
51 | |||
52 | static void __init v2m_timer_init(void) | 55 | static void __init v2m_timer_init(void) |
53 | { | 56 | { |
54 | u32 scctrl; | 57 | u32 scctrl; |
55 | 58 | ||
56 | versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000); | ||
57 | |||
58 | /* Select 1MHz TIMCLK as the reference clock for SP804 timers */ | 59 | /* Select 1MHz TIMCLK as the reference clock for SP804 timers */ |
59 | scctrl = readl(MMIO_P2V(V2M_SYSCTL + SCCTRL)); | 60 | scctrl = readl(MMIO_P2V(V2M_SYSCTL + SCCTRL)); |
60 | scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK; | 61 | scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK; |
@@ -68,7 +69,7 @@ static void __init v2m_timer_init(void) | |||
68 | sp804_clockevents_init(MMIO_P2V(V2M_TIMER0), IRQ_V2M_TIMER0); | 69 | sp804_clockevents_init(MMIO_P2V(V2M_TIMER0), IRQ_V2M_TIMER0); |
69 | } | 70 | } |
70 | 71 | ||
71 | struct sys_timer v2m_timer = { | 72 | static struct sys_timer v2m_timer = { |
72 | .init = v2m_timer_init, | 73 | .init = v2m_timer_init, |
73 | }; | 74 | }; |
74 | 75 | ||
@@ -249,6 +250,29 @@ static struct platform_device v2m_flash_device = { | |||
249 | .dev.platform_data = &v2m_flash_data, | 250 | .dev.platform_data = &v2m_flash_data, |
250 | }; | 251 | }; |
251 | 252 | ||
253 | static struct pata_platform_info v2m_pata_data = { | ||
254 | .ioport_shift = 2, | ||
255 | }; | ||
256 | |||
257 | static struct resource v2m_pata_resources[] = { | ||
258 | { | ||
259 | .start = V2M_CF, | ||
260 | .end = V2M_CF + 0xff, | ||
261 | .flags = IORESOURCE_MEM, | ||
262 | }, { | ||
263 | .start = V2M_CF + 0x100, | ||
264 | .end = V2M_CF + SZ_4K - 1, | ||
265 | .flags = IORESOURCE_MEM, | ||
266 | }, | ||
267 | }; | ||
268 | |||
269 | static struct platform_device v2m_cf_device = { | ||
270 | .name = "pata_platform", | ||
271 | .id = -1, | ||
272 | .resource = v2m_pata_resources, | ||
273 | .num_resources = ARRAY_SIZE(v2m_pata_resources), | ||
274 | .dev.platform_data = &v2m_pata_data, | ||
275 | }; | ||
252 | 276 | ||
253 | static unsigned int v2m_mmci_status(struct device *dev) | 277 | static unsigned int v2m_mmci_status(struct device *dev) |
254 | { | 278 | { |
@@ -354,7 +378,44 @@ static void v2m_restart(char str, const char *cmd) | |||
354 | printk(KERN_EMERG "Unable to reboot\n"); | 378 | printk(KERN_EMERG "Unable to reboot\n"); |
355 | } | 379 | } |
356 | 380 | ||
357 | static int __init v2m_init(void) | 381 | struct ct_desc *ct_desc; |
382 | |||
383 | static struct ct_desc *ct_descs[] __initdata = { | ||
384 | #ifdef CONFIG_ARCH_VEXPRESS_CA9X4 | ||
385 | &ct_ca9x4_desc, | ||
386 | #endif | ||
387 | }; | ||
388 | |||
389 | static void __init v2m_populate_ct_desc(void) | ||
390 | { | ||
391 | int i; | ||
392 | u32 current_tile_id; | ||
393 | |||
394 | ct_desc = NULL; | ||
395 | current_tile_id = readl(MMIO_P2V(V2M_SYS_PROCID0)) & V2M_CT_ID_MASK; | ||
396 | |||
397 | for (i = 0; i < ARRAY_SIZE(ct_descs) && !ct_desc; ++i) | ||
398 | if (ct_descs[i]->id == current_tile_id) | ||
399 | ct_desc = ct_descs[i]; | ||
400 | |||
401 | if (!ct_desc) | ||
402 | panic("vexpress: failed to populate core tile description " | ||
403 | "for tile ID 0x%8x\n", current_tile_id); | ||
404 | } | ||
405 | |||
406 | static void __init v2m_map_io(void) | ||
407 | { | ||
408 | iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc)); | ||
409 | v2m_populate_ct_desc(); | ||
410 | ct_desc->map_io(); | ||
411 | } | ||
412 | |||
413 | static void __init v2m_init_irq(void) | ||
414 | { | ||
415 | ct_desc->init_irq(); | ||
416 | } | ||
417 | |||
418 | static void __init v2m_init(void) | ||
358 | { | 419 | { |
359 | int i; | 420 | int i; |
360 | 421 | ||
@@ -363,6 +424,7 @@ static int __init v2m_init(void) | |||
363 | platform_device_register(&v2m_pcie_i2c_device); | 424 | platform_device_register(&v2m_pcie_i2c_device); |
364 | platform_device_register(&v2m_ddc_i2c_device); | 425 | platform_device_register(&v2m_ddc_i2c_device); |
365 | platform_device_register(&v2m_flash_device); | 426 | platform_device_register(&v2m_flash_device); |
427 | platform_device_register(&v2m_cf_device); | ||
366 | platform_device_register(&v2m_eth_device); | 428 | platform_device_register(&v2m_eth_device); |
367 | platform_device_register(&v2m_usb_device); | 429 | platform_device_register(&v2m_usb_device); |
368 | 430 | ||
@@ -372,6 +434,14 @@ static int __init v2m_init(void) | |||
372 | pm_power_off = v2m_power_off; | 434 | pm_power_off = v2m_power_off; |
373 | arm_pm_restart = v2m_restart; | 435 | arm_pm_restart = v2m_restart; |
374 | 436 | ||
375 | return 0; | 437 | ct_desc->init_tile(); |
376 | } | 438 | } |
377 | arch_initcall(v2m_init); | 439 | |
440 | MACHINE_START(VEXPRESS, "ARM-Versatile Express") | ||
441 | .boot_params = PLAT_PHYS_OFFSET + 0x00000100, | ||
442 | .map_io = v2m_map_io, | ||
443 | .init_early = v2m_init_early, | ||
444 | .init_irq = v2m_init_irq, | ||
445 | .timer = &v2m_timer, | ||
446 | .init_machine = v2m_init, | ||
447 | MACHINE_END | ||