summaryrefslogtreecommitdiff
path: root/target/linux/brcm63xx/patches-3.3
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2012-05-06 21:25:34 +0000
committerJonas Gorski <jogo@openwrt.org>2012-05-06 21:25:34 +0000
commitb218b15709d8699be79fd21e96bf589ca74aa187 (patch)
treea0054d76b5e524d2fcffabf6b1db30e26b3bfa63 /target/linux/brcm63xx/patches-3.3
parent0ff3c396d39e762cb0230eb84b9bd1d29dddc520 (diff)
downloadmtk-20170518-b218b15709d8699be79fd21e96bf589ca74aa187.zip
mtk-20170518-b218b15709d8699be79fd21e96bf589ca74aa187.tar.gz
mtk-20170518-b218b15709d8699be79fd21e96bf589ca74aa187.tar.bz2
bcm63xx: fix a race between PCI bus scan and fallback sprom registration
The fallback sprom handler was installed too late, resulting in ssb failing to get a valid sprom on some devices. Fixes #11384. SVN-Revision: 31638
Diffstat (limited to 'target/linux/brcm63xx/patches-3.3')
-rw-r--r--target/linux/brcm63xx/patches-3.3/306-MIPS-BCM63XX-register-devices-earlier.patch21
-rw-r--r--target/linux/brcm63xx/patches-3.3/307-MIPS-BCM63XX-explicitly-register-the-pci-bus.patch89
2 files changed, 110 insertions, 0 deletions
diff --git a/target/linux/brcm63xx/patches-3.3/306-MIPS-BCM63XX-register-devices-earlier.patch b/target/linux/brcm63xx/patches-3.3/306-MIPS-BCM63XX-register-devices-earlier.patch
new file mode 100644
index 0000000..3e74e97
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.3/306-MIPS-BCM63XX-register-devices-earlier.patch
@@ -0,0 +1,21 @@
+From d42f3f75a5d1abe9f7c5275fb59f3e894e83043d Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jonas.gorski@gmail.com>
+Date: Sun, 6 May 2012 15:05:48 +0200
+Subject: [PATCH 1/2] MIPS: BCM63XX: register devices earlier
+
+Register devices as an arch initcall so that the fallback sprom gets
+installed in the same phase as the pci bus gets registered.
+
+Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
+---
+ arch/mips/bcm63xx/setup.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+--- a/arch/mips/bcm63xx/setup.c
++++ b/arch/mips/bcm63xx/setup.c
+@@ -150,4 +150,4 @@ int __init bcm63xx_register_devices(void
+ return board_register_devices();
+ }
+
+-device_initcall(bcm63xx_register_devices);
++arch_initcall(bcm63xx_register_devices);
diff --git a/target/linux/brcm63xx/patches-3.3/307-MIPS-BCM63XX-explicitly-register-the-pci-bus.patch b/target/linux/brcm63xx/patches-3.3/307-MIPS-BCM63XX-explicitly-register-the-pci-bus.patch
new file mode 100644
index 0000000..284a759
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.3/307-MIPS-BCM63XX-explicitly-register-the-pci-bus.patch
@@ -0,0 +1,89 @@
+From 45aebb9465e22b236a201deef1b234693d99e174 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jonas.gorski@gmail.com>
+Date: Sun, 6 May 2012 15:13:48 +0200
+Subject: [PATCH 2/2] MIPS: BCM63XX: explicitly register the PCI bus
+
+Instead of setting a global variable toggling the PCI registration,
+register it in the device_register phase after setting the fallback
+sprom to ensure there cannot be a race between them.
+
+Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
+---
+ arch/mips/bcm63xx/boards/board_bcm963xx.c | 6 +++++-
+ .../include/asm/mach-bcm63xx/bcm63xx_dev_pci.h | 4 +++-
+ arch/mips/pci/pci-bcm63xx.c | 13 +------------
+ 3 files changed, 9 insertions(+), 14 deletions(-)
+
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -825,7 +825,6 @@ void __init board_prom_init(void)
+
+ #ifdef CONFIG_PCI
+ if (board.has_pci) {
+- bcm63xx_pci_enabled = 1;
+ if (BCMCPU_IS_6348())
+ val |= GPIO_MODE_6348_G2_PCI;
+ }
+@@ -997,5 +996,10 @@ int __init board_register_devices(void)
+ platform_device_register(&bcm63xx_gpio_keys_device);
+ }
+
++#ifdef CONFIG_PCI
++ if (board.has_pci)
++ bcm63xx_pci_register();
++#endif
++
+ return 0;
+ }
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pci.h
++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pci.h
+@@ -1,6 +1,8 @@
+ #ifndef BCM63XX_DEV_PCI_H_
+ #define BCM63XX_DEV_PCI_H_
+
+-extern int bcm63xx_pci_enabled;
++#include <linux/init.h>
++
++int __init bcm63xx_pci_register(void);
+
+ #endif /* BCM63XX_DEV_PCI_H_ */
+--- a/arch/mips/pci/pci-bcm63xx.c
++++ b/arch/mips/pci/pci-bcm63xx.c
+@@ -14,12 +14,6 @@
+
+ #include "pci-bcm63xx.h"
+
+-/*
+- * Allow PCI to be disabled at runtime depending on board nvram
+- * configuration
+- */
+-int bcm63xx_pci_enabled;
+-
+ static struct resource bcm_pci_mem_resource = {
+ .name = "bcm63xx PCI memory space",
+ .start = BCM_PCI_MEM_BASE_PA,
+@@ -94,7 +88,7 @@ static void bcm63xx_int_cfg_writel(u32 v
+
+ void __iomem *pci_iospace_start;
+
+-static int __init bcm63xx_pci_init(void)
++int __init bcm63xx_pci_register(void)
+ {
+ unsigned int mem_size;
+ u32 val;
+@@ -102,9 +96,6 @@ static int __init bcm63xx_pci_init(void)
+ if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358() && !BCMCPU_IS_6368())
+ return -ENODEV;
+
+- if (!bcm63xx_pci_enabled)
+- return -ENODEV;
+-
+ /*
+ * configuration access are done through IO space, remap 4
+ * first bytes to access it from CPU.
+@@ -220,5 +211,3 @@ static int __init bcm63xx_pci_init(void)
+ "bcm63xx PCI IO space");
+ return 0;
+ }
+-
+-arch_initcall(bcm63xx_pci_init);