aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBastian Hecht <hechtb@googlemail.com>2012-10-25 06:58:22 -0400
committerSimon Horman <horms@verge.net.au>2012-11-05 23:47:21 -0500
commitcdc7594e5c5f7509a86b205edeedc58d72dd3999 (patch)
treeeadd753e7bc5dca10c2a0b7ae08c863f4eb57086
parente721295185535ed6ef4711eba156fbf5c24f9c5e (diff)
ARM: shmobile: r8a7779: Replace modify_scu_cpu_psr with scu_power_mode
We can remove the extra code of modify_scu_cpu_psr() and use the cleaner generic ARM helper scu_power_mode(). As every CPU only deals with its own power register and scu_power_mode() operates with 8-bit accesses, we save the locking overhead too. Signed-off-by: Bastian Hecht <hechtb@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 2ce6af9a6a37..9def0f22bf22 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -61,9 +61,6 @@ static void __iomem *scu_base_addr(void)
61 return (void __iomem *)0xf0000000; 61 return (void __iomem *)0xf0000000;
62} 62}
63 63
64static DEFINE_SPINLOCK(scu_lock);
65static unsigned long tmp;
66
67#ifdef CONFIG_HAVE_ARM_TWD 64#ifdef CONFIG_HAVE_ARM_TWD
68static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); 65static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
69 66
@@ -73,20 +70,6 @@ void __init r8a7779_register_twd(void)
73} 70}
74#endif 71#endif
75 72
76static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
77{
78 void __iomem *scu_base = scu_base_addr();
79
80 spin_lock(&scu_lock);
81 tmp = __raw_readl(scu_base + 8);
82 tmp &= ~clr;
83 tmp |= set;
84 spin_unlock(&scu_lock);
85
86 /* disable cache coherency after releasing the lock */
87 __raw_writel(tmp, scu_base + 8);
88}
89
90static unsigned int __init r8a7779_get_core_count(void) 73static unsigned int __init r8a7779_get_core_count(void)
91{ 74{
92 void __iomem *scu_base = scu_base_addr(); 75 void __iomem *scu_base = scu_base_addr();
@@ -102,7 +85,7 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
102 cpu = cpu_logical_map(cpu); 85 cpu = cpu_logical_map(cpu);
103 86
104 /* disable cache coherency */ 87 /* disable cache coherency */
105 modify_scu_cpu_psr(3 << (cpu * 8), 0); 88 scu_power_mode(scu_base_addr(), 3);
106 89
107 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) 90 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu))
108 ch = r8a7779_ch_cpu[cpu]; 91 ch = r8a7779_ch_cpu[cpu];
@@ -145,7 +128,7 @@ static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct
145 cpu = cpu_logical_map(cpu); 128 cpu = cpu_logical_map(cpu);
146 129
147 /* enable cache coherency */ 130 /* enable cache coherency */
148 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 131 scu_power_mode(scu_base_addr(), 0);
149 132
150 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) 133 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu))
151 ch = r8a7779_ch_cpu[cpu]; 134 ch = r8a7779_ch_cpu[cpu];
@@ -158,15 +141,13 @@ static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct
158 141
159static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus) 142static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
160{ 143{
161 int cpu = cpu_logical_map(0);
162
163 scu_enable(scu_base_addr()); 144 scu_enable(scu_base_addr());
164 145
165 /* Map the reset vector (in headsmp.S) */ 146 /* Map the reset vector (in headsmp.S) */
166 __raw_writel(__pa(shmobile_secondary_vector), AVECR); 147 __raw_writel(__pa(shmobile_secondary_vector), AVECR);
167 148
168 /* enable cache coherency on CPU0 */ 149 /* enable cache coherency on CPU0 */
169 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 150 scu_power_mode(scu_base_addr(), 0);
170 151
171 r8a7779_pm_init(); 152 r8a7779_pm_init();
172 153