]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm: caches: Disable mmu only if mmu is available
authorLokesh Vutla <lokeshvutla@ti.com>
Wed, 30 Oct 2019 10:25:41 +0000 (15:55 +0530)
committerTom Rini <trini@konsulko.com>
Thu, 7 Nov 2019 23:01:13 +0000 (18:01 -0500)
As part of disabling caches MMU as well gets disabled. But MMU is not
available on all armv7 cores like R5F. So disable MMU only if it is
available.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
arch/arm/lib/cache-cp15.c

index b2913e8165a8c85ba473adb4f5abe7a210570364..47c223917a0298a2ca6e85a772d1599f4c78c9cf 100644 (file)
@@ -235,12 +235,18 @@ static void cache_disable(uint32_t cache_bit)
                /* if cache isn;t enabled no need to disable */
                if ((reg & CR_C) != CR_C)
                        return;
+#ifdef CONFIG_SYS_ARM_MMU
                /* if disabling data cache, disable mmu too */
                cache_bit |= CR_M;
+#endif
        }
        reg = get_cr();
 
+#ifdef CONFIG_SYS_ARM_MMU
        if (cache_bit == (CR_C | CR_M))
+#elif defined(CONFIG_SYS_ARM_MPU)
+       if (cache_bit == CR_C)
+#endif
                flush_dcache_all();
        set_cr(reg & ~cache_bit);
 }