aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2010-06-01 05:44:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-03 14:10:46 -0400
commit79d7f4bcf8519abbea46d909ff01a1358b431e1d (patch)
tree00e240de8a7c74374f273ec12bd00e0b8f499d95 /drivers/net/wireless/ath
parent16c94ac6cf9727b686e16b8d5dedfd282ab3a9ee (diff)
ath9k_hw: Optimize ath9k_hw_ar9287_set_board_values
Rather than doing a series of RMWs, calculate the value to be written to the register in question and do a single REGWRITE. This improves bringup time. This depends on the analog_shiftreg configuration option, which is currently buggy. For AP mode, a delay of 100us has to be the default. For station mode, this knob has to be enabled on a per-case basis, though it is a little unclear on when to enable a delay. This can be fixed later though. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_9287.c69
3 files changed, 41 insertions, 37 deletions
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index ca8704a9d7ac..a29b2d94c802 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -24,6 +24,14 @@ static inline u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz)
24 return (u16) ((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin)); 24 return (u16) ((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin));
25} 25}
26 26
27void ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val)
28{
29 REG_WRITE(ah, reg, val);
30
31 if (ah->config.analog_shiftreg)
32 udelay(100);
33}
34
27void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, 35void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask,
28 u32 shift, u32 val) 36 u32 shift, u32 val)
29{ 37{
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h
index 21354c15a9a9..14186f2fc113 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
@@ -679,6 +679,7 @@ struct eeprom_ops {
679 u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz); 679 u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz);
680}; 680};
681 681
682void ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val);
682void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, 683void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask,
683 u32 shift, u32 val); 684 u32 shift, u32 val);
684int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, 685int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight,
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
index 5010cd13023c..27abfba0b69f 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
@@ -988,7 +988,7 @@ static void ath9k_hw_ar9287_set_board_values(struct ath_hw *ah,
988 struct ar9287_eeprom *eep = &ah->eeprom.map9287; 988 struct ar9287_eeprom *eep = &ah->eeprom.map9287;
989 struct modal_eep_ar9287_header *pModal = &eep->modalHeader; 989 struct modal_eep_ar9287_header *pModal = &eep->modalHeader;
990 u16 antWrites[AR9287_ANT_16S]; 990 u16 antWrites[AR9287_ANT_16S];
991 u32 regChainOffset; 991 u32 regChainOffset, regval;
992 u8 txRxAttenLocal; 992 u8 txRxAttenLocal;
993 int i, j, offset_num; 993 int i, j, offset_num;
994 994
@@ -1075,42 +1075,37 @@ static void ath9k_hw_ar9287_set_board_values(struct ath_hw *ah,
1075 REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0, 1075 REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0,
1076 AR_PHY_EXT_CCA0_THRESH62, pModal->thresh62); 1076 AR_PHY_EXT_CCA0_THRESH62, pModal->thresh62);
1077 1077
1078 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH0, AR9287_AN_RF2G3_DB1, 1078 regval = REG_READ(ah, AR9287_AN_RF2G3_CH0);
1079 AR9287_AN_RF2G3_DB1_S, pModal->db1); 1079 regval &= ~(AR9287_AN_RF2G3_DB1 |
1080 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH0, AR9287_AN_RF2G3_DB2, 1080 AR9287_AN_RF2G3_DB2 |
1081 AR9287_AN_RF2G3_DB2_S, pModal->db2); 1081 AR9287_AN_RF2G3_OB_CCK |
1082 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH0, 1082 AR9287_AN_RF2G3_OB_PSK |
1083 AR9287_AN_RF2G3_OB_CCK, 1083 AR9287_AN_RF2G3_OB_QAM |
1084 AR9287_AN_RF2G3_OB_CCK_S, pModal->ob_cck); 1084 AR9287_AN_RF2G3_OB_PAL_OFF);
1085 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH0, 1085 regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) |
1086 AR9287_AN_RF2G3_OB_PSK, 1086 SM(pModal->db2, AR9287_AN_RF2G3_DB2) |
1087 AR9287_AN_RF2G3_OB_PSK_S, pModal->ob_psk); 1087 SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) |
1088 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH0, 1088 SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) |
1089 AR9287_AN_RF2G3_OB_QAM, 1089 SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) |
1090 AR9287_AN_RF2G3_OB_QAM_S, pModal->ob_qam); 1090 SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF));
1091 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH0, 1091
1092 AR9287_AN_RF2G3_OB_PAL_OFF, 1092 ath9k_hw_analog_shift_regwrite(ah, AR9287_AN_RF2G3_CH0, regval);
1093 AR9287_AN_RF2G3_OB_PAL_OFF_S, 1093
1094 pModal->ob_pal_off); 1094 regval = REG_READ(ah, AR9287_AN_RF2G3_CH1);
1095 1095 regval &= ~(AR9287_AN_RF2G3_DB1 |
1096 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH1, 1096 AR9287_AN_RF2G3_DB2 |
1097 AR9287_AN_RF2G3_DB1, AR9287_AN_RF2G3_DB1_S, 1097 AR9287_AN_RF2G3_OB_CCK |
1098 pModal->db1); 1098 AR9287_AN_RF2G3_OB_PSK |
1099 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH1, AR9287_AN_RF2G3_DB2, 1099 AR9287_AN_RF2G3_OB_QAM |
1100 AR9287_AN_RF2G3_DB2_S, pModal->db2); 1100 AR9287_AN_RF2G3_OB_PAL_OFF);
1101 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH1, 1101 regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) |
1102 AR9287_AN_RF2G3_OB_CCK, 1102 SM(pModal->db2, AR9287_AN_RF2G3_DB2) |
1103 AR9287_AN_RF2G3_OB_CCK_S, pModal->ob_cck); 1103 SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) |
1104 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH1, 1104 SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) |
1105 AR9287_AN_RF2G3_OB_PSK, 1105 SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) |
1106 AR9287_AN_RF2G3_OB_PSK_S, pModal->ob_psk); 1106 SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF));
1107 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH1, 1107
1108 AR9287_AN_RF2G3_OB_QAM, 1108 ath9k_hw_analog_shift_regwrite(ah, AR9287_AN_RF2G3_CH1, regval);
1109 AR9287_AN_RF2G3_OB_QAM_S, pModal->ob_qam);
1110 ath9k_hw_analog_shift_rmw(ah, AR9287_AN_RF2G3_CH1,
1111 AR9287_AN_RF2G3_OB_PAL_OFF,
1112 AR9287_AN_RF2G3_OB_PAL_OFF_S,
1113 pModal->ob_pal_off);
1114 1109
1115 REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, 1110 REG_RMW_FIELD(ah, AR_PHY_RF_CTL2,
1116 AR_PHY_TX_END_DATA_START, pModal->txFrameToDataStart); 1111 AR_PHY_TX_END_DATA_START, pModal->txFrameToDataStart);