aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap-smp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/omap-smp.c')
-rw-r--r--arch/arm/mach-omap2/omap-smp.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 48ee295db275..38153e5fbca0 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -17,20 +17,17 @@
17 */ 17 */
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/jiffies.h>
21#include <linux/smp.h> 20#include <linux/smp.h>
22#include <linux/io.h> 21#include <linux/io.h>
23 22
23#include <asm/cacheflush.h>
24#include <asm/localtimer.h> 24#include <asm/localtimer.h>
25#include <asm/smp_scu.h> 25#include <asm/smp_scu.h>
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27 27#include <plat/common.h>
28/* Registers used for communicating startup information */
29#define OMAP4_AUXCOREBOOT_REG0 (OMAP44XX_VA_WKUPGEN_BASE + 0x800)
30#define OMAP4_AUXCOREBOOT_REG1 (OMAP44XX_VA_WKUPGEN_BASE + 0x804)
31 28
32/* SCU base address */ 29/* SCU base address */
33static void __iomem *scu_base = OMAP44XX_VA_SCU_BASE; 30static void __iomem *scu_base;
34 31
35/* 32/*
36 * Use SCU config register to count number of cores 33 * Use SCU config register to count number of cores
@@ -53,8 +50,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
53 * core (e.g. timer irq), then they will not have been enabled 50 * core (e.g. timer irq), then they will not have been enabled
54 * for us: do so 51 * for us: do so
55 */ 52 */
56 53 gic_cpu_init(0, gic_cpu_base_addr);
57 gic_cpu_init(0, OMAP2_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE));
58 54
59 /* 55 /*
60 * Synchronise with the boot thread. 56 * Synchronise with the boot thread.
@@ -65,8 +61,6 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
65 61
66int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) 62int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
67{ 63{
68 unsigned long timeout;
69
70 /* 64 /*
71 * Set synchronisation state between this boot processor 65 * Set synchronisation state between this boot processor
72 * and the secondary one 66 * and the secondary one
@@ -74,18 +68,15 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
74 spin_lock(&boot_lock); 68 spin_lock(&boot_lock);
75 69
76 /* 70 /*
77 * Update the AuxCoreBoot1 with boot state for secondary core. 71 * Update the AuxCoreBoot0 with boot state for secondary core.
78 * omap_secondary_startup() routine will hold the secondary core till 72 * omap_secondary_startup() routine will hold the secondary core till
79 * the AuxCoreBoot1 register is updated with cpu state 73 * the AuxCoreBoot1 register is updated with cpu state
80 * A barrier is added to ensure that write buffer is drained 74 * A barrier is added to ensure that write buffer is drained
81 */ 75 */
82 __raw_writel(cpu, OMAP4_AUXCOREBOOT_REG1); 76 omap_modify_auxcoreboot0(0x200, 0x0);
77 flush_cache_all();
83 smp_wmb(); 78 smp_wmb();
84 79
85 timeout = jiffies + (1 * HZ);
86 while (time_before(jiffies, timeout))
87 ;
88
89 /* 80 /*
90 * Now the secondary core is starting up let it run its 81 * Now the secondary core is starting up let it run its
91 * calibrations, then wait for it to finish 82 * calibrations, then wait for it to finish
@@ -99,17 +90,18 @@ static void __init wakeup_secondary(void)
99{ 90{
100 /* 91 /*
101 * Write the address of secondary startup routine into the 92 * Write the address of secondary startup routine into the
102 * AuxCoreBoot0 where ROM code will jump and start executing 93 * AuxCoreBoot1 where ROM code will jump and start executing
103 * on secondary core once out of WFE 94 * on secondary core once out of WFE
104 * A barrier is added to ensure that write buffer is drained 95 * A barrier is added to ensure that write buffer is drained
105 */ 96 */
106 __raw_writel(virt_to_phys(omap_secondary_startup), \ 97 omap_auxcoreboot_addr(virt_to_phys(omap_secondary_startup));
107 OMAP4_AUXCOREBOOT_REG0);
108 smp_wmb(); 98 smp_wmb();
109 99
110 /* 100 /*
111 * Send a 'sev' to wake the secondary core from WFE. 101 * Send a 'sev' to wake the secondary core from WFE.
102 * Drain the outstanding writes to memory
112 */ 103 */
104 dsb();
113 set_event(); 105 set_event();
114 mb(); 106 mb();
115} 107}
@@ -120,7 +112,13 @@ static void __init wakeup_secondary(void)
120 */ 112 */
121void __init smp_init_cpus(void) 113void __init smp_init_cpus(void)
122{ 114{
123 unsigned int i, ncores = get_core_count(); 115 unsigned int i, ncores;
116
117 /* Never released */
118 scu_base = ioremap(OMAP44XX_SCU_BASE, SZ_256);
119 BUG_ON(!scu_base);
120
121 ncores = get_core_count();
124 122
125 for (i = 0; i < ncores; i++) 123 for (i = 0; i < ncores; i++)
126 set_cpu_possible(i, true); 124 set_cpu_possible(i, true);