aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm63xx/patches-5.15/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2022-05-20 14:27:22 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2022-05-20 15:53:16 +0200
commit2317a7426ed95978e7f4feaebb00bc909ffced34 (patch)
treefd6de73d0c1d1a1ee5bcf2982067a28ab05cf102 /target/linux/bcm63xx/patches-5.15/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch
parent0f14619e301059848761eb6c973c0bb85f211b94 (diff)
downloadupstream-2317a7426ed95978e7f4feaebb00bc909ffced34.tar.gz
upstream-2317a7426ed95978e7f4feaebb00bc909ffced34.tar.bz2
upstream-2317a7426ed95978e7f4feaebb00bc909ffced34.zip
bcm63xx: add linux v5.15 support
Build system: x86_64 Build-tested: generic, smp Run-tested: generic/AR-5387un, smp/VR-3032u Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm63xx/patches-5.15/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch')
-rw-r--r--target/linux/bcm63xx/patches-5.15/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch78
1 files changed, 78 insertions, 0 deletions
diff --git a/target/linux/bcm63xx/patches-5.15/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch b/target/linux/bcm63xx/patches-5.15/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch
new file mode 100644
index 0000000000..31641aeff2
--- /dev/null
+++ b/target/linux/bcm63xx/patches-5.15/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch
@@ -0,0 +1,78 @@
+--- a/arch/mips/bcm63xx/sprom.c
++++ b/arch/mips/bcm63xx/sprom.c
+@@ -384,6 +384,7 @@ static __initconst u16 bcm4331_sprom[] =
+ struct fallback_sprom_match {
+ u8 pci_bus;
+ u8 pci_dev;
++ int override_devid;
+ struct ssb_sprom sprom;
+ };
+
+@@ -399,6 +400,8 @@ int bcm63xx_get_fallback_ssb_sprom(struc
+ fallback_sprom.pci_bus, fallback_sprom.pci_dev,
+ bus->host_pci->bus->number,
+ PCI_SLOT(bus->host_pci->devfn));
++ if (fallback_sprom.override_devid)
++ bus->host_pci->device = fallback_sprom.sprom.dev_id;
+ memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom));
+ return 0;
+ } else {
+@@ -418,6 +421,8 @@ int bcm63xx_get_fallback_bcma_sprom(stru
+ fallback_sprom.pci_bus, fallback_sprom.pci_dev,
+ bus->host_pci->bus->number,
+ PCI_SLOT(bus->host_pci->devfn));
++ if (fallback_sprom.override_devid)
++ bus->host_pci->device = fallback_sprom.sprom.dev_id;
+ memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom));
+ return 0;
+ } else {
+@@ -965,6 +970,37 @@ static int sprom_extract(struct ssb_spro
+ return 0;
+ }
+
++int sprom_override_devid(struct fallback_sprom_data *data,
++ struct ssb_sprom *out, const u16 *in)
++{
++ switch (data->type) {
++#if defined(CONFIG_SSB_PCIHOST)
++ case SPROM_BCM4306:
++ case SPROM_BCM4318:
++ case SPROM_BCM4321:
++ case SPROM_BCM4322:
++ case SPROM_BCM43222:
++ SPEX(dev_id, SSB_SPROM1_PID, 0xFFFF, 0);
++ return !!out->dev_id;
++#endif /* CONFIG_SSB_PCIHOST */
++#if defined(CONFIG_BCMA_HOST_PCI)
++ case SPROM_BCM4313:
++ case SPROM_BCM43131:
++ case SPROM_BCM43217:
++ case SPROM_BCM43225:
++ case SPROM_BCM43227:
++ case SPROM_BCM43228:
++ case SPROM_BCM4331:
++ SPEX(dev_id, 0x0060, 0xFFFF, 0);
++ return !!out->dev_id;
++#endif /* CONFIG_BCMA_HOST_PCI */
++ case SPROM_DEFAULT:
++ return 0;
++ }
++
++ return 0;
++}
++
+ void sprom_apply_fixups(u16 *sprom, struct sprom_fixup *fixups, int n)
+ {
+ unsigned int i;
+@@ -1056,6 +1092,11 @@ int __init bcm63xx_register_fallback_spr
+ data->num_board_fixups);
+
+ sprom_extract(&fallback_sprom.sprom, template_sprom, size);
++
++ fallback_sprom.override_devid =
++ sprom_override_devid(data, &fallback_sprom.sprom, template_sprom);
++ } else {
++ fallback_sprom.override_devid = 0;
+ }
+
+ memcpy(fallback_sprom.sprom.il0mac, data->mac_addr, ETH_ALEN);