brcm47xx: fix reboot problem on BCM4705/BCM4785
[openwrt/openwrt.git] / target / linux / brcm47xx / patches-3.10 / 144-make-reboot-more-reliable.patch
index 036de1da3c3c4067cd18977447e6b4a03e255de2..f1a343a0cc9f8ff15aa797f6a8a40a27f132f97d 100644 (file)
@@ -1,17 +1,40 @@
+From 26db431400c336c4cc658cb4888bab18d254c64a Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sat, 9 Aug 2014 00:00:09 +0200
+Subject: [PATCH] MIPS: BCM47XX: fix reboot problem on BCM4705/BCM4785
+
+This adds some code based on code from the Broadcom GPL tar to fix the
+reboot problems on BCM4705/BCM4785. I tried rebooting my device for ~10
+times and have never seen a problem. This reverts the changes in the
+previous commit and adds the real fix as suggested by RafaƂ.
+
+Setting bit 22 in Reg 22, sel 4 puts the BIU (Bus Interface Unit) into
+async mode.
+
+The previous try was this:
+commit 316cad5c1d4daee998cd1f83ccdb437f6f20d45c
+Author: Hauke Mehrtens <hauke@hauke-m.de>
+Date:   Mon Jul 28 23:53:57 2014 +0200
+
+    MIPS: BCM47XX: make reboot more relaiable
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 --- a/arch/mips/bcm47xx/setup.c
 +++ b/arch/mips/bcm47xx/setup.c
-@@ -55,12 +55,12 @@ static void bcm47xx_machine_restart(char
+@@ -55,7 +55,16 @@ static void bcm47xx_machine_restart(char
        switch (bcm47xx_bus_type) {
  #ifdef CONFIG_BCM47XX_SSB
        case BCM47XX_BUS_TYPE_SSB:
--              ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1);
-+              ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 3);
++              if (bcm47xx_bus.bcma.bus.chipinfo.id == 0x4785)
++                      write_c0_diag4(1 << 22);
+               ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1);
++              if (bcm47xx_bus.bcma.bus.chipinfo.id == 0x4785) {
++                      __asm__ __volatile__(
++                              ".set\tmips3\n\t"
++                              "sync\n\t"
++                              "wait\n\t"
++                              ".set\tmips0");
++              }
                break;
  #endif
  #ifdef CONFIG_BCM47XX_BCMA
-       case BCM47XX_BUS_TYPE_BCMA:
--              bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 1);
-+              bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 3);
-               break;
- #endif
-       }