1 // SPDX-License-Identifier: GPL-2.0-only
3 * arch/arm/mach-sti/platsmp.c
5 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
8 * Cloned from linux/arch/arm/mach-vexpress/platsmp.c
10 * Copyright (C) 2002 ARM Ltd.
13 #include <linux/init.h>
14 #include <linux/errno.h>
15 #include <linux/delay.h>
16 #include <linux/smp.h>
19 #include <linux/of_address.h>
20 #include <linux/memblock.h>
22 #include <asm/cacheflush.h>
23 #include <asm/smp_plat.h>
24 #include <asm/smp_scu.h>
28 static u32 __iomem
*cpu_strt_ptr
;
30 static int sti_boot_secondary(unsigned int cpu
, struct task_struct
*idle
)
32 unsigned long entry_pa
= __pa_symbol(secondary_startup
);
35 * Secondary CPU is initialised and started by a U-BOOTROM firmware.
36 * Secondary CPU is spinning and waiting for a write at cpu_strt_ptr.
37 * Writing secondary_startup address at cpu_strt_ptr makes it to
38 * jump directly to secondary_startup().
40 __raw_writel(entry_pa
, cpu_strt_ptr
);
42 /* wmb so that data is actually written before cache flush is done */
44 sync_cache_w(cpu_strt_ptr
);
49 static void __init
sti_smp_prepare_cpus(unsigned int max_cpus
)
51 struct device_node
*np
;
52 void __iomem
*scu_base
;
56 np
= of_find_compatible_node(NULL
, NULL
, "arm,cortex-a9-scu");
59 scu_base
= of_iomap(np
, 0);
67 for_each_possible_cpu(cpu
) {
69 np
= of_get_cpu_node(cpu
, NULL
);
74 if (of_property_read_u32(np
, "cpu-release-addr",
76 pr_err("CPU %d: missing or invalid cpu-release-addr "
82 * cpu-release-addr is usually configured in SBC DMEM but can
86 if (!memblock_is_memory(release_phys
))
88 ioremap(release_phys
, sizeof(release_phys
));
91 (u32 __iomem
*)phys_to_virt(release_phys
);
93 set_cpu_possible(cpu
, true);
97 const struct smp_operations sti_smp_ops __initconst
= {
98 .smp_prepare_cpus
= sti_smp_prepare_cpus
,
99 .smp_boot_secondary
= sti_boot_secondary
,