Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
[deliverable/linux.git] / drivers / net / wireless / rt2x00 / rt2800lib.h
CommitLineData
7ef5cc92 1/*
96481b20
ID
2 Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
3 Copyright (C) 2010 Ivo van Doorn <IvDoorn@gmail.com>
7ef5cc92
BZ
4 Copyright (C) 2009 Bartlomiej Zolnierkiewicz
5
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.
10
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.
15
16 You should have received a copy of the GNU General Public License
a05b8c58 17 along with this program; if not, see <http://www.gnu.org/licenses/>.
7ef5cc92
BZ
18 */
19
20#ifndef RT2800LIB_H
21#define RT2800LIB_H
22
23struct rt2800_ops {
24 void (*register_read)(struct rt2x00_dev *rt2x00dev,
25 const unsigned int offset, u32 *value);
31a4cf1f
GW
26 void (*register_read_lock)(struct rt2x00_dev *rt2x00dev,
27 const unsigned int offset, u32 *value);
7ef5cc92
BZ
28 void (*register_write)(struct rt2x00_dev *rt2x00dev,
29 const unsigned int offset, u32 value);
30 void (*register_write_lock)(struct rt2x00_dev *rt2x00dev,
31 const unsigned int offset, u32 value);
32
33 void (*register_multiread)(struct rt2x00_dev *rt2x00dev,
34 const unsigned int offset,
35 void *value, const u32 length);
36 void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev,
37 const unsigned int offset,
38 const void *value, const u32 length);
39
40 int (*regbusy_read)(struct rt2x00_dev *rt2x00dev,
41 const unsigned int offset,
42 const struct rt2x00_field32 field, u32 *reg);
e3a896b9 43
a02308e9 44 int (*read_eeprom)(struct rt2x00_dev *rt2x00dev);
ad417a53
GW
45 bool (*hwcrypt_disabled)(struct rt2x00_dev *rt2x00dev);
46
f31c9a8c
ID
47 int (*drv_write_firmware)(struct rt2x00_dev *rt2x00dev,
48 const u8 *data, const size_t len);
e3a896b9 49 int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
0c5879bc 50 __le32 *(*drv_get_txwi)(struct queue_entry *entry);
7ef5cc92
BZ
51};
52
53static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev,
54 const unsigned int offset,
55 u32 *value)
56{
e796643e 57 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
7ef5cc92
BZ
58
59 rt2800ops->register_read(rt2x00dev, offset, value);
60}
61
31a4cf1f
GW
62static inline void rt2800_register_read_lock(struct rt2x00_dev *rt2x00dev,
63 const unsigned int offset,
64 u32 *value)
65{
e796643e 66 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
31a4cf1f
GW
67
68 rt2800ops->register_read_lock(rt2x00dev, offset, value);
69}
70
7ef5cc92
BZ
71static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev,
72 const unsigned int offset,
73 u32 value)
74{
e796643e 75 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
7ef5cc92
BZ
76
77 rt2800ops->register_write(rt2x00dev, offset, value);
78}
79
80static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev,
81 const unsigned int offset,
82 u32 value)
83{
e796643e 84 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
7ef5cc92
BZ
85
86 rt2800ops->register_write_lock(rt2x00dev, offset, value);
87}
88
89static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev,
90 const unsigned int offset,
91 void *value, const u32 length)
92{
e796643e 93 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
7ef5cc92
BZ
94
95 rt2800ops->register_multiread(rt2x00dev, offset, value, length);
96}
97
98static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev,
99 const unsigned int offset,
100 const void *value,
101 const u32 length)
102{
e796643e 103 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
7ef5cc92
BZ
104
105 rt2800ops->register_multiwrite(rt2x00dev, offset, value, length);
106}
107
108static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev,
109 const unsigned int offset,
110 const struct rt2x00_field32 field,
111 u32 *reg)
112{
e796643e 113 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
7ef5cc92
BZ
114
115 return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg);
116}
117
a02308e9 118static inline int rt2800_read_eeprom(struct rt2x00_dev *rt2x00dev)
ad417a53
GW
119{
120 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
121
a02308e9 122 return rt2800ops->read_eeprom(rt2x00dev);
ad417a53
GW
123}
124
125static inline bool rt2800_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev)
126{
127 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
128
129 return rt2800ops->hwcrypt_disabled(rt2x00dev);
130}
131
f31c9a8c
ID
132static inline int rt2800_drv_write_firmware(struct rt2x00_dev *rt2x00dev,
133 const u8 *data, const size_t len)
134{
e796643e 135 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
f31c9a8c
ID
136
137 return rt2800ops->drv_write_firmware(rt2x00dev, data, len);
138}
139
e3a896b9
GW
140static inline int rt2800_drv_init_registers(struct rt2x00_dev *rt2x00dev)
141{
e796643e 142 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
e3a896b9
GW
143
144 return rt2800ops->drv_init_registers(rt2x00dev);
145}
146
0c5879bc
ID
147static inline __le32 *rt2800_drv_get_txwi(struct queue_entry *entry)
148{
149 const struct rt2800_ops *rt2800ops = entry->queue->rt2x00dev->ops->drv;
150
151 return rt2800ops->drv_get_txwi(entry);
152}
153
89297425
BZ
154void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
155 const u8 command, const u8 token,
156 const u8 arg0, const u8 arg1);
157
5ffddc49 158int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev);
b9a07ae9
ID
159int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev);
160
f31c9a8c
ID
161int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev,
162 const u8 *data, const size_t len);
163int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
164 const u8 *data, const size_t len);
165
0c5879bc
ID
166void rt2800_write_tx_data(struct queue_entry *entry,
167 struct txentry_desc *txdesc);
74861922 168void rt2800_process_rxwi(struct queue_entry *entry, struct rxdone_entry_desc *txdesc);
59679b91 169
31937c42 170void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32* txwi);
96481b20 171
f0194b2d 172void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc);
69cf36a4 173void rt2800_clear_beacon(struct queue_entry *entry);
f0194b2d 174
f4450616
BZ
175extern const struct rt2x00debug rt2800_rt2x00debug;
176
177int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev);
f4450616
BZ
178int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev,
179 struct rt2x00lib_crypto *crypto,
180 struct ieee80211_key_conf *key);
181int rt2800_config_pairwise_key(struct rt2x00_dev *rt2x00dev,
182 struct rt2x00lib_crypto *crypto,
183 struct ieee80211_key_conf *key);
a2b1328a
HS
184int rt2800_sta_add(struct rt2x00_dev *rt2x00dev, struct ieee80211_vif *vif,
185 struct ieee80211_sta *sta);
186int rt2800_sta_remove(struct rt2x00_dev *rt2x00dev, int wcid);
f4450616
BZ
187void rt2800_config_filter(struct rt2x00_dev *rt2x00dev,
188 const unsigned int filter_flags);
189void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf,
190 struct rt2x00intf_conf *conf, const unsigned int flags);
02044643
HS
191void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp,
192 u32 changed);
f4450616
BZ
193void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant);
194void rt2800_config(struct rt2x00_dev *rt2x00dev,
195 struct rt2x00lib_conf *libconf,
196 const unsigned int flags);
197void rt2800_link_stats(struct rt2x00_dev *rt2x00dev, struct link_qual *qual);
198void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual);
199void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual,
200 const u32 count);
9e33a355 201void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev);
2e9c43dd 202void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev);
f4450616 203
b9a07ae9
ID
204int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev);
205void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev);
fcf51541 206
30e84034 207int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev);
a02308e9 208int rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev);
ad417a53
GW
209
210int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev);
38bd7b8a 211
9352c19f
JB
212void rt2800_get_key_seq(struct ieee80211_hw *hw,
213 struct ieee80211_key_conf *key,
214 struct ieee80211_key_seq *seq);
e783619e 215int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
8a3a3c85
EP
216int rt2800_conf_tx(struct ieee80211_hw *hw,
217 struct ieee80211_vif *vif, u16 queue_idx,
e783619e 218 const struct ieee80211_tx_queue_params *params);
37a41b4a 219u64 rt2800_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
e783619e
HS
220int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
221 enum ieee80211_ampdu_mlme_action action,
0b01f030 222 struct ieee80211_sta *sta, u16 tid, u16 *ssn,
e3abc8ff 223 u8 buf_size, bool amsdu);
977206d7
HS
224int rt2800_get_survey(struct ieee80211_hw *hw, int idx,
225 struct survey_info *survey);
f7b395e9 226void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev);
2ce33995 227
ae1b1c5d
GJ
228void rt2800_get_txwi_rxwi_size(struct rt2x00_dev *rt2x00dev,
229 unsigned short *txwi_size,
230 unsigned short *rxwi_size);
231
7ef5cc92 232#endif /* RT2800LIB_H */
This page took 3.078115 seconds and 5 git commands to generate.