diff options
Diffstat (limited to 'drivers/net/wireless/ath/carl9170/fwcmd.h')
-rw-r--r-- | drivers/net/wireless/ath/carl9170/fwcmd.h | 290 |
1 files changed, 290 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/carl9170/fwcmd.h b/drivers/net/wireless/ath/carl9170/fwcmd.h new file mode 100644 index 000000000000..30449d21b762 --- /dev/null +++ b/drivers/net/wireless/ath/carl9170/fwcmd.h | |||
@@ -0,0 +1,290 @@ | |||
1 | /* | ||
2 | * Shared Atheros AR9170 Header | ||
3 | * | ||
4 | * Firmware command interface definitions | ||
5 | * | ||
6 | * Copyright 2008, Johannes Berg <johannes@sipsolutions.net> | ||
7 | * Copyright 2009, 2010, Christian Lamparter <chunkeey@googlemail.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; see the file COPYING. If not, see | ||
20 | * http://www.gnu.org/licenses/. | ||
21 | * | ||
22 | * This file incorporates work covered by the following copyright and | ||
23 | * permission notice: | ||
24 | * Copyright (c) 2007-2008 Atheros Communications, Inc. | ||
25 | * | ||
26 | * Permission to use, copy, modify, and/or distribute this software for any | ||
27 | * purpose with or without fee is hereby granted, provided that the above | ||
28 | * copyright notice and this permission notice appear in all copies. | ||
29 | * | ||
30 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
31 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
32 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
33 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
34 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
35 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
36 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
37 | */ | ||
38 | |||
39 | #ifndef __CARL9170_SHARED_FWCMD_H | ||
40 | #define __CARL9170_SHARED_FWCMD_H | ||
41 | |||
42 | #define CARL9170_MAX_CMD_LEN 64 | ||
43 | #define CARL9170_MAX_CMD_PAYLOAD_LEN 60 | ||
44 | |||
45 | #define CARL9170FW_API_MIN_VER 1 | ||
46 | #define CARL9170FW_API_MAX_VER 1 | ||
47 | |||
48 | enum carl9170_cmd_oids { | ||
49 | CARL9170_CMD_RREG = 0x00, | ||
50 | CARL9170_CMD_WREG = 0x01, | ||
51 | CARL9170_CMD_ECHO = 0x02, | ||
52 | CARL9170_CMD_SWRST = 0x03, | ||
53 | CARL9170_CMD_REBOOT = 0x04, | ||
54 | CARL9170_CMD_BCN_CTRL = 0x05, | ||
55 | CARL9170_CMD_READ_TSF = 0x06, | ||
56 | CARL9170_CMD_RX_FILTER = 0x07, | ||
57 | |||
58 | /* CAM */ | ||
59 | CARL9170_CMD_EKEY = 0x10, | ||
60 | CARL9170_CMD_DKEY = 0x11, | ||
61 | |||
62 | /* RF / PHY */ | ||
63 | CARL9170_CMD_FREQUENCY = 0x20, | ||
64 | CARL9170_CMD_RF_INIT = 0x21, | ||
65 | CARL9170_CMD_SYNTH = 0x22, | ||
66 | CARL9170_CMD_FREQ_START = 0x23, | ||
67 | CARL9170_CMD_PSM = 0x24, | ||
68 | |||
69 | /* Asychronous command flag */ | ||
70 | CARL9170_CMD_ASYNC_FLAG = 0x40, | ||
71 | CARL9170_CMD_WREG_ASYNC = (CARL9170_CMD_WREG | | ||
72 | CARL9170_CMD_ASYNC_FLAG), | ||
73 | CARL9170_CMD_REBOOT_ASYNC = (CARL9170_CMD_REBOOT | | ||
74 | CARL9170_CMD_ASYNC_FLAG), | ||
75 | CARL9170_CMD_BCN_CTRL_ASYNC = (CARL9170_CMD_BCN_CTRL | | ||
76 | CARL9170_CMD_ASYNC_FLAG), | ||
77 | CARL9170_CMD_PSM_ASYNC = (CARL9170_CMD_PSM | | ||
78 | CARL9170_CMD_ASYNC_FLAG), | ||
79 | |||
80 | /* responses and traps */ | ||
81 | CARL9170_RSP_FLAG = 0xc0, | ||
82 | CARL9170_RSP_PRETBTT = 0xc0, | ||
83 | CARL9170_RSP_TXCOMP = 0xc1, | ||
84 | CARL9170_RSP_BEACON_CONFIG = 0xc2, | ||
85 | CARL9170_RSP_ATIM = 0xc3, | ||
86 | CARL9170_RSP_WATCHDOG = 0xc6, | ||
87 | CARL9170_RSP_TEXT = 0xca, | ||
88 | CARL9170_RSP_HEXDUMP = 0xcc, | ||
89 | CARL9170_RSP_RADAR = 0xcd, | ||
90 | CARL9170_RSP_GPIO = 0xce, | ||
91 | CARL9170_RSP_BOOT = 0xcf, | ||
92 | }; | ||
93 | |||
94 | struct carl9170_set_key_cmd { | ||
95 | __le16 user; | ||
96 | __le16 keyId; | ||
97 | __le16 type; | ||
98 | u8 macAddr[6]; | ||
99 | u32 key[4]; | ||
100 | } __packed __aligned(4); | ||
101 | #define CARL9170_SET_KEY_CMD_SIZE 28 | ||
102 | |||
103 | struct carl9170_disable_key_cmd { | ||
104 | __le16 user; | ||
105 | __le16 padding; | ||
106 | } __packed __aligned(4); | ||
107 | #define CARL9170_DISABLE_KEY_CMD_SIZE 4 | ||
108 | |||
109 | struct carl9170_u32_list { | ||
110 | u32 vals[0]; | ||
111 | } __packed; | ||
112 | |||
113 | struct carl9170_reg_list { | ||
114 | __le32 regs[0]; | ||
115 | } __packed; | ||
116 | |||
117 | struct carl9170_write_reg { | ||
118 | struct { | ||
119 | __le32 addr; | ||
120 | __le32 val; | ||
121 | } regs[0] __packed; | ||
122 | } __packed; | ||
123 | |||
124 | #define CARL9170FW_PHY_HT_ENABLE 0x4 | ||
125 | #define CARL9170FW_PHY_HT_DYN2040 0x8 | ||
126 | #define CARL9170FW_PHY_HT_EXT_CHAN_OFF 0x3 | ||
127 | #define CARL9170FW_PHY_HT_EXT_CHAN_OFF_S 2 | ||
128 | |||
129 | struct carl9170_rf_init { | ||
130 | __le32 freq; | ||
131 | u8 ht_settings; | ||
132 | u8 padding2[3]; | ||
133 | __le32 delta_slope_coeff_exp; | ||
134 | __le32 delta_slope_coeff_man; | ||
135 | __le32 delta_slope_coeff_exp_shgi; | ||
136 | __le32 delta_slope_coeff_man_shgi; | ||
137 | __le32 finiteLoopCount; | ||
138 | } __packed; | ||
139 | #define CARL9170_RF_INIT_SIZE 28 | ||
140 | |||
141 | struct carl9170_rf_init_result { | ||
142 | __le32 ret; /* AR9170_PHY_REG_AGC_CONTROL */ | ||
143 | } __packed; | ||
144 | #define CARL9170_RF_INIT_RESULT_SIZE 4 | ||
145 | |||
146 | #define CARL9170_PSM_SLEEP 0x1000 | ||
147 | #define CARL9170_PSM_SOFTWARE 0 | ||
148 | #define CARL9170_PSM_WAKE 0 /* internally used. */ | ||
149 | #define CARL9170_PSM_COUNTER 0xfff | ||
150 | #define CARL9170_PSM_COUNTER_S 0 | ||
151 | |||
152 | struct carl9170_psm { | ||
153 | __le32 state; | ||
154 | } __packed; | ||
155 | #define CARL9170_PSM_SIZE 4 | ||
156 | |||
157 | struct carl9170_rx_filter_cmd { | ||
158 | __le32 rx_filter; | ||
159 | } __packed; | ||
160 | #define CARL9170_RX_FILTER_CMD_SIZE 4 | ||
161 | |||
162 | #define CARL9170_RX_FILTER_BAD 0x01 | ||
163 | #define CARL9170_RX_FILTER_OTHER_RA 0x02 | ||
164 | #define CARL9170_RX_FILTER_DECRY_FAIL 0x04 | ||
165 | #define CARL9170_RX_FILTER_CTL_OTHER 0x08 | ||
166 | #define CARL9170_RX_FILTER_CTL_PSPOLL 0x10 | ||
167 | #define CARL9170_RX_FILTER_CTL_BACKR 0x20 | ||
168 | #define CARL9170_RX_FILTER_MGMT 0x40 | ||
169 | #define CARL9170_RX_FILTER_DATA 0x80 | ||
170 | #define CARL9170_RX_FILTER_EVERYTHING (~0) | ||
171 | |||
172 | struct carl9170_bcn_ctrl_cmd { | ||
173 | __le32 vif_id; | ||
174 | __le32 mode; | ||
175 | __le32 bcn_addr; | ||
176 | __le32 bcn_len; | ||
177 | } __packed; | ||
178 | #define CARL9170_BCN_CTRL_CMD_SIZE 16 | ||
179 | |||
180 | #define CARL9170_BCN_CTRL_DRAIN 0 | ||
181 | #define CARL9170_BCN_CTRL_CAB_TRIGGER 1 | ||
182 | |||
183 | struct carl9170_cmd_head { | ||
184 | union { | ||
185 | struct { | ||
186 | u8 len; | ||
187 | u8 cmd; | ||
188 | u8 seq; | ||
189 | u8 ext; | ||
190 | } __packed; | ||
191 | |||
192 | u32 hdr_data; | ||
193 | } __packed; | ||
194 | } __packed; | ||
195 | |||
196 | struct carl9170_cmd { | ||
197 | struct carl9170_cmd_head hdr; | ||
198 | union { | ||
199 | struct carl9170_set_key_cmd setkey; | ||
200 | struct carl9170_disable_key_cmd disablekey; | ||
201 | struct carl9170_u32_list echo; | ||
202 | struct carl9170_reg_list rreg; | ||
203 | struct carl9170_write_reg wreg; | ||
204 | struct carl9170_rf_init rf_init; | ||
205 | struct carl9170_psm psm; | ||
206 | struct carl9170_bcn_ctrl_cmd bcn_ctrl; | ||
207 | struct carl9170_rx_filter_cmd rx_filter; | ||
208 | u8 data[CARL9170_MAX_CMD_PAYLOAD_LEN]; | ||
209 | } __packed; | ||
210 | } __packed __aligned(4); | ||
211 | |||
212 | #define CARL9170_TX_STATUS_QUEUE 3 | ||
213 | #define CARL9170_TX_STATUS_QUEUE_S 0 | ||
214 | #define CARL9170_TX_STATUS_RIX_S 2 | ||
215 | #define CARL9170_TX_STATUS_RIX (3 << CARL9170_TX_STATUS_RIX_S) | ||
216 | #define CARL9170_TX_STATUS_TRIES_S 4 | ||
217 | #define CARL9170_TX_STATUS_TRIES (7 << CARL9170_TX_STATUS_TRIES_S) | ||
218 | #define CARL9170_TX_STATUS_SUCCESS 0x80 | ||
219 | |||
220 | #ifdef __CARL9170FW__ | ||
221 | /* | ||
222 | * NOTE: | ||
223 | * Both structs [carl9170_tx_status and _carl9170_tx_status] | ||
224 | * need to be "bit for bit" in sync. | ||
225 | */ | ||
226 | struct carl9170_tx_status { | ||
227 | /* | ||
228 | * Beware of compiler bugs in all gcc pre 4.4! | ||
229 | */ | ||
230 | |||
231 | u8 cookie; | ||
232 | u8 queue:2; | ||
233 | u8 rix:2; | ||
234 | u8 tries:3; | ||
235 | u8 success:1; | ||
236 | } __packed; | ||
237 | #endif /* __CARL9170FW__ */ | ||
238 | |||
239 | struct _carl9170_tx_status { | ||
240 | /* | ||
241 | * This version should be immune to all alignment bugs. | ||
242 | */ | ||
243 | |||
244 | u8 cookie; | ||
245 | u8 info; | ||
246 | } __packed; | ||
247 | #define CARL9170_TX_STATUS_SIZE 2 | ||
248 | |||
249 | #define CARL9170_RSP_TX_STATUS_NUM (CARL9170_MAX_CMD_PAYLOAD_LEN / \ | ||
250 | sizeof(struct _carl9170_tx_status)) | ||
251 | |||
252 | #define CARL9170_TX_MAX_RATE_TRIES 7 | ||
253 | |||
254 | #define CARL9170_TX_MAX_RATES 4 | ||
255 | #define CARL9170_TX_MAX_RETRY_RATES (CARL9170_TX_MAX_RATES - 1) | ||
256 | #define CARL9170_ERR_MAGIC "ERR:" | ||
257 | #define CARL9170_BUG_MAGIC "BUG:" | ||
258 | |||
259 | struct carl9170_gpio { | ||
260 | __le32 gpio; | ||
261 | } __packed; | ||
262 | #define CARL9170_GPIO_SIZE 4 | ||
263 | |||
264 | struct carl9170_tsf_rsp { | ||
265 | union { | ||
266 | __le32 tsf[2]; | ||
267 | __le64 tsf_64; | ||
268 | } __packed; | ||
269 | } __packed; | ||
270 | #define CARL9170_TSF_RSP_SIZE 8 | ||
271 | |||
272 | struct carl9170_rsp { | ||
273 | struct carl9170_cmd_head hdr; | ||
274 | |||
275 | union { | ||
276 | struct carl9170_rf_init_result rf_init_res; | ||
277 | struct carl9170_u32_list rreg_res; | ||
278 | struct carl9170_u32_list echo; | ||
279 | #ifdef __CARL9170FW__ | ||
280 | struct carl9170_tx_status tx_status[0]; | ||
281 | #endif /* __CARL9170FW__ */ | ||
282 | struct _carl9170_tx_status _tx_status[0]; | ||
283 | struct carl9170_gpio gpio; | ||
284 | struct carl9170_tsf_rsp tsf; | ||
285 | struct carl9170_psm psm; | ||
286 | u8 data[CARL9170_MAX_CMD_PAYLOAD_LEN]; | ||
287 | } __packed; | ||
288 | } __packed __aligned(4); | ||
289 | |||
290 | #endif /* __CARL9170_SHARED_FWCMD_H */ | ||