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 | |
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')
-rw-r--r-- | drivers/net/wireless/b43/main.c | 12 | ||||
-rw-r--r-- | drivers/ssb/b43_pci_bridge.c | 1 | ||||
-rw-r--r-- | drivers/ssb/pci.c | 74 |
3 files changed, 75 insertions, 12 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 26e733a5a56e..c627bac87a40 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -97,6 +97,7 @@ static const struct ssb_device_id b43_ssb_tbl[] = { | |||
97 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 10), | 97 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 10), |
98 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 11), | 98 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 11), |
99 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 13), | 99 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 13), |
100 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 15), | ||
100 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 16), | 101 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 16), |
101 | SSB_DEVTABLE_END | 102 | SSB_DEVTABLE_END |
102 | }; | 103 | }; |
@@ -3756,6 +3757,12 @@ static int b43_phy_versioning(struct b43_wldev *dev) | |||
3756 | unsupported = 1; | 3757 | unsupported = 1; |
3757 | break; | 3758 | break; |
3758 | #endif | 3759 | #endif |
3760 | #ifdef CONFIG_B43_PHY_LP | ||
3761 | case B43_PHYTYPE_LP: | ||
3762 | if (phy_rev > 1) | ||
3763 | unsupported = 1; | ||
3764 | break; | ||
3765 | #endif | ||
3759 | default: | 3766 | default: |
3760 | unsupported = 1; | 3767 | unsupported = 1; |
3761 | }; | 3768 | }; |
@@ -3808,6 +3815,10 @@ static int b43_phy_versioning(struct b43_wldev *dev) | |||
3808 | if (radio_ver != 0x2055 && radio_ver != 0x2056) | 3815 | if (radio_ver != 0x2055 && radio_ver != 0x2056) |
3809 | unsupported = 1; | 3816 | unsupported = 1; |
3810 | break; | 3817 | break; |
3818 | case B43_PHYTYPE_LP: | ||
3819 | if (radio_ver != 0x2062) | ||
3820 | unsupported = 1; | ||
3821 | break; | ||
3811 | default: | 3822 | default: |
3812 | B43_WARN_ON(1); | 3823 | B43_WARN_ON(1); |
3813 | } | 3824 | } |
@@ -4402,6 +4413,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
4402 | break; | 4413 | break; |
4403 | case B43_PHYTYPE_G: | 4414 | case B43_PHYTYPE_G: |
4404 | case B43_PHYTYPE_N: | 4415 | case B43_PHYTYPE_N: |
4416 | case B43_PHYTYPE_LP: | ||
4405 | have_2ghz_phy = 1; | 4417 | have_2ghz_phy = 1; |
4406 | break; | 4418 | break; |
4407 | default: | 4419 | default: |
diff --git a/drivers/ssb/b43_pci_bridge.c b/drivers/ssb/b43_pci_bridge.c index 6433a7ed39f8..27a677584a4c 100644 --- a/drivers/ssb/b43_pci_bridge.c +++ b/drivers/ssb/b43_pci_bridge.c | |||
@@ -21,6 +21,7 @@ static const struct pci_device_id b43_pci_bridge_tbl[] = { | |||
21 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4307) }, | 21 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4307) }, |
22 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4311) }, | 22 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4311) }, |
23 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) }, | 23 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) }, |
24 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4315) }, | ||
24 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) }, | 25 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) }, |
25 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) }, | 26 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) }, |
26 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) }, | 27 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) }, |
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, |