aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/carl9170/fwcmd.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/carl9170/fwcmd.h')
-rw-r--r--drivers/net/wireless/ath/carl9170/fwcmd.h268
1 files changed, 268 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..d4a4e1dbef06
--- /dev/null
+++ b/drivers/net/wireless/ath/carl9170/fwcmd.h
@@ -0,0 +1,268 @@
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
48enum 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
57 /* CAM */
58 CARL9170_CMD_EKEY = 0x10,
59 CARL9170_CMD_DKEY = 0x11,
60
61 /* RF / PHY */
62 CARL9170_CMD_FREQUENCY = 0x20,
63 CARL9170_CMD_RF_INIT = 0x21,
64 CARL9170_CMD_SYNTH = 0x22,
65 CARL9170_CMD_FREQ_START = 0x23,
66 CARL9170_CMD_PSM = 0x24,
67
68 /* Asychronous command flag */
69 CARL9170_CMD_ASYNC_FLAG = 0x40,
70 CARL9170_CMD_WREG_ASYNC = (CARL9170_CMD_WREG |
71 CARL9170_CMD_ASYNC_FLAG),
72 CARL9170_CMD_REBOOT_ASYNC = (CARL9170_CMD_REBOOT |
73 CARL9170_CMD_ASYNC_FLAG),
74 CARL9170_CMD_BCN_CTRL_ASYNC = (CARL9170_CMD_BCN_CTRL |
75 CARL9170_CMD_ASYNC_FLAG),
76 CARL9170_CMD_PSM_ASYNC = (CARL9170_CMD_PSM |
77 CARL9170_CMD_ASYNC_FLAG),
78
79 /* responses and traps */
80 CARL9170_RSP_FLAG = 0xc0,
81 CARL9170_RSP_PRETBTT = 0xc0,
82 CARL9170_RSP_TXCOMP = 0xc1,
83 CARL9170_RSP_BEACON_CONFIG = 0xc2,
84 CARL9170_RSP_ATIM = 0xc3,
85 CARL9170_RSP_WATCHDOG = 0xc6,
86 CARL9170_RSP_TEXT = 0xca,
87 CARL9170_RSP_HEXDUMP = 0xcc,
88 CARL9170_RSP_RADAR = 0xcd,
89 CARL9170_RSP_GPIO = 0xce,
90 CARL9170_RSP_BOOT = 0xcf,
91};
92
93struct carl9170_set_key_cmd {
94 __le16 user;
95 __le16 keyId;
96 __le16 type;
97 u8 macAddr[6];
98 u32 key[4];
99} __packed;
100#define CARL9170_SET_KEY_CMD_SIZE 28
101
102struct carl9170_disable_key_cmd {
103 __le16 user;
104 __le16 padding;
105} __packed;
106#define CARL9170_DISABLE_KEY_CMD_SIZE 4
107
108struct carl9170_u32_list {
109 u32 vals[0];
110} __packed;
111
112struct carl9170_reg_list {
113 __le32 regs[0];
114} __packed;
115
116struct carl9170_write_reg {
117 struct {
118 __le32 addr;
119 __le32 val;
120 } regs[0] __packed;
121} __packed;
122
123#define CARL9170FW_PHY_HT_ENABLE 0x4
124#define CARL9170FW_PHY_HT_DYN2040 0x8
125#define CARL9170FW_PHY_HT_EXT_CHAN_OFF 0x3
126#define CARL9170FW_PHY_HT_EXT_CHAN_OFF_S 2
127
128struct carl9170_rf_init {
129 __le32 freq;
130 u8 ht_settings;
131 u8 padding2[3];
132 __le32 delta_slope_coeff_exp;
133 __le32 delta_slope_coeff_man;
134 __le32 delta_slope_coeff_exp_shgi;
135 __le32 delta_slope_coeff_man_shgi;
136 __le32 finiteLoopCount;
137} __packed;
138#define CARL9170_RF_INIT_SIZE 28
139
140struct carl9170_rf_init_result {
141 __le32 ret; /* AR9170_PHY_REG_AGC_CONTROL */
142} __packed;
143#define CARL9170_RF_INIT_RESULT_SIZE 4
144
145#define CARL9170_PSM_SLEEP 0x1000
146#define CARL9170_PSM_SOFTWARE 0
147#define CARL9170_PSM_WAKE 0 /* internally used. */
148#define CARL9170_PSM_COUNTER 0xfff
149#define CARL9170_PSM_COUNTER_S 0
150
151struct carl9170_psm {
152 __le32 state;
153} __packed;
154#define CARL9170_PSM_SIZE 4
155
156struct carl9170_bcn_ctrl_cmd {
157 __le32 vif_id;
158 __le32 mode;
159 __le32 bcn_addr;
160 __le32 bcn_len;
161} __packed;
162#define CARL9170_BCN_CTRL_CMD_SIZE 16
163
164#define CARL9170_BCN_CTRL_DRAIN 0
165#define CARL9170_BCN_CTRL_CAB_TRIGGER 1
166
167struct carl9170_cmd_head {
168 union {
169 struct {
170 u8 len;
171 u8 cmd;
172 u8 seq;
173 u8 ext;
174 } __packed;
175
176 u32 hdr_data;
177 } __packed;
178} __packed;
179
180struct carl9170_cmd {
181 struct carl9170_cmd_head hdr;
182 union {
183 struct carl9170_set_key_cmd setkey;
184 struct carl9170_disable_key_cmd disablekey;
185 struct carl9170_u32_list echo;
186 struct carl9170_reg_list rreg;
187 struct carl9170_write_reg wreg;
188 struct carl9170_rf_init rf_init;
189 struct carl9170_psm psm;
190 struct carl9170_bcn_ctrl_cmd bcn_ctrl;
191 u8 data[CARL9170_MAX_CMD_PAYLOAD_LEN];
192 } __packed;
193} __packed;
194
195#define CARL9170_TX_STATUS_QUEUE 3
196#define CARL9170_TX_STATUS_QUEUE_S 0
197#define CARL9170_TX_STATUS_RIX_S 2
198#define CARL9170_TX_STATUS_RIX (3 << CARL9170_TX_STATUS_RIX_S)
199#define CARL9170_TX_STATUS_TRIES_S 4
200#define CARL9170_TX_STATUS_TRIES (7 << CARL9170_TX_STATUS_TRIES_S)
201#define CARL9170_TX_STATUS_SUCCESS 0x80
202
203/*
204 * NOTE:
205 * Both structs [carl9170_tx_status and _carl9170_tx_status]
206 * need to be "bit for bit" in sync.
207 */
208struct carl9170_tx_status {
209 /*
210 * Beware of compiler bugs in all gcc pre 4.4!
211 */
212
213 u8 cookie;
214 u8 queue:2;
215 u8 rix:2;
216 u8 tries:3;
217 u8 success:1;
218} __packed;
219struct _carl9170_tx_status {
220 /*
221 * This version should be immune to all alignment bugs.
222 */
223
224 u8 cookie;
225 u8 info;
226} __packed;
227#define CARL9170_TX_STATUS_SIZE 2
228
229#define CARL9170_RSP_TX_STATUS_NUM (CARL9170_MAX_CMD_PAYLOAD_LEN / \
230 sizeof(struct _carl9170_tx_status))
231
232#define CARL9170_TX_MAX_RATE_TRIES 7
233
234#define CARL9170_TX_MAX_RATES 4
235#define CARL9170_TX_MAX_RETRY_RATES (CARL9170_TX_MAX_RATES - 1)
236#define CARL9170_ERR_MAGIC "ERR:"
237#define CARL9170_BUG_MAGIC "BUG:"
238
239struct carl9170_gpio {
240 __le32 gpio;
241} __packed;
242#define CARL9170_GPIO_SIZE 4
243
244struct carl9170_tsf_rsp {
245 union {
246 __le32 tsf[2];
247 __le64 tsf_64;
248 } __packed;
249} __packed;
250#define CARL9170_TSF_RSP_SIZE 8
251
252struct carl9170_rsp {
253 struct carl9170_cmd_head hdr;
254
255 union {
256 struct carl9170_rf_init_result rf_init_res;
257 struct carl9170_u32_list rreg_res;
258 struct carl9170_u32_list echo;
259 struct carl9170_tx_status tx_status[0];
260 struct _carl9170_tx_status _tx_status[0];
261 struct carl9170_gpio gpio;
262 struct carl9170_tsf_rsp tsf;
263 struct carl9170_psm psm;
264 u8 data[CARL9170_MAX_CMD_PAYLOAD_LEN];
265 } __packed;
266} __packed;
267
268#endif /* __CARL9170_SHARED_FWCMD_H */