ath79: lzma-loader: sync with ar71xx target
[openwrt/staging/luka.git] / target / linux / ath79 / image / lzma-loader / src / head.S
index 47a7c9bd6300ad92e6a0d426c5f44bc0f3e7e85f..d414b14d11b9e6cf0655f8d7bda54739a8d6567e 100644 (file)
@@ -42,6 +42,19 @@ LEAF(startup)
        mtc0    t0, CP0_STATUS
        ehb
 
+       /*
+        * Some bootloaders set the 'Kseg0 coherency algorithm' to
+        * 'Cacheable, noncoherent, write-through, no write allocate'
+        * and this cause performance issues. Let's go and change it to
+        * 'Cacheable, noncoherent, write-back, write allocate'
+        */
+       mfc0    t0, CP0_CONFIG
+       li      t1, ~7                  #~CONF_CM_CMASK
+       and     t0, t1
+       ori     t0, 3                   #CONF_CM_CACHABLE_NONCOHERENT
+       mtc0    t0, CP0_CONFIG
+       nop
+
        mtc0    zero, CP0_COUNT
        mtc0    zero, CP0_COMPARE
        ehb