diff options
author | Senthil Balasubramanian <senthilkumar@atheros.com> | 2008-12-08 09:13:48 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-12-12 13:48:26 -0500 |
commit | e7594072a5b918510c937c1ab0acad4e8a931bc7 (patch) | |
tree | 50cc34039e87fc3152c54073b9349971249b050f /drivers/net/wireless/ath9k/hw.c | |
parent | e8fbc99edfe0efa0b42f04587a79a6b3371f961a (diff) |
ath9k: Adding support for Atheros AR9285 chipset.
Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/hw.c')
-rw-r--r-- | drivers/net/wireless/ath9k/hw.c | 90 |
1 files changed, 70 insertions, 20 deletions
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c index 2176fa8e91e7..e95dfa0a030a 100644 --- a/drivers/net/wireless/ath9k/hw.c +++ b/drivers/net/wireless/ath9k/hw.c | |||
@@ -37,7 +37,7 @@ static bool ath9k_hw_set_reset_reg(struct ath_hal *ah, u32 type); | |||
37 | static void ath9k_hw_set_regs(struct ath_hal *ah, struct ath9k_channel *chan, | 37 | static void ath9k_hw_set_regs(struct ath_hal *ah, struct ath9k_channel *chan, |
38 | enum ath9k_ht_macmode macmode); | 38 | enum ath9k_ht_macmode macmode); |
39 | static u32 ath9k_hw_ini_fixup(struct ath_hal *ah, | 39 | static u32 ath9k_hw_ini_fixup(struct ath_hal *ah, |
40 | struct ar5416_eeprom *pEepData, | 40 | struct ar5416_eeprom_def *pEepData, |
41 | u32 reg, u32 value); | 41 | u32 reg, u32 value); |
42 | static void ath9k_hw_9280_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *chan); | 42 | static void ath9k_hw_9280_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *chan); |
43 | static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *chan); | 43 | static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *chan); |
@@ -392,6 +392,8 @@ static const char *ath9k_hw_devname(u16 devid) | |||
392 | case AR9280_DEVID_PCI: | 392 | case AR9280_DEVID_PCI: |
393 | case AR9280_DEVID_PCIE: | 393 | case AR9280_DEVID_PCIE: |
394 | return "Atheros 9280"; | 394 | return "Atheros 9280"; |
395 | case AR9285_DEVID_PCIE: | ||
396 | return "Atheros 9285"; | ||
395 | } | 397 | } |
396 | 398 | ||
397 | return NULL; | 399 | return NULL; |
@@ -682,7 +684,7 @@ static struct ath_hal *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc, | |||
682 | if ((ah->ah_macVersion != AR_SREV_VERSION_5416_PCI) && | 684 | if ((ah->ah_macVersion != AR_SREV_VERSION_5416_PCI) && |
683 | (ah->ah_macVersion != AR_SREV_VERSION_5416_PCIE) && | 685 | (ah->ah_macVersion != AR_SREV_VERSION_5416_PCIE) && |
684 | (ah->ah_macVersion != AR_SREV_VERSION_9160) && | 686 | (ah->ah_macVersion != AR_SREV_VERSION_9160) && |
685 | (!AR_SREV_9100(ah)) && (!AR_SREV_9280(ah))) { | 687 | (!AR_SREV_9100(ah)) && (!AR_SREV_9280(ah)) && (!AR_SREV_9285(ah))) { |
686 | DPRINTF(ah->ah_sc, ATH_DBG_RESET, | 688 | DPRINTF(ah->ah_sc, ATH_DBG_RESET, |
687 | "Mac Chip Rev 0x%02x.%x is not supported by " | 689 | "Mac Chip Rev 0x%02x.%x is not supported by " |
688 | "this driver\n", ah->ah_macVersion, ah->ah_macRev); | 690 | "this driver\n", ah->ah_macVersion, ah->ah_macRev); |
@@ -733,7 +735,38 @@ static struct ath_hal *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc, | |||
733 | "This Mac Chip Rev 0x%02x.%x is \n", | 735 | "This Mac Chip Rev 0x%02x.%x is \n", |
734 | ah->ah_macVersion, ah->ah_macRev); | 736 | ah->ah_macVersion, ah->ah_macRev); |
735 | 737 | ||
736 | if (AR_SREV_9280_20_OR_LATER(ah)) { | 738 | if (AR_SREV_9285_12_OR_LATER(ah)) { |
739 | INIT_INI_ARRAY(&ahp->ah_iniModes, ar9285Modes_9285_1_2, | ||
740 | ARRAY_SIZE(ar9285Modes_9285_1_2), 6); | ||
741 | INIT_INI_ARRAY(&ahp->ah_iniCommon, ar9285Common_9285_1_2, | ||
742 | ARRAY_SIZE(ar9285Common_9285_1_2), 2); | ||
743 | |||
744 | if (ah->ah_config.pcie_clock_req) { | ||
745 | INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes, | ||
746 | ar9285PciePhy_clkreq_off_L1_9285_1_2, | ||
747 | ARRAY_SIZE(ar9285PciePhy_clkreq_off_L1_9285_1_2), 2); | ||
748 | } else { | ||
749 | INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes, | ||
750 | ar9285PciePhy_clkreq_always_on_L1_9285_1_2, | ||
751 | ARRAY_SIZE(ar9285PciePhy_clkreq_always_on_L1_9285_1_2), | ||
752 | 2); | ||
753 | } | ||
754 | } else if (AR_SREV_9285_10_OR_LATER(ah)) { | ||
755 | INIT_INI_ARRAY(&ahp->ah_iniModes, ar9285Modes_9285, | ||
756 | ARRAY_SIZE(ar9285Modes_9285), 6); | ||
757 | INIT_INI_ARRAY(&ahp->ah_iniCommon, ar9285Common_9285, | ||
758 | ARRAY_SIZE(ar9285Common_9285), 2); | ||
759 | |||
760 | if (ah->ah_config.pcie_clock_req) { | ||
761 | INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes, | ||
762 | ar9285PciePhy_clkreq_off_L1_9285, | ||
763 | ARRAY_SIZE(ar9285PciePhy_clkreq_off_L1_9285), 2); | ||
764 | } else { | ||
765 | INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes, | ||
766 | ar9285PciePhy_clkreq_always_on_L1_9285, | ||
767 | ARRAY_SIZE(ar9285PciePhy_clkreq_always_on_L1_9285), 2); | ||
768 | } | ||
769 | } else if (AR_SREV_9280_20_OR_LATER(ah)) { | ||
737 | INIT_INI_ARRAY(&ahp->ah_iniModes, ar9280Modes_9280_2, | 770 | INIT_INI_ARRAY(&ahp->ah_iniModes, ar9280Modes_9280_2, |
738 | ARRAY_SIZE(ar9280Modes_9280_2), 6); | 771 | ARRAY_SIZE(ar9280Modes_9280_2), 6); |
739 | INIT_INI_ARRAY(&ahp->ah_iniCommon, ar9280Common_9280_2, | 772 | INIT_INI_ARRAY(&ahp->ah_iniCommon, ar9280Common_9280_2, |
@@ -843,11 +876,11 @@ static struct ath_hal *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc, | |||
843 | goto bad; | 876 | goto bad; |
844 | 877 | ||
845 | /* rxgain table */ | 878 | /* rxgain table */ |
846 | if (AR_SREV_9280_20_OR_LATER(ah)) | 879 | if (AR_SREV_9280_20(ah)) |
847 | ath9k_hw_init_rxgain_ini(ah); | 880 | ath9k_hw_init_rxgain_ini(ah); |
848 | 881 | ||
849 | /* txgain table */ | 882 | /* txgain table */ |
850 | if (AR_SREV_9280_20_OR_LATER(ah)) | 883 | if (AR_SREV_9280_20(ah)) |
851 | ath9k_hw_init_txgain_ini(ah); | 884 | ath9k_hw_init_txgain_ini(ah); |
852 | 885 | ||
853 | if (ah->ah_devid == AR9280_DEVID_PCI) { | 886 | if (ah->ah_devid == AR9280_DEVID_PCI) { |
@@ -858,7 +891,8 @@ static struct ath_hal *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc, | |||
858 | u32 val = INI_RA(&ahp->ah_iniModes, i, j); | 891 | u32 val = INI_RA(&ahp->ah_iniModes, i, j); |
859 | 892 | ||
860 | INI_RA(&ahp->ah_iniModes, i, j) = | 893 | INI_RA(&ahp->ah_iniModes, i, j) = |
861 | ath9k_hw_ini_fixup(ah, &ahp->ah_eeprom, | 894 | ath9k_hw_ini_fixup(ah, |
895 | &ahp->ah_eeprom.def, | ||
862 | reg, val); | 896 | reg, val); |
863 | } | 897 | } |
864 | } | 898 | } |
@@ -1016,8 +1050,6 @@ static void ath9k_hw_init_chain_masks(struct ath_hal *ah) | |||
1016 | } | 1050 | } |
1017 | case 0x1: | 1051 | case 0x1: |
1018 | case 0x2: | 1052 | case 0x2: |
1019 | if (!AR_SREV_9280(ah)) | ||
1020 | break; | ||
1021 | case 0x7: | 1053 | case 0x7: |
1022 | REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx_chainmask); | 1054 | REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx_chainmask); |
1023 | REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx_chainmask); | 1055 | REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx_chainmask); |
@@ -1162,12 +1194,10 @@ struct ath_hal *ath9k_hw_attach(u16 devid, struct ath_softc *sc, | |||
1162 | case AR9160_DEVID_PCI: | 1194 | case AR9160_DEVID_PCI: |
1163 | case AR9280_DEVID_PCI: | 1195 | case AR9280_DEVID_PCI: |
1164 | case AR9280_DEVID_PCIE: | 1196 | case AR9280_DEVID_PCIE: |
1197 | case AR9285_DEVID_PCIE: | ||
1165 | ah = ath9k_hw_do_attach(devid, sc, mem, error); | 1198 | ah = ath9k_hw_do_attach(devid, sc, mem, error); |
1166 | break; | 1199 | break; |
1167 | default: | 1200 | default: |
1168 | DPRINTF(ah->ah_sc, ATH_DBG_ANY, | ||
1169 | "devid=0x%x not supported.\n", devid); | ||
1170 | ah = NULL; | ||
1171 | *error = -ENXIO; | 1201 | *error = -ENXIO; |
1172 | break; | 1202 | break; |
1173 | } | 1203 | } |
@@ -1189,8 +1219,8 @@ static void ath9k_hw_override_ini(struct ath_hal *ah, | |||
1189 | REG_WRITE(ah, 0x9800 + (651 << 2), 0x11); | 1219 | REG_WRITE(ah, 0x9800 + (651 << 2), 0x11); |
1190 | } | 1220 | } |
1191 | 1221 | ||
1192 | static u32 ath9k_hw_ini_fixup(struct ath_hal *ah, | 1222 | static u32 ath9k_hw_def_ini_fixup(struct ath_hal *ah, |
1193 | struct ar5416_eeprom *pEepData, | 1223 | struct ar5416_eeprom_def *pEepData, |
1194 | u32 reg, u32 value) | 1224 | u32 reg, u32 value) |
1195 | { | 1225 | { |
1196 | struct base_eep_header *pBase = &(pEepData->baseEepHeader); | 1226 | struct base_eep_header *pBase = &(pEepData->baseEepHeader); |
@@ -1223,6 +1253,18 @@ static u32 ath9k_hw_ini_fixup(struct ath_hal *ah, | |||
1223 | return value; | 1253 | return value; |
1224 | } | 1254 | } |
1225 | 1255 | ||
1256 | static u32 ath9k_hw_ini_fixup(struct ath_hal *ah, | ||
1257 | struct ar5416_eeprom_def *pEepData, | ||
1258 | u32 reg, u32 value) | ||
1259 | { | ||
1260 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
1261 | |||
1262 | if (ahp->ah_eep_map == EEP_MAP_4KBITS) | ||
1263 | return value; | ||
1264 | else | ||
1265 | return ath9k_hw_def_ini_fixup(ah, pEepData, reg, value); | ||
1266 | } | ||
1267 | |||
1226 | static int ath9k_hw_process_ini(struct ath_hal *ah, | 1268 | static int ath9k_hw_process_ini(struct ath_hal *ah, |
1227 | struct ath9k_channel *chan, | 1269 | struct ath9k_channel *chan, |
1228 | enum ath9k_ht_macmode macmode) | 1270 | enum ath9k_ht_macmode macmode) |
@@ -1300,10 +1342,10 @@ static int ath9k_hw_process_ini(struct ath_hal *ah, | |||
1300 | DO_DELAY(regWrites); | 1342 | DO_DELAY(regWrites); |
1301 | } | 1343 | } |
1302 | 1344 | ||
1303 | if (AR_SREV_9280_20_OR_LATER(ah)) | 1345 | if (AR_SREV_9280(ah)) |
1304 | REG_WRITE_ARRAY(&ahp->ah_iniModesRxGain, modesIndex, regWrites); | 1346 | REG_WRITE_ARRAY(&ahp->ah_iniModesRxGain, modesIndex, regWrites); |
1305 | 1347 | ||
1306 | if (AR_SREV_9280_20_OR_LATER(ah)) | 1348 | if (AR_SREV_9280(ah)) |
1307 | REG_WRITE_ARRAY(&ahp->ah_iniModesTxGain, modesIndex, regWrites); | 1349 | REG_WRITE_ARRAY(&ahp->ah_iniModesTxGain, modesIndex, regWrites); |
1308 | 1350 | ||
1309 | for (i = 0; i < ahp->ah_iniCommon.ia_rows; i++) { | 1351 | for (i = 0; i < ahp->ah_iniCommon.ia_rows; i++) { |
@@ -1576,10 +1618,15 @@ static void ath9k_hw_set_regs(struct ath_hal *ah, struct ath9k_channel *chan, | |||
1576 | enum ath9k_ht_macmode macmode) | 1618 | enum ath9k_ht_macmode macmode) |
1577 | { | 1619 | { |
1578 | u32 phymode; | 1620 | u32 phymode; |
1621 | u32 enableDacFifo = 0; | ||
1579 | struct ath_hal_5416 *ahp = AH5416(ah); | 1622 | struct ath_hal_5416 *ahp = AH5416(ah); |
1580 | 1623 | ||
1624 | if (AR_SREV_9285_10_OR_LATER(ah)) | ||
1625 | enableDacFifo = (REG_READ(ah, AR_PHY_TURBO) & | ||
1626 | AR_PHY_FC_ENABLE_DAC_FIFO); | ||
1627 | |||
1581 | phymode = AR_PHY_FC_HT_EN | AR_PHY_FC_SHORT_GI_40 | 1628 | phymode = AR_PHY_FC_HT_EN | AR_PHY_FC_SHORT_GI_40 |
1582 | | AR_PHY_FC_SINGLE_HT_LTF1 | AR_PHY_FC_WALSH; | 1629 | | AR_PHY_FC_SINGLE_HT_LTF1 | AR_PHY_FC_WALSH | enableDacFifo; |
1583 | 1630 | ||
1584 | if (IS_CHAN_HT40(chan)) { | 1631 | if (IS_CHAN_HT40(chan)) { |
1585 | phymode |= AR_PHY_FC_DYN2040_EN; | 1632 | phymode |= AR_PHY_FC_DYN2040_EN; |
@@ -2762,11 +2809,14 @@ void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore) | |||
2762 | if (ah->ah_config.pcie_waen) { | 2809 | if (ah->ah_config.pcie_waen) { |
2763 | REG_WRITE(ah, AR_WA, ah->ah_config.pcie_waen); | 2810 | REG_WRITE(ah, AR_WA, ah->ah_config.pcie_waen); |
2764 | } else { | 2811 | } else { |
2765 | if (AR_SREV_9280(ah)) | 2812 | if (AR_SREV_9285(ah)) |
2766 | REG_WRITE(ah, AR_WA, 0x0040073f); | 2813 | REG_WRITE(ah, AR_WA, AR9285_WA_DEFAULT); |
2814 | else if (AR_SREV_9280(ah)) | ||
2815 | REG_WRITE(ah, AR_WA, AR9280_WA_DEFAULT); | ||
2767 | else | 2816 | else |
2768 | REG_WRITE(ah, AR_WA, 0x0000073f); | 2817 | REG_WRITE(ah, AR_WA, AR_WA_DEFAULT); |
2769 | } | 2818 | } |
2819 | |||
2770 | } | 2820 | } |
2771 | 2821 | ||
2772 | /**********************/ | 2822 | /**********************/ |
@@ -3317,7 +3367,7 @@ bool ath9k_hw_fill_cap_info(struct ath_hal *ah) | |||
3317 | else | 3367 | else |
3318 | pCap->hw_caps |= ATH9K_HW_CAP_AUTOSLEEP; | 3368 | pCap->hw_caps |= ATH9K_HW_CAP_AUTOSLEEP; |
3319 | 3369 | ||
3320 | if (AR_SREV_9280(ah)) | 3370 | if (AR_SREV_9280(ah) || AR_SREV_9285(ah)) |
3321 | pCap->hw_caps &= ~ATH9K_HW_CAP_4KB_SPLITTRANS; | 3371 | pCap->hw_caps &= ~ATH9K_HW_CAP_4KB_SPLITTRANS; |
3322 | else | 3372 | else |
3323 | pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS; | 3373 | pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS; |