aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/cache-l2x0.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mm/cache-l2x0.c')
-rw-r--r--arch/arm/mm/cache-l2x0.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index a1313d20f205..1c3a23318f53 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -70,6 +70,12 @@ static inline void l2c_set_debug(void __iomem *base, unsigned long val)
70 outer_cache.set_debug(val); 70 outer_cache.set_debug(val);
71} 71}
72 72
73static void __l2c_op_way(void __iomem *reg)
74{
75 writel_relaxed(l2x0_way_mask, reg);
76 cache_wait_way(reg, l2x0_way_mask);
77}
78
73static inline void l2c_unlock(void __iomem *base, unsigned num) 79static inline void l2c_unlock(void __iomem *base, unsigned num)
74{ 80{
75 unsigned i; 81 unsigned i;
@@ -166,8 +172,7 @@ static void l2x0_cache_sync(void)
166static void __l2x0_flush_all(void) 172static void __l2x0_flush_all(void)
167{ 173{
168 debug_writel(0x03); 174 debug_writel(0x03);
169 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_INV_WAY); 175 __l2c_op_way(l2x0_base + L2X0_CLEAN_INV_WAY);
170 cache_wait_way(l2x0_base + L2X0_CLEAN_INV_WAY, l2x0_way_mask);
171 cache_sync(); 176 cache_sync();
172 debug_writel(0x00); 177 debug_writel(0x00);
173} 178}
@@ -188,8 +193,7 @@ static void l2x0_clean_all(void)
188 193
189 /* clean all ways */ 194 /* clean all ways */
190 raw_spin_lock_irqsave(&l2x0_lock, flags); 195 raw_spin_lock_irqsave(&l2x0_lock, flags);
191 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_WAY); 196 __l2c_op_way(l2x0_base + L2X0_CLEAN_WAY);
192 cache_wait_way(l2x0_base + L2X0_CLEAN_WAY, l2x0_way_mask);
193 cache_sync(); 197 cache_sync();
194 raw_spin_unlock_irqrestore(&l2x0_lock, flags); 198 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
195} 199}
@@ -202,8 +206,7 @@ static void l2x0_inv_all(void)
202 raw_spin_lock_irqsave(&l2x0_lock, flags); 206 raw_spin_lock_irqsave(&l2x0_lock, flags);
203 /* Invalidating when L2 is enabled is a nono */ 207 /* Invalidating when L2 is enabled is a nono */
204 BUG_ON(readl(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN); 208 BUG_ON(readl(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN);
205 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY); 209 __l2c_op_way(l2x0_base + L2X0_INV_WAY);
206 cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask);
207 cache_sync(); 210 cache_sync();
208 raw_spin_unlock_irqrestore(&l2x0_lock, flags); 211 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
209} 212}