mips: bmips: BCM6358: make sure CBR is correctly set
authorChristian Marangi <ansuelsmth@gmail.com>
Tue, 11 Jun 2024 11:35:33 +0000 (13:35 +0200)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Tue, 11 Jun 2024 14:05:24 +0000 (16:05 +0200)
It was discovered that some device have CBR address set to 0 causing
kernel panic when arch_sync_dma_for_cpu_all is called.

This was notice in situation where the system is booted from TP1 and
BMIPS_GET_CBR() returns 0 instead of a valid address and
!!(read_c0_brcm_cmt_local() & (1 << 31)); not failing.

The current check whether RAC flush should be disabled or not are not
enough hence lets check if CBR is a valid address or not.

Fixes: ab327f8acdf8 ("mips: bmips: BCM6358: disable RAC flush for TP1")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/bmips/setup.c

index ec180ab92eaa836607381cac0d3beeabc2828923..66a8ba19c28722875fa8754221b2b9c776d0b64d 100644 (file)
@@ -110,7 +110,8 @@ static void bcm6358_quirks(void)
         * RAC flush causes kernel panics on BCM6358 when booting from TP1
         * because the bootloader is not initializing it properly.
         */
-       bmips_rac_flush_disable = !!(read_c0_brcm_cmt_local() & (1 << 31));
+       bmips_rac_flush_disable = !!(read_c0_brcm_cmt_local() & (1 << 31)) ||
+                                 !!BMIPS_GET_CBR();
 }
 
 static void bcm6368_quirks(void)