1
2
3
4
5
6
7
8
9
10
11#include <linux/init.h>
12#include <linux/errno.h>
13#include <linux/smp.h>
14#include <linux/io.h>
15#include <linux/of_address.h>
16#include <linux/vexpress.h>
17
18#include <asm/mcpm.h>
19#include <asm/smp_scu.h>
20#include <asm/mach/map.h>
21
22#include <plat/platsmp.h>
23
24#include "core.h"
25
26bool __init vexpress_smp_init_ops(void)
27{
28#ifdef CONFIG_MCPM
29 int cpu;
30 struct device_node *cpu_node, *cci_node;
31
32
33
34
35
36
37
38
39 for_each_possible_cpu(cpu) {
40 bool available;
41
42 cpu_node = of_get_cpu_node(cpu, NULL);
43 if (WARN(!cpu_node, "Missing cpu device node!"))
44 return false;
45
46 cci_node = of_parse_phandle(cpu_node, "cci-control-port", 0);
47 available = cci_node && of_device_is_available(cci_node);
48 of_node_put(cci_node);
49 of_node_put(cpu_node);
50
51 if (!available)
52 return false;
53 }
54
55 mcpm_smp_set_ops();
56 return true;
57#else
58 return false;
59#endif
60}
61
62static const struct of_device_id vexpress_smp_dt_scu_match[] __initconst = {
63 { .compatible = "arm,cortex-a5-scu", },
64 { .compatible = "arm,cortex-a9-scu", },
65 {}
66};
67
68static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
69{
70 struct device_node *scu = of_find_matching_node(NULL,
71 vexpress_smp_dt_scu_match);
72
73 if (scu)
74 scu_enable(of_iomap(scu, 0));
75
76
77
78
79
80
81
82 vexpress_flags_set(__pa_symbol(versatile_secondary_startup));
83}
84
85const struct smp_operations vexpress_smp_dt_ops __initconst = {
86 .smp_prepare_cpus = vexpress_smp_dt_prepare_cpus,
87 .smp_secondary_init = versatile_secondary_init,
88 .smp_boot_secondary = versatile_boot_secondary,
89#ifdef CONFIG_HOTPLUG_CPU
90 .cpu_die = vexpress_cpu_die,
91#endif
92};
93