diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2008-02-04 11:39:00 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-02-04 12:52:24 -0500 |
commit | 7dd19e755dbe481ae42590dbd921dfd47e94779c (patch) | |
tree | 66056a17aa12457f8b5f91995fe774958a1d3534 | |
parent | 0fc2a1616f37175ff0cf54b99e9b76f7717a3f10 (diff) |
[ARM] 4818/1: RealView: Add core-tile detection
This patch adds the core-tile detection and only enables devices if the
corresponding tile is present. It currently detects the ARM11MPCore via
the core_tile_eb11mp() macro.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-realview/platsmp.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-realview/realview_eb.c | 93 | ||||
-rw-r--r-- | include/asm-arm/arch-realview/board-eb.h | 19 |
3 files changed, 80 insertions, 44 deletions
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c index 0186c80c9040..de2b7159557d 100644 --- a/arch/arm/mach-realview/platsmp.c +++ b/arch/arm/mach-realview/platsmp.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/hardware/arm_scu.h> | 18 | #include <asm/hardware/arm_scu.h> |
19 | #include <asm/hardware.h> | 19 | #include <asm/hardware.h> |
20 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | #include <asm/mach-types.h> | ||
21 | 22 | ||
22 | extern void realview_secondary_startup(void); | 23 | extern void realview_secondary_startup(void); |
23 | 24 | ||
@@ -31,9 +32,13 @@ static unsigned int __init get_core_count(void) | |||
31 | { | 32 | { |
32 | unsigned int ncores; | 33 | unsigned int ncores; |
33 | 34 | ||
34 | ncores = __raw_readl(__io_address(REALVIEW_EB11MP_SCU_BASE) + SCU_CONFIG); | 35 | if (machine_is_realview_eb() && core_tile_eb11mp()) { |
36 | ncores = __raw_readl(__io_address(REALVIEW_EB11MP_SCU_BASE) + SCU_CONFIG); | ||
37 | ncores = (ncores & 0x03) + 1; | ||
38 | } else | ||
39 | ncores = 1; | ||
35 | 40 | ||
36 | return (ncores & 0x03) + 1; | 41 | return ncores; |
37 | } | 42 | } |
38 | 43 | ||
39 | static DEFINE_SPINLOCK(boot_lock); | 44 | static DEFINE_SPINLOCK(boot_lock); |
@@ -193,7 +198,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
193 | * dummy (!CONFIG_LOCAL_TIMERS), it was already registers in | 198 | * dummy (!CONFIG_LOCAL_TIMERS), it was already registers in |
194 | * realview_timer_init | 199 | * realview_timer_init |
195 | */ | 200 | */ |
196 | local_timer_setup(cpu); | 201 | if (machine_is_realview_eb() && core_tile_eb11mp()) |
202 | local_timer_setup(cpu); | ||
197 | #endif | 203 | #endif |
198 | 204 | ||
199 | /* | 205 | /* |
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index afcf27ceac57..e42ac56e4db5 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c | |||
@@ -59,26 +59,7 @@ static struct map_desc realview_eb_io_desc[] __initdata = { | |||
59 | .pfn = __phys_to_pfn(REALVIEW_GIC_DIST_BASE), | 59 | .pfn = __phys_to_pfn(REALVIEW_GIC_DIST_BASE), |
60 | .length = SZ_4K, | 60 | .length = SZ_4K, |
61 | .type = MT_DEVICE, | 61 | .type = MT_DEVICE, |
62 | }, | ||
63 | #ifdef CONFIG_REALVIEW_MPCORE | ||
64 | { | ||
65 | .virtual = IO_ADDRESS(REALVIEW_GIC1_CPU_BASE), | ||
66 | .pfn = __phys_to_pfn(REALVIEW_GIC1_CPU_BASE), | ||
67 | .length = SZ_4K, | ||
68 | .type = MT_DEVICE, | ||
69 | }, { | 62 | }, { |
70 | .virtual = IO_ADDRESS(REALVIEW_GIC1_DIST_BASE), | ||
71 | .pfn = __phys_to_pfn(REALVIEW_GIC1_DIST_BASE), | ||
72 | .length = SZ_4K, | ||
73 | .type = MT_DEVICE, | ||
74 | }, { | ||
75 | .virtual = IO_ADDRESS(REALVIEW_MPCORE_L220_BASE), | ||
76 | .pfn = __phys_to_pfn(REALVIEW_MPCORE_L220_BASE), | ||
77 | .length = SZ_8K, | ||
78 | .type = MT_DEVICE, | ||
79 | }, | ||
80 | #endif | ||
81 | { | ||
82 | .virtual = IO_ADDRESS(REALVIEW_SCTL_BASE), | 63 | .virtual = IO_ADDRESS(REALVIEW_SCTL_BASE), |
83 | .pfn = __phys_to_pfn(REALVIEW_SCTL_BASE), | 64 | .pfn = __phys_to_pfn(REALVIEW_SCTL_BASE), |
84 | .length = SZ_4K, | 65 | .length = SZ_4K, |
@@ -104,9 +85,30 @@ static struct map_desc realview_eb_io_desc[] __initdata = { | |||
104 | #endif | 85 | #endif |
105 | }; | 86 | }; |
106 | 87 | ||
88 | static struct map_desc realview_eb11mp_io_desc[] __initdata = { | ||
89 | { | ||
90 | .virtual = IO_ADDRESS(REALVIEW_EB11MP_GIC_CPU_BASE), | ||
91 | .pfn = __phys_to_pfn(REALVIEW_EB11MP_GIC_CPU_BASE), | ||
92 | .length = SZ_4K, | ||
93 | .type = MT_DEVICE, | ||
94 | }, { | ||
95 | .virtual = IO_ADDRESS(REALVIEW_EB11MP_GIC_DIST_BASE), | ||
96 | .pfn = __phys_to_pfn(REALVIEW_EB11MP_GIC_DIST_BASE), | ||
97 | .length = SZ_4K, | ||
98 | .type = MT_DEVICE, | ||
99 | }, { | ||
100 | .virtual = IO_ADDRESS(REALVIEW_EB11MP_L220_BASE), | ||
101 | .pfn = __phys_to_pfn(REALVIEW_EB11MP_L220_BASE), | ||
102 | .length = SZ_8K, | ||
103 | .type = MT_DEVICE, | ||
104 | } | ||
105 | }; | ||
106 | |||
107 | static void __init realview_eb_map_io(void) | 107 | static void __init realview_eb_map_io(void) |
108 | { | 108 | { |
109 | iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc)); | 109 | iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc)); |
110 | if (core_tile_eb11mp()) | ||
111 | iotable_init(realview_eb11mp_io_desc, ARRAY_SIZE(realview_eb11mp_io_desc)); | ||
110 | } | 112 | } |
111 | 113 | ||
112 | /* | 114 | /* |
@@ -243,24 +245,33 @@ static struct platform_device realview_eb_smc91x_device = { | |||
243 | 245 | ||
244 | static void __init gic_init_irq(void) | 246 | static void __init gic_init_irq(void) |
245 | { | 247 | { |
246 | #ifdef CONFIG_REALVIEW_MPCORE | 248 | if (core_tile_eb11mp()) { |
247 | unsigned int pldctrl; | 249 | unsigned int pldctrl; |
248 | writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK)); | 250 | |
249 | pldctrl = readl(__io_address(REALVIEW_SYS_BASE) + REALVIEW_MPCORE_SYS_PLD_CTRL1); | 251 | /* new irq mode */ |
250 | pldctrl |= 0x00800000; /* New irq mode */ | 252 | writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK)); |
251 | writel(pldctrl, __io_address(REALVIEW_SYS_BASE) + REALVIEW_MPCORE_SYS_PLD_CTRL1); | 253 | pldctrl = readl(__io_address(REALVIEW_SYS_BASE) + REALVIEW_EB11MP_SYS_PLD_CTRL1); |
252 | writel(0x00000000, __io_address(REALVIEW_SYS_LOCK)); | 254 | pldctrl |= 0x00800000; |
253 | #endif | 255 | writel(pldctrl, __io_address(REALVIEW_SYS_BASE) + REALVIEW_EB11MP_SYS_PLD_CTRL1); |
254 | gic_dist_init(0, __io_address(REALVIEW_GIC_DIST_BASE), 29); | 256 | writel(0x00000000, __io_address(REALVIEW_SYS_LOCK)); |
255 | gic_cpu_init(0, __io_address(REALVIEW_GIC_CPU_BASE)); | 257 | |
256 | #if defined(CONFIG_REALVIEW_MPCORE) && !defined(CONFIG_REALVIEW_MPCORE_REVB) | 258 | /* core tile GIC, primary */ |
257 | gic_dist_init(1, __io_address(REALVIEW_GIC1_DIST_BASE), 64); | 259 | gic_dist_init(0, __io_address(REALVIEW_EB11MP_GIC_DIST_BASE), 29); |
258 | gic_cpu_init(1, __io_address(REALVIEW_GIC1_CPU_BASE)); | 260 | gic_cpu_init(0, __io_address(REALVIEW_EB11MP_GIC_CPU_BASE)); |
259 | gic_cascade_irq(1, IRQ_EB_IRQ1); | 261 | |
262 | #ifndef CONFIG_REALVIEW_MPCORE_REVB | ||
263 | /* board GIC, secondary */ | ||
264 | gic_dist_init(1, __io_address(REALVIEW_GIC_DIST_BASE), 64); | ||
265 | gic_cpu_init(1, __io_address(REALVIEW_GIC_CPU_BASE)); | ||
266 | gic_cascade_irq(1, IRQ_EB11MP_EB_IRQ1); | ||
260 | #endif | 267 | #endif |
268 | } else { | ||
269 | /* board GIC, primary */ | ||
270 | gic_dist_init(0, __io_address(REALVIEW_GIC_DIST_BASE), 29); | ||
271 | gic_cpu_init(0, __io_address(REALVIEW_GIC_CPU_BASE)); | ||
272 | } | ||
261 | } | 273 | } |
262 | 274 | ||
263 | #ifdef CONFIG_REALVIEW_MPCORE | ||
264 | /* | 275 | /* |
265 | * Fix up the IRQ numbers for the RealView EB/ARM11MPCore tile | 276 | * Fix up the IRQ numbers for the RealView EB/ARM11MPCore tile |
266 | */ | 277 | */ |
@@ -290,19 +301,19 @@ static void realview_eb11mp_fixup(void) | |||
290 | realview_eb_smc91x_resources[1].start = IRQ_EB11MP_ETH; | 301 | realview_eb_smc91x_resources[1].start = IRQ_EB11MP_ETH; |
291 | realview_eb_smc91x_resources[1].end = IRQ_EB11MP_ETH; | 302 | realview_eb_smc91x_resources[1].end = IRQ_EB11MP_ETH; |
292 | } | 303 | } |
293 | #endif | ||
294 | 304 | ||
295 | static void __init realview_eb_init(void) | 305 | static void __init realview_eb_init(void) |
296 | { | 306 | { |
297 | int i; | 307 | int i; |
298 | 308 | ||
299 | #ifdef CONFIG_REALVIEW_MPCORE | 309 | if (core_tile_eb11mp()) { |
300 | realview_eb11mp_fixup(); | 310 | realview_eb11mp_fixup(); |
311 | |||
312 | /* 1MB (128KB/way), 8-way associativity, evmon/parity/share enabled | ||
313 | * Bits: .... ...0 0111 1001 0000 .... .... .... */ | ||
314 | l2x0_init(__io_address(REALVIEW_EB11MP_L220_BASE), 0x00790000, 0xfe000fff); | ||
315 | } | ||
301 | 316 | ||
302 | /* 1MB (128KB/way), 8-way associativity, evmon/parity/share enabled | ||
303 | * Bits: .... ...0 0111 1001 0000 .... .... .... */ | ||
304 | l2x0_init(__io_address(REALVIEW_MPCORE_L220_BASE), 0x00790000, 0xfe000fff); | ||
305 | #endif | ||
306 | clk_register(&realview_clcd_clk); | 317 | clk_register(&realview_clcd_clk); |
307 | 318 | ||
308 | platform_device_register(&realview_flash_device); | 319 | platform_device_register(&realview_flash_device); |
diff --git a/include/asm-arm/arch-realview/board-eb.h b/include/asm-arm/arch-realview/board-eb.h index 943efc5de4eb..9e76b236b529 100644 --- a/include/asm-arm/arch-realview/board-eb.h +++ b/include/asm-arm/arch-realview/board-eb.h | |||
@@ -149,4 +149,23 @@ | |||
149 | #define MAX_GIC_NR NR_GIC_EB11MP | 149 | #define MAX_GIC_NR NR_GIC_EB11MP |
150 | #endif | 150 | #endif |
151 | 151 | ||
152 | /* | ||
153 | * Core tile identification (REALVIEW_SYS_PROCID) | ||
154 | */ | ||
155 | #define REALVIEW_EB_PROC_MASK 0xFF000000 | ||
156 | #define REALVIEW_EB_PROC_ARM7TDMI 0x00000000 | ||
157 | #define REALVIEW_EB_PROC_ARM9 0x02000000 | ||
158 | #define REALVIEW_EB_PROC_ARM11 0x04000000 | ||
159 | #define REALVIEW_EB_PROC_ARM11MP 0x06000000 | ||
160 | |||
161 | #define check_eb_proc(proc_type) \ | ||
162 | ((readl(__io_address(REALVIEW_SYS_PROCID)) & REALVIEW_EB_PROC_MASK) \ | ||
163 | == proc_type) | ||
164 | |||
165 | #ifdef CONFIG_REALVIEW_MPCORE | ||
166 | #define core_tile_eb11mp() check_eb_proc(REALVIEW_EB_PROC_ARM11MP) | ||
167 | #else | ||
168 | #define core_tile_eb11mp() 0 | ||
169 | #endif | ||
170 | |||
152 | #endif /* __ASM_ARCH_BOARD_EB_H */ | 171 | #endif /* __ASM_ARCH_BOARD_EB_H */ |