aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLarry.Finger@lwfinger.net <Larry.Finger@lwfinger.net>2008-04-19 10:24:09 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-07 15:02:12 -0400
commit2afc49015db927fea7bc6ca33c0a60bf5d7c2c5f (patch)
tree1442845f56a9d235a3fb8546b7b4277c013f5aa4 /drivers
parent3acea5b616c6d85008700a9d51cb02a81b2d0c67 (diff)
ssb: Allow reading of 440-byte SPROM that is not rev 4
The current code checks for the special signature that signifies a revision 4 SPROM. Now that a rev. 8 SPROM with a 440-byte length has been found that may not have any special code, this check could be relaxed. With this patch, if the CRC is incorrect for a 256-byte SPROM, the code will immediately check for a 440-byte SPROM. If there is still a CRC error, the size is set to 440 bytes, which allows dumping of most of any 512-byte SPROM if one is encountered. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ssb/pci.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index 57c4ccfab1ee..f883dcfffe06 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -510,17 +510,15 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
510 sprom_do_read(bus, buf); 510 sprom_do_read(bus, buf);
511 err = sprom_check_crc(buf, bus->sprom_size); 511 err = sprom_check_crc(buf, bus->sprom_size);
512 if (err) { 512 if (err) {
513 /* check for rev 4 sprom - has special signature */ 513 /* try for a 440 byte SPROM - revision 4 and higher */
514 if (buf[32] == 0x5372) { 514 kfree(buf);
515 kfree(buf); 515 buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
516 buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16), 516 GFP_KERNEL);
517 GFP_KERNEL); 517 if (!buf)
518 if (!buf) 518 goto out;
519 goto out; 519 bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
520 bus->sprom_size = SSB_SPROMSIZE_WORDS_R4; 520 sprom_do_read(bus, buf);
521 sprom_do_read(bus, buf); 521 err = sprom_check_crc(buf, bus->sprom_size);
522 err = sprom_check_crc(buf, bus->sprom_size);
523 }
524 if (err) 522 if (err)
525 ssb_printk(KERN_WARNING PFX "WARNING: Invalid" 523 ssb_printk(KERN_WARNING PFX "WARNING: Invalid"
526 " SPROM CRC (corrupt SPROM)\n"); 524 " SPROM CRC (corrupt SPROM)\n");