summaryrefslogtreecommitdiffstats
path: root/arch/metag/kernel/cachepart.c
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2013-03-08 15:27:49 +0000
committerJames Hogan <james.hogan@imgtec.com>2013-03-15 13:21:18 +0000
commit4d8edbfefb630559220939ad5a3bdd8a75190cc3 (patch)
tree1e66e9ee78da18e95c536cc2a772c8c4b67c6a01 /arch/metag/kernel/cachepart.c
parent9e7129630329d50b8e8c3403bb71c85a7c3cbe35 (diff)
downloadlinux-4d8edbfefb630559220939ad5a3bdd8a75190cc3.tar.gz
linux-4d8edbfefb630559220939ad5a3bdd8a75190cc3.tar.bz2
linux-4d8edbfefb630559220939ad5a3bdd8a75190cc3.zip
metag: cachepart: take into account small cache bits
The CORE_CONFIG2 register has bits to indicate that the data or code cache is small, i.e. that the size described in the field should be divided by 64. Take this into account in get_icache_size() and get_dcache_size(). Signed-off-by: James Hogan <james.hogan@imgtec.com>
Diffstat (limited to 'arch/metag/kernel/cachepart.c')
-rw-r--r--arch/metag/kernel/cachepart.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/metag/kernel/cachepart.c b/arch/metag/kernel/cachepart.c
index 3a589dfb966b..c737edb5b2d5 100644
--- a/arch/metag/kernel/cachepart.c
+++ b/arch/metag/kernel/cachepart.c
@@ -24,15 +24,21 @@
unsigned int get_dcache_size(void)
{
unsigned int config2 = metag_in32(METAC_CORE_CONFIG2);
- return 0x1000 << ((config2 & METAC_CORECFG2_DCSZ_BITS)
- >> METAC_CORECFG2_DCSZ_S);
+ unsigned int sz = 0x1000 << ((config2 & METAC_CORECFG2_DCSZ_BITS)
+ >> METAC_CORECFG2_DCSZ_S);
+ if (config2 & METAC_CORECFG2_DCSMALL_BIT)
+ sz >>= 6;
+ return sz;
}
unsigned int get_icache_size(void)
{
unsigned int config2 = metag_in32(METAC_CORE_CONFIG2);
- return 0x1000 << ((config2 & METAC_CORE_C2ICSZ_BITS)
- >> METAC_CORE_C2ICSZ_S);
+ unsigned int sz = 0x1000 << ((config2 & METAC_CORE_C2ICSZ_BITS)
+ >> METAC_CORE_C2ICSZ_S);
+ if (config2 & METAC_CORECFG2_ICSMALL_BIT)
+ sz >>= 6;
+ return sz;
}
unsigned int get_global_dcache_size(void)