a0e0e621ca
The PCI device ID detected by the wifi drivers on devices using a fallback SPROM is wrong. Currently the chipnum is used for this parameter. Most SSB based Broadcom wifi chips are 2.4 and 5GHz capable. But on devices without a physical SPROM, the only one way to detect if the device suports both bands or only the 5GHz band, is by reading the device ID from the fallback SPROM. In some devices, this may lead to a non working wifi on a 5GHz-only card, or in the best case a working 2.4GHz-only in a dual band wifi card. The offset for the deviceid in SSB SPROMs is 0x0008, whereas in BCMA is 0x0060. This is true for any SPROM version. Override the PCI device ID with the one defined at the fallback SPROM, to detect the correct wifi card model and allow using the 5GHz band if supported. The patch has been tested with the following wifi radios: BCM43222: b43: both 2.4/5GHz working brcm-wl: both 2.4/5GHz working BCM43225: b43: 2.4GHz, working brcmsmac: working brcm-wl: it lacks support BCM43217: b43: 2.4GHz, working brcmsmac: it lacks support brcm-wl: it lacks support Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com> [amend commit description, rework patch to avoid using a new global variable and keep ssb sprom extraction code as close to ssb/pci.c as possible] Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
32 lines
988 B
Diff
32 lines
988 B
Diff
--- a/arch/mips/bcm63xx/sprom.c
|
|
+++ b/arch/mips/bcm63xx/sprom.c
|
|
@@ -8,6 +8,7 @@
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
+#include <linux/export.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/string.h>
|
|
#include <linux/platform_device.h>
|
|
@@ -388,7 +389,19 @@ struct fallback_sprom_match {
|
|
struct ssb_sprom sprom;
|
|
};
|
|
|
|
-static struct fallback_sprom_match fallback_sprom;
|
|
+struct fallback_sprom_match fallback_sprom;
|
|
+
|
|
+int bcm63xx_get_fallback_sprom(uint pci_bus, uint pci_slot, struct ssb_sprom *out)
|
|
+{
|
|
+ if (pci_bus != fallback_sprom.pci_bus ||
|
|
+ pci_slot != fallback_sprom.pci_dev)
|
|
+ pr_warn("fallback_sprom: pci bus/device num mismatch: expected %i/%i, but got %i/%i\n",
|
|
+ fallback_sprom.pci_bus, fallback_sprom.pci_dev,
|
|
+ pci_bus, pci_slot);
|
|
+ memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom));
|
|
+ return 0;
|
|
+}
|
|
+EXPORT_SYMBOL(bcm63xx_get_fallback_sprom);
|
|
|
|
#if defined(CONFIG_SSB_PCIHOST)
|
|
int bcm63xx_get_fallback_ssb_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
|