2 * linux/arch/arm/mach-vexpress/platsmp.c
4 * Copyright (C) 2002 ARM Ltd.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 #include <linux/init.h>
12 #include <linux/errno.h>
13 #include <linux/smp.h>
15 #include <linux/of_address.h>
16 #include <linux/vexpress.h>
19 #include <asm/smp_scu.h>
20 #include <asm/mach/map.h>
22 #include <mach/motherboard.h>
24 #include <plat/platsmp.h>
29 * Initialise the CPU possible map early - this describes the CPUs
30 * which may be present or become present in the system.
32 static void __init
vexpress_smp_init_cpus(void)
34 ct_desc
->init_cpu_map();
37 static void __init
vexpress_smp_prepare_cpus(unsigned int max_cpus
)
40 * Initialise the present map, which describes the set of CPUs
41 * actually populated at the present time.
43 ct_desc
->smp_enable(max_cpus
);
46 * Write the address of secondary startup into the
47 * system-wide flags register. The boot monitor waits
48 * until it receives a soft interrupt, and then the
49 * secondary CPU branches to this address.
51 vexpress_flags_set(virt_to_phys(versatile_secondary_startup
));
54 struct smp_operations __initdata vexpress_smp_ops
= {
55 .smp_init_cpus
= vexpress_smp_init_cpus
,
56 .smp_prepare_cpus
= vexpress_smp_prepare_cpus
,
57 .smp_secondary_init
= versatile_secondary_init
,
58 .smp_boot_secondary
= versatile_boot_secondary
,
59 #ifdef CONFIG_HOTPLUG_CPU
60 .cpu_die
= vexpress_cpu_die
,
64 bool __init
vexpress_smp_init_ops(void)
68 * The best way to detect a multi-cluster configuration at the moment
69 * is to look for the presence of a CCI in the system.
70 * Override the default vexpress_smp_ops if so.
72 struct device_node
*node
;
73 node
= of_find_compatible_node(NULL
, NULL
, "arm,cci-400");
74 if (node
&& of_device_is_available(node
)) {
82 #if defined(CONFIG_OF)
84 static const struct of_device_id vexpress_smp_dt_scu_match
[] __initconst
= {
85 { .compatible
= "arm,cortex-a5-scu", },
86 { .compatible
= "arm,cortex-a9-scu", },
90 static void __init
vexpress_smp_dt_prepare_cpus(unsigned int max_cpus
)
92 struct device_node
*scu
= of_find_matching_node(NULL
,
93 vexpress_smp_dt_scu_match
);
96 scu_enable(of_iomap(scu
, 0));
99 * Write the address of secondary startup into the
100 * system-wide flags register. The boot monitor waits
101 * until it receives a soft interrupt, and then the
102 * secondary CPU branches to this address.
104 vexpress_flags_set(virt_to_phys(versatile_secondary_startup
));
107 struct smp_operations __initdata vexpress_smp_dt_ops
= {
108 .smp_prepare_cpus
= vexpress_smp_dt_prepare_cpus
,
109 .smp_secondary_init
= versatile_secondary_init
,
110 .smp_boot_secondary
= versatile_boot_secondary
,
111 #ifdef CONFIG_HOTPLUG_CPU
112 .cpu_die
= vexpress_cpu_die
,