diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-12-24 18:39:28 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:59:38 -0500 |
commit | 6b1c7c67603efdf0b39f6056989b0f8194cdc1f3 (patch) | |
tree | 7086a0f862ce5f3e5d6e6cb0daca71193c4185f8 /drivers/ssb/pci.c | |
parent | bb519bee07eed4fac9921ad658fb1f7ed78defb5 (diff) |
b43/ssb: Add SPROM8 extraction and LP-PHY detection
This adds detection code for the LP-PHY and SPROM
extraction code for version 8, which is needed by the LP-PHY and
newer N-PHY.
Signed-off-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 | 74 |
1 files changed, 62 insertions, 12 deletions
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c index d5cde051806b..c958ac16423c 100644 --- a/drivers/ssb/pci.c +++ b/drivers/ssb/pci.c | |||
@@ -467,6 +467,51 @@ static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) | |||
467 | /* TODO - get remaining rev 4 stuff needed */ | 467 | /* TODO - get remaining rev 4 stuff needed */ |
468 | } | 468 | } |
469 | 469 | ||
470 | static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in) | ||
471 | { | ||
472 | int i; | ||
473 | u16 v; | ||
474 | |||
475 | /* extract the MAC address */ | ||
476 | for (i = 0; i < 3; i++) { | ||
477 | v = in[SPOFF(SSB_SPROM1_IL0MAC) + i]; | ||
478 | *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); | ||
479 | } | ||
480 | SPEX(country_code, SSB_SPROM8_CCODE, 0xFFFF, 0); | ||
481 | SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0); | ||
482 | SPEX(boardflags_hi, SSB_SPROM8_BFLHI, 0xFFFF, 0); | ||
483 | SPEX(ant_available_a, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_A, | ||
484 | SSB_SPROM8_ANTAVAIL_A_SHIFT); | ||
485 | SPEX(ant_available_bg, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_BG, | ||
486 | SSB_SPROM8_ANTAVAIL_BG_SHIFT); | ||
487 | SPEX(maxpwr_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_MAXP_BG_MASK, 0); | ||
488 | SPEX(itssi_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_ITSSI_BG, | ||
489 | SSB_SPROM8_ITSSI_BG_SHIFT); | ||
490 | SPEX(maxpwr_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_MAXP_A_MASK, 0); | ||
491 | SPEX(itssi_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_ITSSI_A, | ||
492 | SSB_SPROM8_ITSSI_A_SHIFT); | ||
493 | SPEX(gpio0, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P0, 0); | ||
494 | SPEX(gpio1, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P1, | ||
495 | SSB_SPROM8_GPIOA_P1_SHIFT); | ||
496 | SPEX(gpio2, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P2, 0); | ||
497 | SPEX(gpio3, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P3, | ||
498 | SSB_SPROM8_GPIOB_P3_SHIFT); | ||
499 | |||
500 | /* Extract the antenna gain values. */ | ||
501 | SPEX(antenna_gain.ghz24.a0, SSB_SPROM8_AGAIN01, | ||
502 | SSB_SPROM8_AGAIN0, SSB_SPROM8_AGAIN0_SHIFT); | ||
503 | SPEX(antenna_gain.ghz24.a1, SSB_SPROM8_AGAIN01, | ||
504 | SSB_SPROM8_AGAIN1, SSB_SPROM8_AGAIN1_SHIFT); | ||
505 | SPEX(antenna_gain.ghz24.a2, SSB_SPROM8_AGAIN23, | ||
506 | SSB_SPROM8_AGAIN2, SSB_SPROM8_AGAIN2_SHIFT); | ||
507 | SPEX(antenna_gain.ghz24.a3, SSB_SPROM8_AGAIN23, | ||
508 | SSB_SPROM8_AGAIN3, SSB_SPROM8_AGAIN3_SHIFT); | ||
509 | memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24, | ||
510 | sizeof(out->antenna_gain.ghz5)); | ||
511 | |||
512 | /* TODO - get remaining rev 8 stuff needed */ | ||
513 | } | ||
514 | |||
470 | static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, | 515 | static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, |
471 | const u16 *in, u16 size) | 516 | const u16 *in, u16 size) |
472 | { | 517 | { |
@@ -487,15 +532,25 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, | |||
487 | out->revision = 4; | 532 | out->revision = 4; |
488 | sprom_extract_r45(out, in); | 533 | sprom_extract_r45(out, in); |
489 | } else { | 534 | } else { |
490 | if (out->revision == 0) | 535 | switch (out->revision) { |
491 | goto unsupported; | 536 | case 1: |
492 | if (out->revision >= 1 && out->revision <= 3) { | 537 | case 2: |
538 | case 3: | ||
493 | sprom_extract_r123(out, in); | 539 | sprom_extract_r123(out, in); |
494 | } | 540 | break; |
495 | if (out->revision == 4 || out->revision == 5) | 541 | case 4: |
542 | case 5: | ||
496 | sprom_extract_r45(out, in); | 543 | sprom_extract_r45(out, in); |
497 | if (out->revision > 5) | 544 | break; |
498 | goto unsupported; | 545 | case 8: |
546 | sprom_extract_r8(out, in); | ||
547 | break; | ||
548 | default: | ||
549 | ssb_printk(KERN_WARNING PFX "Unsupported SPROM" | ||
550 | " revision %d detected. Will extract" | ||
551 | " v1\n", out->revision); | ||
552 | sprom_extract_r123(out, in); | ||
553 | } | ||
499 | } | 554 | } |
500 | 555 | ||
501 | if (out->boardflags_lo == 0xFFFF) | 556 | if (out->boardflags_lo == 0xFFFF) |
@@ -504,11 +559,6 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, | |||
504 | out->boardflags_hi = 0; /* per specs */ | 559 | out->boardflags_hi = 0; /* per specs */ |
505 | 560 | ||
506 | return 0; | 561 | return 0; |
507 | unsupported: | ||
508 | ssb_printk(KERN_WARNING PFX "Unsupported SPROM revision %d " | ||
509 | "detected. Will extract v1\n", out->revision); | ||
510 | sprom_extract_r123(out, in); | ||
511 | return 0; | ||
512 | } | 562 | } |
513 | 563 | ||
514 | static int ssb_pci_sprom_get(struct ssb_bus *bus, | 564 | static int ssb_pci_sprom_get(struct ssb_bus *bus, |