Commit 81b1e19a authored by Vasanthakumar Thiagarajan's avatar Vasanthakumar Thiagarajan Committed by John W. Linville

ath9k: Clean up the way the eeprom antenna configuration is read

Signed-off-by: default avatarVasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3aa24e60
...@@ -974,9 +974,8 @@ bool ath9k_hw_set_power_cal_table(struct ath_hal *ah, ...@@ -974,9 +974,8 @@ bool ath9k_hw_set_power_cal_table(struct ath_hal *ah,
int16_t *pTxPowerIndexOffset); int16_t *pTxPowerIndexOffset);
bool ath9k_hw_eeprom_set_board_values(struct ath_hal *ah, bool ath9k_hw_eeprom_set_board_values(struct ath_hal *ah,
struct ath9k_channel *chan); struct ath9k_channel *chan);
int ath9k_hw_get_eeprom_antenna_cfg(struct ath_hal *ah, u16 ath9k_hw_get_eeprom_antenna_cfg(struct ath_hal *ah,
struct ath9k_channel *chan, struct ath9k_channel *chan);
u8 index, u16 *config);
u8 ath9k_hw_get_num_ant_config(struct ath_hal *ah, u8 ath9k_hw_get_num_ant_config(struct ath_hal *ah,
enum ieee80211_band freq_band); enum ieee80211_band freq_band);
u16 ath9k_hw_eeprom_get_spur_chan(struct ath_hal *ah, u16 i, bool is2GHz); u16 ath9k_hw_eeprom_get_spur_chan(struct ath_hal *ah, u16 i, bool is2GHz);
......
...@@ -2085,14 +2085,13 @@ static bool ath9k_hw_eeprom_set_def_board_values(struct ath_hal *ah, ...@@ -2085,14 +2085,13 @@ static bool ath9k_hw_eeprom_set_def_board_values(struct ath_hal *ah,
struct ar5416_eeprom_def *eep = &ahp->ah_eeprom.def; struct ar5416_eeprom_def *eep = &ahp->ah_eeprom.def;
int i, regChainOffset; int i, regChainOffset;
u8 txRxAttenLocal; u8 txRxAttenLocal;
u16 ant_config;
pModal = &(eep->modalHeader[IS_CHAN_2GHZ(chan)]); pModal = &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
txRxAttenLocal = IS_CHAN_2GHZ(chan) ? 23 : 44; txRxAttenLocal = IS_CHAN_2GHZ(chan) ? 23 : 44;
ath9k_hw_get_eeprom_antenna_cfg(ah, chan, 0, &ant_config); REG_WRITE(ah, AR_PHY_SWITCH_COM,
REG_WRITE(ah, AR_PHY_SWITCH_COM, ant_config); ath9k_hw_get_eeprom_antenna_cfg(ah, chan));
for (i = 0; i < AR5416_MAX_CHAINS; i++) { for (i = 0; i < AR5416_MAX_CHAINS; i++) {
if (AR_SREV_9280(ah)) { if (AR_SREV_9280(ah)) {
...@@ -2330,7 +2329,6 @@ static bool ath9k_hw_eeprom_set_4k_board_values(struct ath_hal *ah, ...@@ -2330,7 +2329,6 @@ static bool ath9k_hw_eeprom_set_4k_board_values(struct ath_hal *ah,
struct ar5416_eeprom_4k *eep = &ahp->ah_eeprom.map4k; struct ar5416_eeprom_4k *eep = &ahp->ah_eeprom.map4k;
int regChainOffset; int regChainOffset;
u8 txRxAttenLocal; u8 txRxAttenLocal;
u16 ant_config = 0;
u8 ob[5], db1[5], db2[5]; u8 ob[5], db1[5], db2[5];
u8 ant_div_control1, ant_div_control2; u8 ant_div_control1, ant_div_control2;
u32 regVal; u32 regVal;
...@@ -2340,8 +2338,8 @@ static bool ath9k_hw_eeprom_set_4k_board_values(struct ath_hal *ah, ...@@ -2340,8 +2338,8 @@ static bool ath9k_hw_eeprom_set_4k_board_values(struct ath_hal *ah,
txRxAttenLocal = 23; txRxAttenLocal = 23;
ath9k_hw_get_eeprom_antenna_cfg(ah, chan, 0, &ant_config); REG_WRITE(ah, AR_PHY_SWITCH_COM,
REG_WRITE(ah, AR_PHY_SWITCH_COM, ant_config); ath9k_hw_get_eeprom_antenna_cfg(ah, chan));
regChainOffset = 0; regChainOffset = 0;
REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset, REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset,
...@@ -2524,70 +2522,39 @@ bool ath9k_hw_eeprom_set_board_values(struct ath_hal *ah, ...@@ -2524,70 +2522,39 @@ bool ath9k_hw_eeprom_set_board_values(struct ath_hal *ah,
return ath9k_eeprom_set_board_values[ahp->ah_eep_map](ah, chan); return ath9k_eeprom_set_board_values[ahp->ah_eep_map](ah, chan);
} }
static int ath9k_hw_get_def_eeprom_antenna_cfg(struct ath_hal *ah, static u16 ath9k_hw_get_def_eeprom_antenna_cfg(struct ath_hal *ah,
struct ath9k_channel *chan, struct ath9k_channel *chan)
u8 index, u16 *config)
{ {
struct ath_hal_5416 *ahp = AH5416(ah); struct ath_hal_5416 *ahp = AH5416(ah);
struct ar5416_eeprom_def *eep = &ahp->ah_eeprom.def; struct ar5416_eeprom_def *eep = &ahp->ah_eeprom.def;
struct modal_eep_header *pModal = struct modal_eep_header *pModal =
&(eep->modalHeader[IS_CHAN_2GHZ(chan)]); &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
struct base_eep_header *pBase = &eep->baseEepHeader;
switch (index) { return pModal->antCtrlCommon & 0xFFFF;
case 0:
*config = pModal->antCtrlCommon & 0xFFFF;
return 0;
case 1:
if (pBase->version >= 0x0E0D) {
if (pModal->useAnt1) {
*config =
((pModal->antCtrlCommon & 0xFFFF0000) >> 16);
return 0;
}
}
break;
default:
break;
}
return -EINVAL;
} }
static int ath9k_hw_get_4k_eeprom_antenna_cfg(struct ath_hal *ah, static u16 ath9k_hw_get_4k_eeprom_antenna_cfg(struct ath_hal *ah,
struct ath9k_channel *chan, struct ath9k_channel *chan)
u8 index, u16 *config)
{ {
struct ath_hal_5416 *ahp = AH5416(ah); struct ath_hal_5416 *ahp = AH5416(ah);
struct ar5416_eeprom_4k *eep = &ahp->ah_eeprom.map4k; struct ar5416_eeprom_4k *eep = &ahp->ah_eeprom.map4k;
struct modal_eep_4k_header *pModal = &eep->modalHeader; struct modal_eep_4k_header *pModal = &eep->modalHeader;
switch (index) { return pModal->antCtrlCommon & 0xFFFF;
case 0:
*config = pModal->antCtrlCommon & 0xFFFF;
return 0;
default:
break;
}
return -EINVAL;
} }
static int (*ath9k_get_eeprom_antenna_cfg[])(struct ath_hal *, static u16 (*ath9k_get_eeprom_antenna_cfg[])(struct ath_hal *,
struct ath9k_channel *, struct ath9k_channel *) = {
u8, u16 *) = {
ath9k_hw_get_def_eeprom_antenna_cfg, ath9k_hw_get_def_eeprom_antenna_cfg,
ath9k_hw_get_4k_eeprom_antenna_cfg ath9k_hw_get_4k_eeprom_antenna_cfg
}; };
int ath9k_hw_get_eeprom_antenna_cfg(struct ath_hal *ah, u16 ath9k_hw_get_eeprom_antenna_cfg(struct ath_hal *ah,
struct ath9k_channel *chan, struct ath9k_channel *chan)
u8 index, u16 *config)
{ {
struct ath_hal_5416 *ahp = AH5416(ah); struct ath_hal_5416 *ahp = AH5416(ah);
return ath9k_get_eeprom_antenna_cfg[ahp->ah_eep_map](ah, chan, return ath9k_get_eeprom_antenna_cfg[ahp->ah_eep_map](ah, chan);
index, config);
} }
static u8 ath9k_hw_get_4k_num_ant_config(struct ath_hal *ah, static u8 ath9k_hw_get_4k_num_ant_config(struct ath_hal *ah,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment