* [PATCH 04/10] bcm63xx: register a fallback SPROM require for b43 to work
@ 2009-05-31 18:28 Florian Fainelli
2009-05-31 18:56 ` Florian Fainelli
2009-06-02 9:05 ` Ralf Baechle
0 siblings, 2 replies; 3+ messages in thread
From: Florian Fainelli @ 2009-05-31 18:28 UTC (permalink / raw)
To: linux-mips, Ralf Baechle, Maxime Bizon
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.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 7b93fb8..78a40e7 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -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));
diff --git a/arch/mips/bcm63xx/setup.c b/arch/mips/bcm63xx/setup.c
index f3256a8..b18a0ca 100644
--- a/arch/mips/bcm63xx/setup.c
+++ b/arch/mips/bcm63xx/setup.c
@@ -122,4 +122,4 @@ int __init bcm63xx_register_devices(void)
return board_register_devices();
}
-device_initcall(bcm63xx_register_devices);
+arch_initcall(bcm63xx_register_devices);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 04/10] bcm63xx: register a fallback SPROM require for b43 to work
2009-05-31 18:28 [PATCH 04/10] bcm63xx: register a fallback SPROM require for b43 to work Florian Fainelli
@ 2009-05-31 18:56 ` Florian Fainelli
2009-06-02 9:05 ` Ralf Baechle
1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2009-05-31 18:56 UTC (permalink / raw)
To: linux-mips, Michael Buesch; +Cc: Ralf Baechle, Maxime Bizon
Le Sunday 31 May 2009 20:28:02 Florian Fainelli, vous avez écrit :
> 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
--
Best regards, Florian Fainelli
Email : florian@openwrt.org
http://openwrt.org
-------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 04/10] bcm63xx: register a fallback SPROM require for b43 to work
2009-05-31 18:28 [PATCH 04/10] bcm63xx: register a fallback SPROM require for b43 to work Florian Fainelli
2009-05-31 18:56 ` Florian Fainelli
@ 2009-06-02 9:05 ` Ralf Baechle
1 sibling, 0 replies; 3+ messages in thread
From: Ralf Baechle @ 2009-06-02 9:05 UTC (permalink / raw)
To: Florian Fainelli; +Cc: linux-mips, Maxime Bizon
On Sun, May 31, 2009 at 08:28:02PM +0200, Florian Fainelli wrote:
> 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.
>
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
Also folded into the series.
Ralf
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-02 9:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-31 18:28 [PATCH 04/10] bcm63xx: register a fallback SPROM require for b43 to work Florian Fainelli
2009-05-31 18:56 ` Florian Fainelli
2009-06-02 9:05 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).