Skip to contentSkip to conversation

bcm63xx: register a fallback SPROM require for b43 to work

PATCH In review Florian Fainelli 2 participants 3 messages May 31, 2009 – Jun 2, 2009 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 4/10 bcm63xx: register a fallback SPROM require for b43 to work

In order to get b43 working, we have to register a SPROM which provides sane values to calibrate the radio, provide GPIO settings and country code. The SSB bus is initialized when the PCI bus is registered and expects to find the SPROM at init time. Thus we have to move our device registration from device_initcall to arch_initcall. The rationale behind this comes from Broadcom not providing on-chip EEPROM to store such settings, but relying on the main system Flash to provide them by software means.

---

arch/mips/bcm63xx/boards/board_bcm963xx.c +34 -0
index 7b93fb8..78a40e7 100644
@@ -14,6 +14,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
+#include <linux/ssb/ssb.h>
 #include <asm/addrspace.h>
 #include <bcm63xx_board.h>
 #include <bcm63xx_cpu.h>
@@ -459,6 +460,31 @@ static struct platform_device mtd_dev = {
 };
 
 /*
+ * Register a sane SPROMv2 to make the on-board
+ * bcm4318 WLAN work
+ */
+static struct ssb_sprom bcm63xx_sprom = {
+	.revision		= 0x02,
+	.board_rev		= 0x17,
+	.country_code		= 0x0,
+	.ant_available_bg 	= 0x3,
+	.pa0b0			= 0x15ae,
+	.pa0b1			= 0xfa85,
+	.pa0b2			= 0xfe8d,
+	.pa1b0			= 0xffff,
+	.pa1b1			= 0xffff,
+	.pa1b2			= 0xffff,
+	.gpio0			= 0xff,
+	.gpio1			= 0xff,
+	.gpio2			= 0xff,
+	.gpio3			= 0xff,
+	.maxpwr_bg		= 0x004c,
+	.itssi_bg		= 0x00,
+	.boardflags_lo		= 0x2848,
+	.boardflags_hi		= 0x0000,
+};
+
+/*
  * third stage init callback, register all board devices.
  */
 int __init board_register_devices(void)
@@ -484,6 +510,14 @@ int __init board_register_devices(void)
 	if (board.has_ehci0)
 		bcm63xx_ehci_register();
 
+	/* Generate MAC address for WLAN and
+	 * register our SPROM */
+	if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
+		memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
+		memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
+		if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
+			printk(KERN_ERR "failed to register fallback SPROM\n");
+	}
 
 	/* read base address of boot chip select (0) */
 	val = bcm_mpi_readl(MPI_CSBASE_REG(0));
arch/mips/bcm63xx/setup.c +1 -1
index f3256a8..b18a0ca 100644
@@ -122,4 +122,4 @@ int __init bcm63xx_register_devices(void)
 	return board_register_devices();
 }
 
-device_initcall(bcm63xx_register_devices);
+arch_initcall(bcm63xx_register_devices);
#1 lore raw

Le Sunday 31 May 2009 20:28:02 Florian Fainelli, vous avez écrit :

Quoted 9 lines

In order to get b43 working, we have to register a SPROM which provides sane values to calibrate the radio, provide GPIO settings and country code. The SSB bus is initialized when the PCI bus is registered and expects to find the SPROM at init time. Thus we have to move our device registration from device_initcall to arch_initcall. The rationale behind this comes from Broadcom not providing on-chip EEPROM to store such settings, but relying on the main system Flash to provide them by software means.

Forgot to mention that it is possible to actually register a fallback SPROM thanks to Michael's patch, see
http://marc.info/?l=linux-wireless&m=123575046807993&w=2

Signature · 4 lines
Best regards, Florian Fainelli
Email : [email protected]
http://openwrt.org
-------------------------------
#2 lore raw
In reply to Florian Fainelli
Quoted 11 lines · Florian Fainelli

In order to get b43 working, we have to register a SPROM which provides sane values to calibrate the radio, provide GPIO settings and country code. The SSB bus is initialized when the PCI bus is registered and expects to find the SPROM at init time. Thus we have to move our device registration from device_initcall to arch_initcall. The rationale behind this comes from Broadcom not providing on-chip EEPROM to store such settings, but relying on the main system Flash to provide them by software means.

Also folded into the series.

Ralf