ssb: workarounds: be verbose about hacking SPROM revision, don't duplicate code
PATCH 1/1 ssb: workarounds: be verbose about hacking SPROM revision, don't duplicate code
---
This changes code flow the way even if workaround is needed, standard extracing calls are used. Additionaly if user wants to know SPROM version (enabled debugging) we really should let know also about hacking it!
John: this is 2.6.38 material. Is this OK to submit this via wireless tree?
--- drivers/ssb/pci.c | 45 +++++++++++++++++++++++---------------------- 1 files changed, 23 insertions(+), 22 deletions(-)
drivers/ssb/pci.c +23 -22
@@ -573,37 +573,38 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, ssb_dprintk(KERN_DEBUG PFX "SPROM revision %d detected.\n", out->revision);memset (out->et0mac,0xFF ,6 );/* preset et0 and et1 mac */ memset (out->et1mac,0xFF ,6 ); +if ((bus->chip_id &0xFF00 ) ==0x4400 ) {/* Workaround: The BCM44XX chip has a stupid revision * number stored in the SPROM. * Always extract r1. */ out->revision =1 ; -sprom_extract_r123 (out, in); + ssb_dprintk(KERN_DEBUG PFX "SPROM treated as revision %d\n", out->revision); }else if (bus->chip_id ==0x4321 ) {/* the BCM4328 has a chipid == 0x4321 and a rev 4 SPROM */ out->revision =4 ; + ssb_dprintk(KERN_DEBUG PFX "SPROM treated as revision %d\n", out->revision); + } + +switch (out->revision) { +case 1 : +case 2 : +case 3 : +sprom_extract_r123 (out, in); +break ; +case 4 : +case 5 :sprom_extract_r45 (out, in); - }else { -switch (out->revision) { -case 1 : -case 2 : -case 3 : -sprom_extract_r123 (out, in); -break ; -case 4 : -case 5 : -sprom_extract_r45 (out, in); -break ; -case 8 : -sprom_extract_r8 (out, in); -break ; -default : - ssb_printk(KERN_WARNING PFX "Unsupported SPROM" -" revision %d detected. Will extract" - " v1\n", out->revision); - out->revision =1 ; -sprom_extract_r123 (out, in); - } +break ; +case 8 : +sprom_extract_r8 (out, in); +break ; +default : + ssb_printk(KERN_WARNING PFX "Unsupported SPROM" +" revision %d detected. Will extract" + " v1\n", out->revision); + out->revision =1 ; +sprom_extract_r123 (out, in); }if (out->boardflags_lo ==0xFFFF )
Signature · 1 line
1.6.0.4
PATCH 1/1 ssb: workarounds: be verbose about hacking SPROM revision, don't duplicate code
drivers/ssb/pci.c static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, · line 607
Quoted 6 lines · Rafa? Mi?ecki
drivers/ssb/pci.c +6
-0+default : + ssb_printk(KERN_WARNING PFX "Unsupported SPROM" +" revision %d detected. Will extract" + " v1\n", out->revision); + out->revision =1 ; +sprom_extract_r123 (out, in);
I think we should change this to throw a hard error if the sprom is unknown. Extracting r123 is unlikely to do any good these days. This workaround was only useful back in the days where 95% of the cards out there were r123. But today that's not the case.
Quoted 3 lines
}if (
out->boardflags_lo==0xFFFF)
Signature · 1 line
Greetings Michael.
PATCH 1/1 ssb: workarounds: be verbose about hacking SPROM revision, don't duplicate code
Quoted 16 lines · Michael Büsch
drivers/ssb/pci.c static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, · line 607
Quoted 6 lines · Rafał Miłecki
drivers/ssb/pci.c +6
-0+default : + ssb_printk(KERN_WARNING PFX "Unsupported SPROM" +" revision %d detected. Will extract" + " v1\n", out->revision); + out->revision =1 ; +sprom_extract_r123 (out, in);I think we should change this to throw a hard error if the sprom is unknown. Extracting r123 is unlikely to do any good these days. This workaround was only useful back in the days where 95% of the cards out there were r123. But today that's not the case.
Quoted 3 lines
}if (
out->boardflags_lo==0xFFFF)
In any case, the out->revision = 1 statement should be before the ssb_printk() call.
I agree - throw a hard error.
Larry
PATCH 1/1 ssb: workarounds: be verbose about hacking SPROM revision, don't duplicate code
Quoted 14 lines · Larry Finger
Quoted 13 lines · Michael B?sch
drivers/ssb/pci.c static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, · line 607
Quoted 6 lines · Rafa? Mi?ecki
drivers/ssb/pci.c +6
-0+default : + ssb_printk(KERN_WARNING PFX "Unsupported SPROM" +" revision %d detected. Will extract" + " v1\n", out->revision); + out->revision =1 ; +sprom_extract_r123 (out, in);I think we should change this to throw a hard error if the sprom is unknown. Extracting r123 is unlikely to do any good these days. This workaround was only useful back in the days where 95% of the cards out there were r123. But today that's not the case.
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
}if (
out->boardflags_lo==0xFFFF)In any case, the
out->revision= 1 statement should be before thessb_printk()call.
I don't think so.
Signature · 1 line
Greetings Michael.
PATCH 1/1 ssb: workarounds: be verbose about hacking SPROM revision, don't duplicate code
Quoted 15 lines · Michael Büsch
Quoted 14 lines · Larry Finger
Quoted 13 lines · Michael Büsch
drivers/ssb/pci.c static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, · line 607
Quoted 6 lines · Rafał Miłecki
drivers/ssb/pci.c +6
-0+default : + ssb_printk(KERN_WARNING PFX "Unsupported SPROM" +" revision %d detected. Will extract" + " v1\n", out->revision); + out->revision =1 ; +sprom_extract_r123 (out, in);I think we should change this to throw a hard error if the sprom is unknown. Extracting r123 is unlikely to do any good these days. This workaround was only useful back in the days where 95% of the cards out there were r123. But today that's not the case.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
}if (
out->boardflags_lo==0xFFFF)In any case, the
out->revision= 1 statement should be before thessb_printk()call.I don't think so.
You are right. I misread the code.
Larry