diff options
Diffstat (limited to 'drivers/ssb/pci.c')
-rw-r--r-- | drivers/ssb/pci.c | 88 |
1 files changed, 82 insertions, 6 deletions
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c index ed4124469a3a..e9d94968f394 100644 --- a/drivers/ssb/pci.c +++ b/drivers/ssb/pci.c | |||
@@ -178,6 +178,18 @@ err_pci: | |||
178 | #define SPEX(_outvar, _offset, _mask, _shift) \ | 178 | #define SPEX(_outvar, _offset, _mask, _shift) \ |
179 | SPEX16(_outvar, _offset, _mask, _shift) | 179 | SPEX16(_outvar, _offset, _mask, _shift) |
180 | 180 | ||
181 | #define SPEX_ARRAY8(_field, _offset, _mask, _shift) \ | ||
182 | do { \ | ||
183 | SPEX(_field[0], _offset + 0, _mask, _shift); \ | ||
184 | SPEX(_field[1], _offset + 2, _mask, _shift); \ | ||
185 | SPEX(_field[2], _offset + 4, _mask, _shift); \ | ||
186 | SPEX(_field[3], _offset + 6, _mask, _shift); \ | ||
187 | SPEX(_field[4], _offset + 8, _mask, _shift); \ | ||
188 | SPEX(_field[5], _offset + 10, _mask, _shift); \ | ||
189 | SPEX(_field[6], _offset + 12, _mask, _shift); \ | ||
190 | SPEX(_field[7], _offset + 14, _mask, _shift); \ | ||
191 | } while (0) | ||
192 | |||
181 | 193 | ||
182 | static inline u8 ssb_crc8(u8 crc, u8 data) | 194 | static inline u8 ssb_crc8(u8 crc, u8 data) |
183 | { | 195 | { |
@@ -360,8 +372,9 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in) | |||
360 | SPEX(et0mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0M, 14); | 372 | SPEX(et0mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0M, 14); |
361 | SPEX(et1mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1M, 15); | 373 | SPEX(et1mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1M, 15); |
362 | SPEX(board_rev, SSB_SPROM1_BINF, SSB_SPROM1_BINF_BREV, 0); | 374 | SPEX(board_rev, SSB_SPROM1_BINF, SSB_SPROM1_BINF_BREV, 0); |
363 | SPEX(country_code, SSB_SPROM1_BINF, SSB_SPROM1_BINF_CCODE, | 375 | if (out->revision == 1) |
364 | SSB_SPROM1_BINF_CCODE_SHIFT); | 376 | SPEX(country_code, SSB_SPROM1_BINF, SSB_SPROM1_BINF_CCODE, |
377 | SSB_SPROM1_BINF_CCODE_SHIFT); | ||
365 | SPEX(ant_available_a, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTA, | 378 | SPEX(ant_available_a, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTA, |
366 | SSB_SPROM1_BINF_ANTA_SHIFT); | 379 | SSB_SPROM1_BINF_ANTA_SHIFT); |
367 | SPEX(ant_available_bg, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTBG, | 380 | SPEX(ant_available_bg, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTBG, |
@@ -387,6 +400,8 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in) | |||
387 | SPEX(boardflags_lo, SSB_SPROM1_BFLLO, 0xFFFF, 0); | 400 | SPEX(boardflags_lo, SSB_SPROM1_BFLLO, 0xFFFF, 0); |
388 | if (out->revision >= 2) | 401 | if (out->revision >= 2) |
389 | SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0); | 402 | SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0); |
403 | SPEX(alpha2[0], SSB_SPROM1_CCODE, 0xff00, 8); | ||
404 | SPEX(alpha2[1], SSB_SPROM1_CCODE, 0x00ff, 0); | ||
390 | 405 | ||
391 | /* Extract the antenna gain values. */ | 406 | /* Extract the antenna gain values. */ |
392 | out->antenna_gain.a0 = r123_extract_antgain(out->revision, in, | 407 | out->antenna_gain.a0 = r123_extract_antgain(out->revision, in, |
@@ -455,14 +470,17 @@ static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) | |||
455 | SPEX(et0phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET0A, 0); | 470 | SPEX(et0phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET0A, 0); |
456 | SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A, | 471 | SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A, |
457 | SSB_SPROM4_ETHPHY_ET1A_SHIFT); | 472 | SSB_SPROM4_ETHPHY_ET1A_SHIFT); |
473 | SPEX(board_rev, SSB_SPROM4_BOARDREV, 0xFFFF, 0); | ||
458 | if (out->revision == 4) { | 474 | if (out->revision == 4) { |
459 | SPEX(country_code, SSB_SPROM4_CCODE, 0xFFFF, 0); | 475 | SPEX(alpha2[0], SSB_SPROM4_CCODE, 0xff00, 8); |
476 | SPEX(alpha2[1], SSB_SPROM4_CCODE, 0x00ff, 0); | ||
460 | SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0); | 477 | SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0); |
461 | SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0); | 478 | SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0); |
462 | SPEX(boardflags2_lo, SSB_SPROM4_BFL2LO, 0xFFFF, 0); | 479 | SPEX(boardflags2_lo, SSB_SPROM4_BFL2LO, 0xFFFF, 0); |
463 | SPEX(boardflags2_hi, SSB_SPROM4_BFL2HI, 0xFFFF, 0); | 480 | SPEX(boardflags2_hi, SSB_SPROM4_BFL2HI, 0xFFFF, 0); |
464 | } else { | 481 | } else { |
465 | SPEX(country_code, SSB_SPROM5_CCODE, 0xFFFF, 0); | 482 | SPEX(alpha2[0], SSB_SPROM5_CCODE, 0xff00, 8); |
483 | SPEX(alpha2[1], SSB_SPROM5_CCODE, 0x00ff, 0); | ||
466 | SPEX(boardflags_lo, SSB_SPROM5_BFLLO, 0xFFFF, 0); | 484 | SPEX(boardflags_lo, SSB_SPROM5_BFLLO, 0xFFFF, 0); |
467 | SPEX(boardflags_hi, SSB_SPROM5_BFLHI, 0xFFFF, 0); | 485 | SPEX(boardflags_hi, SSB_SPROM5_BFLHI, 0xFFFF, 0); |
468 | SPEX(boardflags2_lo, SSB_SPROM5_BFL2LO, 0xFFFF, 0); | 486 | SPEX(boardflags2_lo, SSB_SPROM5_BFL2LO, 0xFFFF, 0); |
@@ -525,7 +543,9 @@ static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in) | |||
525 | v = in[SPOFF(SSB_SPROM8_IL0MAC) + i]; | 543 | v = in[SPOFF(SSB_SPROM8_IL0MAC) + i]; |
526 | *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); | 544 | *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); |
527 | } | 545 | } |
528 | SPEX(country_code, SSB_SPROM8_CCODE, 0xFFFF, 0); | 546 | SPEX(board_rev, SSB_SPROM8_BOARDREV, 0xFFFF, 0); |
547 | SPEX(alpha2[0], SSB_SPROM8_CCODE, 0xff00, 8); | ||
548 | SPEX(alpha2[1], SSB_SPROM8_CCODE, 0x00ff, 0); | ||
529 | SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0); | 549 | SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0); |
530 | SPEX(boardflags_hi, SSB_SPROM8_BFLHI, 0xFFFF, 0); | 550 | SPEX(boardflags_hi, SSB_SPROM8_BFLHI, 0xFFFF, 0); |
531 | SPEX(boardflags2_lo, SSB_SPROM8_BFL2LO, 0xFFFF, 0); | 551 | SPEX(boardflags2_lo, SSB_SPROM8_BFL2LO, 0xFFFF, 0); |
@@ -655,6 +675,63 @@ static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in) | |||
655 | SPEX(fem.ghz5.antswlut, SSB_SPROM8_FEM5G, | 675 | SPEX(fem.ghz5.antswlut, SSB_SPROM8_FEM5G, |
656 | SSB_SROM8_FEM_ANTSWLUT, SSB_SROM8_FEM_ANTSWLUT_SHIFT); | 676 | SSB_SROM8_FEM_ANTSWLUT, SSB_SROM8_FEM_ANTSWLUT_SHIFT); |
657 | 677 | ||
678 | SPEX(leddc_on_time, SSB_SPROM8_LEDDC, SSB_SPROM8_LEDDC_ON, | ||
679 | SSB_SPROM8_LEDDC_ON_SHIFT); | ||
680 | SPEX(leddc_off_time, SSB_SPROM8_LEDDC, SSB_SPROM8_LEDDC_OFF, | ||
681 | SSB_SPROM8_LEDDC_OFF_SHIFT); | ||
682 | |||
683 | SPEX(txchain, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_TXCHAIN, | ||
684 | SSB_SPROM8_TXRXC_TXCHAIN_SHIFT); | ||
685 | SPEX(rxchain, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_RXCHAIN, | ||
686 | SSB_SPROM8_TXRXC_RXCHAIN_SHIFT); | ||
687 | SPEX(antswitch, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_SWITCH, | ||
688 | SSB_SPROM8_TXRXC_SWITCH_SHIFT); | ||
689 | |||
690 | SPEX(opo, SSB_SPROM8_OFDM2GPO, 0x00ff, 0); | ||
691 | |||
692 | SPEX_ARRAY8(mcs2gpo, SSB_SPROM8_2G_MCSPO, ~0, 0); | ||
693 | SPEX_ARRAY8(mcs5gpo, SSB_SPROM8_5G_MCSPO, ~0, 0); | ||
694 | SPEX_ARRAY8(mcs5glpo, SSB_SPROM8_5GL_MCSPO, ~0, 0); | ||
695 | SPEX_ARRAY8(mcs5ghpo, SSB_SPROM8_5GH_MCSPO, ~0, 0); | ||
696 | |||
697 | SPEX(rawtempsense, SSB_SPROM8_RAWTS, SSB_SPROM8_RAWTS_RAWTEMP, | ||
698 | SSB_SPROM8_RAWTS_RAWTEMP_SHIFT); | ||
699 | SPEX(measpower, SSB_SPROM8_RAWTS, SSB_SPROM8_RAWTS_MEASPOWER, | ||
700 | SSB_SPROM8_RAWTS_MEASPOWER_SHIFT); | ||
701 | SPEX(tempsense_slope, SSB_SPROM8_OPT_CORRX, | ||
702 | SSB_SPROM8_OPT_CORRX_TEMP_SLOPE, | ||
703 | SSB_SPROM8_OPT_CORRX_TEMP_SLOPE_SHIFT); | ||
704 | SPEX(tempcorrx, SSB_SPROM8_OPT_CORRX, SSB_SPROM8_OPT_CORRX_TEMPCORRX, | ||
705 | SSB_SPROM8_OPT_CORRX_TEMPCORRX_SHIFT); | ||
706 | SPEX(tempsense_option, SSB_SPROM8_OPT_CORRX, | ||
707 | SSB_SPROM8_OPT_CORRX_TEMP_OPTION, | ||
708 | SSB_SPROM8_OPT_CORRX_TEMP_OPTION_SHIFT); | ||
709 | SPEX(freqoffset_corr, SSB_SPROM8_HWIQ_IQSWP, | ||
710 | SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR, | ||
711 | SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR_SHIFT); | ||
712 | SPEX(iqcal_swp_dis, SSB_SPROM8_HWIQ_IQSWP, | ||
713 | SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP, | ||
714 | SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT); | ||
715 | SPEX(hw_iqcal_en, SSB_SPROM8_HWIQ_IQSWP, SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL, | ||
716 | SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT); | ||
717 | |||
718 | SPEX(bw40po, SSB_SPROM8_BW40PO, ~0, 0); | ||
719 | SPEX(cddpo, SSB_SPROM8_CDDPO, ~0, 0); | ||
720 | SPEX(stbcpo, SSB_SPROM8_STBCPO, ~0, 0); | ||
721 | SPEX(bwduppo, SSB_SPROM8_BWDUPPO, ~0, 0); | ||
722 | |||
723 | SPEX(tempthresh, SSB_SPROM8_THERMAL, SSB_SPROM8_THERMAL_TRESH, | ||
724 | SSB_SPROM8_THERMAL_TRESH_SHIFT); | ||
725 | SPEX(tempoffset, SSB_SPROM8_THERMAL, SSB_SPROM8_THERMAL_OFFSET, | ||
726 | SSB_SPROM8_THERMAL_OFFSET_SHIFT); | ||
727 | SPEX(phycal_tempdelta, SSB_SPROM8_TEMPDELTA, | ||
728 | SSB_SPROM8_TEMPDELTA_PHYCAL, | ||
729 | SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT); | ||
730 | SPEX(temps_period, SSB_SPROM8_TEMPDELTA, SSB_SPROM8_TEMPDELTA_PERIOD, | ||
731 | SSB_SPROM8_TEMPDELTA_PERIOD_SHIFT); | ||
732 | SPEX(temps_hysteresis, SSB_SPROM8_TEMPDELTA, | ||
733 | SSB_SPROM8_TEMPDELTA_HYSTERESIS, | ||
734 | SSB_SPROM8_TEMPDELTA_HYSTERESIS_SHIFT); | ||
658 | sprom_extract_r458(out, in); | 735 | sprom_extract_r458(out, in); |
659 | 736 | ||
660 | /* TODO - get remaining rev 8 stuff needed */ | 737 | /* TODO - get remaining rev 8 stuff needed */ |
@@ -784,7 +861,6 @@ static void ssb_pci_get_boardinfo(struct ssb_bus *bus, | |||
784 | { | 861 | { |
785 | bi->vendor = bus->host_pci->subsystem_vendor; | 862 | bi->vendor = bus->host_pci->subsystem_vendor; |
786 | bi->type = bus->host_pci->subsystem_device; | 863 | bi->type = bus->host_pci->subsystem_device; |
787 | bi->rev = bus->host_pci->revision; | ||
788 | } | 864 | } |
789 | 865 | ||
790 | int ssb_pci_get_invariants(struct ssb_bus *bus, | 866 | int ssb_pci_get_invariants(struct ssb_bus *bus, |