dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / drivers / net / wireless / ralink / rt2x00 / rt2800lib.h
blob0dff2c7b30105133122f60cac3417153f5eecc68
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, see <http://www.gnu.org/licenses/>.
20 #ifndef RT2800LIB_H
21 #define RT2800LIB_H
24 * Hardware has 255 WCID table entries. First 32 entries are reserved for
25 * shared keys. Since parts of the pairwise key table might be shared with
26 * the beacon frame buffers 6 & 7 we could only use the first 222 entries.
28 #define WCID_START 33
29 #define WCID_END 222
30 #define STA_IDS_SIZE (WCID_END - WCID_START + 2)
32 /* RT2800 driver data structure */
33 struct rt2800_drv_data {
34 u8 calibration_bw20;
35 u8 calibration_bw40;
36 char rx_calibration_bw20;
37 char rx_calibration_bw40;
38 char tx_calibration_bw20;
39 char tx_calibration_bw40;
40 u8 bbp25;
41 u8 bbp26;
42 u8 txmixer_gain_24g;
43 u8 txmixer_gain_5g;
44 u8 max_psdu;
45 unsigned int tbtt_tick;
46 unsigned int ampdu_factor_cnt[4];
47 DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
48 struct ieee80211_sta *wcid_to_sta[STA_IDS_SIZE];
51 struct rt2800_ops {
52 u32 (*register_read)(struct rt2x00_dev *rt2x00dev,
53 const unsigned int offset);
54 u32 (*register_read_lock)(struct rt2x00_dev *rt2x00dev,
55 const unsigned int offset);
56 void (*register_write)(struct rt2x00_dev *rt2x00dev,
57 const unsigned int offset, u32 value);
58 void (*register_write_lock)(struct rt2x00_dev *rt2x00dev,
59 const unsigned int offset, u32 value);
61 void (*register_multiread)(struct rt2x00_dev *rt2x00dev,
62 const unsigned int offset,
63 void *value, const u32 length);
64 void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev,
65 const unsigned int offset,
66 const void *value, const u32 length);
68 int (*regbusy_read)(struct rt2x00_dev *rt2x00dev,
69 const unsigned int offset,
70 const struct rt2x00_field32 field, u32 *reg);
72 int (*read_eeprom)(struct rt2x00_dev *rt2x00dev);
73 bool (*hwcrypt_disabled)(struct rt2x00_dev *rt2x00dev);
75 int (*drv_write_firmware)(struct rt2x00_dev *rt2x00dev,
76 const u8 *data, const size_t len);
77 int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
78 __le32 *(*drv_get_txwi)(struct queue_entry *entry);
81 static inline u32 rt2800_register_read(struct rt2x00_dev *rt2x00dev,
82 const unsigned int offset)
84 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
86 return rt2800ops->register_read(rt2x00dev, offset);
89 static inline u32 rt2800_register_read_lock(struct rt2x00_dev *rt2x00dev,
90 const unsigned int offset)
92 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
94 return rt2800ops->register_read_lock(rt2x00dev, offset);
97 static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev,
98 const unsigned int offset,
99 u32 value)
101 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
103 rt2800ops->register_write(rt2x00dev, offset, value);
106 static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev,
107 const unsigned int offset,
108 u32 value)
110 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
112 rt2800ops->register_write_lock(rt2x00dev, offset, value);
115 static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev,
116 const unsigned int offset,
117 void *value, const u32 length)
119 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
121 rt2800ops->register_multiread(rt2x00dev, offset, value, length);
124 static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev,
125 const unsigned int offset,
126 const void *value,
127 const u32 length)
129 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
131 rt2800ops->register_multiwrite(rt2x00dev, offset, value, length);
134 static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev,
135 const unsigned int offset,
136 const struct rt2x00_field32 field,
137 u32 *reg)
139 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
141 return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg);
144 static inline int rt2800_read_eeprom(struct rt2x00_dev *rt2x00dev)
146 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
148 return rt2800ops->read_eeprom(rt2x00dev);
151 static inline bool rt2800_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev)
153 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
155 return rt2800ops->hwcrypt_disabled(rt2x00dev);
158 static inline int rt2800_drv_write_firmware(struct rt2x00_dev *rt2x00dev,
159 const u8 *data, const size_t len)
161 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
163 return rt2800ops->drv_write_firmware(rt2x00dev, data, len);
166 static inline int rt2800_drv_init_registers(struct rt2x00_dev *rt2x00dev)
168 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
170 return rt2800ops->drv_init_registers(rt2x00dev);
173 static inline __le32 *rt2800_drv_get_txwi(struct queue_entry *entry)
175 const struct rt2800_ops *rt2800ops = entry->queue->rt2x00dev->ops->drv;
177 return rt2800ops->drv_get_txwi(entry);
180 void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
181 const u8 command, const u8 token,
182 const u8 arg0, const u8 arg1);
184 int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev);
185 int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev);
187 int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev,
188 const u8 *data, const size_t len);
189 int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
190 const u8 *data, const size_t len);
192 void rt2800_write_tx_data(struct queue_entry *entry,
193 struct txentry_desc *txdesc);
194 void rt2800_process_rxwi(struct queue_entry *entry, struct rxdone_entry_desc *txdesc);
196 void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi,
197 bool match);
198 void rt2800_txdone(struct rt2x00_dev *rt2x00dev);
199 void rt2800_txdone_nostatus(struct rt2x00_dev *rt2x00dev);
200 bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev);
202 void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc);
203 void rt2800_clear_beacon(struct queue_entry *entry);
205 extern const struct rt2x00debug rt2800_rt2x00debug;
207 int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev);
208 int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev,
209 struct rt2x00lib_crypto *crypto,
210 struct ieee80211_key_conf *key);
211 int rt2800_config_pairwise_key(struct rt2x00_dev *rt2x00dev,
212 struct rt2x00lib_crypto *crypto,
213 struct ieee80211_key_conf *key);
214 int rt2800_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
215 struct ieee80211_sta *sta);
216 int rt2800_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
217 struct ieee80211_sta *sta);
218 void rt2800_config_filter(struct rt2x00_dev *rt2x00dev,
219 const unsigned int filter_flags);
220 void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf,
221 struct rt2x00intf_conf *conf, const unsigned int flags);
222 void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp,
223 u32 changed);
224 void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant);
225 void rt2800_config(struct rt2x00_dev *rt2x00dev,
226 struct rt2x00lib_conf *libconf,
227 const unsigned int flags);
228 void rt2800_link_stats(struct rt2x00_dev *rt2x00dev, struct link_qual *qual);
229 void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual);
230 void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual,
231 const u32 count);
232 void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev);
233 void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev);
235 int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev);
236 void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev);
238 int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev);
239 int rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev);
241 int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev);
243 void rt2800_get_key_seq(struct ieee80211_hw *hw,
244 struct ieee80211_key_conf *key,
245 struct ieee80211_key_seq *seq);
246 int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
247 int rt2800_conf_tx(struct ieee80211_hw *hw,
248 struct ieee80211_vif *vif, u16 queue_idx,
249 const struct ieee80211_tx_queue_params *params);
250 u64 rt2800_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
251 int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
252 struct ieee80211_ampdu_params *params);
253 int rt2800_get_survey(struct ieee80211_hw *hw, int idx,
254 struct survey_info *survey);
255 void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev);
257 void rt2800_get_txwi_rxwi_size(struct rt2x00_dev *rt2x00dev,
258 unsigned short *txwi_size,
259 unsigned short *rxwi_size);
261 #endif /* RT2800LIB_H */