Commit d75de087 authored by Maxime Bizon's avatar Maxime Bizon Committed by Nicolas Pitre

[ARM] Kirkwood: invalidate L2 cache before enabling it

I get random oopses on my Kirkwood board at startup when L2 cache is
enabled. FYI I'm using Marvell uboot version 3.4.16

Each boot produces the same oops, but anything that changes the kernel
size (even only changing initramfs) makes the oops different.

I noticed that nothing invalidates the L2 cache before enabling it,
doing so fixes my problem.
Signed-off-by: default avatarMaxime Bizon <mbizon@freebox.fr>
Signed-off-by: default avatarNicolas Pitre <nico@marvell.com>
parent c31f403d
...@@ -115,6 +115,10 @@ static inline void l2_inv_pa_range(unsigned long start, unsigned long end) ...@@ -115,6 +115,10 @@ static inline void l2_inv_pa_range(unsigned long start, unsigned long end)
raw_local_irq_restore(flags); raw_local_irq_restore(flags);
} }
static inline void l2_inv_all(void)
{
__asm__("mcr p15, 1, %0, c15, c11, 0" : : "r" (0));
}
/* /*
* Linux primitives. * Linux primitives.
...@@ -321,6 +325,7 @@ static void __init enable_l2(void) ...@@ -321,6 +325,7 @@ static void __init enable_l2(void)
d = flush_and_disable_dcache(); d = flush_and_disable_dcache();
i = invalidate_and_disable_icache(); i = invalidate_and_disable_icache();
l2_inv_all();
write_extra_features(u | 0x00400000); write_extra_features(u | 0x00400000);
if (i) if (i)
enable_icache(); enable_icache();
......
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