Patchwork brcm80211 breakage..

login
register
mail settings
Submitter Larry Finger
Date Jan. 13, 2012, 1:53 a.m.
Message ID <4F0F8E8C.9020000@lwfinger.net>
Download mbox | patch
Permalink /patch/135701/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Larry Finger - Jan. 13, 2012, 1:53 a.m.
On 01/12/2012 01:00 PM, Linus Torvalds wrote:
> On Wed, Jan 11, 2012 at 11:13 PM, Linus Torvalds
> <torvalds@linux-foundation.org>  wrote:
>>
>> All the BCMA changes make the revert somewhat non-trivial, could
>> somebody who knows the code better please try to do it for me? It
>> doesn't look complicated, and I can try to do it myself tomorrow if
>> nobody else steps up, but I'd *really* prefer the guilty parties
>> themselves to do it, ok?
>
> Since I had the hardware to test, I could work on this and try to
> figure out exactly what went wrong in that commit.
>
> The problem seems to be simple: the SPROM contents *have* to be read
> as aligned 16-bit words. Anything else seems to return 0xff and just
> fails the transaction.
>
> I didn't check all the combinations, of course, so who knows what the
> exact details are, but it does look like the sprom has very limited
> pci decode and simply refuses to touch anything but the one case it
> can handle.
>
> I'll send out a patch that seems to get things to a working state for
> me. At least I have wireless connectivity again, I don't know if there
> are some other problems remaining.

As my device has both SPROM and OTP, I hacked on it to get it to use the SPROM 
rather than the default OTP.

I learned that reading by byte on my HP laptop fails the same was as did the 
MacBook - it is not an Apple artifact.

Note, the patch that worked for me is as follows:



Larry
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

Index: linux-2.6/drivers/net/wireless/brcm80211/brcmsmac/srom.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/brcm80211/brcmsmac/srom.c
+++ linux-2.6/drivers/net/wireless/brcm80211/brcmsmac/srom.c
@@ -786,9 +786,12 @@  sprom_read_pci(struct si_pub *sih, u16 *
  		sprom_offset = CHIPCREGOFFS(sromotp);
  	}

-	/* read the sprom in bytes */
-	for (i = 0; i < nbytes; i++)
-		bbuf[i] = bcma_read8(core, sprom_offset+i);
+	/* read the sprom - this operation must be done by words */
+	for (i = 0; i < nbytes; i += 2) {
+		u16 data = bcma_read16(core, sprom_offset+i);
+		bbuf[i] = data & 0xff;
+		bbuf[i+1] = (data >> 8) & 0xff;
+	}

  	if (buf[0] == 0xffff)
  		/*