aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-vexpress/v2m.c
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2011-02-28 11:01:04 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-03-20 05:32:21 -0400
commit80b5efbd43f0a21e9fc6db87823be32fcfe3e7ce (patch)
tree12a213968fa7c0bac41ff539f82ba64f0e979c4c /arch/arm/mach-vexpress/v2m.c
parent196f020fbbb83d246960548e73a40fd08f3e7866 (diff)
ARM: 6771/1: vexpress: add support for multiple core tiles
The current Versatile Express BSP defines the MACHINE_START macro in the core tile code. This patch moves this into the generic board code and introduces a method for determining the current tile at runtime, allowing the Kernel to have support for multiple tiles compiled in. Tile-specific functions are executed via a descriptor struct containing the correct implementations for the current tile. Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-vexpress/v2m.c')
-rw-r--r--arch/arm/mach-vexpress/v2m.c65
1 files changed, 54 insertions, 11 deletions
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 63ef663fb0be..ba46e8e07437 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -14,7 +14,9 @@
14#include <linux/usb/isp1760.h> 14#include <linux/usb/isp1760.h>
15#include <linux/clkdev.h> 15#include <linux/clkdev.h>
16 16
17#include <asm/mach-types.h>
17#include <asm/sizes.h> 18#include <asm/sizes.h>
19#include <asm/mach/arch.h>
18#include <asm/mach/flash.h> 20#include <asm/mach/flash.h>
19#include <asm/mach/map.h> 21#include <asm/mach/map.h>
20#include <asm/mach/time.h> 22#include <asm/mach/time.h>
@@ -22,6 +24,7 @@
22#include <asm/hardware/timer-sp.h> 24#include <asm/hardware/timer-sp.h>
23#include <asm/hardware/sp810.h> 25#include <asm/hardware/sp810.h>
24 26
27#include <mach/ct-ca9x4.h>
25#include <mach/motherboard.h> 28#include <mach/motherboard.h>
26 29
27#include <plat/sched_clock.h> 30#include <plat/sched_clock.h>
@@ -43,14 +46,9 @@ static struct map_desc v2m_io_desc[] __initdata = {
43 }, 46 },
44}; 47};
45 48
46void __init v2m_map_io(struct map_desc *tile, size_t num) 49static void __init v2m_init_early(void)
47{
48 iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc));
49 iotable_init(tile, num);
50}
51
52void __init v2m_init_early(void)
53{ 50{
51 ct_desc->init_early();
54 versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000); 52 versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000);
55} 53}
56 54
@@ -71,7 +69,7 @@ static void __init v2m_timer_init(void)
71 sp804_clockevents_init(MMIO_P2V(V2M_TIMER0), IRQ_V2M_TIMER0); 69 sp804_clockevents_init(MMIO_P2V(V2M_TIMER0), IRQ_V2M_TIMER0);
72} 70}
73 71
74struct sys_timer v2m_timer = { 72static struct sys_timer v2m_timer = {
75 .init = v2m_timer_init, 73 .init = v2m_timer_init,
76}; 74};
77 75
@@ -380,7 +378,44 @@ static void v2m_restart(char str, const char *cmd)
380 printk(KERN_EMERG "Unable to reboot\n"); 378 printk(KERN_EMERG "Unable to reboot\n");
381} 379}
382 380
383static int __init v2m_init(void) 381struct ct_desc *ct_desc;
382
383static struct ct_desc *ct_descs[] __initdata = {
384#ifdef CONFIG_ARCH_VEXPRESS_CA9X4
385 &ct_ca9x4_desc,
386#endif
387};
388
389static 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
406static 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
413static void __init v2m_init_irq(void)
414{
415 ct_desc->init_irq();
416}
417
418static void __init v2m_init(void)
384{ 419{
385 int i; 420 int i;
386 421
@@ -399,6 +434,14 @@ static int __init v2m_init(void)
399 pm_power_off = v2m_power_off; 434 pm_power_off = v2m_power_off;
400 arm_pm_restart = v2m_restart; 435 arm_pm_restart = v2m_restart;
401 436
402 return 0; 437 ct_desc->init_tile();
403} 438}
404arch_initcall(v2m_init); 439
440MACHINE_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,
447MACHINE_END