aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-qcom
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2014-08-04 21:31:44 -0400
committerKumar Gala <galak@codeaurora.org>2015-01-19 12:53:31 -0500
commit30cbb0c01bc98a2372966b8c5ac0ce1421cd933c (patch)
tree487d86524ba1f4cb9a5f41613cd6013dc3cfc9b0 /arch/arm/mach-qcom
parentf76c6916570d8d24a622f2107ef747531148046e (diff)
ARM: qcom: scm: Get cacheline size from CTR
Instead of hardcoding the cacheline size as 32, get the cacheline size from the CTR register. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Kumar Gala <galak@codeaurora.org>
Diffstat (limited to 'arch/arm/mach-qcom')
-rw-r--r--arch/arm/mach-qcom/scm.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c
index 820c72165e19..c08786ebf116 100644
--- a/arch/arm/mach-qcom/scm.c
+++ b/arch/arm/mach-qcom/scm.c
@@ -27,9 +27,6 @@
27 27
28#include "scm.h" 28#include "scm.h"
29 29
30/* Cache line size for msm8x60 */
31#define CACHELINESIZE 32
32
33#define SCM_ENOMEM -5 30#define SCM_ENOMEM -5
34#define SCM_EOPNOTSUPP -4 31#define SCM_EOPNOTSUPP -4
35#define SCM_EINVAL_ADDR -3 32#define SCM_EINVAL_ADDR -3
@@ -214,13 +211,18 @@ static int __scm_call(const struct scm_command *cmd)
214 211
215static void scm_inv_range(unsigned long start, unsigned long end) 212static void scm_inv_range(unsigned long start, unsigned long end)
216{ 213{
217 start = round_down(start, CACHELINESIZE); 214 u32 cacheline_size, ctr;
218 end = round_up(end, CACHELINESIZE); 215
216 asm volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (ctr));
217 cacheline_size = 4 << ((ctr >> 16) & 0xf);
218
219 start = round_down(start, cacheline_size);
220 end = round_up(end, cacheline_size);
219 outer_inv_range(start, end); 221 outer_inv_range(start, end);
220 while (start < end) { 222 while (start < end) {
221 asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start) 223 asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start)
222 : "memory"); 224 : "memory");
223 start += CACHELINESIZE; 225 start += cacheline_size;
224 } 226 }
225 dsb(); 227 dsb();
226 isb(); 228 isb();