rt2x00: rt2800lib: fix frequency offset boundary calculation
[linux/fpc-iii.git] / drivers / net / wireless / rt2x00 / rt2800lib.h
bloba94ba447e63c93eb10744ba2adf8ff2aa00f1886
1 /*
2 Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
3 Copyright (C) 2010 Ivo van Doorn <IvDoorn@gmail.com>
4 Copyright (C) 2009 Bartlomiej Zolnierkiewicz
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the
18 Free Software Foundation, Inc.,
19 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef RT2800LIB_H
23 #define RT2800LIB_H
25 struct rt2800_ops {
26 void (*register_read)(struct rt2x00_dev *rt2x00dev,
27 const unsigned int offset, u32 *value);
28 void (*register_read_lock)(struct rt2x00_dev *rt2x00dev,
29 const unsigned int offset, u32 *value);
30 void (*register_write)(struct rt2x00_dev *rt2x00dev,
31 const unsigned int offset, u32 value);
32 void (*register_write_lock)(struct rt2x00_dev *rt2x00dev,
33 const unsigned int offset, u32 value);
35 void (*register_multiread)(struct rt2x00_dev *rt2x00dev,
36 const unsigned int offset,
37 void *value, const u32 length);
38 void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev,
39 const unsigned int offset,
40 const void *value, const u32 length);
42 int (*regbusy_read)(struct rt2x00_dev *rt2x00dev,
43 const unsigned int offset,
44 const struct rt2x00_field32 field, u32 *reg);
46 int (*read_eeprom)(struct rt2x00_dev *rt2x00dev);
47 bool (*hwcrypt_disabled)(struct rt2x00_dev *rt2x00dev);
49 int (*drv_write_firmware)(struct rt2x00_dev *rt2x00dev,
50 const u8 *data, const size_t len);
51 int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
52 __le32 *(*drv_get_txwi)(struct queue_entry *entry);
55 static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev,
56 const unsigned int offset,
57 u32 *value)
59 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
61 rt2800ops->register_read(rt2x00dev, offset, value);
64 static inline void rt2800_register_read_lock(struct rt2x00_dev *rt2x00dev,
65 const unsigned int offset,
66 u32 *value)
68 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
70 rt2800ops->register_read_lock(rt2x00dev, offset, value);
73 static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev,
74 const unsigned int offset,
75 u32 value)
77 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
79 rt2800ops->register_write(rt2x00dev, offset, value);
82 static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev,
83 const unsigned int offset,
84 u32 value)
86 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
88 rt2800ops->register_write_lock(rt2x00dev, offset, value);
91 static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev,
92 const unsigned int offset,
93 void *value, const u32 length)
95 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
97 rt2800ops->register_multiread(rt2x00dev, offset, value, length);
100 static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev,
101 const unsigned int offset,
102 const void *value,
103 const u32 length)
105 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
107 rt2800ops->register_multiwrite(rt2x00dev, offset, value, length);
110 static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev,
111 const unsigned int offset,
112 const struct rt2x00_field32 field,
113 u32 *reg)
115 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
117 return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg);
120 static inline int rt2800_read_eeprom(struct rt2x00_dev *rt2x00dev)
122 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
124 return rt2800ops->read_eeprom(rt2x00dev);
127 static inline bool rt2800_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev)
129 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
131 return rt2800ops->hwcrypt_disabled(rt2x00dev);
134 static inline int rt2800_drv_write_firmware(struct rt2x00_dev *rt2x00dev,
135 const u8 *data, const size_t len)
137 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
139 return rt2800ops->drv_write_firmware(rt2x00dev, data, len);
142 static inline int rt2800_drv_init_registers(struct rt2x00_dev *rt2x00dev)
144 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
146 return rt2800ops->drv_init_registers(rt2x00dev);
149 static inline __le32 *rt2800_drv_get_txwi(struct queue_entry *entry)
151 const struct rt2800_ops *rt2800ops = entry->queue->rt2x00dev->ops->drv;
153 return rt2800ops->drv_get_txwi(entry);
156 void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
157 const u8 command, const u8 token,
158 const u8 arg0, const u8 arg1);
160 int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev);
161 int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev);
163 int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev,
164 const u8 *data, const size_t len);
165 int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
166 const u8 *data, const size_t len);
168 void rt2800_write_tx_data(struct queue_entry *entry,
169 struct txentry_desc *txdesc);
170 void rt2800_process_rxwi(struct queue_entry *entry, struct rxdone_entry_desc *txdesc);
172 void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32* txwi);
174 void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc);
175 void rt2800_clear_beacon(struct queue_entry *entry);
177 extern const struct rt2x00debug rt2800_rt2x00debug;
179 int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev);
180 int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev,
181 struct rt2x00lib_crypto *crypto,
182 struct ieee80211_key_conf *key);
183 int rt2800_config_pairwise_key(struct rt2x00_dev *rt2x00dev,
184 struct rt2x00lib_crypto *crypto,
185 struct ieee80211_key_conf *key);
186 int rt2800_sta_add(struct rt2x00_dev *rt2x00dev, struct ieee80211_vif *vif,
187 struct ieee80211_sta *sta);
188 int rt2800_sta_remove(struct rt2x00_dev *rt2x00dev, int wcid);
189 void rt2800_config_filter(struct rt2x00_dev *rt2x00dev,
190 const unsigned int filter_flags);
191 void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf,
192 struct rt2x00intf_conf *conf, const unsigned int flags);
193 void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp,
194 u32 changed);
195 void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant);
196 void rt2800_config(struct rt2x00_dev *rt2x00dev,
197 struct rt2x00lib_conf *libconf,
198 const unsigned int flags);
199 void rt2800_link_stats(struct rt2x00_dev *rt2x00dev, struct link_qual *qual);
200 void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual);
201 void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual,
202 const u32 count);
203 void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev);
204 void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev);
206 int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev);
207 void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev);
209 int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev);
210 int rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev);
212 int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev);
214 void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx, u32 *iv32,
215 u16 *iv16);
216 int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
217 int rt2800_conf_tx(struct ieee80211_hw *hw,
218 struct ieee80211_vif *vif, u16 queue_idx,
219 const struct ieee80211_tx_queue_params *params);
220 u64 rt2800_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
221 int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
222 enum ieee80211_ampdu_mlme_action action,
223 struct ieee80211_sta *sta, u16 tid, u16 *ssn,
224 u8 buf_size);
225 int rt2800_get_survey(struct ieee80211_hw *hw, int idx,
226 struct survey_info *survey);
227 void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev);
229 void rt2800_get_txwi_rxwi_size(struct rt2x00_dev *rt2x00dev,
230 unsigned short *txwi_size,
231 unsigned short *rxwi_size);
233 #endif /* RT2800LIB_H */