Commit 727ac9ec authored by Linus Walleij's avatar Linus Walleij Committed by Russell King (Oracle)

ARM: 9409/1: mmu: Do not use magic number for TTBCR settings

The code in early_paging_init is directly masking off bits
8, 9, 10 and 11 to temporarily disable caching of the translation
tables. There is some exlanations in the comment, but use some
defines instead of magic numbers so ut becomes more evident
what is going on.

Change the type of the register to u32 since these are indeed
unsigned 32bit registers, and use a temporary variable instead
of baking too much into the inline assembly call to increase
readability.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
parent de9c2c66
......@@ -106,6 +106,11 @@
/*
* TTBCR register bits.
*
* The ORGN0 and IRGN0 bits enables different forms of caching when
* walking the translation table. Clearing these bits (which is claimed
* to be the reset default) means "normal memory, [outer|inner]
* non-cacheable"
*/
#define TTBCR_EAE (1 << 31)
#define TTBCR_IMP (1 << 30)
......
......@@ -1638,7 +1638,7 @@ static void __init early_paging_init(const struct machine_desc *mdesc)
{
pgtables_remap *lpae_pgtables_remap;
unsigned long pa_pgd;
unsigned int cr, ttbcr;
u32 cr, ttbcr, tmp;
long long offset;
if (!mdesc->pv_fixup)
......@@ -1688,7 +1688,9 @@ static void __init early_paging_init(const struct machine_desc *mdesc)
cr = get_cr();
set_cr(cr & ~(CR_I | CR_C));
ttbcr = cpu_get_ttbcr();
cpu_set_ttbcr(ttbcr & ~(3 << 8 | 3 << 10));
/* Disable all kind of caching of the translation table */
tmp = ttbcr & ~(TTBCR_ORGN0_MASK | TTBCR_IRGN0_MASK);
cpu_set_ttbcr(tmp);
flush_cache_all();
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment