aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/hw.c
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-02-09 02:57:24 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-13 13:45:08 -0500
commitf74df6fbe31561091bf42be0ed30232be2b9d3ac (patch)
tree5cd6ed9f809e60d8ff6acd9363efa0475a95e20c /drivers/net/wireless/ath9k/hw.c
parente153789dc3846b35494435b4a8ae82a034c99dae (diff)
ath9k: Cleanup EEPROM operations
This patch removes the various function pointer assignments and unifies them in a single ops structure. Signed-off-by: Sujith <Sujith.Manoharan@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.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index ba908e9f1a8e..f744d8cd8307 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -487,7 +487,7 @@ static int ath9k_hw_init_macaddr(struct ath_hw *ah)
487 487
488 sum = 0; 488 sum = 0;
489 for (i = 0; i < 3; i++) { 489 for (i = 0; i < 3; i++) {
490 eeval = ath9k_hw_get_eeprom(ah, AR_EEPROM_MAC(i)); 490 eeval = ah->eep_ops->get_eeprom(ah, AR_EEPROM_MAC(i));
491 sum += eeval; 491 sum += eeval;
492 ah->macaddr[2 * i] = eeval >> 8; 492 ah->macaddr[2 * i] = eeval >> 8;
493 ah->macaddr[2 * i + 1] = eeval & 0xff; 493 ah->macaddr[2 * i + 1] = eeval & 0xff;
@@ -506,8 +506,8 @@ static void ath9k_hw_init_rxgain_ini(struct ath_hw *ah)
506{ 506{
507 u32 rxgain_type; 507 u32 rxgain_type;
508 508
509 if (ath9k_hw_get_eeprom(ah, EEP_MINOR_REV) >= AR5416_EEP_MINOR_VER_17) { 509 if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >= AR5416_EEP_MINOR_VER_17) {
510 rxgain_type = ath9k_hw_get_eeprom(ah, EEP_RXGAIN_TYPE); 510 rxgain_type = ah->eep_ops->get_eeprom(ah, EEP_RXGAIN_TYPE);
511 511
512 if (rxgain_type == AR5416_EEP_RXGAIN_13DB_BACKOFF) 512 if (rxgain_type == AR5416_EEP_RXGAIN_13DB_BACKOFF)
513 INIT_INI_ARRAY(&ah->ah_iniModesRxGain, 513 INIT_INI_ARRAY(&ah->ah_iniModesRxGain,
@@ -532,8 +532,8 @@ static void ath9k_hw_init_txgain_ini(struct ath_hw *ah)
532{ 532{
533 u32 txgain_type; 533 u32 txgain_type;
534 534
535 if (ath9k_hw_get_eeprom(ah, EEP_MINOR_REV) >= AR5416_EEP_MINOR_VER_19) { 535 if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >= AR5416_EEP_MINOR_VER_19) {
536 txgain_type = ath9k_hw_get_eeprom(ah, EEP_TXGAIN_TYPE); 536 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
537 537
538 if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER) 538 if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER)
539 INIT_INI_ARRAY(&ah->ah_iniModesTxGain, 539 INIT_INI_ARRAY(&ah->ah_iniModesTxGain,
@@ -1238,7 +1238,7 @@ static int ath9k_hw_process_ini(struct ath_hw *ah,
1238 1238
1239 REG_WRITE(ah, AR_PHY(0), 0x00000007); 1239 REG_WRITE(ah, AR_PHY(0), 0x00000007);
1240 REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_EXTERNAL_RADIO); 1240 REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_EXTERNAL_RADIO);
1241 ath9k_hw_set_addac(ah, chan); 1241 ah->eep_ops->set_addac(ah, chan);
1242 1242
1243 if (AR_SREV_5416_V22_OR_LATER(ah)) { 1243 if (AR_SREV_5416_V22_OR_LATER(ah)) {
1244 REG_WRITE_ARRAY(&ah->ah_iniAddac, 1, regWrites); 1244 REG_WRITE_ARRAY(&ah->ah_iniAddac, 1, regWrites);
@@ -1306,12 +1306,12 @@ static int ath9k_hw_process_ini(struct ath_hw *ah,
1306 ath9k_hw_set_regs(ah, chan, macmode); 1306 ath9k_hw_set_regs(ah, chan, macmode);
1307 ath9k_hw_init_chain_masks(ah); 1307 ath9k_hw_init_chain_masks(ah);
1308 1308
1309 status = ath9k_hw_set_txpower(ah, chan, 1309 status = ah->eep_ops->set_txpower(ah, chan,
1310 ath9k_regd_get_ctl(ah, chan), 1310 ath9k_regd_get_ctl(ah, chan),
1311 channel->max_antenna_gain * 2, 1311 channel->max_antenna_gain * 2,
1312 channel->max_power * 2, 1312 channel->max_power * 2,
1313 min((u32) MAX_RATE_POWER, 1313 min((u32) MAX_RATE_POWER,
1314 (u32) ah->regulatory.power_limit)); 1314 (u32) ah->regulatory.power_limit));
1315 if (status != 0) { 1315 if (status != 0) {
1316 DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT, 1316 DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
1317 "error init'ing transmit power\n"); 1317 "error init'ing transmit power\n");
@@ -1632,12 +1632,12 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah,
1632 } 1632 }
1633 } 1633 }
1634 1634
1635 if (ath9k_hw_set_txpower(ah, chan, 1635 if (ah->eep_ops->set_txpower(ah, chan,
1636 ath9k_regd_get_ctl(ah, chan), 1636 ath9k_regd_get_ctl(ah, chan),
1637 channel->max_antenna_gain * 2, 1637 channel->max_antenna_gain * 2,
1638 channel->max_power * 2, 1638 channel->max_power * 2,
1639 min((u32) MAX_RATE_POWER, 1639 min((u32) MAX_RATE_POWER,
1640 (u32) ah->regulatory.power_limit)) != 0) { 1640 (u32) ah->regulatory.power_limit)) != 0) {
1641 DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, 1641 DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
1642 "error init'ing transmit power\n"); 1642 "error init'ing transmit power\n");
1643 return false; 1643 return false;
@@ -1703,7 +1703,7 @@ static void ath9k_hw_9280_spur_mitigate(struct ath_hw *ah, struct ath9k_channel
1703 1703
1704 ah->ah_config.spurmode = SPUR_ENABLE_EEPROM; 1704 ah->ah_config.spurmode = SPUR_ENABLE_EEPROM;
1705 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { 1705 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
1706 cur_bb_spur = ath9k_hw_eeprom_get_spur_chan(ah, i, is2GHz); 1706 cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
1707 1707
1708 if (is2GHz) 1708 if (is2GHz)
1709 cur_bb_spur = (cur_bb_spur / 10) + AR_BASE_FREQ_2GHZ; 1709 cur_bb_spur = (cur_bb_spur / 10) + AR_BASE_FREQ_2GHZ;
@@ -1946,7 +1946,7 @@ static void ath9k_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan
1946 memset(&mask_p, 0, sizeof(int8_t) * 123); 1946 memset(&mask_p, 0, sizeof(int8_t) * 123);
1947 1947
1948 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { 1948 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
1949 cur_bb_spur = ath9k_hw_eeprom_get_spur_chan(ah, i, is2GHz); 1949 cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
1950 if (AR_NO_SPUR == cur_bb_spur) 1950 if (AR_NO_SPUR == cur_bb_spur)
1951 break; 1951 break;
1952 cur_bb_spur = cur_bb_spur - (chan->channel * 10); 1952 cur_bb_spur = cur_bb_spur - (chan->channel * 10);
@@ -2211,7 +2211,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
2211 else 2211 else
2212 ath9k_hw_spur_mitigate(ah, chan); 2212 ath9k_hw_spur_mitigate(ah, chan);
2213 2213
2214 if (!ath9k_hw_eeprom_set_board_values(ah, chan)) { 2214 if (!ah->eep_ops->set_board_values(ah, chan)) {
2215 DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, 2215 DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
2216 "error setting board options\n"); 2216 "error setting board options\n");
2217 return -EIO; 2217 return -EIO;
@@ -3092,14 +3092,14 @@ bool ath9k_hw_fill_cap_info(struct ath_hw *ah)
3092 struct ath9k_hw_capabilities *pCap = &ah->ah_caps; 3092 struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
3093 u16 capField = 0, eeval; 3093 u16 capField = 0, eeval;
3094 3094
3095 eeval = ath9k_hw_get_eeprom(ah, EEP_REG_0); 3095 eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_0);
3096 3096
3097 ah->regulatory.current_rd = eeval; 3097 ah->regulatory.current_rd = eeval;
3098 3098
3099 eeval = ath9k_hw_get_eeprom(ah, EEP_REG_1); 3099 eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_1);
3100 ah->regulatory.current_rd_ext = eeval; 3100 ah->regulatory.current_rd_ext = eeval;
3101 3101
3102 capField = ath9k_hw_get_eeprom(ah, EEP_OP_CAP); 3102 capField = ah->eep_ops->get_eeprom(ah, EEP_OP_CAP);
3103 3103
3104 if (ah->ah_opmode != NL80211_IFTYPE_AP && 3104 if (ah->ah_opmode != NL80211_IFTYPE_AP &&
3105 ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) { 3105 ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) {
@@ -3112,7 +3112,7 @@ bool ath9k_hw_fill_cap_info(struct ath_hw *ah)
3112 "regdomain mapped to 0x%x\n", ah->regulatory.current_rd); 3112 "regdomain mapped to 0x%x\n", ah->regulatory.current_rd);
3113 } 3113 }
3114 3114
3115 eeval = ath9k_hw_get_eeprom(ah, EEP_OP_MODE); 3115 eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
3116 bitmap_zero(pCap->wireless_modes, ATH9K_MODE_MAX); 3116 bitmap_zero(pCap->wireless_modes, ATH9K_MODE_MAX);
3117 3117
3118 if (eeval & AR5416_OPFLAGS_11A) { 3118 if (eeval & AR5416_OPFLAGS_11A) {
@@ -3146,11 +3146,11 @@ bool ath9k_hw_fill_cap_info(struct ath_hw *ah)
3146 } 3146 }
3147 } 3147 }
3148 3148
3149 pCap->tx_chainmask = ath9k_hw_get_eeprom(ah, EEP_TX_MASK); 3149 pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK);
3150 if ((ah->ah_isPciExpress) 3150 if ((ah->ah_isPciExpress)
3151 || (eeval & AR5416_OPFLAGS_11A)) { 3151 || (eeval & AR5416_OPFLAGS_11A)) {
3152 pCap->rx_chainmask = 3152 pCap->rx_chainmask =
3153 ath9k_hw_get_eeprom(ah, EEP_RX_MASK); 3153 ah->eep_ops->get_eeprom(ah, EEP_RX_MASK);
3154 } else { 3154 } else {
3155 pCap->rx_chainmask = 3155 pCap->rx_chainmask =
3156 (ath9k_hw_gpio_get(ah, 0)) ? 0x5 : 0x7; 3156 (ath9k_hw_gpio_get(ah, 0)) ? 0x5 : 0x7;
@@ -3226,7 +3226,7 @@ bool ath9k_hw_fill_cap_info(struct ath_hw *ah)
3226 pCap->hw_caps |= ATH9K_HW_CAP_ENHANCEDPM; 3226 pCap->hw_caps |= ATH9K_HW_CAP_ENHANCEDPM;
3227 3227
3228#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) 3228#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
3229 ah->ah_rfsilent = ath9k_hw_get_eeprom(ah, EEP_RF_SILENT); 3229 ah->ah_rfsilent = ah->eep_ops->get_eeprom(ah, EEP_RF_SILENT);
3230 if (ah->ah_rfsilent & EEP_RFSILENT_ENABLED) { 3230 if (ah->ah_rfsilent & EEP_RFSILENT_ENABLED) {
3231 ah->ah_rfkill_gpio = 3231 ah->ah_rfkill_gpio =
3232 MS(ah->ah_rfsilent, EEP_RFSILENT_GPIO_SEL); 3232 MS(ah->ah_rfsilent, EEP_RFSILENT_GPIO_SEL);
@@ -3266,9 +3266,9 @@ bool ath9k_hw_fill_cap_info(struct ath_hw *ah)
3266 pCap->reg_cap |= AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND; 3266 pCap->reg_cap |= AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND;
3267 3267
3268 pCap->num_antcfg_5ghz = 3268 pCap->num_antcfg_5ghz =
3269 ath9k_hw_get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_5GHZ); 3269 ah->eep_ops->get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_5GHZ);
3270 pCap->num_antcfg_2ghz = 3270 pCap->num_antcfg_2ghz =
3271 ath9k_hw_get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_2GHZ); 3271 ah->eep_ops->get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_2GHZ);
3272 3272
3273 if (AR_SREV_9280_10_OR_LATER(ah) && btcoex_enable) { 3273 if (AR_SREV_9280_10_OR_LATER(ah) && btcoex_enable) {
3274 pCap->hw_caps |= ATH9K_HW_CAP_BT_COEX; 3274 pCap->hw_caps |= ATH9K_HW_CAP_BT_COEX;
@@ -3613,12 +3613,12 @@ bool ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit)
3613 3613
3614 ah->regulatory.power_limit = min(limit, (u32) MAX_RATE_POWER); 3614 ah->regulatory.power_limit = min(limit, (u32) MAX_RATE_POWER);
3615 3615
3616 if (ath9k_hw_set_txpower(ah, chan, 3616 if (ah->eep_ops->set_txpower(ah, chan,
3617 ath9k_regd_get_ctl(ah, chan), 3617 ath9k_regd_get_ctl(ah, chan),
3618 channel->max_antenna_gain * 2, 3618 channel->max_antenna_gain * 2,
3619 channel->max_power * 2, 3619 channel->max_power * 2,
3620 min((u32) MAX_RATE_POWER, 3620 min((u32) MAX_RATE_POWER,
3621 (u32) ah->regulatory.power_limit)) != 0) 3621 (u32) ah->regulatory.power_limit)) != 0)
3622 return false; 3622 return false;
3623 3623
3624 return true; 3624 return true;