2 * Copyright (c) 2010-2011 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #ifndef ATH9K_HW_OPS_H
18 #define ATH9K_HW_OPS_H
20 FILE_LICENCE ( BSD2 );
24 /* Hardware core and driver accessible callbacks */
26 static inline void ath9k_hw_configpcipowersave(struct ath_hw *ah,
30 ath9k_hw_ops(ah)->config_pci_powersave(ah, restore, power_off);
33 static inline void ath9k_hw_rxena(struct ath_hw *ah)
35 ath9k_hw_ops(ah)->rx_enable(ah);
38 static inline void ath9k_hw_set_desc_link(struct ath_hw *ah, void *ds,
41 ath9k_hw_ops(ah)->set_desc_link(ds, link);
44 static inline void ath9k_hw_get_desc_link(struct ath_hw *ah, void *ds,
47 ath9k_hw_ops(ah)->get_desc_link(ds, link);
49 static inline int ath9k_hw_calibrate(struct ath_hw *ah,
50 struct ath9k_channel *chan,
54 return ath9k_hw_ops(ah)->calibrate(ah, chan, rxchainmask, longcal);
57 static inline int ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked)
59 return ath9k_hw_ops(ah)->get_isr(ah, masked);
62 static inline void ath9k_hw_filltxdesc(struct ath_hw *ah, void *ds, u32 seglen,
63 int is_firstseg, int is_lastseg,
64 const void *ds0, u32 buf_addr,
67 ath9k_hw_ops(ah)->fill_txdesc(ah, ds, seglen, is_firstseg, is_lastseg,
71 static inline int ath9k_hw_txprocdesc(struct ath_hw *ah, void *ds,
72 struct ath_tx_status *ts)
74 return ath9k_hw_ops(ah)->proc_txdesc(ah, ds, ts);
77 static inline void ath9k_hw_set11n_txdesc(struct ath_hw *ah, void *ds,
78 u32 pktLen, enum ath9k_pkt_type type,
79 u32 txPower, u32 keyIx,
80 enum ath9k_key_type keyType,
83 ath9k_hw_ops(ah)->set11n_txdesc(ah, ds, pktLen, type, txPower, keyIx,
87 static inline void ath9k_hw_set11n_ratescenario(struct ath_hw *ah, void *ds,
89 u32 durUpdateEn, u32 rtsctsRate,
91 struct ath9k_11n_rate_series series[],
92 u32 nseries, u32 flags)
94 ath9k_hw_ops(ah)->set11n_ratescenario(ah, ds, lastds, durUpdateEn,
95 rtsctsRate, rtsctsDuration, series,
99 static inline void ath9k_hw_set11n_aggr_first(struct ath_hw *ah, void *ds,
102 ath9k_hw_ops(ah)->set11n_aggr_first(ah, ds, aggrLen);
105 static inline void ath9k_hw_set11n_aggr_middle(struct ath_hw *ah, void *ds,
108 ath9k_hw_ops(ah)->set11n_aggr_middle(ah, ds, numDelims);
111 static inline void ath9k_hw_set11n_aggr_last(struct ath_hw *ah, void *ds)
113 ath9k_hw_ops(ah)->set11n_aggr_last(ah, ds);
116 static inline void ath9k_hw_clr11n_aggr(struct ath_hw *ah, void *ds)
118 ath9k_hw_ops(ah)->clr11n_aggr(ah, ds);
121 static inline void ath9k_hw_set_clrdmask(struct ath_hw *ah, void *ds, int val)
123 ath9k_hw_ops(ah)->set_clrdmask(ah, ds, val);
126 static inline void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
127 struct ath_hw_antcomb_conf *antconf)
129 ath9k_hw_ops(ah)->antdiv_comb_conf_get(ah, antconf);
132 static inline void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah,
133 struct ath_hw_antcomb_conf *antconf)
135 ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf);
138 /* Private hardware call ops */
142 static inline int ath9k_hw_rf_set_freq(struct ath_hw *ah,
143 struct ath9k_channel *chan)
145 return ath9k_hw_private_ops(ah)->rf_set_freq(ah, chan);
148 static inline void ath9k_hw_spur_mitigate_freq(struct ath_hw *ah,
149 struct ath9k_channel *chan)
151 ath9k_hw_private_ops(ah)->spur_mitigate_freq(ah, chan);
154 static inline int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)
156 if (!ath9k_hw_private_ops(ah)->rf_alloc_ext_banks)
159 return ath9k_hw_private_ops(ah)->rf_alloc_ext_banks(ah);
162 static inline void ath9k_hw_rf_free_ext_banks(struct ath_hw *ah)
164 if (!ath9k_hw_private_ops(ah)->rf_free_ext_banks)
167 ath9k_hw_private_ops(ah)->rf_free_ext_banks(ah);
170 static inline int ath9k_hw_set_rf_regs(struct ath_hw *ah,
171 struct ath9k_channel *chan,
174 if (!ath9k_hw_private_ops(ah)->set_rf_regs)
177 return ath9k_hw_private_ops(ah)->set_rf_regs(ah, chan, modesIndex);
180 static inline void ath9k_hw_init_bb(struct ath_hw *ah,
181 struct ath9k_channel *chan)
183 return ath9k_hw_private_ops(ah)->init_bb(ah, chan);
186 static inline void ath9k_hw_set_channel_regs(struct ath_hw *ah,
187 struct ath9k_channel *chan)
189 return ath9k_hw_private_ops(ah)->set_channel_regs(ah, chan);
192 static inline int ath9k_hw_process_ini(struct ath_hw *ah,
193 struct ath9k_channel *chan)
195 return ath9k_hw_private_ops(ah)->process_ini(ah, chan);
198 static inline void ath9k_olc_init(struct ath_hw *ah)
200 if (!ath9k_hw_private_ops(ah)->olc_init)
203 return ath9k_hw_private_ops(ah)->olc_init(ah);
206 static inline void ath9k_hw_set_rfmode(struct ath_hw *ah,
207 struct ath9k_channel *chan)
209 return ath9k_hw_private_ops(ah)->set_rfmode(ah, chan);
212 static inline void ath9k_hw_mark_phy_inactive(struct ath_hw *ah)
214 return ath9k_hw_private_ops(ah)->mark_phy_inactive(ah);
217 static inline void ath9k_hw_set_delta_slope(struct ath_hw *ah,
218 struct ath9k_channel *chan)
220 return ath9k_hw_private_ops(ah)->set_delta_slope(ah, chan);
223 static inline int ath9k_hw_rfbus_req(struct ath_hw *ah)
225 return ath9k_hw_private_ops(ah)->rfbus_req(ah);
228 static inline void ath9k_hw_rfbus_done(struct ath_hw *ah)
230 return ath9k_hw_private_ops(ah)->rfbus_done(ah);
233 static inline void ath9k_hw_restore_chainmask(struct ath_hw *ah)
235 if (!ath9k_hw_private_ops(ah)->restore_chainmask)
238 return ath9k_hw_private_ops(ah)->restore_chainmask(ah);
241 static inline void ath9k_hw_set_diversity(struct ath_hw *ah, int value)
243 return ath9k_hw_private_ops(ah)->set_diversity(ah, value);
246 static inline int ath9k_hw_ani_control(struct ath_hw *ah,
247 enum ath9k_ani_cmd cmd, int param)
249 return ath9k_hw_private_ops(ah)->ani_control(ah, cmd, param);
252 static inline void ath9k_hw_do_getnf(struct ath_hw *ah,
253 int16_t nfarray[NUM_NF_READINGS])
255 ath9k_hw_private_ops(ah)->do_getnf(ah, nfarray);
258 static inline int ath9k_hw_init_cal(struct ath_hw *ah,
259 struct ath9k_channel *chan)
261 return ath9k_hw_private_ops(ah)->init_cal(ah, chan);
264 static inline void ath9k_hw_setup_calibration(struct ath_hw *ah,
265 struct ath9k_cal_list *currCal)
267 ath9k_hw_private_ops(ah)->setup_calibration(ah, currCal);
270 #endif /* ATH9K_HW_OPS_H */