Skip to content

Commit

Permalink
metag: cachepart: take into account small cache bits
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
James Hogan committed Mar 15, 2013
1 parent 9e71296 commit 4d8edbf
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions arch/metag/kernel/cachepart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4d8edbf

Please sign in to comment.