ath9k: Cleanup data structures related to HW capabilities

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by Sujith and committed by John W. Linville 60b67f51 b08cbcd4

+330 -320
+92 -91
drivers/net/wireless/ath9k/ath9k.h
··· 147 148 #define ATH9K_RXDESC_INTREQ 0x0020 149 150 - enum hal_capability_type { 151 - HAL_CAP_CIPHER = 0, 152 - HAL_CAP_TKIP_MIC, 153 - HAL_CAP_TKIP_SPLIT, 154 - HAL_CAP_PHYCOUNTERS, 155 - HAL_CAP_DIVERSITY, 156 - HAL_CAP_PSPOLL, 157 - HAL_CAP_TXPOW, 158 - HAL_CAP_PHYDIAG, 159 - HAL_CAP_MCAST_KEYSRCH, 160 - HAL_CAP_TSF_ADJUST, 161 - HAL_CAP_WME_TKIPMIC, 162 - HAL_CAP_RFSILENT, 163 - HAL_CAP_ANT_CFG_2GHZ, 164 - HAL_CAP_ANT_CFG_5GHZ 165 }; 166 167 - struct hal_capabilities { 168 - u32 halChanSpreadSupport:1, 169 - halChapTuningSupport:1, 170 - halMicAesCcmSupport:1, 171 - halMicCkipSupport:1, 172 - halMicTkipSupport:1, 173 - halCipherAesCcmSupport:1, 174 - halCipherCkipSupport:1, 175 - halCipherTkipSupport:1, 176 - halVEOLSupport:1, 177 - halBssIdMaskSupport:1, 178 - halMcastKeySrchSupport:1, 179 - halTsfAddSupport:1, 180 - halChanHalfRate:1, 181 - halChanQuarterRate:1, 182 - halHTSupport:1, 183 - halGTTSupport:1, 184 - halFastCCSupport:1, 185 - halRfSilentSupport:1, 186 - halWowSupport:1, 187 - halCSTSupport:1, 188 - halEnhancedPmSupport:1, 189 - halAutoSleepSupport:1, 190 - hal4kbSplitTransSupport:1, 191 - halWowMatchPatternExact:1; 192 - u32 halWirelessModes; 193 - u16 halTotalQueues; 194 - u16 halKeyCacheSize; 195 - u16 halLow5GhzChan, halHigh5GhzChan; 196 - u16 halLow2GhzChan, halHigh2GhzChan; 197 - u16 halNumMRRetries; 198 - u16 halRtsAggrLimit; 199 - u8 halTxChainMask; 200 - u8 halRxChainMask; 201 - u16 halTxTrigLevelMax; 202 - u16 halRegCap; 203 - u8 halNumGpioPins; 204 - u8 halNumAntCfg2GHz; 205 - u8 halNumAntCfg5GHz; 206 }; 207 208 - struct hal_ops_config { 209 - int ath_hal_dma_beacon_response_time; 210 - int ath_hal_sw_beacon_response_time; 211 - int ath_hal_additional_swba_backoff; 212 - int ath_hal_6mb_ack; 213 - int ath_hal_cwmIgnoreExtCCA; 214 - u8 ath_hal_pciePowerSaveEnable; 215 - u8 ath_hal_pcieL1SKPEnable; 216 - u8 ath_hal_pcieClockReq; 217 - u32 ath_hal_pcieWaen; 218 - int ath_hal_pciePowerReset; 219 - u8 ath_hal_pcieRestore; 220 - u8 ath_hal_analogShiftReg; 221 - u8 ath_hal_htEnable; 222 - u32 ath_hal_ofdmTrigLow; 223 - u32 ath_hal_ofdmTrigHigh; 224 - u32 ath_hal_cckTrigHigh; 225 - u32 ath_hal_cckTrigLow; 226 - u32 ath_hal_enableANI; 227 - u8 ath_hal_noiseImmunityLvl; 228 - u32 ath_hal_ofdmWeakSigDet; 229 - u32 ath_hal_cckWeakSigThr; 230 - u8 ath_hal_spurImmunityLvl; 231 - u8 ath_hal_firStepLvl; 232 - int8_t ath_hal_rssiThrHigh; 233 - int8_t ath_hal_rssiThrLow; 234 - u16 ath_hal_diversityControl; 235 - u16 ath_hal_antennaSwitchSwap; 236 - int ath_hal_serializeRegMode; 237 - int ath_hal_intrMitigation; 238 #define SPUR_DISABLE 0 239 #define SPUR_ENABLE_IOCTL 1 240 #define SPUR_ENABLE_EEPROM 2 ··· 247 #define AR_BASE_FREQ_5GHZ 4900 248 #define AR_SPUR_FEEQ_BOUND_HT40 19 249 #define AR_SPUR_FEEQ_BOUND_HT20 10 250 - int ath_hal_spurMode; 251 - u16 ath_hal_spurChans[AR_EEPROM_MODAL_SPURS][2]; 252 }; 253 254 enum ath9k_tx_queue { ··· 816 u8 ah_decompMask[ATH9K_DECOMP_MASK_SIZE]; 817 u32 ah_flags; 818 enum ath9k_opmode ah_opmode; 819 - struct hal_ops_config ah_config; 820 - struct hal_capabilities ah_caps; 821 int16_t ah_powerLimit; 822 u16 ah_maxPowerLevel; 823 u32 ah_tpScale; ··· 879 }; 880 881 int ath_hal_getcapability(struct ath_hal *ah, 882 - enum hal_capability_type type, 883 u32 capability, 884 u32 *result); 885 const struct ath9k_rate_table *ath9k_hw_getratetable(struct ath_hal *ah, ··· 948 bool ath9k_hw_phycounters(struct ath_hal *ah); 949 bool ath9k_hw_keyreset(struct ath_hal *ah, u16 entry); 950 bool ath9k_hw_getcapability(struct ath_hal *ah, 951 - enum hal_capability_type type, 952 u32 capability, 953 u32 *result); 954 bool ath9k_hw_setcapability(struct ath_hal *ah, 955 - enum hal_capability_type type, 956 u32 capability, 957 u32 setting, 958 int *status);
··· 147 148 #define ATH9K_RXDESC_INTREQ 0x0020 149 150 + enum ath9k_hw_caps { 151 + ATH9K_HW_CAP_CHAN_SPREAD = BIT(0), 152 + ATH9K_HW_CAP_MIC_AESCCM = BIT(1), 153 + ATH9K_HW_CAP_MIC_CKIP = BIT(2), 154 + ATH9K_HW_CAP_MIC_TKIP = BIT(3), 155 + ATH9K_HW_CAP_CIPHER_AESCCM = BIT(4), 156 + ATH9K_HW_CAP_CIPHER_CKIP = BIT(5), 157 + ATH9K_HW_CAP_CIPHER_TKIP = BIT(6), 158 + ATH9K_HW_CAP_VEOL = BIT(7), 159 + ATH9K_HW_CAP_BSSIDMASK = BIT(8), 160 + ATH9K_HW_CAP_MCAST_KEYSEARCH = BIT(9), 161 + ATH9K_HW_CAP_CHAN_HALFRATE = BIT(10), 162 + ATH9K_HW_CAP_CHAN_QUARTERRATE = BIT(11), 163 + ATH9K_HW_CAP_HT = BIT(12), 164 + ATH9K_HW_CAP_GTT = BIT(13), 165 + ATH9K_HW_CAP_FASTCC = BIT(14), 166 + ATH9K_HW_CAP_RFSILENT = BIT(15), 167 + ATH9K_HW_CAP_WOW = BIT(16), 168 + ATH9K_HW_CAP_CST = BIT(17), 169 + ATH9K_HW_CAP_ENHANCEDPM = BIT(18), 170 + ATH9K_HW_CAP_AUTOSLEEP = BIT(19), 171 + ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(20), 172 + ATH9K_HW_CAP_WOW_MATCHPATTERN_EXACT = BIT(21), 173 }; 174 175 + enum ath9k_capability_type { 176 + ATH9K_CAP_CIPHER = 0, 177 + ATH9K_CAP_TKIP_MIC, 178 + ATH9K_CAP_TKIP_SPLIT, 179 + ATH9K_CAP_PHYCOUNTERS, 180 + ATH9K_CAP_DIVERSITY, 181 + ATH9K_CAP_TXPOW, 182 + ATH9K_CAP_PHYDIAG, 183 + ATH9K_CAP_MCAST_KEYSRCH, 184 + ATH9K_CAP_TSF_ADJUST, 185 + ATH9K_CAP_WME_TKIPMIC, 186 + ATH9K_CAP_RFSILENT, 187 + ATH9K_CAP_ANT_CFG_2GHZ, 188 + ATH9K_CAP_ANT_CFG_5GHZ 189 }; 190 191 + struct ath9k_hw_capabilities { 192 + u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */ 193 + u32 wireless_modes; 194 + u16 total_queues; 195 + u16 keycache_size; 196 + u16 low_5ghz_chan, high_5ghz_chan; 197 + u16 low_2ghz_chan, high_2ghz_chan; 198 + u16 num_mr_retries; 199 + u16 rts_aggr_limit; 200 + u8 tx_chainmask; 201 + u8 rx_chainmask; 202 + u16 tx_triglevel_max; 203 + u16 reg_cap; 204 + u8 num_gpio_pins; 205 + u8 num_antcfg_2ghz; 206 + u8 num_antcfg_5ghz; 207 + }; 208 + 209 + struct ath9k_ops_config { 210 + int dma_beacon_response_time; 211 + int sw_beacon_response_time; 212 + int additional_swba_backoff; 213 + int ack_6mb; 214 + int cwm_ignore_extcca; 215 + u8 pcie_powersave_enable; 216 + u8 pcie_l1skp_enable; 217 + u8 pcie_clock_req; 218 + u32 pcie_waen; 219 + int pcie_power_reset; 220 + u8 pcie_restore; 221 + u8 analog_shiftreg; 222 + u8 ht_enable; 223 + u32 ofdm_trig_low; 224 + u32 ofdm_trig_high; 225 + u32 cck_trig_high; 226 + u32 cck_trig_low; 227 + u32 enable_ani; 228 + u8 noise_immunity_level; 229 + u32 ofdm_weaksignal_det; 230 + u32 cck_weaksignal_thr; 231 + u8 spur_immunity_level; 232 + u8 firstep_level; 233 + int8_t rssi_thr_high; 234 + int8_t rssi_thr_low; 235 + u16 diversity_control; 236 + u16 antenna_switch_swap; 237 + int serialize_regmode; 238 + int intr_mitigation; 239 #define SPUR_DISABLE 0 240 #define SPUR_ENABLE_IOCTL 1 241 #define SPUR_ENABLE_EEPROM 2 ··· 246 #define AR_BASE_FREQ_5GHZ 4900 247 #define AR_SPUR_FEEQ_BOUND_HT40 19 248 #define AR_SPUR_FEEQ_BOUND_HT20 10 249 + int spurmode; 250 + u16 spurchans[AR_EEPROM_MODAL_SPURS][2]; 251 }; 252 253 enum ath9k_tx_queue { ··· 815 u8 ah_decompMask[ATH9K_DECOMP_MASK_SIZE]; 816 u32 ah_flags; 817 enum ath9k_opmode ah_opmode; 818 + struct ath9k_ops_config ah_config; 819 + struct ath9k_hw_capabilities ah_caps; 820 int16_t ah_powerLimit; 821 u16 ah_maxPowerLevel; 822 u32 ah_tpScale; ··· 878 }; 879 880 int ath_hal_getcapability(struct ath_hal *ah, 881 + enum ath9k_capability_type type, 882 u32 capability, 883 u32 *result); 884 const struct ath9k_rate_table *ath9k_hw_getratetable(struct ath_hal *ah, ··· 947 bool ath9k_hw_phycounters(struct ath_hal *ah); 948 bool ath9k_hw_keyreset(struct ath_hal *ah, u16 entry); 949 bool ath9k_hw_getcapability(struct ath_hal *ah, 950 + enum ath9k_capability_type type, 951 u32 capability, 952 u32 *result); 953 bool ath9k_hw_setcapability(struct ath_hal *ah, 954 + enum ath9k_capability_type type, 955 u32 capability, 956 u32 setting, 957 int *status);
+6 -4
drivers/net/wireless/ath9k/beacon.c
··· 85 86 flags = ATH9K_TXDESC_NOACK; 87 88 - if (sc->sc_opmode == ATH9K_M_IBSS && ah->ah_caps.halVEOLSupport) { 89 ds->ds_link = bf->bf_daddr; /* self-linked */ 90 flags |= ATH9K_TXDESC_VEOL; 91 /* Let hardware handle antenna switching. */ ··· 376 list_del(&avp->av_bcbuf->list); 377 378 if (sc->sc_opmode == ATH9K_M_HOSTAP || 379 - !sc->sc_ah->ah_caps.halVEOLSupport) { 380 int slot; 381 /* 382 * Assign the vap to a beacon xmit slot. As ··· 940 * deal with things. 941 */ 942 intval |= ATH9K_BEACON_ENA; 943 - if (!ah->ah_caps.halVEOLSupport) 944 sc->sc_imask |= ATH9K_INT_SWBA; 945 ath_beaconq_config(sc); 946 } else if (sc->sc_opmode == ATH9K_M_HOSTAP) { ··· 959 * When using a self-linked beacon descriptor in 960 * ibss mode load it once here. 961 */ 962 - if (sc->sc_opmode == ATH9K_M_IBSS && ah->ah_caps.halVEOLSupport) 963 ath_beacon_start_adhoc(sc, 0); 964 } 965 #undef TSF_TO_TU
··· 85 86 flags = ATH9K_TXDESC_NOACK; 87 88 + if (sc->sc_opmode == ATH9K_M_IBSS && 89 + (ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) { 90 ds->ds_link = bf->bf_daddr; /* self-linked */ 91 flags |= ATH9K_TXDESC_VEOL; 92 /* Let hardware handle antenna switching. */ ··· 375 list_del(&avp->av_bcbuf->list); 376 377 if (sc->sc_opmode == ATH9K_M_HOSTAP || 378 + !(sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) { 379 int slot; 380 /* 381 * Assign the vap to a beacon xmit slot. As ··· 939 * deal with things. 940 */ 941 intval |= ATH9K_BEACON_ENA; 942 + if (!(ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) 943 sc->sc_imask |= ATH9K_INT_SWBA; 944 ath_beaconq_config(sc); 945 } else if (sc->sc_opmode == ATH9K_M_HOSTAP) { ··· 958 * When using a self-linked beacon descriptor in 959 * ibss mode load it once here. 960 */ 961 + if (sc->sc_opmode == ATH9K_M_IBSS && 962 + (ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) 963 ath_beacon_start_adhoc(sc, 0); 964 } 965 #undef TSF_TO_TU
+31 -27
drivers/net/wireless/ath9k/core.c
··· 536 * sc_chainmask_auto_sel is used for internal global auto-switching 537 * enabled/disabled setting 538 */ 539 - if (sc->sc_ah->ah_caps.halTxChainMask != ATH_CHAINMASK_SEL_3X3) { 540 cm->cur_tx_mask = sc->sc_tx_chainmask; 541 return cm->cur_tx_mask; 542 } ··· 580 { 581 sc->sc_update_chainmask = 1; 582 if (is_ht) { 583 - sc->sc_tx_chainmask = sc->sc_ah->ah_caps.halTxChainMask; 584 - sc->sc_rx_chainmask = sc->sc_ah->ah_caps.halRxChainMask; 585 } else { 586 sc->sc_tx_chainmask = 1; 587 sc->sc_rx_chainmask = 1; ··· 780 ath_stop(sc); 781 782 /* Initialize chanmask selection */ 783 - sc->sc_tx_chainmask = ah->ah_caps.halTxChainMask; 784 - sc->sc_rx_chainmask = ah->ah_caps.halRxChainMask; 785 786 /* Reset SERDES registers */ 787 ath9k_hw_configpcipowersave(ah, 0); ··· 832 | ATH9K_INT_RXEOL | ATH9K_INT_RXORN 833 | ATH9K_INT_FATAL | ATH9K_INT_GLOBAL; 834 835 - if (ah->ah_caps.halGTTSupport) 836 sc->sc_imask |= ATH9K_INT_GTT; 837 838 - if (ah->ah_caps.halHTSupport) 839 sc->sc_imask |= ATH9K_INT_CST; 840 841 /* ··· 851 * that does, if not overridden by configuration, 852 * enable the TIM interrupt when operating as station. 853 */ 854 - if (ah->ah_caps.halEnhancedPmSupport && sc->sc_opmode == ATH9K_M_STA && 855 - !sc->sc_config.swBeaconProcess) 856 sc->sc_imask |= ATH9K_INT_TIM; 857 /* 858 * Don't enable interrupts here as we've not yet built our ··· 1062 ath9k_hw_set_interrupts(ah, sc->sc_imask); 1063 } 1064 if (status & ATH9K_INT_TIM_TIMER) { 1065 - if (!ah->ah_caps.halAutoSleepSupport) { 1066 /* Clear RxAbort bit so that we can 1067 * receive frames */ 1068 ath9k_hw_setrxabort(ah, 0); ··· 1168 sc->sc_ah = ah; 1169 1170 /* Get the chipset-specific aggr limit. */ 1171 - sc->sc_rtsaggrlimit = ah->ah_caps.halRtsAggrLimit; 1172 1173 /* Get the hardware key cache size. */ 1174 - sc->sc_keymax = ah->ah_caps.halKeyCacheSize; 1175 if (sc->sc_keymax > ATH_KEYMAX) { 1176 DPRINTF(sc, ATH_DBG_KEYCACHE, 1177 "%s: Warning, using only %u entries in %u key cache\n", ··· 1286 goto bad2; 1287 } 1288 1289 - if (ath9k_hw_getcapability(ah, HAL_CAP_CIPHER, 1290 ATH9K_CIPHER_TKIP, NULL)) { 1291 /* 1292 * Whether we should enable h/w TKIP MIC. ··· 1294 * report WMM capable, so it's always safe to turn on 1295 * TKIP MIC in this case. 1296 */ 1297 - ath9k_hw_setcapability(sc->sc_ah, HAL_CAP_TKIP_MIC, 0, 1, NULL); 1298 } 1299 1300 /* ··· 1304 * With split mic keys the number of stations is limited 1305 * to 27 otherwise 59. 1306 */ 1307 - if (ath9k_hw_getcapability(ah, HAL_CAP_CIPHER, 1308 ATH9K_CIPHER_TKIP, NULL) 1309 - && ath9k_hw_getcapability(ah, HAL_CAP_CIPHER, 1310 ATH9K_CIPHER_MIC, NULL) 1311 - && ath9k_hw_getcapability(ah, HAL_CAP_TKIP_SPLIT, 1312 0, NULL)) 1313 sc->sc_splitmic = 1; 1314 1315 /* turn on mcast key search if possible */ 1316 - if (!ath9k_hw_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 0, NULL)) 1317 - (void)ath9k_hw_setcapability(ah, HAL_CAP_MCAST_KEYSRCH, 1, 1318 1, NULL); 1319 1320 sc->sc_config.txpowlimit = ATH_TXPOWER_MAX; 1321 sc->sc_config.txpowlimit_override = 0; 1322 1323 /* 11n Capabilities */ 1324 - if (ah->ah_caps.halHTSupport) { 1325 sc->sc_txaggr = 1; 1326 sc->sc_rxaggr = 1; 1327 } 1328 1329 - sc->sc_tx_chainmask = ah->ah_caps.halTxChainMask; 1330 - sc->sc_rx_chainmask = ah->ah_caps.halRxChainMask; 1331 1332 /* Configuration for rx chain detection */ 1333 sc->sc_rxchaindetect_ref = 0; ··· 1336 sc->sc_rxchaindetect_delta5GHz = 30; 1337 sc->sc_rxchaindetect_delta2GHz = 30; 1338 1339 - ath9k_hw_setcapability(ah, HAL_CAP_DIVERSITY, 1, true, NULL); 1340 sc->sc_defant = ath9k_hw_getdefantenna(ah); 1341 1342 ath9k_hw_getmac(ah, sc->sc_myaddr); 1343 - if (ah->ah_caps.halBssIdMaskSupport) { 1344 ath9k_hw_getbssidmask(ah, sc->sc_bssidmask); 1345 ATH_SET_VAP_BSSID_MASK(sc->sc_bssidmask); 1346 ath9k_hw_setbssidmask(ah, sc->sc_bssidmask); ··· 1558 if (sc->sc_curtxpow != sc->sc_config.txpowlimit) { 1559 ath9k_hw_set_txpowerlimit(ah, sc->sc_config.txpowlimit); 1560 /* read back in case value is clamped */ 1561 - ath9k_hw_getcapability(ah, HAL_CAP_TXPOW, 1, &txpow); 1562 sc->sc_curtxpow = txpow; 1563 } 1564 } ··· 1760 * descriptors that cross the 4K page boundary. Assume 1761 * one skipped descriptor per 4K page. 1762 */ 1763 - if (!(sc->sc_ah->ah_caps.hal4kbSplitTransSupport)) { 1764 u32 ndesc_skipped = 1765 ATH_DESC_4KB_BOUND_NUM_SKIPPED(dd->dd_desc_len); 1766 u32 dma_len; ··· 1801 bf->bf_desc = ds; 1802 bf->bf_daddr = DS2PHYS(dd, ds); 1803 1804 - if (!(sc->sc_ah->ah_caps.hal4kbSplitTransSupport)) { 1805 /* 1806 * Skip descriptor addresses which can cause 4KB 1807 * boundary crossing (addr + length) with a 32 dword
··· 536 * sc_chainmask_auto_sel is used for internal global auto-switching 537 * enabled/disabled setting 538 */ 539 + if (sc->sc_ah->ah_caps.tx_chainmask != ATH_CHAINMASK_SEL_3X3) { 540 cm->cur_tx_mask = sc->sc_tx_chainmask; 541 return cm->cur_tx_mask; 542 } ··· 580 { 581 sc->sc_update_chainmask = 1; 582 if (is_ht) { 583 + sc->sc_tx_chainmask = sc->sc_ah->ah_caps.tx_chainmask; 584 + sc->sc_rx_chainmask = sc->sc_ah->ah_caps.rx_chainmask; 585 } else { 586 sc->sc_tx_chainmask = 1; 587 sc->sc_rx_chainmask = 1; ··· 780 ath_stop(sc); 781 782 /* Initialize chanmask selection */ 783 + sc->sc_tx_chainmask = ah->ah_caps.tx_chainmask; 784 + sc->sc_rx_chainmask = ah->ah_caps.rx_chainmask; 785 786 /* Reset SERDES registers */ 787 ath9k_hw_configpcipowersave(ah, 0); ··· 832 | ATH9K_INT_RXEOL | ATH9K_INT_RXORN 833 | ATH9K_INT_FATAL | ATH9K_INT_GLOBAL; 834 835 + if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_GTT) 836 sc->sc_imask |= ATH9K_INT_GTT; 837 838 + if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) 839 sc->sc_imask |= ATH9K_INT_CST; 840 841 /* ··· 851 * that does, if not overridden by configuration, 852 * enable the TIM interrupt when operating as station. 853 */ 854 + if ((ah->ah_caps.hw_caps & ATH9K_HW_CAP_ENHANCEDPM) && 855 + (sc->sc_opmode == ATH9K_M_STA) && 856 + !sc->sc_config.swBeaconProcess) 857 sc->sc_imask |= ATH9K_INT_TIM; 858 /* 859 * Don't enable interrupts here as we've not yet built our ··· 1061 ath9k_hw_set_interrupts(ah, sc->sc_imask); 1062 } 1063 if (status & ATH9K_INT_TIM_TIMER) { 1064 + if (!(ah->ah_caps.hw_caps & 1065 + ATH9K_HW_CAP_AUTOSLEEP)) { 1066 /* Clear RxAbort bit so that we can 1067 * receive frames */ 1068 ath9k_hw_setrxabort(ah, 0); ··· 1166 sc->sc_ah = ah; 1167 1168 /* Get the chipset-specific aggr limit. */ 1169 + sc->sc_rtsaggrlimit = ah->ah_caps.rts_aggr_limit; 1170 1171 /* Get the hardware key cache size. */ 1172 + sc->sc_keymax = ah->ah_caps.keycache_size; 1173 if (sc->sc_keymax > ATH_KEYMAX) { 1174 DPRINTF(sc, ATH_DBG_KEYCACHE, 1175 "%s: Warning, using only %u entries in %u key cache\n", ··· 1284 goto bad2; 1285 } 1286 1287 + if (ath9k_hw_getcapability(ah, ATH9K_CAP_CIPHER, 1288 ATH9K_CIPHER_TKIP, NULL)) { 1289 /* 1290 * Whether we should enable h/w TKIP MIC. ··· 1292 * report WMM capable, so it's always safe to turn on 1293 * TKIP MIC in this case. 1294 */ 1295 + ath9k_hw_setcapability(sc->sc_ah, ATH9K_CAP_TKIP_MIC, 1296 + 0, 1, NULL); 1297 } 1298 1299 /* ··· 1301 * With split mic keys the number of stations is limited 1302 * to 27 otherwise 59. 1303 */ 1304 + if (ath9k_hw_getcapability(ah, ATH9K_CAP_CIPHER, 1305 ATH9K_CIPHER_TKIP, NULL) 1306 + && ath9k_hw_getcapability(ah, ATH9K_CAP_CIPHER, 1307 ATH9K_CIPHER_MIC, NULL) 1308 + && ath9k_hw_getcapability(ah, ATH9K_CAP_TKIP_SPLIT, 1309 0, NULL)) 1310 sc->sc_splitmic = 1; 1311 1312 /* turn on mcast key search if possible */ 1313 + if (!ath9k_hw_getcapability(ah, ATH9K_CAP_MCAST_KEYSRCH, 0, NULL)) 1314 + (void)ath9k_hw_setcapability(ah, ATH9K_CAP_MCAST_KEYSRCH, 1, 1315 1, NULL); 1316 1317 sc->sc_config.txpowlimit = ATH_TXPOWER_MAX; 1318 sc->sc_config.txpowlimit_override = 0; 1319 1320 /* 11n Capabilities */ 1321 + if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) { 1322 sc->sc_txaggr = 1; 1323 sc->sc_rxaggr = 1; 1324 } 1325 1326 + sc->sc_tx_chainmask = ah->ah_caps.tx_chainmask; 1327 + sc->sc_rx_chainmask = ah->ah_caps.rx_chainmask; 1328 1329 /* Configuration for rx chain detection */ 1330 sc->sc_rxchaindetect_ref = 0; ··· 1333 sc->sc_rxchaindetect_delta5GHz = 30; 1334 sc->sc_rxchaindetect_delta2GHz = 30; 1335 1336 + ath9k_hw_setcapability(ah, ATH9K_CAP_DIVERSITY, 1, true, NULL); 1337 sc->sc_defant = ath9k_hw_getdefantenna(ah); 1338 1339 ath9k_hw_getmac(ah, sc->sc_myaddr); 1340 + if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) { 1341 ath9k_hw_getbssidmask(ah, sc->sc_bssidmask); 1342 ATH_SET_VAP_BSSID_MASK(sc->sc_bssidmask); 1343 ath9k_hw_setbssidmask(ah, sc->sc_bssidmask); ··· 1555 if (sc->sc_curtxpow != sc->sc_config.txpowlimit) { 1556 ath9k_hw_set_txpowerlimit(ah, sc->sc_config.txpowlimit); 1557 /* read back in case value is clamped */ 1558 + ath9k_hw_getcapability(ah, ATH9K_CAP_TXPOW, 1, &txpow); 1559 sc->sc_curtxpow = txpow; 1560 } 1561 } ··· 1757 * descriptors that cross the 4K page boundary. Assume 1758 * one skipped descriptor per 4K page. 1759 */ 1760 + if (!(sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_4KB_SPLITTRANS)) { 1761 u32 ndesc_skipped = 1762 ATH_DESC_4KB_BOUND_NUM_SKIPPED(dd->dd_desc_len); 1763 u32 dma_len; ··· 1798 bf->bf_desc = ds; 1799 bf->bf_daddr = DS2PHYS(dd, ds); 1800 1801 + if (!(sc->sc_ah->ah_caps.hw_caps & 1802 + ATH9K_HW_CAP_4KB_SPLITTRANS)) { 1803 /* 1804 * Skip descriptor addresses which can cause 4KB 1805 * boundary crossing (addr + length) with a 32 dword
+186 -183
drivers/net/wireless/ath9k/hw.c
··· 335 { 336 int i; 337 338 - ah->ah_config.ath_hal_dma_beacon_response_time = 2; 339 - ah->ah_config.ath_hal_sw_beacon_response_time = 10; 340 - ah->ah_config.ath_hal_additional_swba_backoff = 0; 341 - ah->ah_config.ath_hal_6mb_ack = 0x0; 342 - ah->ah_config.ath_hal_cwmIgnoreExtCCA = 0; 343 - ah->ah_config.ath_hal_pciePowerSaveEnable = 0; 344 - ah->ah_config.ath_hal_pcieL1SKPEnable = 0; 345 - ah->ah_config.ath_hal_pcieClockReq = 0; 346 - ah->ah_config.ath_hal_pciePowerReset = 0x100; 347 - ah->ah_config.ath_hal_pcieRestore = 0; 348 - ah->ah_config.ath_hal_pcieWaen = 0; 349 - ah->ah_config.ath_hal_analogShiftReg = 1; 350 - ah->ah_config.ath_hal_htEnable = 1; 351 - ah->ah_config.ath_hal_ofdmTrigLow = 200; 352 - ah->ah_config.ath_hal_ofdmTrigHigh = 500; 353 - ah->ah_config.ath_hal_cckTrigHigh = 200; 354 - ah->ah_config.ath_hal_cckTrigLow = 100; 355 - ah->ah_config.ath_hal_enableANI = 0; 356 - ah->ah_config.ath_hal_noiseImmunityLvl = 4; 357 - ah->ah_config.ath_hal_ofdmWeakSigDet = 1; 358 - ah->ah_config.ath_hal_cckWeakSigThr = 0; 359 - ah->ah_config.ath_hal_spurImmunityLvl = 2; 360 - ah->ah_config.ath_hal_firStepLvl = 0; 361 - ah->ah_config.ath_hal_rssiThrHigh = 40; 362 - ah->ah_config.ath_hal_rssiThrLow = 7; 363 - ah->ah_config.ath_hal_diversityControl = 0; 364 - ah->ah_config.ath_hal_antennaSwitchSwap = 0; 365 366 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { 367 - ah->ah_config.ath_hal_spurChans[i][0] = AR_NO_SPUR; 368 - ah->ah_config.ath_hal_spurChans[i][1] = AR_NO_SPUR; 369 } 370 371 - ah->ah_config.ath_hal_intrMitigation = 0; 372 } 373 374 static inline void ath9k_hw_override_ini(struct ath_hal *ah, ··· 458 459 REG_WRITE(ah, reg, regVal); 460 461 - if (ah->ah_config.ath_hal_analogShiftReg) 462 udelay(100); 463 464 return; ··· 1001 } 1002 1003 bool ath9k_hw_setcapability(struct ath_hal *ah, 1004 - enum hal_capability_type type, 1005 u32 capability, 1006 u32 setting, 1007 int *status) ··· 1010 u32 v; 1011 1012 switch (type) { 1013 - case HAL_CAP_TKIP_MIC: 1014 if (setting) 1015 ahp->ah_staId1Defaults |= 1016 AR_STA_ID1_CRPT_MIC_ENABLE; ··· 1018 ahp->ah_staId1Defaults &= 1019 ~AR_STA_ID1_CRPT_MIC_ENABLE; 1020 return true; 1021 - case HAL_CAP_DIVERSITY: 1022 v = REG_READ(ah, AR_PHY_CCK_DETECT); 1023 if (setting) 1024 v |= AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV; ··· 1026 v &= ~AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV; 1027 REG_WRITE(ah, AR_PHY_CCK_DETECT, v); 1028 return true; 1029 - case HAL_CAP_MCAST_KEYSRCH: 1030 if (setting) 1031 ahp->ah_staId1Defaults |= AR_STA_ID1_MCAST_KSRCH; 1032 else 1033 ahp->ah_staId1Defaults &= ~AR_STA_ID1_MCAST_KSRCH; 1034 return true; 1035 - case HAL_CAP_TSF_ADJUST: 1036 if (setting) 1037 ahp->ah_miscMode |= AR_PCU_TX_ADD_TSF; 1038 else ··· 1161 u32 macmode; 1162 1163 if (mode == ATH9K_HT_MACMODE_2040 && 1164 - !ah->ah_config.ath_hal_cwmIgnoreExtCCA) 1165 macmode = AR_2040_JOINED_RX_CLEAR; 1166 else 1167 macmode = 0; ··· 1214 ah->ah_tpScale = ATH9K_TP_SCALE_MAX; 1215 1216 ahp->ah_atimWindow = 0; 1217 - ahp->ah_diversityControl = ah->ah_config.ath_hal_diversityControl; 1218 ahp->ah_antennaSwitchSwap = 1219 - ah->ah_config.ath_hal_antennaSwitchSwap; 1220 1221 ahp->ah_staId1Defaults = AR_STA_ID1_CRPT_MIC_ENABLE; 1222 ahp->ah_beaconInterval = 100; ··· 1371 1372 DPRINTF(ah->ah_sc, ATH_DBG_ANI, 1373 "Getting spur idx %d is2Ghz. %d val %x\n", 1374 - i, is2GHz, ah->ah_config.ath_hal_spurChans[i][is2GHz]); 1375 1376 - switch (ah->ah_config.ath_hal_spurMode) { 1377 case SPUR_DISABLE: 1378 break; 1379 case SPUR_ENABLE_IOCTL: 1380 - spur_val = ah->ah_config.ath_hal_spurChans[i][is2GHz]; 1381 DPRINTF(ah->ah_sc, ATH_DBG_ANI, 1382 "Getting spur val from new loc. %d\n", spur_val); 1383 break; ··· 2094 ath9k_enable_mib_counters(ah); 2095 } 2096 ahp->ah_aniPeriod = ATH9K_ANI_PERIOD; 2097 - if (ah->ah_config.ath_hal_enableANI) 2098 ahp->ah_procPhyErr |= HAL_PROCESS_ANI; 2099 } 2100 ··· 2504 ATH9K_RX_FILTER_PHYERR); 2505 if (ah->ah_opmode == ATH9K_M_HOSTAP) { 2506 ahp->ah_curani->ofdmTrigHigh = 2507 - ah->ah_config.ath_hal_ofdmTrigHigh; 2508 ahp->ah_curani->ofdmTrigLow = 2509 - ah->ah_config.ath_hal_ofdmTrigLow; 2510 ahp->ah_curani->cckTrigHigh = 2511 - ah->ah_config.ath_hal_cckTrigHigh; 2512 ahp->ah_curani->cckTrigLow = 2513 - ah->ah_config.ath_hal_cckTrigLow; 2514 } 2515 ath9k_ani_restart(ah); 2516 return; ··· 2870 2871 static u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio) 2872 { 2873 - if (gpio >= ah->ah_caps.halNumGpioPins) 2874 return 0xffffffff; 2875 2876 if (AR_SREV_9280_10_OR_LATER(ah)) { ··· 2947 static bool ath9k_hw_fill_cap_info(struct ath_hal *ah) 2948 { 2949 struct ath_hal_5416 *ahp = AH5416(ah); 2950 - struct hal_capabilities *pCap = &ah->ah_caps; 2951 u16 capField = 0, eeval; 2952 2953 eeval = ath9k_hw_get_eeprom(ahp, EEP_REG_0); ··· 2970 ah->ah_currentRD); 2971 } 2972 2973 - pCap->halWirelessModes = 0; 2974 eeval = ath9k_hw_get_eeprom(ahp, EEP_OP_MODE); 2975 2976 if (eeval & AR5416_OPFLAGS_11A) { 2977 - pCap->halWirelessModes |= ATH9K_MODE_SEL_11A | 2978 - ((!ah->ah_config.ath_hal_htEnable 2979 || (eeval & AR5416_OPFLAGS_N_5G_HT20)) ? 0 2980 : (ATH9K_MODE_SEL_11NA_HT20 | 2981 ((eeval & AR5416_OPFLAGS_N_5G_HT40) ? 0 ··· 2983 ATH9K_MODE_SEL_11NA_HT40MINUS)))); 2984 } 2985 if (eeval & AR5416_OPFLAGS_11G) { 2986 - pCap->halWirelessModes |= 2987 ATH9K_MODE_SEL_11B | ATH9K_MODE_SEL_11G | 2988 - ((!ah->ah_config.ath_hal_htEnable 2989 || (eeval & AR5416_OPFLAGS_N_2G_HT20)) ? 0 2990 : (ATH9K_MODE_SEL_11NG_HT20 | 2991 ((eeval & AR5416_OPFLAGS_N_2G_HT40) ? 0 ··· 2993 ATH9K_MODE_SEL_11NG_HT40MINUS)))); 2994 2995 } 2996 - pCap->halTxChainMask = ath9k_hw_get_eeprom(ahp, EEP_TX_MASK); 2997 if ((ah->ah_isPciExpress) 2998 || (eeval & AR5416_OPFLAGS_11A)) { 2999 - pCap->halRxChainMask = 3000 ath9k_hw_get_eeprom(ahp, EEP_RX_MASK); 3001 } else { 3002 - pCap->halRxChainMask = 3003 (ath9k_hw_gpio_get(ah, 0)) ? 0x5 : 0x7; 3004 } 3005 3006 if (!(AR_SREV_9280(ah) && (ah->ah_macRev == 0))) 3007 ahp->ah_miscMode |= AR_PCU_MIC_NEW_LOC_ENA; 3008 3009 - pCap->halLow2GhzChan = 2312; 3010 - pCap->halHigh2GhzChan = 2732; 3011 3012 - pCap->halLow5GhzChan = 4920; 3013 - pCap->halHigh5GhzChan = 6100; 3014 3015 - pCap->halCipherCkipSupport = false; 3016 - pCap->halCipherTkipSupport = true; 3017 - pCap->halCipherAesCcmSupport = true; 3018 3019 - pCap->halMicCkipSupport = false; 3020 - pCap->halMicTkipSupport = true; 3021 - pCap->halMicAesCcmSupport = true; 3022 3023 - pCap->halChanSpreadSupport = true; 3024 3025 - pCap->halHTSupport = 3026 - ah->ah_config.ath_hal_htEnable ? true : false; 3027 - pCap->halGTTSupport = true; 3028 - pCap->halVEOLSupport = true; 3029 - pCap->halBssIdMaskSupport = true; 3030 - pCap->halMcastKeySrchSupport = false; 3031 3032 if (capField & AR_EEPROM_EEPCAP_MAXQCU) 3033 - pCap->halTotalQueues = 3034 MS(capField, AR_EEPROM_EEPCAP_MAXQCU); 3035 else 3036 - pCap->halTotalQueues = ATH9K_NUM_TX_QUEUES; 3037 3038 if (capField & AR_EEPROM_EEPCAP_KC_ENTRIES) 3039 - pCap->halKeyCacheSize = 3040 1 << MS(capField, AR_EEPROM_EEPCAP_KC_ENTRIES); 3041 else 3042 - pCap->halKeyCacheSize = AR_KEYTABLE_SIZE; 3043 3044 - pCap->halFastCCSupport = true; 3045 - pCap->halNumMRRetries = 4; 3046 - pCap->halTxTrigLevelMax = MAX_TX_FIFO_THRESHOLD; 3047 3048 if (AR_SREV_9280_10_OR_LATER(ah)) 3049 - pCap->halNumGpioPins = AR928X_NUM_GPIO; 3050 else 3051 - pCap->halNumGpioPins = AR_NUM_GPIO; 3052 3053 if (AR_SREV_9280_10_OR_LATER(ah)) { 3054 - pCap->halWowSupport = true; 3055 - pCap->halWowMatchPatternExact = true; 3056 } else { 3057 - pCap->halWowSupport = false; 3058 - pCap->halWowMatchPatternExact = false; 3059 } 3060 3061 if (AR_SREV_9160_10_OR_LATER(ah) || AR_SREV_9100(ah)) { 3062 - pCap->halCSTSupport = true; 3063 - pCap->halRtsAggrLimit = ATH_AMPDU_LIMIT_MAX; 3064 } else { 3065 - pCap->halRtsAggrLimit = (8 * 1024); 3066 } 3067 3068 - pCap->halEnhancedPmSupport = true; 3069 3070 ah->ah_rfsilent = ath9k_hw_get_eeprom(ahp, EEP_RF_SILENT); 3071 if (ah->ah_rfsilent & EEP_RFSILENT_ENABLED) { ··· 3077 ahp->ah_polarity = 3078 MS(ah->ah_rfsilent, EEP_RFSILENT_POLARITY); 3079 3080 - ath9k_hw_setcapability(ah, HAL_CAP_RFSILENT, 1, true, 3081 NULL); 3082 - pCap->halRfSilentSupport = true; 3083 } 3084 3085 if ((ah->ah_macVersion == AR_SREV_VERSION_5416_PCI) || ··· 3087 (ah->ah_macVersion == AR_SREV_VERSION_9160) || 3088 (ah->ah_macVersion == AR_SREV_VERSION_9100) || 3089 (ah->ah_macVersion == AR_SREV_VERSION_9280)) 3090 - pCap->halAutoSleepSupport = false; 3091 else 3092 - pCap->halAutoSleepSupport = true; 3093 3094 if (AR_SREV_9280(ah)) 3095 - pCap->hal4kbSplitTransSupport = false; 3096 else 3097 - pCap->hal4kbSplitTransSupport = true; 3098 3099 if (ah->ah_currentRDExt & (1 << REG_EXT_JAPAN_MIDBAND)) { 3100 - pCap->halRegCap = 3101 AR_EEPROM_EEREGCAP_EN_KK_NEW_11A | 3102 AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN | 3103 AR_EEPROM_EEREGCAP_EN_KK_U2 | 3104 AR_EEPROM_EEREGCAP_EN_KK_MIDBAND; 3105 } else { 3106 - pCap->halRegCap = 3107 AR_EEPROM_EEREGCAP_EN_KK_NEW_11A | 3108 AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN; 3109 } 3110 3111 - pCap->halRegCap |= AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND; 3112 3113 - pCap->halNumAntCfg5GHz = 3114 ath9k_hw_get_num_ant_config(ahp, HAL_FREQ_BAND_5GHZ); 3115 - pCap->halNumAntCfg2GHz = 3116 ath9k_hw_get_num_ant_config(ahp, HAL_FREQ_BAND_2GHZ); 3117 3118 return true; ··· 3154 { 3155 REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV); 3156 if (setChip) { 3157 - struct hal_capabilities *pCap = &ah->ah_caps; 3158 3159 - if (!pCap->halAutoSleepSupport) { 3160 REG_WRITE(ah, AR_RTC_FORCE_WAKE, 3161 AR_RTC_FORCE_WAKE_ON_INT); 3162 } else { ··· 3265 3266 ath9k_hw_set_defaults(ah); 3267 3268 - if (ah->ah_config.ath_hal_intrMitigation != 0) 3269 ahp->ah_intrMitigation = true; 3270 3271 if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) { ··· 3282 goto bad; 3283 } 3284 3285 - if (ah->ah_config.ath_hal_serializeRegMode == SER_REG_MODE_AUTO) { 3286 if (ah->ah_macVersion == AR_SREV_VERSION_5416_PCI) { 3287 - ah->ah_config.ath_hal_serializeRegMode = 3288 SER_REG_MODE_ON; 3289 } else { 3290 - ah->ah_config.ath_hal_serializeRegMode = 3291 SER_REG_MODE_OFF; 3292 } 3293 } 3294 DPRINTF(ah->ah_sc, ATH_DBG_RESET, 3295 - "%s: ath_hal_serializeRegMode is %d\n", 3296 - __func__, ah->ah_config.ath_hal_serializeRegMode); 3297 3298 if ((ah->ah_macVersion != AR_SREV_VERSION_5416_PCI) && 3299 (ah->ah_macVersion != AR_SREV_VERSION_5416_PCIE) && ··· 3337 } 3338 3339 if (AR_SREV_9160(ah)) { 3340 - ah->ah_config.ath_hal_enableANI = 1; 3341 ahp->ah_ani_function = (ATH9K_ANI_SPUR_IMMUNITY_LEVEL | 3342 ATH9K_ANI_FIRSTEP_LEVEL); 3343 } else { ··· 3358 INIT_INI_ARRAY(&ahp->ah_iniCommon, ar9280Common_9280_2, 3359 ARRAY_SIZE(ar9280Common_9280_2), 2); 3360 3361 - if (ah->ah_config.ath_hal_pcieClockReq) { 3362 INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes, 3363 ar9280PciePhy_clkreq_off_L1_9280, 3364 ARRAY_SIZE ··· 3531 u16 flags, u16 *low, 3532 u16 *high) 3533 { 3534 - struct hal_capabilities *pCap = &ah->ah_caps; 3535 3536 if (flags & CHANNEL_5GHZ) { 3537 - *low = pCap->halLow5GhzChan; 3538 - *high = pCap->halHigh5GhzChan; 3539 return true; 3540 } 3541 if ((flags & CHANNEL_2GHZ)) { 3542 - *low = pCap->halLow2GhzChan; 3543 - *high = pCap->halHigh2GhzChan; 3544 3545 return true; 3546 } ··· 3911 if (ah->ah_isPciExpress != true) 3912 return; 3913 3914 - if (ah->ah_config.ath_hal_pciePowerSaveEnable == 2) 3915 return; 3916 3917 if (restore) ··· 3932 REG_WRITE(ah, AR_PCIE_SERDES, 0x13160820); 3933 REG_WRITE(ah, AR_PCIE_SERDES, 0xe5980560); 3934 3935 - if (ah->ah_config.ath_hal_pcieClockReq) 3936 REG_WRITE(ah, AR_PCIE_SERDES, 0x401deffc); 3937 else 3938 REG_WRITE(ah, AR_PCIE_SERDES, 0x401deffd); ··· 3959 3960 REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); 3961 3962 - if (ah->ah_config.ath_hal_pcieWaen) { 3963 - REG_WRITE(ah, AR_WA, ah->ah_config.ath_hal_pcieWaen); 3964 } else { 3965 if (AR_SREV_9280(ah)) 3966 REG_WRITE(ah, AR_WA, 0x0040073f); ··· 4693 ath9k_hw_get_channel_centers(ah, chan, &centers); 4694 freq = centers.synth_center; 4695 4696 - ah->ah_config.ath_hal_spurMode = SPUR_ENABLE_EEPROM; 4697 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { 4698 cur_bb_spur = ath9k_hw_eeprom_get_spur_chan(ah, i, is2GHz); 4699 ··· 5407 REG_WRITE(ah, reg, val); 5408 5409 if (reg >= 0x7800 && reg < 0x78a0 5410 - && ah->ah_config.ath_hal_analogShiftReg) { 5411 udelay(100); 5412 } 5413 ··· 5421 REG_WRITE(ah, reg, val); 5422 5423 if (reg >= 0x7800 && reg < 0x78a0 5424 - && ah->ah_config.ath_hal_analogShiftReg) { 5425 udelay(100); 5426 } 5427 ··· 5924 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, 5925 AR_GPIO_JTAG_DISABLE); 5926 5927 - if (ah->ah_caps.halWirelessModes & ATH9K_MODE_SEL_11A) { 5928 if (IS_CHAN_5GHZ(chan)) 5929 ath9k_hw_set_gpio(ah, 9, 0); 5930 else ··· 5958 | macStaId1 5959 | AR_STA_ID1_RTS_USE_DEF 5960 | (ah->ah_config. 5961 - ath_hal_6mb_ack ? AR_STA_ID1_ACKCTS_6MB : 0) 5962 | ahp->ah_staId1Defaults); 5963 ath9k_hw_set_operating_mode(ah, opmode); 5964 ··· 5987 REG_WRITE(ah, AR_DQCUMASK(i), 1 << i); 5988 5989 ahp->ah_intrTxqs = 0; 5990 - for (i = 0; i < ah->ah_caps.halTotalQueues; i++) 5991 ath9k_hw_resettxqueue(ah, i); 5992 5993 ath9k_hw_init_interrupt_masks(ah, opmode); ··· 6625 *antenna_cfgd = true; 6626 break; 6627 case ATH9K_ANT_FIXED_B: 6628 - if (ah->ah_caps.halTxChainMask > 6629 ATH9K_ANTENNA1_CHAINMASK) { 6630 *tx_chainmask = ATH9K_ANTENNA1_CHAINMASK; 6631 } ··· 6653 } 6654 6655 bool 6656 - ath9k_hw_getcapability(struct ath_hal *ah, enum hal_capability_type type, 6657 u32 capability, u32 *result) 6658 { 6659 struct ath_hal_5416 *ahp = AH5416(ah); 6660 - const struct hal_capabilities *pCap = &ah->ah_caps; 6661 6662 switch (type) { 6663 - case HAL_CAP_CIPHER: 6664 switch (capability) { 6665 case ATH9K_CIPHER_AES_CCM: 6666 case ATH9K_CIPHER_AES_OCB: ··· 6672 default: 6673 return false; 6674 } 6675 - case HAL_CAP_TKIP_MIC: 6676 switch (capability) { 6677 case 0: 6678 return true; ··· 6681 AR_STA_ID1_CRPT_MIC_ENABLE) ? true : 6682 false; 6683 } 6684 - case HAL_CAP_TKIP_SPLIT: 6685 return (ahp->ah_miscMode & AR_PCU_MIC_NEW_LOC_ENA) ? 6686 false : true; 6687 - case HAL_CAP_WME_TKIPMIC: 6688 return 0; 6689 - case HAL_CAP_PHYCOUNTERS: 6690 return ahp->ah_hasHwPhyCounters ? 0 : -ENXIO; 6691 - case HAL_CAP_DIVERSITY: 6692 return (REG_READ(ah, AR_PHY_CCK_DETECT) & 6693 AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV) ? 6694 true : false; 6695 - case HAL_CAP_PHYDIAG: 6696 return true; 6697 - case HAL_CAP_MCAST_KEYSRCH: 6698 switch (capability) { 6699 case 0: 6700 return true; ··· 6708 } 6709 } 6710 return false; 6711 - case HAL_CAP_TSF_ADJUST: 6712 return (ahp->ah_miscMode & AR_PCU_TX_ADD_TSF) ? 6713 true : false; 6714 - case HAL_CAP_RFSILENT: 6715 if (capability == 3) 6716 return false; 6717 - case HAL_CAP_ANT_CFG_2GHZ: 6718 - *result = pCap->halNumAntCfg2GHz; 6719 return true; 6720 - case HAL_CAP_ANT_CFG_5GHZ: 6721 - *result = pCap->halNumAntCfg5GHz; 6722 return true; 6723 - case HAL_CAP_TXPOW: 6724 switch (capability) { 6725 case 0: 6726 return 0; ··· 6745 { 6746 struct ath_hal_5416 *ahp = AH5416(ah); 6747 struct ath9k_channel *chan = ah->ah_curchan; 6748 - const struct hal_capabilities *pCap = &ah->ah_caps; 6749 u16 ant_config; 6750 u32 halNumAntConfig; 6751 6752 halNumAntConfig = 6753 - IS_CHAN_2GHZ(chan) ? pCap->halNumAntCfg2GHz : pCap-> 6754 - halNumAntCfg5GHz; 6755 6756 if (cfg < halNumAntConfig) { 6757 if (!ath9k_hw_get_eeprom_antenna_cfg(ahp, chan, ··· 6787 { 6788 u32 isr = 0; 6789 u32 mask2 = 0; 6790 - struct hal_capabilities *pCap = &ah->ah_caps; 6791 u32 sync_cause = 0; 6792 bool fatal_int = false; 6793 ··· 6871 } 6872 6873 if (!AR_SREV_9100(ah)) { 6874 - if (!pCap->halAutoSleepSupport) { 6875 u32 isr5 = REG_READ(ah, AR_ISR_S5_S); 6876 if (isr5 & AR_ISR_S5_TIM_TIMER) 6877 *masked |= ATH9K_INT_TIM_TIMER; ··· 6930 struct ath_hal_5416 *ahp = AH5416(ah); 6931 u32 omask = ahp->ah_maskReg; 6932 u32 mask, mask2; 6933 - struct hal_capabilities *pCap = &ah->ah_caps; 6934 6935 DPRINTF(ah->ah_sc, ATH_DBG_INTERRUPT, "%s: 0x%x => 0x%x\n", __func__, 6936 omask, ints); ··· 6968 mask |= AR_IMR_RXMINTR | AR_IMR_RXINTM; 6969 else 6970 mask |= AR_IMR_RXOK | AR_IMR_RXDESC; 6971 - if (!pCap->halAutoSleepSupport) 6972 mask |= AR_IMR_GENTMR; 6973 } 6974 ··· 7005 REG_WRITE(ah, AR_IMR_S2, mask | mask2); 7006 ahp->ah_maskReg = ints; 7007 7008 - if (!pCap->halAutoSleepSupport) { 7009 if (ints & ATH9K_INT_TIM_TIMER) 7010 REG_SET_BIT(ah, AR_IMR_S5, AR_IMR_S5_TIM_TIMER); 7011 else ··· 7064 REG_WRITE(ah, AR_NEXT_DMA_BEACON_ALERT, 7065 TU_TO_USEC(next_beacon - 7066 ah->ah_config. 7067 - ath_hal_dma_beacon_response_time)); 7068 REG_WRITE(ah, AR_NEXT_SWBA, 7069 TU_TO_USEC(next_beacon - 7070 ah->ah_config. 7071 - ath_hal_sw_beacon_response_time)); 7072 flags |= 7073 AR_TBTT_TIMER_EN | AR_DBA_TIMER_EN | AR_SWBA_TIMER_EN; 7074 break; ··· 7093 const struct ath9k_beacon_state *bs) 7094 { 7095 u32 nextTbtt, beaconintval, dtimperiod, beacontimeout; 7096 - struct hal_capabilities *pCap = &ah->ah_caps; 7097 7098 REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(bs->bs_nexttbtt)); 7099 ··· 7136 SM((CAB_TIMEOUT_VAL << 3), AR_SLEEP1_CAB_TIMEOUT) 7137 | AR_SLEEP1_ASSUME_DTIM); 7138 7139 - if (pCap->halAutoSleepSupport) 7140 beacontimeout = (BEACON_TIMEOUT_VAL << 3); 7141 else 7142 beacontimeout = MIN_BEACON_TIMEOUT_VAL; ··· 7155 7156 bool ath9k_hw_keyisvalid(struct ath_hal *ah, u16 entry) 7157 { 7158 - if (entry < ah->ah_caps.halKeyCacheSize) { 7159 u32 val = REG_READ(ah, AR_KEYTABLE_MAC1(entry)); 7160 if (val & AR_KEYTABLE_VALID) 7161 return true; ··· 7167 { 7168 u32 keyType; 7169 7170 - if (entry >= ah->ah_caps.halKeyCacheSize) { 7171 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7172 "%s: entry %u out of range\n", __func__, entry); 7173 return false; ··· 7205 { 7206 u32 macHi, macLo; 7207 7208 - if (entry >= ah->ah_caps.halKeyCacheSize) { 7209 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7210 "%s: entry %u out of range\n", __func__, entry); 7211 return false; ··· 7232 const struct ath9k_keyval *k, 7233 const u8 *mac, int xorKey) 7234 { 7235 - const struct hal_capabilities *pCap = &ah->ah_caps; 7236 u32 key0, key1, key2, key3, key4; 7237 u32 keyType; 7238 u32 xorMask = xorKey ? ··· 7240 | ATH9K_KEY_XOR) : 0; 7241 struct ath_hal_5416 *ahp = AH5416(ah); 7242 7243 - if (entry >= pCap->halKeyCacheSize) { 7244 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7245 "%s: entry %u out of range\n", __func__, entry); 7246 return false; ··· 7250 keyType = AR_KEYTABLE_TYPE_AES; 7251 break; 7252 case ATH9K_CIPHER_AES_CCM: 7253 - if (!pCap->halCipherAesCcmSupport) { 7254 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7255 "%s: AES-CCM not supported by " 7256 "mac rev 0x%x\n", __func__, ··· 7262 case ATH9K_CIPHER_TKIP: 7263 keyType = AR_KEYTABLE_TYPE_TKIP; 7264 if (ATH9K_IS_MIC_ENABLED(ah) 7265 - && entry + 64 >= pCap->halKeyCacheSize) { 7266 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7267 "%s: entry %u inappropriate for TKIP\n", 7268 __func__, entry); ··· 7459 const struct ath9k_txq_info *qInfo) 7460 { 7461 struct ath_hal_5416 *ahp = AH5416(ah); 7462 - struct hal_capabilities *pCap = &ah->ah_caps; 7463 7464 - if (q >= pCap->halTotalQueues) { 7465 DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "%s: invalid queue num %u\n", 7466 __func__, q); 7467 return false; ··· 7502 struct ath9k_txq_info *qInfo) 7503 { 7504 struct ath_hal_5416 *ahp = AH5416(ah); 7505 - struct hal_capabilities *pCap = &ah->ah_caps; 7506 7507 - if (q >= pCap->halTotalQueues) { 7508 DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "%s: invalid queue num %u\n", 7509 __func__, q); 7510 return false; ··· 7518 { 7519 struct ath_hal_5416 *ahp = AH5416(ah); 7520 struct ath9k_tx_queue_info *qi; 7521 - struct hal_capabilities *pCap = &ah->ah_caps; 7522 int q; 7523 7524 switch (type) { 7525 case ATH9K_TX_QUEUE_BEACON: 7526 - q = pCap->halTotalQueues - 1; 7527 break; 7528 case ATH9K_TX_QUEUE_CAB: 7529 - q = pCap->halTotalQueues - 2; 7530 break; 7531 case ATH9K_TX_QUEUE_PSPOLL: 7532 q = 1; 7533 break; 7534 case ATH9K_TX_QUEUE_UAPSD: 7535 - q = pCap->halTotalQueues - 3; 7536 break; 7537 case ATH9K_TX_QUEUE_DATA: 7538 - for (q = 0; q < pCap->halTotalQueues; q++) 7539 if (ahp->ah_txq[q].tqi_type == 7540 ATH9K_TX_QUEUE_INACTIVE) 7541 break; 7542 - if (q == pCap->halTotalQueues) { 7543 DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, 7544 "%s: no available tx queue\n", __func__); 7545 return -1; ··· 7605 bool ath9k_hw_releasetxqueue(struct ath_hal *ah, u32 q) 7606 { 7607 struct ath_hal_5416 *ahp = AH5416(ah); 7608 - struct hal_capabilities *pCap = &ah->ah_caps; 7609 struct ath9k_tx_queue_info *qi; 7610 7611 - if (q >= pCap->halTotalQueues) { 7612 DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "%s: invalid queue num %u\n", 7613 __func__, q); 7614 return false; ··· 7637 bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q) 7638 { 7639 struct ath_hal_5416 *ahp = AH5416(ah); 7640 - struct hal_capabilities *pCap = &ah->ah_caps; 7641 struct ath9k_channel *chan = ah->ah_curchan; 7642 struct ath9k_tx_queue_info *qi; 7643 u32 cwMin, chanCwMin, value; 7644 7645 - if (q >= pCap->halTotalQueues) { 7646 DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "%s: invalid queue num %u\n", 7647 __func__, q); 7648 return false; ··· 7742 | AR_Q_MISC_CBR_INCR_DIS1 7743 | AR_Q_MISC_CBR_INCR_DIS0); 7744 value = (qi->tqi_readyTime 7745 - - (ah->ah_config.ath_hal_sw_beacon_response_time - 7746 - ah->ah_config.ath_hal_dma_beacon_response_time) 7747 - 7748 - ah->ah_config.ath_hal_additional_swba_backoff) * 7749 1024; 7750 REG_WRITE(ah, AR_QRDYTIMECFG(q), 7751 value | AR_Q_RDYTIMECFG_EN); ··· 8134 u32 size, u32 flags) 8135 { 8136 struct ar5416_desc *ads = AR5416DESC(ds); 8137 - struct hal_capabilities *pCap = &ah->ah_caps; 8138 8139 ads->ds_ctl1 = size & AR_BufLen; 8140 if (flags & ATH9K_RXDESC_INTREQ) 8141 ads->ds_ctl1 |= AR_RxIntrReq; 8142 8143 ads->ds_rxstatus8 &= ~AR_RxDone; 8144 - if (!pCap->halAutoSleepSupport) 8145 memset(&(ads->u), 0, sizeof(ads->u)); 8146 return true; 8147 }
··· 335 { 336 int i; 337 338 + ah->ah_config.dma_beacon_response_time = 2; 339 + ah->ah_config.sw_beacon_response_time = 10; 340 + ah->ah_config.additional_swba_backoff = 0; 341 + ah->ah_config.ack_6mb = 0x0; 342 + ah->ah_config.cwm_ignore_extcca = 0; 343 + ah->ah_config.pcie_powersave_enable = 0; 344 + ah->ah_config.pcie_l1skp_enable = 0; 345 + ah->ah_config.pcie_clock_req = 0; 346 + ah->ah_config.pcie_power_reset = 0x100; 347 + ah->ah_config.pcie_restore = 0; 348 + ah->ah_config.pcie_waen = 0; 349 + ah->ah_config.analog_shiftreg = 1; 350 + ah->ah_config.ht_enable = 1; 351 + ah->ah_config.ofdm_trig_low = 200; 352 + ah->ah_config.ofdm_trig_high = 500; 353 + ah->ah_config.cck_trig_high = 200; 354 + ah->ah_config.cck_trig_low = 100; 355 + ah->ah_config.enable_ani = 0; 356 + ah->ah_config.noise_immunity_level = 4; 357 + ah->ah_config.ofdm_weaksignal_det = 1; 358 + ah->ah_config.cck_weaksignal_thr = 0; 359 + ah->ah_config.spur_immunity_level = 2; 360 + ah->ah_config.firstep_level = 0; 361 + ah->ah_config.rssi_thr_high = 40; 362 + ah->ah_config.rssi_thr_low = 7; 363 + ah->ah_config.diversity_control = 0; 364 + ah->ah_config.antenna_switch_swap = 0; 365 366 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { 367 + ah->ah_config.spurchans[i][0] = AR_NO_SPUR; 368 + ah->ah_config.spurchans[i][1] = AR_NO_SPUR; 369 } 370 371 + ah->ah_config.intr_mitigation = 0; 372 } 373 374 static inline void ath9k_hw_override_ini(struct ath_hal *ah, ··· 458 459 REG_WRITE(ah, reg, regVal); 460 461 + if (ah->ah_config.analog_shiftreg) 462 udelay(100); 463 464 return; ··· 1001 } 1002 1003 bool ath9k_hw_setcapability(struct ath_hal *ah, 1004 + enum ath9k_capability_type type, 1005 u32 capability, 1006 u32 setting, 1007 int *status) ··· 1010 u32 v; 1011 1012 switch (type) { 1013 + case ATH9K_CAP_TKIP_MIC: 1014 if (setting) 1015 ahp->ah_staId1Defaults |= 1016 AR_STA_ID1_CRPT_MIC_ENABLE; ··· 1018 ahp->ah_staId1Defaults &= 1019 ~AR_STA_ID1_CRPT_MIC_ENABLE; 1020 return true; 1021 + case ATH9K_CAP_DIVERSITY: 1022 v = REG_READ(ah, AR_PHY_CCK_DETECT); 1023 if (setting) 1024 v |= AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV; ··· 1026 v &= ~AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV; 1027 REG_WRITE(ah, AR_PHY_CCK_DETECT, v); 1028 return true; 1029 + case ATH9K_CAP_MCAST_KEYSRCH: 1030 if (setting) 1031 ahp->ah_staId1Defaults |= AR_STA_ID1_MCAST_KSRCH; 1032 else 1033 ahp->ah_staId1Defaults &= ~AR_STA_ID1_MCAST_KSRCH; 1034 return true; 1035 + case ATH9K_CAP_TSF_ADJUST: 1036 if (setting) 1037 ahp->ah_miscMode |= AR_PCU_TX_ADD_TSF; 1038 else ··· 1161 u32 macmode; 1162 1163 if (mode == ATH9K_HT_MACMODE_2040 && 1164 + !ah->ah_config.cwm_ignore_extcca) 1165 macmode = AR_2040_JOINED_RX_CLEAR; 1166 else 1167 macmode = 0; ··· 1214 ah->ah_tpScale = ATH9K_TP_SCALE_MAX; 1215 1216 ahp->ah_atimWindow = 0; 1217 + ahp->ah_diversityControl = ah->ah_config.diversity_control; 1218 ahp->ah_antennaSwitchSwap = 1219 + ah->ah_config.antenna_switch_swap; 1220 1221 ahp->ah_staId1Defaults = AR_STA_ID1_CRPT_MIC_ENABLE; 1222 ahp->ah_beaconInterval = 100; ··· 1371 1372 DPRINTF(ah->ah_sc, ATH_DBG_ANI, 1373 "Getting spur idx %d is2Ghz. %d val %x\n", 1374 + i, is2GHz, ah->ah_config.spurchans[i][is2GHz]); 1375 1376 + switch (ah->ah_config.spurmode) { 1377 case SPUR_DISABLE: 1378 break; 1379 case SPUR_ENABLE_IOCTL: 1380 + spur_val = ah->ah_config.spurchans[i][is2GHz]; 1381 DPRINTF(ah->ah_sc, ATH_DBG_ANI, 1382 "Getting spur val from new loc. %d\n", spur_val); 1383 break; ··· 2094 ath9k_enable_mib_counters(ah); 2095 } 2096 ahp->ah_aniPeriod = ATH9K_ANI_PERIOD; 2097 + if (ah->ah_config.enable_ani) 2098 ahp->ah_procPhyErr |= HAL_PROCESS_ANI; 2099 } 2100 ··· 2504 ATH9K_RX_FILTER_PHYERR); 2505 if (ah->ah_opmode == ATH9K_M_HOSTAP) { 2506 ahp->ah_curani->ofdmTrigHigh = 2507 + ah->ah_config.ofdm_trig_high; 2508 ahp->ah_curani->ofdmTrigLow = 2509 + ah->ah_config.ofdm_trig_low; 2510 ahp->ah_curani->cckTrigHigh = 2511 + ah->ah_config.cck_trig_high; 2512 ahp->ah_curani->cckTrigLow = 2513 + ah->ah_config.cck_trig_low; 2514 } 2515 ath9k_ani_restart(ah); 2516 return; ··· 2870 2871 static u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio) 2872 { 2873 + if (gpio >= ah->ah_caps.num_gpio_pins) 2874 return 0xffffffff; 2875 2876 if (AR_SREV_9280_10_OR_LATER(ah)) { ··· 2947 static bool ath9k_hw_fill_cap_info(struct ath_hal *ah) 2948 { 2949 struct ath_hal_5416 *ahp = AH5416(ah); 2950 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 2951 u16 capField = 0, eeval; 2952 2953 eeval = ath9k_hw_get_eeprom(ahp, EEP_REG_0); ··· 2970 ah->ah_currentRD); 2971 } 2972 2973 + pCap->wireless_modes = 0; 2974 eeval = ath9k_hw_get_eeprom(ahp, EEP_OP_MODE); 2975 2976 if (eeval & AR5416_OPFLAGS_11A) { 2977 + pCap->wireless_modes |= ATH9K_MODE_SEL_11A | 2978 + ((!ah->ah_config.ht_enable 2979 || (eeval & AR5416_OPFLAGS_N_5G_HT20)) ? 0 2980 : (ATH9K_MODE_SEL_11NA_HT20 | 2981 ((eeval & AR5416_OPFLAGS_N_5G_HT40) ? 0 ··· 2983 ATH9K_MODE_SEL_11NA_HT40MINUS)))); 2984 } 2985 if (eeval & AR5416_OPFLAGS_11G) { 2986 + pCap->wireless_modes |= 2987 ATH9K_MODE_SEL_11B | ATH9K_MODE_SEL_11G | 2988 + ((!ah->ah_config.ht_enable 2989 || (eeval & AR5416_OPFLAGS_N_2G_HT20)) ? 0 2990 : (ATH9K_MODE_SEL_11NG_HT20 | 2991 ((eeval & AR5416_OPFLAGS_N_2G_HT40) ? 0 ··· 2993 ATH9K_MODE_SEL_11NG_HT40MINUS)))); 2994 2995 } 2996 + pCap->tx_chainmask = ath9k_hw_get_eeprom(ahp, EEP_TX_MASK); 2997 if ((ah->ah_isPciExpress) 2998 || (eeval & AR5416_OPFLAGS_11A)) { 2999 + pCap->rx_chainmask = 3000 ath9k_hw_get_eeprom(ahp, EEP_RX_MASK); 3001 } else { 3002 + pCap->rx_chainmask = 3003 (ath9k_hw_gpio_get(ah, 0)) ? 0x5 : 0x7; 3004 } 3005 3006 if (!(AR_SREV_9280(ah) && (ah->ah_macRev == 0))) 3007 ahp->ah_miscMode |= AR_PCU_MIC_NEW_LOC_ENA; 3008 3009 + pCap->low_2ghz_chan = 2312; 3010 + pCap->high_2ghz_chan = 2732; 3011 3012 + pCap->low_5ghz_chan = 4920; 3013 + pCap->high_5ghz_chan = 6100; 3014 3015 + pCap->hw_caps &= ~ATH9K_HW_CAP_CIPHER_CKIP; 3016 + pCap->hw_caps |= ATH9K_HW_CAP_CIPHER_TKIP; 3017 + pCap->hw_caps |= ATH9K_HW_CAP_CIPHER_AESCCM; 3018 3019 + pCap->hw_caps &= ~ATH9K_HW_CAP_MIC_CKIP; 3020 + pCap->hw_caps |= ATH9K_HW_CAP_MIC_TKIP; 3021 + pCap->hw_caps |= ATH9K_HW_CAP_MIC_AESCCM; 3022 3023 + pCap->hw_caps |= ATH9K_HW_CAP_CHAN_SPREAD; 3024 3025 + if (ah->ah_config.ht_enable) 3026 + pCap->hw_caps |= ATH9K_HW_CAP_HT; 3027 + else 3028 + pCap->hw_caps &= ~ATH9K_HW_CAP_HT; 3029 + 3030 + pCap->hw_caps |= ATH9K_HW_CAP_GTT; 3031 + pCap->hw_caps |= ATH9K_HW_CAP_VEOL; 3032 + pCap->hw_caps |= ATH9K_HW_CAP_BSSIDMASK; 3033 + pCap->hw_caps &= ~ATH9K_HW_CAP_MCAST_KEYSEARCH; 3034 3035 if (capField & AR_EEPROM_EEPCAP_MAXQCU) 3036 + pCap->total_queues = 3037 MS(capField, AR_EEPROM_EEPCAP_MAXQCU); 3038 else 3039 + pCap->total_queues = ATH9K_NUM_TX_QUEUES; 3040 3041 if (capField & AR_EEPROM_EEPCAP_KC_ENTRIES) 3042 + pCap->keycache_size = 3043 1 << MS(capField, AR_EEPROM_EEPCAP_KC_ENTRIES); 3044 else 3045 + pCap->keycache_size = AR_KEYTABLE_SIZE; 3046 3047 + pCap->hw_caps |= ATH9K_HW_CAP_FASTCC; 3048 + pCap->num_mr_retries = 4; 3049 + pCap->tx_triglevel_max = MAX_TX_FIFO_THRESHOLD; 3050 3051 if (AR_SREV_9280_10_OR_LATER(ah)) 3052 + pCap->num_gpio_pins = AR928X_NUM_GPIO; 3053 else 3054 + pCap->num_gpio_pins = AR_NUM_GPIO; 3055 3056 if (AR_SREV_9280_10_OR_LATER(ah)) { 3057 + pCap->hw_caps |= ATH9K_HW_CAP_WOW; 3058 + pCap->hw_caps |= ATH9K_HW_CAP_WOW_MATCHPATTERN_EXACT; 3059 } else { 3060 + pCap->hw_caps &= ~ATH9K_HW_CAP_WOW; 3061 + pCap->hw_caps &= ~ATH9K_HW_CAP_WOW_MATCHPATTERN_EXACT; 3062 } 3063 3064 if (AR_SREV_9160_10_OR_LATER(ah) || AR_SREV_9100(ah)) { 3065 + pCap->hw_caps |= ATH9K_HW_CAP_CST; 3066 + pCap->rts_aggr_limit = ATH_AMPDU_LIMIT_MAX; 3067 } else { 3068 + pCap->rts_aggr_limit = (8 * 1024); 3069 } 3070 3071 + pCap->hw_caps |= ATH9K_HW_CAP_ENHANCEDPM; 3072 3073 ah->ah_rfsilent = ath9k_hw_get_eeprom(ahp, EEP_RF_SILENT); 3074 if (ah->ah_rfsilent & EEP_RFSILENT_ENABLED) { ··· 3074 ahp->ah_polarity = 3075 MS(ah->ah_rfsilent, EEP_RFSILENT_POLARITY); 3076 3077 + ath9k_hw_setcapability(ah, ATH9K_CAP_RFSILENT, 1, true, 3078 NULL); 3079 + pCap->hw_caps |= ATH9K_HW_CAP_RFSILENT; 3080 } 3081 3082 if ((ah->ah_macVersion == AR_SREV_VERSION_5416_PCI) || ··· 3084 (ah->ah_macVersion == AR_SREV_VERSION_9160) || 3085 (ah->ah_macVersion == AR_SREV_VERSION_9100) || 3086 (ah->ah_macVersion == AR_SREV_VERSION_9280)) 3087 + pCap->hw_caps &= ~ATH9K_HW_CAP_AUTOSLEEP; 3088 else 3089 + pCap->hw_caps |= ATH9K_HW_CAP_AUTOSLEEP; 3090 3091 if (AR_SREV_9280(ah)) 3092 + pCap->hw_caps &= ~ATH9K_HW_CAP_4KB_SPLITTRANS; 3093 else 3094 + pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS; 3095 3096 if (ah->ah_currentRDExt & (1 << REG_EXT_JAPAN_MIDBAND)) { 3097 + pCap->reg_cap = 3098 AR_EEPROM_EEREGCAP_EN_KK_NEW_11A | 3099 AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN | 3100 AR_EEPROM_EEREGCAP_EN_KK_U2 | 3101 AR_EEPROM_EEREGCAP_EN_KK_MIDBAND; 3102 } else { 3103 + pCap->reg_cap = 3104 AR_EEPROM_EEREGCAP_EN_KK_NEW_11A | 3105 AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN; 3106 } 3107 3108 + pCap->reg_cap |= AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND; 3109 3110 + pCap->num_antcfg_5ghz = 3111 ath9k_hw_get_num_ant_config(ahp, HAL_FREQ_BAND_5GHZ); 3112 + pCap->num_antcfg_2ghz = 3113 ath9k_hw_get_num_ant_config(ahp, HAL_FREQ_BAND_2GHZ); 3114 3115 return true; ··· 3151 { 3152 REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV); 3153 if (setChip) { 3154 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 3155 3156 + if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { 3157 REG_WRITE(ah, AR_RTC_FORCE_WAKE, 3158 AR_RTC_FORCE_WAKE_ON_INT); 3159 } else { ··· 3262 3263 ath9k_hw_set_defaults(ah); 3264 3265 + if (ah->ah_config.intr_mitigation != 0) 3266 ahp->ah_intrMitigation = true; 3267 3268 if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) { ··· 3279 goto bad; 3280 } 3281 3282 + if (ah->ah_config.serialize_regmode == SER_REG_MODE_AUTO) { 3283 if (ah->ah_macVersion == AR_SREV_VERSION_5416_PCI) { 3284 + ah->ah_config.serialize_regmode = 3285 SER_REG_MODE_ON; 3286 } else { 3287 + ah->ah_config.serialize_regmode = 3288 SER_REG_MODE_OFF; 3289 } 3290 } 3291 DPRINTF(ah->ah_sc, ATH_DBG_RESET, 3292 + "%s: serialize_regmode is %d\n", 3293 + __func__, ah->ah_config.serialize_regmode); 3294 3295 if ((ah->ah_macVersion != AR_SREV_VERSION_5416_PCI) && 3296 (ah->ah_macVersion != AR_SREV_VERSION_5416_PCIE) && ··· 3334 } 3335 3336 if (AR_SREV_9160(ah)) { 3337 + ah->ah_config.enable_ani = 1; 3338 ahp->ah_ani_function = (ATH9K_ANI_SPUR_IMMUNITY_LEVEL | 3339 ATH9K_ANI_FIRSTEP_LEVEL); 3340 } else { ··· 3355 INIT_INI_ARRAY(&ahp->ah_iniCommon, ar9280Common_9280_2, 3356 ARRAY_SIZE(ar9280Common_9280_2), 2); 3357 3358 + if (ah->ah_config.pcie_clock_req) { 3359 INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes, 3360 ar9280PciePhy_clkreq_off_L1_9280, 3361 ARRAY_SIZE ··· 3528 u16 flags, u16 *low, 3529 u16 *high) 3530 { 3531 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 3532 3533 if (flags & CHANNEL_5GHZ) { 3534 + *low = pCap->low_5ghz_chan; 3535 + *high = pCap->high_5ghz_chan; 3536 return true; 3537 } 3538 if ((flags & CHANNEL_2GHZ)) { 3539 + *low = pCap->low_2ghz_chan; 3540 + *high = pCap->high_2ghz_chan; 3541 3542 return true; 3543 } ··· 3908 if (ah->ah_isPciExpress != true) 3909 return; 3910 3911 + if (ah->ah_config.pcie_powersave_enable == 2) 3912 return; 3913 3914 if (restore) ··· 3929 REG_WRITE(ah, AR_PCIE_SERDES, 0x13160820); 3930 REG_WRITE(ah, AR_PCIE_SERDES, 0xe5980560); 3931 3932 + if (ah->ah_config.pcie_clock_req) 3933 REG_WRITE(ah, AR_PCIE_SERDES, 0x401deffc); 3934 else 3935 REG_WRITE(ah, AR_PCIE_SERDES, 0x401deffd); ··· 3956 3957 REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); 3958 3959 + if (ah->ah_config.pcie_waen) { 3960 + REG_WRITE(ah, AR_WA, ah->ah_config.pcie_waen); 3961 } else { 3962 if (AR_SREV_9280(ah)) 3963 REG_WRITE(ah, AR_WA, 0x0040073f); ··· 4690 ath9k_hw_get_channel_centers(ah, chan, &centers); 4691 freq = centers.synth_center; 4692 4693 + ah->ah_config.spurmode = SPUR_ENABLE_EEPROM; 4694 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { 4695 cur_bb_spur = ath9k_hw_eeprom_get_spur_chan(ah, i, is2GHz); 4696 ··· 5404 REG_WRITE(ah, reg, val); 5405 5406 if (reg >= 0x7800 && reg < 0x78a0 5407 + && ah->ah_config.analog_shiftreg) { 5408 udelay(100); 5409 } 5410 ··· 5418 REG_WRITE(ah, reg, val); 5419 5420 if (reg >= 0x7800 && reg < 0x78a0 5421 + && ah->ah_config.analog_shiftreg) { 5422 udelay(100); 5423 } 5424 ··· 5921 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, 5922 AR_GPIO_JTAG_DISABLE); 5923 5924 + if (ah->ah_caps.wireless_modes & ATH9K_MODE_SEL_11A) { 5925 if (IS_CHAN_5GHZ(chan)) 5926 ath9k_hw_set_gpio(ah, 9, 0); 5927 else ··· 5955 | macStaId1 5956 | AR_STA_ID1_RTS_USE_DEF 5957 | (ah->ah_config. 5958 + ack_6mb ? AR_STA_ID1_ACKCTS_6MB : 0) 5959 | ahp->ah_staId1Defaults); 5960 ath9k_hw_set_operating_mode(ah, opmode); 5961 ··· 5984 REG_WRITE(ah, AR_DQCUMASK(i), 1 << i); 5985 5986 ahp->ah_intrTxqs = 0; 5987 + for (i = 0; i < ah->ah_caps.total_queues; i++) 5988 ath9k_hw_resettxqueue(ah, i); 5989 5990 ath9k_hw_init_interrupt_masks(ah, opmode); ··· 6622 *antenna_cfgd = true; 6623 break; 6624 case ATH9K_ANT_FIXED_B: 6625 + if (ah->ah_caps.tx_chainmask > 6626 ATH9K_ANTENNA1_CHAINMASK) { 6627 *tx_chainmask = ATH9K_ANTENNA1_CHAINMASK; 6628 } ··· 6650 } 6651 6652 bool 6653 + ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type, 6654 u32 capability, u32 *result) 6655 { 6656 struct ath_hal_5416 *ahp = AH5416(ah); 6657 + const struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 6658 6659 switch (type) { 6660 + case ATH9K_CAP_CIPHER: 6661 switch (capability) { 6662 case ATH9K_CIPHER_AES_CCM: 6663 case ATH9K_CIPHER_AES_OCB: ··· 6669 default: 6670 return false; 6671 } 6672 + case ATH9K_CAP_TKIP_MIC: 6673 switch (capability) { 6674 case 0: 6675 return true; ··· 6678 AR_STA_ID1_CRPT_MIC_ENABLE) ? true : 6679 false; 6680 } 6681 + case ATH9K_CAP_TKIP_SPLIT: 6682 return (ahp->ah_miscMode & AR_PCU_MIC_NEW_LOC_ENA) ? 6683 false : true; 6684 + case ATH9K_CAP_WME_TKIPMIC: 6685 return 0; 6686 + case ATH9K_CAP_PHYCOUNTERS: 6687 return ahp->ah_hasHwPhyCounters ? 0 : -ENXIO; 6688 + case ATH9K_CAP_DIVERSITY: 6689 return (REG_READ(ah, AR_PHY_CCK_DETECT) & 6690 AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV) ? 6691 true : false; 6692 + case ATH9K_CAP_PHYDIAG: 6693 return true; 6694 + case ATH9K_CAP_MCAST_KEYSRCH: 6695 switch (capability) { 6696 case 0: 6697 return true; ··· 6705 } 6706 } 6707 return false; 6708 + case ATH9K_CAP_TSF_ADJUST: 6709 return (ahp->ah_miscMode & AR_PCU_TX_ADD_TSF) ? 6710 true : false; 6711 + case ATH9K_CAP_RFSILENT: 6712 if (capability == 3) 6713 return false; 6714 + case ATH9K_CAP_ANT_CFG_2GHZ: 6715 + *result = pCap->num_antcfg_2ghz; 6716 return true; 6717 + case ATH9K_CAP_ANT_CFG_5GHZ: 6718 + *result = pCap->num_antcfg_5ghz; 6719 return true; 6720 + case ATH9K_CAP_TXPOW: 6721 switch (capability) { 6722 case 0: 6723 return 0; ··· 6742 { 6743 struct ath_hal_5416 *ahp = AH5416(ah); 6744 struct ath9k_channel *chan = ah->ah_curchan; 6745 + const struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 6746 u16 ant_config; 6747 u32 halNumAntConfig; 6748 6749 halNumAntConfig = 6750 + IS_CHAN_2GHZ(chan) ? pCap->num_antcfg_2ghz : pCap-> 6751 + num_antcfg_5ghz; 6752 6753 if (cfg < halNumAntConfig) { 6754 if (!ath9k_hw_get_eeprom_antenna_cfg(ahp, chan, ··· 6784 { 6785 u32 isr = 0; 6786 u32 mask2 = 0; 6787 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 6788 u32 sync_cause = 0; 6789 bool fatal_int = false; 6790 ··· 6868 } 6869 6870 if (!AR_SREV_9100(ah)) { 6871 + if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { 6872 u32 isr5 = REG_READ(ah, AR_ISR_S5_S); 6873 if (isr5 & AR_ISR_S5_TIM_TIMER) 6874 *masked |= ATH9K_INT_TIM_TIMER; ··· 6927 struct ath_hal_5416 *ahp = AH5416(ah); 6928 u32 omask = ahp->ah_maskReg; 6929 u32 mask, mask2; 6930 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 6931 6932 DPRINTF(ah->ah_sc, ATH_DBG_INTERRUPT, "%s: 0x%x => 0x%x\n", __func__, 6933 omask, ints); ··· 6965 mask |= AR_IMR_RXMINTR | AR_IMR_RXINTM; 6966 else 6967 mask |= AR_IMR_RXOK | AR_IMR_RXDESC; 6968 + if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) 6969 mask |= AR_IMR_GENTMR; 6970 } 6971 ··· 7002 REG_WRITE(ah, AR_IMR_S2, mask | mask2); 7003 ahp->ah_maskReg = ints; 7004 7005 + if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { 7006 if (ints & ATH9K_INT_TIM_TIMER) 7007 REG_SET_BIT(ah, AR_IMR_S5, AR_IMR_S5_TIM_TIMER); 7008 else ··· 7061 REG_WRITE(ah, AR_NEXT_DMA_BEACON_ALERT, 7062 TU_TO_USEC(next_beacon - 7063 ah->ah_config. 7064 + dma_beacon_response_time)); 7065 REG_WRITE(ah, AR_NEXT_SWBA, 7066 TU_TO_USEC(next_beacon - 7067 ah->ah_config. 7068 + sw_beacon_response_time)); 7069 flags |= 7070 AR_TBTT_TIMER_EN | AR_DBA_TIMER_EN | AR_SWBA_TIMER_EN; 7071 break; ··· 7090 const struct ath9k_beacon_state *bs) 7091 { 7092 u32 nextTbtt, beaconintval, dtimperiod, beacontimeout; 7093 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 7094 7095 REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(bs->bs_nexttbtt)); 7096 ··· 7133 SM((CAB_TIMEOUT_VAL << 3), AR_SLEEP1_CAB_TIMEOUT) 7134 | AR_SLEEP1_ASSUME_DTIM); 7135 7136 + if (pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP) 7137 beacontimeout = (BEACON_TIMEOUT_VAL << 3); 7138 else 7139 beacontimeout = MIN_BEACON_TIMEOUT_VAL; ··· 7152 7153 bool ath9k_hw_keyisvalid(struct ath_hal *ah, u16 entry) 7154 { 7155 + if (entry < ah->ah_caps.keycache_size) { 7156 u32 val = REG_READ(ah, AR_KEYTABLE_MAC1(entry)); 7157 if (val & AR_KEYTABLE_VALID) 7158 return true; ··· 7164 { 7165 u32 keyType; 7166 7167 + if (entry >= ah->ah_caps.keycache_size) { 7168 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7169 "%s: entry %u out of range\n", __func__, entry); 7170 return false; ··· 7202 { 7203 u32 macHi, macLo; 7204 7205 + if (entry >= ah->ah_caps.keycache_size) { 7206 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7207 "%s: entry %u out of range\n", __func__, entry); 7208 return false; ··· 7229 const struct ath9k_keyval *k, 7230 const u8 *mac, int xorKey) 7231 { 7232 + const struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 7233 u32 key0, key1, key2, key3, key4; 7234 u32 keyType; 7235 u32 xorMask = xorKey ? ··· 7237 | ATH9K_KEY_XOR) : 0; 7238 struct ath_hal_5416 *ahp = AH5416(ah); 7239 7240 + if (entry >= pCap->keycache_size) { 7241 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7242 "%s: entry %u out of range\n", __func__, entry); 7243 return false; ··· 7247 keyType = AR_KEYTABLE_TYPE_AES; 7248 break; 7249 case ATH9K_CIPHER_AES_CCM: 7250 + if (!(pCap->hw_caps & ATH9K_HW_CAP_CIPHER_AESCCM)) { 7251 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7252 "%s: AES-CCM not supported by " 7253 "mac rev 0x%x\n", __func__, ··· 7259 case ATH9K_CIPHER_TKIP: 7260 keyType = AR_KEYTABLE_TYPE_TKIP; 7261 if (ATH9K_IS_MIC_ENABLED(ah) 7262 + && entry + 64 >= pCap->keycache_size) { 7263 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7264 "%s: entry %u inappropriate for TKIP\n", 7265 __func__, entry); ··· 7456 const struct ath9k_txq_info *qInfo) 7457 { 7458 struct ath_hal_5416 *ahp = AH5416(ah); 7459 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 7460 7461 + if (q >= pCap->total_queues) { 7462 DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "%s: invalid queue num %u\n", 7463 __func__, q); 7464 return false; ··· 7499 struct ath9k_txq_info *qInfo) 7500 { 7501 struct ath_hal_5416 *ahp = AH5416(ah); 7502 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 7503 7504 + if (q >= pCap->total_queues) { 7505 DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "%s: invalid queue num %u\n", 7506 __func__, q); 7507 return false; ··· 7515 { 7516 struct ath_hal_5416 *ahp = AH5416(ah); 7517 struct ath9k_tx_queue_info *qi; 7518 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 7519 int q; 7520 7521 switch (type) { 7522 case ATH9K_TX_QUEUE_BEACON: 7523 + q = pCap->total_queues - 1; 7524 break; 7525 case ATH9K_TX_QUEUE_CAB: 7526 + q = pCap->total_queues - 2; 7527 break; 7528 case ATH9K_TX_QUEUE_PSPOLL: 7529 q = 1; 7530 break; 7531 case ATH9K_TX_QUEUE_UAPSD: 7532 + q = pCap->total_queues - 3; 7533 break; 7534 case ATH9K_TX_QUEUE_DATA: 7535 + for (q = 0; q < pCap->total_queues; q++) 7536 if (ahp->ah_txq[q].tqi_type == 7537 ATH9K_TX_QUEUE_INACTIVE) 7538 break; 7539 + if (q == pCap->total_queues) { 7540 DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, 7541 "%s: no available tx queue\n", __func__); 7542 return -1; ··· 7602 bool ath9k_hw_releasetxqueue(struct ath_hal *ah, u32 q) 7603 { 7604 struct ath_hal_5416 *ahp = AH5416(ah); 7605 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 7606 struct ath9k_tx_queue_info *qi; 7607 7608 + if (q >= pCap->total_queues) { 7609 DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "%s: invalid queue num %u\n", 7610 __func__, q); 7611 return false; ··· 7634 bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q) 7635 { 7636 struct ath_hal_5416 *ahp = AH5416(ah); 7637 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 7638 struct ath9k_channel *chan = ah->ah_curchan; 7639 struct ath9k_tx_queue_info *qi; 7640 u32 cwMin, chanCwMin, value; 7641 7642 + if (q >= pCap->total_queues) { 7643 DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "%s: invalid queue num %u\n", 7644 __func__, q); 7645 return false; ··· 7739 | AR_Q_MISC_CBR_INCR_DIS1 7740 | AR_Q_MISC_CBR_INCR_DIS0); 7741 value = (qi->tqi_readyTime 7742 + - (ah->ah_config.sw_beacon_response_time - 7743 + ah->ah_config.dma_beacon_response_time) 7744 - 7745 + ah->ah_config.additional_swba_backoff) * 7746 1024; 7747 REG_WRITE(ah, AR_QRDYTIMECFG(q), 7748 value | AR_Q_RDYTIMECFG_EN); ··· 8131 u32 size, u32 flags) 8132 { 8133 struct ar5416_desc *ads = AR5416DESC(ds); 8134 + struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 8135 8136 ads->ds_ctl1 = size & AR_BufLen; 8137 if (flags & ATH9K_RXDESC_INTREQ) 8138 ads->ds_ctl1 |= AR_RxIntrReq; 8139 8140 ads->ds_rxstatus8 &= ~AR_RxDone; 8141 + if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) 8142 memset(&(ads->u), 0, sizeof(ads->u)); 8143 return true; 8144 }
+3 -3
drivers/net/wireless/ath9k/main.c
··· 1268 sc->rates[IEEE80211_BAND_2GHZ]; 1269 sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; 1270 1271 - if (sc->sc_ah->ah_caps.halHTSupport) 1272 /* Setup HT capabilities for 2.4Ghz*/ 1273 setup_ht_cap(&sc->sbands[IEEE80211_BAND_2GHZ].ht_info); 1274 1275 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = 1276 &sc->sbands[IEEE80211_BAND_2GHZ]; 1277 1278 - if (sc->sc_ah->ah_caps.halWirelessModes & ATH9K_MODE_SEL_11A) { 1279 sc->sbands[IEEE80211_BAND_5GHZ].channels = 1280 sc->channels[IEEE80211_BAND_5GHZ]; 1281 sc->sbands[IEEE80211_BAND_5GHZ].bitrates = ··· 1283 sc->sbands[IEEE80211_BAND_5GHZ].band = 1284 IEEE80211_BAND_5GHZ; 1285 1286 - if (sc->sc_ah->ah_caps.halHTSupport) 1287 /* Setup HT capabilities for 5Ghz*/ 1288 setup_ht_cap(&sc->sbands[IEEE80211_BAND_5GHZ].ht_info); 1289
··· 1268 sc->rates[IEEE80211_BAND_2GHZ]; 1269 sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; 1270 1271 + if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) 1272 /* Setup HT capabilities for 2.4Ghz*/ 1273 setup_ht_cap(&sc->sbands[IEEE80211_BAND_2GHZ].ht_info); 1274 1275 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = 1276 &sc->sbands[IEEE80211_BAND_2GHZ]; 1277 1278 + if (sc->sc_ah->ah_caps.wireless_modes & ATH9K_MODE_SEL_11A) { 1279 sc->sbands[IEEE80211_BAND_5GHZ].channels = 1280 sc->channels[IEEE80211_BAND_5GHZ]; 1281 sc->sbands[IEEE80211_BAND_5GHZ].bitrates = ··· 1283 sc->sbands[IEEE80211_BAND_5GHZ].band = 1284 IEEE80211_BAND_5GHZ; 1285 1286 + if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) 1287 /* Setup HT capabilities for 5Ghz*/ 1288 setup_ht_cap(&sc->sbands[IEEE80211_BAND_5GHZ].ht_info); 1289
+1 -1
drivers/net/wireless/ath9k/rc.c
··· 780 ar5416_attach_ratetables(asc); 781 782 /* Save Maximum TX Trigger Level (used for 11n) */ 783 - tx_triglevel_max = ah->ah_caps.halTxTrigLevelMax; 784 /* return alias for ath_rate_softc * */ 785 return asc; 786 }
··· 780 ar5416_attach_ratetables(asc); 781 782 /* Save Maximum TX Trigger Level (used for 11n) */ 783 + tx_triglevel_max = ah->ah_caps.tx_triglevel_max; 784 /* return alias for ath_rate_softc * */ 785 return asc; 786 }
+2 -2
drivers/net/wireless/ath9k/recv.c
··· 478 ath9k_hw_setrxfilter(ah, rfilt); 479 480 /* configure bssid mask */ 481 - if (ah->ah_caps.halBssIdMaskSupport) 482 ath9k_hw_setbssidmask(ah, sc->sc_bssidmask); 483 484 /* configure operational mode */ ··· 1018 PCI_DMA_FROMDEVICE); 1019 1020 /* XXX: Ah! make me more readable, use a helper */ 1021 - if (ah->ah_caps.halHTSupport) { 1022 if (ds->ds_rxstat.rs_moreaggr == 0) { 1023 rx_status.rssictl[0] = 1024 ds->ds_rxstat.rs_rssi_ctl0;
··· 478 ath9k_hw_setrxfilter(ah, rfilt); 479 480 /* configure bssid mask */ 481 + if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) 482 ath9k_hw_setbssidmask(ah, sc->sc_bssidmask); 483 484 /* configure operational mode */ ··· 1018 PCI_DMA_FROMDEVICE); 1019 1020 /* XXX: Ah! make me more readable, use a helper */ 1021 + if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) { 1022 if (ds->ds_rxstat.rs_moreaggr == 0) { 1023 rx_status.rssictl[0] = 1024 ds->ds_rxstat.rs_rssi_ctl0;
+7 -7
drivers/net/wireless/ath9k/regd.c
··· 87 { 88 u32 regcap; 89 90 - regcap = ah->ah_caps.halRegCap; 91 92 if (regcap & AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND) 93 return true; ··· 138 { 139 u32 modesAvail; 140 141 - modesAvail = ah->ah_caps.halWirelessModes; 142 143 if ((modesAvail & ATH9K_MODE_SEL_11G) && (!country->allow11g)) 144 modesAvail &= ~ATH9K_MODE_SEL_11G; ··· 436 return false; 437 } 438 if ((fband->channelBW == CHANNEL_HALF_BW) && 439 - !ah->ah_caps.halChanHalfRate) { 440 DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, 441 "%s: Skipping %u half rate channel\n", 442 __func__, c); ··· 444 } 445 446 if ((fband->channelBW == CHANNEL_QUARTER_BW) && 447 - !ah->ah_caps.halChanQuarterRate) { 448 DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, 449 "%s: Skipping %u quarter rate channel\n", 450 __func__, c); ··· 529 if ((c < 2412) || (c > 2462)) { 530 if (rd5GHz.regDmnEnum == MKK1 || 531 rd5GHz.regDmnEnum == MKK2) { 532 - u32 regcap = ah->ah_caps.halRegCap; 533 if (!(regcap & 534 (AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN | 535 AR_EEPROM_EEREGCAP_EN_KK_U2 | ··· 594 595 for (i = 0; i < ARRAY_SIZE(j_bandcheck); i++) { 596 if (j_bandcheck[i].freqbandbit == b) { 597 - regcap = ah->ah_caps.halRegCap; 598 if ((j_bandcheck[i].eepromflagtocheck & regcap) == 0) { 599 skipband = true; 600 } else if ((regcap & AR_EEPROM_EEREGCAP_EN_KK_U2) || ··· 726 } 727 728 if (country == NULL) { 729 - modesAvail = ah->ah_caps.halWirelessModes; 730 } else { 731 modesAvail = ath9k_regd_get_wmodes_nreg(ah, country, &rd5GHz); 732 if (!enableOutdoor)
··· 87 { 88 u32 regcap; 89 90 + regcap = ah->ah_caps.reg_cap; 91 92 if (regcap & AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND) 93 return true; ··· 138 { 139 u32 modesAvail; 140 141 + modesAvail = ah->ah_caps.wireless_modes; 142 143 if ((modesAvail & ATH9K_MODE_SEL_11G) && (!country->allow11g)) 144 modesAvail &= ~ATH9K_MODE_SEL_11G; ··· 436 return false; 437 } 438 if ((fband->channelBW == CHANNEL_HALF_BW) && 439 + !(ah->ah_caps.hw_caps & ATH9K_HW_CAP_CHAN_HALFRATE)) { 440 DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, 441 "%s: Skipping %u half rate channel\n", 442 __func__, c); ··· 444 } 445 446 if ((fband->channelBW == CHANNEL_QUARTER_BW) && 447 + !(ah->ah_caps.hw_caps & ATH9K_HW_CAP_CHAN_QUARTERRATE)) { 448 DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, 449 "%s: Skipping %u quarter rate channel\n", 450 __func__, c); ··· 529 if ((c < 2412) || (c > 2462)) { 530 if (rd5GHz.regDmnEnum == MKK1 || 531 rd5GHz.regDmnEnum == MKK2) { 532 + u32 regcap = ah->ah_caps.reg_cap; 533 if (!(regcap & 534 (AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN | 535 AR_EEPROM_EEREGCAP_EN_KK_U2 | ··· 594 595 for (i = 0; i < ARRAY_SIZE(j_bandcheck); i++) { 596 if (j_bandcheck[i].freqbandbit == b) { 597 + regcap = ah->ah_caps.reg_cap; 598 if ((j_bandcheck[i].eepromflagtocheck & regcap) == 0) { 599 skipband = true; 600 } else if ((regcap & AR_EEPROM_EEREGCAP_EN_KK_U2) || ··· 726 } 727 728 if (country == NULL) { 729 + modesAvail = ah->ah_caps.wireless_modes; 730 } else { 731 modesAvail = ath9k_regd_get_wmodes_nreg(ah, country, &rd5GHz); 732 if (!enableOutdoor)
+2 -2
drivers/net/wireless/ath9k/xmit.c
··· 781 * let rate series flags determine which rates will actually 782 * use RTS. 783 */ 784 - if (ah->ah_caps.halHTSupport && bf->bf_isdata) { 785 BUG_ON(!an); 786 /* 787 * 802.11g protection not needed, use our default behavior ··· 897 * For non-HT devices, calculate RTS/CTS duration in software 898 * and disable multi-rate retry. 899 */ 900 - if (flags && !ah->ah_caps.halHTSupport) { 901 /* 902 * Compute the transmit duration based on the frame 903 * size and the size of an ACK frame. We call into the
··· 781 * let rate series flags determine which rates will actually 782 * use RTS. 783 */ 784 + if ((ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) && bf->bf_isdata) { 785 BUG_ON(!an); 786 /* 787 * 802.11g protection not needed, use our default behavior ··· 897 * For non-HT devices, calculate RTS/CTS duration in software 898 * and disable multi-rate retry. 899 */ 900 + if (flags && !(ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT)) { 901 /* 902 * Compute the transmit duration based on the frame 903 * size and the size of an ACK frame. We call into the