Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / arch / arm / mach-vexpress / platsmp.c
CommitLineData
59ac59f6
RK
1/*
2 * linux/arch/arm/mach-vexpress/platsmp.c
3 *
4 * Copyright (C) 2002 ARM Ltd.
5 * All Rights Reserved
6 *
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.
10 */
11#include <linux/init.h>
12#include <linux/errno.h>
59ac59f6
RK
13#include <linux/smp.h>
14#include <linux/io.h>
d2606f81 15#include <linux/of_address.h>
38669e04 16#include <linux/vexpress.h>
95d59741 17
033a899c 18#include <asm/mcpm.h>
95d59741 19#include <asm/smp_scu.h>
95d59741 20#include <asm/mach/map.h>
59ac59f6 21
59ac59f6 22#include <mach/motherboard.h>
59ac59f6 23
3695adc2 24#include <plat/platsmp.h>
59ac59f6 25
3695adc2 26#include "core.h"
3705ff6d 27
59ac59f6
RK
28/*
29 * Initialise the CPU possible map early - this describes the CPUs
30 * which may be present or become present in the system.
31 */
3695adc2 32static void __init vexpress_smp_init_cpus(void)
59ac59f6 33{
d2606f81 34 ct_desc->init_cpu_map();
59ac59f6
RK
35}
36
3695adc2 37static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus)
59ac59f6 38{
59ac59f6
RK
39 /*
40 * Initialise the present map, which describes the set of CPUs
41 * actually populated at the present time.
42 */
d2606f81 43 ct_desc->smp_enable(max_cpus);
05c74a6c 44
59ac59f6 45 /*
05c74a6c
RK
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.
59ac59f6 50 */
38669e04 51 vexpress_flags_set(virt_to_phys(versatile_secondary_startup));
59ac59f6 52}
3695adc2
MZ
53
54struct 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,
61#endif
62};
033a899c
JM
63
64bool __init vexpress_smp_init_ops(void)
65{
66#ifdef CONFIG_MCPM
67 /*
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.
71 */
72 struct device_node *node;
73 node = of_find_compatible_node(NULL, NULL, "arm,cci-400");
74 if (node && of_device_is_available(node)) {
75 mcpm_smp_set_ops();
76 return true;
77 }
78#endif
79 return false;
80}
d2606f81
PM
81
82#if defined(CONFIG_OF)
83
84static const struct of_device_id vexpress_smp_dt_scu_match[] __initconst = {
85 { .compatible = "arm,cortex-a5-scu", },
86 { .compatible = "arm,cortex-a9-scu", },
87 {}
88};
89
90static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
91{
92 struct device_node *scu = of_find_matching_node(NULL,
93 vexpress_smp_dt_scu_match);
94
95 if (scu)
96 scu_enable(of_iomap(scu, 0));
97
98 /*
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.
103 */
104 vexpress_flags_set(virt_to_phys(versatile_secondary_startup));
105}
106
107struct 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,
113#endif
114};
115
116#endif
This page took 0.227491 seconds and 5 git commands to generate.