diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2008-08-19 13:50:31 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-29 16:24:05 -0400 |
commit | 095f695cbb07281682462da0618fffabb499d0be (patch) | |
tree | b46e86b862d0c5928cc1829f22ebef1b57ecfc14 /drivers/ssb/pci.c | |
parent | 2f58bbf27fe5321a7a208be9071efc54e8a8a3bd (diff) |
ssb: Update for Rev. 5 SPROM
Although a revision 5 SPROM has not been seen in the wild, the
open-source portion of the MIPS driver 4.150.10.5 describes its
layout, which is mostly inherited from revision 4. This patch
implements the differences.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb/pci.c')
-rw-r--r-- | drivers/ssb/pci.c | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c index f883dcfffe06..0de4b5e04505 100644 --- a/drivers/ssb/pci.c +++ b/drivers/ssb/pci.c | |||
@@ -399,14 +399,19 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in) | |||
399 | out->antenna_gain.ghz5.a3 = gain; | 399 | out->antenna_gain.ghz5.a3 = gain; |
400 | } | 400 | } |
401 | 401 | ||
402 | static void sprom_extract_r4(struct ssb_sprom *out, const u16 *in) | 402 | static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) |
403 | { | 403 | { |
404 | int i; | 404 | int i; |
405 | u16 v; | 405 | u16 v; |
406 | u16 il0mac_offset; | ||
406 | 407 | ||
408 | if (out->revision == 4) | ||
409 | il0mac_offset = SSB_SPROM4_IL0MAC; | ||
410 | else | ||
411 | il0mac_offset = SSB_SPROM5_IL0MAC; | ||
407 | /* extract the equivalent of the r1 variables */ | 412 | /* extract the equivalent of the r1 variables */ |
408 | for (i = 0; i < 3; i++) { | 413 | for (i = 0; i < 3; i++) { |
409 | v = in[SPOFF(SSB_SPROM4_IL0MAC) + i]; | 414 | v = in[SPOFF(il0mac_offset) + i]; |
410 | *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); | 415 | *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); |
411 | } | 416 | } |
412 | for (i = 0; i < 3; i++) { | 417 | for (i = 0; i < 3; i++) { |
@@ -420,9 +425,15 @@ static void sprom_extract_r4(struct ssb_sprom *out, const u16 *in) | |||
420 | SPEX(et0phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET0A, 0); | 425 | SPEX(et0phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET0A, 0); |
421 | SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A, | 426 | SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A, |
422 | SSB_SPROM4_ETHPHY_ET1A_SHIFT); | 427 | SSB_SPROM4_ETHPHY_ET1A_SHIFT); |
423 | SPEX(country_code, SSB_SPROM4_CCODE, 0xFFFF, 0); | 428 | if (out->revision == 4) { |
424 | SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0); | 429 | SPEX(country_code, SSB_SPROM4_CCODE, 0xFFFF, 0); |
425 | SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0); | 430 | SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0); |
431 | SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0); | ||
432 | } else { | ||
433 | SPEX(country_code, SSB_SPROM5_CCODE, 0xFFFF, 0); | ||
434 | SPEX(boardflags_lo, SSB_SPROM5_BFLLO, 0xFFFF, 0); | ||
435 | SPEX(boardflags_hi, SSB_SPROM5_BFLHI, 0xFFFF, 0); | ||
436 | } | ||
426 | SPEX(ant_available_a, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_A, | 437 | SPEX(ant_available_a, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_A, |
427 | SSB_SPROM4_ANTAVAIL_A_SHIFT); | 438 | SSB_SPROM4_ANTAVAIL_A_SHIFT); |
428 | SPEX(ant_available_bg, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_BG, | 439 | SPEX(ant_available_bg, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_BG, |
@@ -433,12 +444,21 @@ static void sprom_extract_r4(struct ssb_sprom *out, const u16 *in) | |||
433 | SPEX(maxpwr_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_MAXP_A_MASK, 0); | 444 | SPEX(maxpwr_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_MAXP_A_MASK, 0); |
434 | SPEX(itssi_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_ITSSI_A, | 445 | SPEX(itssi_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_ITSSI_A, |
435 | SSB_SPROM4_ITSSI_A_SHIFT); | 446 | SSB_SPROM4_ITSSI_A_SHIFT); |
436 | SPEX(gpio0, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P0, 0); | 447 | if (out->revision == 4) { |
437 | SPEX(gpio1, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P1, | 448 | SPEX(gpio0, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P0, 0); |
438 | SSB_SPROM4_GPIOA_P1_SHIFT); | 449 | SPEX(gpio1, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P1, |
439 | SPEX(gpio2, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P2, 0); | 450 | SSB_SPROM4_GPIOA_P1_SHIFT); |
440 | SPEX(gpio3, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P3, | 451 | SPEX(gpio2, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P2, 0); |
441 | SSB_SPROM4_GPIOB_P3_SHIFT); | 452 | SPEX(gpio3, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P3, |
453 | SSB_SPROM4_GPIOB_P3_SHIFT); | ||
454 | } else { | ||
455 | SPEX(gpio0, SSB_SPROM5_GPIOA, SSB_SPROM5_GPIOA_P0, 0); | ||
456 | SPEX(gpio1, SSB_SPROM5_GPIOA, SSB_SPROM5_GPIOA_P1, | ||
457 | SSB_SPROM5_GPIOA_P1_SHIFT); | ||
458 | SPEX(gpio2, SSB_SPROM5_GPIOB, SSB_SPROM5_GPIOB_P2, 0); | ||
459 | SPEX(gpio3, SSB_SPROM5_GPIOB, SSB_SPROM5_GPIOB_P3, | ||
460 | SSB_SPROM5_GPIOB_P3_SHIFT); | ||
461 | } | ||
442 | 462 | ||
443 | /* Extract the antenna gain values. */ | 463 | /* Extract the antenna gain values. */ |
444 | SPEX(antenna_gain.ghz24.a0, SSB_SPROM4_AGAIN01, | 464 | SPEX(antenna_gain.ghz24.a0, SSB_SPROM4_AGAIN01, |
@@ -471,16 +491,16 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, | |||
471 | } else if (bus->chip_id == 0x4321) { | 491 | } else if (bus->chip_id == 0x4321) { |
472 | /* the BCM4328 has a chipid == 0x4321 and a rev 4 SPROM */ | 492 | /* the BCM4328 has a chipid == 0x4321 and a rev 4 SPROM */ |
473 | out->revision = 4; | 493 | out->revision = 4; |
474 | sprom_extract_r4(out, in); | 494 | sprom_extract_r45(out, in); |
475 | } else { | 495 | } else { |
476 | if (out->revision == 0) | 496 | if (out->revision == 0) |
477 | goto unsupported; | 497 | goto unsupported; |
478 | if (out->revision >= 1 && out->revision <= 3) { | 498 | if (out->revision >= 1 && out->revision <= 3) { |
479 | sprom_extract_r123(out, in); | 499 | sprom_extract_r123(out, in); |
480 | } | 500 | } |
481 | if (out->revision == 4) | 501 | if (out->revision == 4 || out->revision == 5) |
482 | sprom_extract_r4(out, in); | 502 | sprom_extract_r45(out, in); |
483 | if (out->revision >= 5) | 503 | if (out->revision > 5) |
484 | goto unsupported; | 504 | goto unsupported; |
485 | } | 505 | } |
486 | 506 | ||