Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
fwcmd.h
Go to the documentation of this file.
1 /*
2  * Shared Atheros AR9170 Header
3  *
4  * Firmware command interface definitions
5  *
6  * Copyright 2008, Johannes Berg <[email protected]>
7  * Copyright 2009-2011 Christian Lamparter <[email protected]>
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 
59 
60  /* CAM */
63 
64  /* RF / PHY */
70 
71  /* Asychronous command flag */
81 
82  /* responses and traps */
94 };
95 
101  u32 key[4];
102 } __packed __aligned(4);
103 #define CARL9170_SET_KEY_CMD_SIZE 28
108 } __packed __aligned(4);
109 #define CARL9170_DISABLE_KEY_CMD_SIZE 4
112  u32 vals[0];
113 } __packed;
114 
117 } __packed;
118 
120  struct {
123  } regs[0] __packed;
124 } __packed;
125 
126 #define CARL9170FW_PHY_HT_ENABLE 0x4
127 #define CARL9170FW_PHY_HT_DYN2040 0x8
128 #define CARL9170FW_PHY_HT_EXT_CHAN_OFF 0x3
129 #define CARL9170FW_PHY_HT_EXT_CHAN_OFF_S 2
130 
140 } __packed;
141 #define CARL9170_RF_INIT_SIZE 28
142 
144  __le32 ret; /* AR9170_PHY_REG_AGC_CONTROL */
145 } __packed;
146 #define CARL9170_RF_INIT_RESULT_SIZE 4
147 
148 #define CARL9170_PSM_SLEEP 0x1000
149 #define CARL9170_PSM_SOFTWARE 0
150 #define CARL9170_PSM_WAKE 0 /* internally used. */
151 #define CARL9170_PSM_COUNTER 0xfff
152 #define CARL9170_PSM_COUNTER_S 0
153 
154 struct carl9170_psm {
156 } __packed;
157 #define CARL9170_PSM_SIZE 4
158 
161 } __packed;
162 #define CARL9170_RX_FILTER_CMD_SIZE 4
163 
164 #define CARL9170_RX_FILTER_BAD 0x01
165 #define CARL9170_RX_FILTER_OTHER_RA 0x02
166 #define CARL9170_RX_FILTER_DECRY_FAIL 0x04
167 #define CARL9170_RX_FILTER_CTL_OTHER 0x08
168 #define CARL9170_RX_FILTER_CTL_PSPOLL 0x10
169 #define CARL9170_RX_FILTER_CTL_BACKR 0x20
170 #define CARL9170_RX_FILTER_MGMT 0x40
171 #define CARL9170_RX_FILTER_DATA 0x80
172 #define CARL9170_RX_FILTER_EVERYTHING (~0)
173 
179 } __packed;
180 #define CARL9170_BCN_CTRL_CMD_SIZE 16
181 
182 #define CARL9170_BCN_CTRL_DRAIN 0
183 #define CARL9170_BCN_CTRL_CAB_TRIGGER 1
184 
187  u8 mac[6];
188  u8 bssid[6];
192  u8 pattern[32];
193 } __packed;
194 
195 #define CARL9170_WOL_CMD_SIZE 60
196 
197 #define CARL9170_WOL_DISCONNECT 1
198 #define CARL9170_WOL_MAGIC_PKT 2
199 
201  union {
202  struct {
207  } __packed;
208 
210  } __packed;
211 } __packed;
212 
213 struct carl9170_cmd {
215  union {
227  } __packed;
228 } __packed __aligned(4);
230 #define CARL9170_TX_STATUS_QUEUE 3
231 #define CARL9170_TX_STATUS_QUEUE_S 0
232 #define CARL9170_TX_STATUS_RIX_S 2
233 #define CARL9170_TX_STATUS_RIX (3 << CARL9170_TX_STATUS_RIX_S)
234 #define CARL9170_TX_STATUS_TRIES_S 4
235 #define CARL9170_TX_STATUS_TRIES (7 << CARL9170_TX_STATUS_TRIES_S)
236 #define CARL9170_TX_STATUS_SUCCESS 0x80
238 #ifdef __CARL9170FW__
239 /*
240  * NOTE:
241  * Both structs [carl9170_tx_status and _carl9170_tx_status]
242  * need to be "bit for bit" in sync.
243  */
244 struct carl9170_tx_status {
245  /*
246  * Beware of compiler bugs in all gcc pre 4.4!
247  */
248 
249  u8 cookie;
250  u8 queue:2;
251  u8 rix:2;
252  u8 tries:3;
253  u8 success:1;
254 } __packed;
255 #endif /* __CARL9170FW__ */
256 
258  /*
259  * This version should be immune to all alignment bugs.
260  */
261 
264 } __packed;
265 #define CARL9170_TX_STATUS_SIZE 2
266 
267 #define CARL9170_RSP_TX_STATUS_NUM (CARL9170_MAX_CMD_PAYLOAD_LEN / \
268  sizeof(struct _carl9170_tx_status))
269 
270 #define CARL9170_TX_MAX_RATE_TRIES 7
271 
272 #define CARL9170_TX_MAX_RATES 4
273 #define CARL9170_TX_MAX_RETRY_RATES (CARL9170_TX_MAX_RATES - 1)
274 #define CARL9170_ERR_MAGIC "ERR:"
275 #define CARL9170_BUG_MAGIC "BUG:"
276 
279 } __packed;
280 #define CARL9170_GPIO_SIZE 4
281 
283  union {
286  } __packed;
287 } __packed;
288 #define CARL9170_TSF_RSP_SIZE 8
289 
297 } __packed;
298 
299 struct carl9170_rsp {
301 
302  union {
306 #ifdef __CARL9170FW__
307  struct carl9170_tx_status tx_status[0];
308 #endif /* __CARL9170FW__ */
315  } __packed;
316 } __packed __aligned(4);
317 
318 #endif /* __CARL9170_SHARED_FWCMD_H */