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 | |
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>
-rw-r--r-- | drivers/ssb/pci.c | 50 | ||||
-rw-r--r-- | include/linux/ssb/ssb_regs.h | 15 |
2 files changed, 50 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 | ||
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index ebad0bac9801..271bb4b6446e 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h | |||
@@ -316,6 +316,21 @@ | |||
316 | #define SSB_SPROM4_PA1B1 0x1090 | 316 | #define SSB_SPROM4_PA1B1 0x1090 |
317 | #define SSB_SPROM4_PA1B2 0x1092 | 317 | #define SSB_SPROM4_PA1B2 0x1092 |
318 | 318 | ||
319 | /* SPROM Revision 5 (inherits most data from rev 4) */ | ||
320 | #define SSB_SPROM5_BFLLO 0x104A /* Boardflags (low 16 bits) */ | ||
321 | #define SSB_SPROM5_BFLHI 0x104C /* Board Flags Hi */ | ||
322 | #define SSB_SPROM5_IL0MAC 0x1052 /* 6 byte MAC address for a/b/g/n */ | ||
323 | #define SSB_SPROM5_CCODE 0x1044 /* Country Code (2 bytes) */ | ||
324 | #define SSB_SPROM5_GPIOA 0x1076 /* Gen. Purpose IO # 0 and 1 */ | ||
325 | #define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ | ||
326 | #define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */ | ||
327 | #define SSB_SPROM5_GPIOA_P1_SHIFT 8 | ||
328 | #define SSB_SPROM5_GPIOB 0x1078 /* Gen. Purpose IO # 2 and 3 */ | ||
329 | #define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */ | ||
330 | #define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */ | ||
331 | #define SSB_SPROM5_GPIOB_P3_SHIFT 8 | ||
332 | |||
333 | |||
319 | /* Values for SSB_SPROM1_BINF_CCODE */ | 334 | /* Values for SSB_SPROM1_BINF_CCODE */ |
320 | enum { | 335 | enum { |
321 | SSB_SPROM1CCODE_WORLD = 0, | 336 | SSB_SPROM1CCODE_WORLD = 0, |