[PATCH] bcm63xx: override dev_id on BCM43222 using fallback SPROM

Daniel González Cabanelas dgcbueu at gmail.com
Mon Jan 25 15:19:12 EST 2021


The BCM43222 is able to operate in both 2.4/5GHz bands in some devices if
the device id stored at the SPROM is 4350.

Extract the dev_id register from the BCM43222 fallback SPROM to allow
using the 5GHz band on the on the devices supporting it.

Signed-off-by: Daniel González Cabanelas <dgcbueu at gmail.com>
---
 ...d-raw-fallback-sproms-for-most-common.patch | 16 ++++++++++++++--
 ...so-register-a-fallback-sprom-for-bcma.patch | 18 +++++++++---------
 ...CM63XX-add-BCMA-based-sprom-templates.patch |  6 +++---
 ...low-board-files-to-provide-sprom-fixu.patch |  4 ++--
 ...low-setting-a-pci-bus-device-for-fall.patch |  8 ++++----
 .../801-ssb_export_fallback_sprom.patch        |  2 +-
 6 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/target/linux/bcm63xx/patches-5.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch b/target/linux/bcm63xx/patches-5.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch
index 65c00b5197..e40e4c4a51 100644
--- a/target/linux/bcm63xx/patches-5.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch
+++ b/target/linux/bcm63xx/patches-5.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch
@@ -14,10 +14,12 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
 
 --- a/arch/mips/bcm63xx/sprom.c
 +++ b/arch/mips/bcm63xx/sprom.c
-@@ -43,6 +43,122 @@ static __initconst struct ssb_sprom bcm6
+@@ -43,6 +43,124 @@ static __initconst struct ssb_sprom bcm6
  	.boardflags_hi		= 0x0000,
  };
  
++static bool deviceid_fallback = false;
++
 +
 +static __initconst u16 bcm4306_sprom[] = {
 +	0x4001, 0x0000, 0x0453, 0x14e4, 0x4320, 0x8000, 0x0002, 0x0002,
@@ -137,7 +139,16 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
  static struct ssb_sprom bcm63xx_sprom;
  
  int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
-@@ -542,6 +658,26 @@ int __init bcm63xx_register_fallback_spr
+@@ -299,6 +417,8 @@ static void sprom_extract_r8(struct ssb_
+ 	BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) !=
+ 			ARRAY_SIZE(out->core_pwr_info));
+ 
++	if (deviceid_fallback)
++		SPEX(dev_id, SSB_SPROM1_PID, 0xFFFF, 0);
+ 	SPEX(board_rev, SSB_SPROM8_BOARDREV, 0xFFFF, 0);
+ 	SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0);
+ 	SPEX(alpha2[0], SSB_SPROM8_CCODE, 0xff00, 8);
+@@ -542,6 +662,27 @@ int __init bcm63xx_register_fallback_spr
  	u16 size = 0;
  
  	switch (data->type) {
@@ -160,6 +171,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
 +	case SPROM_BCM43222:
 +		memcpy(&template_sprom, &bcm43222_sprom, sizeof(bcm43222_sprom));
 +		size = ARRAY_SIZE(bcm43222_sprom);
++		deviceid_fallback = true;
 +		break;
  	case SPROM_DEFAULT:
  		memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom,
diff --git a/target/linux/bcm63xx/patches-5.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch b/target/linux/bcm63xx/patches-5.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch
index 24ae8c35c7..7a7a01683c 100644
--- a/target/linux/bcm63xx/patches-5.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch
+++ b/target/linux/bcm63xx/patches-5.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch
@@ -40,16 +40,16 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
  static __initconst struct ssb_sprom bcm63xx_default_sprom = {
  	.revision		= 0x02,
  	.board_rev		= 0x17,
-@@ -43,7 +44,7 @@ static __initconst struct ssb_sprom bcm6
- 	.boardflags_hi		= 0x0000,
- };
+@@ -45,7 +46,7 @@ static __initconst struct ssb_sprom bcm6
+ 
+ static bool deviceid_fallback = false;
  
 -
 +#if defined (CONFIG_SSB_PCIHOST)
  static __initconst u16 bcm4306_sprom[] = {
  	0x4001, 0x0000, 0x0453, 0x14e4, 0x4320, 0x8000, 0x0002, 0x0002,
  	0x1000, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff,
-@@ -158,10 +159,12 @@ static __initconst u16 bcm43222_sprom[]
+@@ -160,10 +161,12 @@ static __initconst u16 bcm43222_sprom[]
  	0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
  	0xffff, 0xffff, 0xffff, 0x0008,
  };
@@ -63,7 +63,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
  {
  	if (bus->bustype == SSB_BUSTYPE_PCI) {
  		memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
-@@ -171,6 +174,20 @@ int bcm63xx_get_fallback_sprom(struct ss
+@@ -173,6 +176,20 @@ int bcm63xx_get_fallback_sprom(struct ss
  		return -EINVAL;
  	}
  }
@@ -84,7 +84,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
  
  /* FIXME: use lib_sprom after submission upstream */
  
-@@ -654,10 +671,11 @@ int __init bcm63xx_register_fallback_spr
+@@ -658,10 +675,11 @@ int __init bcm63xx_register_fallback_spr
  {
  	int ret = 0;
  
@@ -97,15 +97,15 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
  	case SPROM_BCM4306:
  		memcpy(&template_sprom, &bcm4306_sprom, sizeof(bcm4306_sprom));
  		size = ARRAY_SIZE(bcm4306_sprom);
-@@ -678,6 +696,7 @@ int __init bcm63xx_register_fallback_spr
- 		memcpy(&template_sprom, &bcm43222_sprom, sizeof(bcm43222_sprom));
+@@ -683,6 +701,7 @@ int __init bcm63xx_register_fallback_spr
  		size = ARRAY_SIZE(bcm43222_sprom);
+ 		deviceid_fallback = true;
  		break;
 +#endif
  	case SPROM_DEFAULT:
  		memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom,
  		       sizeof(bcm63xx_sprom));
-@@ -692,8 +711,19 @@ int __init bcm63xx_register_fallback_spr
+@@ -697,8 +716,19 @@ int __init bcm63xx_register_fallback_spr
  	memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN);
  	memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN);
  	memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN);
diff --git a/target/linux/bcm63xx/patches-5.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch b/target/linux/bcm63xx/patches-5.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch
index 5c0abb90e3..386c735ffd 100644
--- a/target/linux/bcm63xx/patches-5.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch
+++ b/target/linux/bcm63xx/patches-5.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch
@@ -14,7 +14,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
 
 --- a/arch/mips/bcm63xx/sprom.c
 +++ b/arch/mips/bcm63xx/sprom.c
-@@ -161,6 +161,226 @@ static __initconst u16 bcm43222_sprom[]
+@@ -163,6 +163,226 @@ static __initconst u16 bcm43222_sprom[]
  };
  #endif /* CONFIG_SSB_PCIHOST */
  
@@ -241,8 +241,8 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
  static struct ssb_sprom bcm63xx_sprom;
  
  #if defined(CONFIG_SSB_PCIHOST)
-@@ -697,6 +917,42 @@ int __init bcm63xx_register_fallback_spr
- 		size = ARRAY_SIZE(bcm43222_sprom);
+@@ -702,6 +922,42 @@ int __init bcm63xx_register_fallback_spr
+ 		deviceid_fallback = true;
  		break;
  #endif
 +#if defined(CONFIG_BCMA_HOST_PCI)
diff --git a/target/linux/bcm63xx/patches-5.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch b/target/linux/bcm63xx/patches-5.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch
index 74c2846d5f..2b6d62790c 100644
--- a/target/linux/bcm63xx/patches-5.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch
+++ b/target/linux/bcm63xx/patches-5.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch
@@ -16,7 +16,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
 
 --- a/arch/mips/bcm63xx/sprom.c
 +++ b/arch/mips/bcm63xx/sprom.c
-@@ -883,6 +883,14 @@ static int sprom_extract(struct ssb_spro
+@@ -887,6 +887,14 @@ static int sprom_extract(struct ssb_spro
  	return 0;
  }
  
@@ -31,7 +31,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
  static __initdata u16 template_sprom[220];
  #endif
  
-@@ -961,8 +969,12 @@ int __init bcm63xx_register_fallback_spr
+@@ -966,8 +974,12 @@ int __init bcm63xx_register_fallback_spr
  		return -EINVAL;
  	}
  
diff --git a/target/linux/bcm63xx/patches-5.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch b/target/linux/bcm63xx/patches-5.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch
index 40591e5f2e..4632d579f0 100644
--- a/target/linux/bcm63xx/patches-5.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch
+++ b/target/linux/bcm63xx/patches-5.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch
@@ -14,7 +14,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
 
 --- a/arch/mips/bcm63xx/sprom.c
 +++ b/arch/mips/bcm63xx/sprom.c
-@@ -381,13 +381,25 @@ static __initconst u16 bcm4331_sprom[] =
+@@ -383,13 +383,25 @@ static __initconst u16 bcm4331_sprom[] =
  
  #endif  /* CONFIG_BCMA_HOST_PCI */
  
@@ -42,7 +42,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
  		return 0;
  	} else {
  		printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
-@@ -400,7 +412,13 @@ int bcm63xx_get_fallback_ssb_sprom(struc
+@@ -402,7 +414,13 @@ int bcm63xx_get_fallback_ssb_sprom(struc
  int bcm63xx_get_fallback_bcma_sprom(struct bcma_bus *bus, struct ssb_sprom *out)
  {
  	if (bus->hosttype == BCMA_HOSTTYPE_PCI) {
@@ -57,7 +57,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
  		return 0;
  	} else {
  		printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
-@@ -962,8 +980,8 @@ int __init bcm63xx_register_fallback_spr
+@@ -967,8 +985,8 @@ int __init bcm63xx_register_fallback_spr
  		break;
  #endif
  	case SPROM_DEFAULT:
@@ -68,7 +68,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
  		break;
  	default:
  		return -EINVAL;
-@@ -973,12 +991,15 @@ int __init bcm63xx_register_fallback_spr
+@@ -978,12 +996,15 @@ int __init bcm63xx_register_fallback_spr
  		sprom_apply_fixups(template_sprom, data->board_fixups,
  				   data->num_board_fixups);
  
diff --git a/target/linux/bcm63xx/patches-5.4/801-ssb_export_fallback_sprom.patch b/target/linux/bcm63xx/patches-5.4/801-ssb_export_fallback_sprom.patch
index 11a83536b7..af54d6cf08 100644
--- a/target/linux/bcm63xx/patches-5.4/801-ssb_export_fallback_sprom.patch
+++ b/target/linux/bcm63xx/patches-5.4/801-ssb_export_fallback_sprom.patch
@@ -8,7 +8,7 @@
  #include <linux/kernel.h>
  #include <linux/string.h>
  #include <linux/platform_device.h>
-@@ -387,7 +388,19 @@ struct fallback_sprom_match {
+@@ -389,7 +390,19 @@ struct fallback_sprom_match {
  	struct ssb_sprom sprom;
  };
  
-- 
2.30.0







More information about the openwrt-devel mailing list