Lines Matching refs:ah
38 void ar9003_hw_rtt_enable(struct ath_hw *ah) in ar9003_hw_rtt_enable() argument
40 REG_WRITE(ah, AR_PHY_RTT_CTRL, 1); in ar9003_hw_rtt_enable()
43 void ar9003_hw_rtt_disable(struct ath_hw *ah) in ar9003_hw_rtt_disable() argument
45 REG_WRITE(ah, AR_PHY_RTT_CTRL, 0); in ar9003_hw_rtt_disable()
48 void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask) in ar9003_hw_rtt_set_mask() argument
50 REG_RMW_FIELD(ah, AR_PHY_RTT_CTRL, in ar9003_hw_rtt_set_mask()
54 bool ar9003_hw_rtt_force_restore(struct ath_hw *ah) in ar9003_hw_rtt_force_restore() argument
56 if (!ath9k_hw_wait(ah, AR_PHY_RTT_CTRL, in ar9003_hw_rtt_force_restore()
61 REG_RMW_FIELD(ah, AR_PHY_RTT_CTRL, in ar9003_hw_rtt_force_restore()
64 if (!ath9k_hw_wait(ah, AR_PHY_RTT_CTRL, in ar9003_hw_rtt_force_restore()
72 static void ar9003_hw_rtt_load_hist_entry(struct ath_hw *ah, u8 chain, in ar9003_hw_rtt_load_hist_entry() argument
78 REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_1_B(chain), val); in ar9003_hw_rtt_load_hist_entry()
83 REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), val); in ar9003_hw_rtt_load_hist_entry()
87 REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), val); in ar9003_hw_rtt_load_hist_entry()
90 if (!ath9k_hw_wait(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), in ar9003_hw_rtt_load_hist_entry()
96 REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), val); in ar9003_hw_rtt_load_hist_entry()
99 ath9k_hw_wait(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), in ar9003_hw_rtt_load_hist_entry()
104 void ar9003_hw_rtt_load_hist(struct ath_hw *ah) in ar9003_hw_rtt_load_hist() argument
109 if (!(ah->caps.rx_chainmask & (1 << chain))) in ar9003_hw_rtt_load_hist()
112 ar9003_hw_rtt_load_hist_entry(ah, chain, i, in ar9003_hw_rtt_load_hist()
113 ah->caldata->rtt_table[chain][i]); in ar9003_hw_rtt_load_hist()
114 ath_dbg(ath9k_hw_common(ah), CALIBRATE, in ar9003_hw_rtt_load_hist()
116 i, chain, ah->caldata->rtt_table[chain][i]); in ar9003_hw_rtt_load_hist()
121 static void ar9003_hw_patch_rtt(struct ath_hw *ah, int index, int chain) in ar9003_hw_patch_rtt() argument
125 if (!test_bit(SW_PKDET_DONE, &ah->caldata->cal_flags)) in ar9003_hw_patch_rtt()
131 agc = REG_READ_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), in ar9003_hw_patch_rtt()
136 caldac = ah->caldata->caldac[chain]; in ar9003_hw_patch_rtt()
137 ah->caldata->rtt_table[chain][index] &= 0xFFFF05FF; in ar9003_hw_patch_rtt()
139 ah->caldata->rtt_table[chain][index] |= (caldac << 4); in ar9003_hw_patch_rtt()
142 static int ar9003_hw_rtt_fill_hist_entry(struct ath_hw *ah, u8 chain, u32 index) in ar9003_hw_rtt_fill_hist_entry() argument
150 REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), val); in ar9003_hw_rtt_fill_hist_entry()
154 REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), val); in ar9003_hw_rtt_fill_hist_entry()
157 if (!ath9k_hw_wait(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), in ar9003_hw_rtt_fill_hist_entry()
162 val = MS(REG_READ(ah, AR_PHY_RTT_TABLE_SW_INTF_1_B(chain)), in ar9003_hw_rtt_fill_hist_entry()
169 void ar9003_hw_rtt_fill_hist(struct ath_hw *ah) in ar9003_hw_rtt_fill_hist() argument
174 if (!(ah->caps.rx_chainmask & (1 << chain))) in ar9003_hw_rtt_fill_hist()
177 ah->caldata->rtt_table[chain][i] = in ar9003_hw_rtt_fill_hist()
178 ar9003_hw_rtt_fill_hist_entry(ah, chain, i); in ar9003_hw_rtt_fill_hist()
180 ar9003_hw_patch_rtt(ah, i, chain); in ar9003_hw_rtt_fill_hist()
182 ath_dbg(ath9k_hw_common(ah), CALIBRATE, in ar9003_hw_rtt_fill_hist()
184 i, chain, ah->caldata->rtt_table[chain][i]); in ar9003_hw_rtt_fill_hist()
188 set_bit(RTT_DONE, &ah->caldata->cal_flags); in ar9003_hw_rtt_fill_hist()
191 void ar9003_hw_rtt_clear_hist(struct ath_hw *ah) in ar9003_hw_rtt_clear_hist() argument
196 if (!(ah->caps.rx_chainmask & (1 << chain))) in ar9003_hw_rtt_clear_hist()
199 ar9003_hw_rtt_load_hist_entry(ah, chain, i, 0); in ar9003_hw_rtt_clear_hist()
202 if (ah->caldata) in ar9003_hw_rtt_clear_hist()
203 clear_bit(RTT_DONE, &ah->caldata->cal_flags); in ar9003_hw_rtt_clear_hist()
206 bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan) in ar9003_hw_rtt_restore() argument
210 if (!ah->caldata) in ar9003_hw_rtt_restore()
213 if (test_bit(SW_PKDET_DONE, &ah->caldata->cal_flags)) { in ar9003_hw_rtt_restore()
215 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(0), in ar9003_hw_rtt_restore()
217 ah->caldata->caldac[0]); in ar9003_hw_rtt_restore()
218 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(1), in ar9003_hw_rtt_restore()
220 ah->caldata->caldac[1]); in ar9003_hw_rtt_restore()
222 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(0), in ar9003_hw_rtt_restore()
224 ah->caldata->caldac[0]); in ar9003_hw_rtt_restore()
225 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(1), in ar9003_hw_rtt_restore()
227 ah->caldata->caldac[1]); in ar9003_hw_rtt_restore()
229 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(1), in ar9003_hw_rtt_restore()
231 REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(0), in ar9003_hw_rtt_restore()
235 if (!test_bit(RTT_DONE, &ah->caldata->cal_flags)) in ar9003_hw_rtt_restore()
238 ar9003_hw_rtt_enable(ah); in ar9003_hw_rtt_restore()
240 if (test_bit(SW_PKDET_DONE, &ah->caldata->cal_flags)) in ar9003_hw_rtt_restore()
241 ar9003_hw_rtt_set_mask(ah, 0x30); in ar9003_hw_rtt_restore()
243 ar9003_hw_rtt_set_mask(ah, 0x10); in ar9003_hw_rtt_restore()
245 if (!ath9k_hw_rfbus_req(ah)) { in ar9003_hw_rtt_restore()
246 ath_err(ath9k_hw_common(ah), "Could not stop baseband\n"); in ar9003_hw_rtt_restore()
251 ar9003_hw_rtt_load_hist(ah); in ar9003_hw_rtt_restore()
252 restore = ar9003_hw_rtt_force_restore(ah); in ar9003_hw_rtt_restore()
255 ath9k_hw_rfbus_done(ah); in ar9003_hw_rtt_restore()
256 ar9003_hw_rtt_disable(ah); in ar9003_hw_rtt_restore()