diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-07 14:51:36 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-08 16:45:29 +0200 |
commit | 3f7e890da73ea3585bed36dfb1d444c75548f78c (patch) | |
tree | 3fd9062cd1b7ee0d3c6b005ab1ced167934b6234 /arch/arm/cpu | |
parent | 9a56bfa95d3ca167fba04eacc0421c39efbbdd8a (diff) | |
download | barebox-3f7e890da73ea3585bed36dfb1d444c75548f78c.tar.gz barebox-3f7e890da73ea3585bed36dfb1d444c75548f78c.tar.xz |
ARM: l2x0: Implement L310 support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r-- | arch/arm/cpu/cache-l2x0.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/arch/arm/cpu/cache-l2x0.c b/arch/arm/cpu/cache-l2x0.c index 2be562d7de..6d6e044cf1 100644 --- a/arch/arm/cpu/cache-l2x0.c +++ b/arch/arm/cpu/cache-l2x0.c @@ -7,6 +7,7 @@ #define CACHE_LINE_SIZE 32 static void __iomem *l2x0_base; +static uint32_t l2x0_way_mask; /* Bitmask of active ways */ static inline void cache_wait(void __iomem *reg, unsigned long mask) { @@ -50,8 +51,8 @@ static inline void l2x0_flush_line(unsigned long addr) static inline void l2x0_inv_all(void) { /* invalidate all ways */ - writel(0xff, l2x0_base + L2X0_INV_WAY); - cache_wait(l2x0_base + L2X0_INV_WAY, 0xff); + writel(l2x0_way_mask, l2x0_base + L2X0_INV_WAY); + cache_wait(l2x0_base + L2X0_INV_WAY, l2x0_way_mask); cache_sync(); } @@ -122,9 +123,37 @@ static void l2x0_disable(void) void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask) { __u32 aux; + __u32 cache_id; + int ways; + const char *type; l2x0_base = base; + cache_id = readl(l2x0_base + L2X0_CACHE_ID); + aux = readl(l2x0_base + L2X0_AUX_CTRL); + + /* Determine the number of ways */ + switch (cache_id & L2X0_CACHE_ID_PART_MASK) { + case L2X0_CACHE_ID_PART_L310: + if (aux & (1 << 16)) + ways = 16; + else + ways = 8; + type = "L310"; + break; + case L2X0_CACHE_ID_PART_L210: + ways = (aux >> 13) & 0xf; + type = "L210"; + break; + default: + /* Assume unknown chips have 8 ways */ + ways = 8; + type = "L2x0 series"; + break; + } + + l2x0_way_mask = (1 << ways) - 1; + /* * Check if l2x0 controller is already enabled. * If you are booting from non-secure mode |