aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ux500/platsmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-ux500/platsmp.c')
-rw-r--r--arch/arm/mach-ux500/platsmp.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index d77e76cb7edd..4fff4d408417 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -20,6 +20,7 @@
20#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
21#include <asm/smp_scu.h> 21#include <asm/smp_scu.h>
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/setup.h>
23 24
24/* 25/*
25 * control for which core is the next to come out of the secondary 26 * control for which core is the next to come out of the secondary
@@ -40,6 +41,18 @@ static void write_pen_release(int val)
40 outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); 41 outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
41} 42}
42 43
44static void __iomem *scu_base_addr(void)
45{
46 if (cpu_is_u5500())
47 return __io_address(U5500_SCU_BASE);
48 else if (cpu_is_u8500())
49 return __io_address(U8500_SCU_BASE);
50 else
51 ux500_unknown_soc();
52
53 return NULL;
54}
55
43static DEFINE_SPINLOCK(boot_lock); 56static DEFINE_SPINLOCK(boot_lock);
44 57
45void __cpuinit platform_secondary_init(unsigned int cpu) 58void __cpuinit platform_secondary_init(unsigned int cpu)
@@ -100,21 +113,28 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
100 113
101static void __init wakeup_secondary(void) 114static void __init wakeup_secondary(void)
102{ 115{
116 void __iomem *backupram;
117
118 if (cpu_is_u5500())
119 backupram = __io_address(U5500_BACKUPRAM0_BASE);
120 else if (cpu_is_u8500())
121 backupram = __io_address(U8500_BACKUPRAM0_BASE);
122 else
123 ux500_unknown_soc();
124
103 /* 125 /*
104 * write the address of secondary startup into the backup ram register 126 * write the address of secondary startup into the backup ram register
105 * at offset 0x1FF4, then write the magic number 0xA1FEED01 to the 127 * at offset 0x1FF4, then write the magic number 0xA1FEED01 to the
106 * backup ram register at offset 0x1FF0, which is what boot rom code 128 * backup ram register at offset 0x1FF0, which is what boot rom code
107 * is waiting for. This would wake up the secondary core from WFE 129 * is waiting for. This would wake up the secondary core from WFE
108 */ 130 */
109#define U8500_CPU1_JUMPADDR_OFFSET 0x1FF4 131#define UX500_CPU1_JUMPADDR_OFFSET 0x1FF4
110 __raw_writel(virt_to_phys(u8500_secondary_startup), 132 __raw_writel(virt_to_phys(u8500_secondary_startup),
111 __io_address(UX500_BACKUPRAM0_BASE) + 133 backupram + UX500_CPU1_JUMPADDR_OFFSET);
112 U8500_CPU1_JUMPADDR_OFFSET);
113 134
114#define U8500_CPU1_WAKEMAGIC_OFFSET 0x1FF0 135#define UX500_CPU1_WAKEMAGIC_OFFSET 0x1FF0
115 __raw_writel(0xA1FEED01, 136 __raw_writel(0xA1FEED01,
116 __io_address(UX500_BACKUPRAM0_BASE) + 137 backupram + UX500_CPU1_WAKEMAGIC_OFFSET);
117 U8500_CPU1_WAKEMAGIC_OFFSET);
118 138
119 /* make sure write buffer is drained */ 139 /* make sure write buffer is drained */
120 mb(); 140 mb();
@@ -126,9 +146,10 @@ static void __init wakeup_secondary(void)
126 */ 146 */
127void __init smp_init_cpus(void) 147void __init smp_init_cpus(void)
128{ 148{
149 void __iomem *scu_base = scu_base_addr();
129 unsigned int i, ncores; 150 unsigned int i, ncores;
130 151
131 ncores = scu_get_core_count(__io_address(UX500_SCU_BASE)); 152 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
132 153
133 /* sanity check */ 154 /* sanity check */
134 if (ncores > NR_CPUS) { 155 if (ncores > NR_CPUS) {
@@ -154,6 +175,6 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
154 for (i = 0; i < max_cpus; i++) 175 for (i = 0; i < max_cpus; i++)
155 set_cpu_present(i, true); 176 set_cpu_present(i, true);
156 177
157 scu_enable(__io_address(UX500_SCU_BASE)); 178 scu_enable(scu_base_addr());
158 wakeup_secondary(); 179 wakeup_secondary();
159} 180}