]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mips: refactor disabling of caches
authorDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Sat, 11 Jul 2020 22:45:56 +0000 (00:45 +0200)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Sat, 18 Jul 2020 12:23:25 +0000 (14:23 +0200)
Logically this code belongs to cache_init.S.

If a complex SoC needs to replace the generic cache init,
mips_cache_disable() can now be called from custom start.S files.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
arch/mips/cpu/start.S
arch/mips/lib/cache_init.S

index c3d1e64c1c57d5455add377df7468c155cadc2b2..a9f87437174752ea2148a22582b00913f7415c3f 100644 (file)
@@ -196,11 +196,10 @@ wr_done:
        mtc0    zero, CP0_COMPARE
 
 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
-       mfc0    t0, CP0_CONFIG
-       and     t0, t0, MIPS_CONF_IMPL
-       or      t0, t0, CONF_CM_UNCACHED
-       mtc0    t0, CP0_CONFIG
-       ehb
+       /* Disable caches */
+       PTR_LA  t9, mips_cache_disable
+       jalr    t9
+        nop
 #endif
 
 #ifdef CONFIG_MIPS_CM
index 2233d27137234722a8c1d9df9069f7a7cc320d3f..602741c65dc989a13df1de97950425794a4e9077 100644 (file)
@@ -418,6 +418,12 @@ return:
        jr      R_RETURN
        END(mips_cache_reset)
 
+LEAF(mips_cache_disable)
+       move    R_RETURN, ra
+       change_k0_cca_kseg1 CONF_CM_UNCACHED
+       jr      R_RETURN
+       END(mips_cache_disable)
+
 LEAF(change_k0_cca)
        mfc0            t0, CP0_CONFIG
 #if __mips_isa_rev >= 2