if_otusreg.h revision 1.1 1 1.1 christos /* $OpenBSD: if_otusreg.h,v 1.6 2009/04/06 18:17:01 damien Exp $ */
2 1.1 christos
3 1.1 christos /*-
4 1.1 christos * Copyright (c) 2009 Damien Bergamini <damien.bergamini (at) free.fr>
5 1.1 christos * Copyright (c) 2007-2008 Atheros Communications, Inc.
6 1.1 christos *
7 1.1 christos * Permission to use, copy, modify, and distribute this software for any
8 1.1 christos * purpose with or without fee is hereby granted, provided that the above
9 1.1 christos * copyright notice and this permission notice appear in all copies.
10 1.1 christos *
11 1.1 christos * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 1.1 christos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 1.1 christos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 1.1 christos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 1.1 christos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 1.1 christos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 1.1 christos * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 1.1 christos */
19 1.1 christos
20 1.1 christos /* USB Endpoints addresses. */
21 1.1 christos #define AR_EPT_BULK_TX_NO (UE_DIR_OUT | 1)
22 1.1 christos #define AR_EPT_BULK_RX_NO (UE_DIR_IN | 2)
23 1.1 christos #define AR_EPT_INTR_RX_NO (UE_DIR_IN | 3)
24 1.1 christos #define AR_EPT_INTR_TX_NO (UE_DIR_OUT | 4)
25 1.1 christos
26 1.1 christos /* USB Requests. */
27 1.1 christos #define AR_FW_DOWNLOAD 0x30
28 1.1 christos #define AR_FW_DOWNLOAD_COMPLETE 0x31
29 1.1 christos
30 1.1 christos /* Maximum number of writes that can fit in a single FW command is 7. */
31 1.1 christos #define AR_MAX_WRITE_IDX 6 /* 56 bytes */
32 1.1 christos
33 1.1 christos #define AR_FW_INIT_ADDR 0x102800
34 1.1 christos #define AR_FW_MAIN_ADDR 0x200000
35 1.1 christos #define AR_USB_MODE_CTRL 0x1e1108
36 1.1 christos
37 1.1 christos /*
38 1.1 christos * AR9170 MAC registers.
39 1.1 christos */
40 1.1 christos #define AR_MAC_REG_BASE 0x1c3000
41 1.1 christos #define AR_MAC_REG_MAC_ADDR_L (AR_MAC_REG_BASE + 0x610)
42 1.1 christos #define AR_MAC_REG_MAC_ADDR_H (AR_MAC_REG_BASE + 0x614)
43 1.1 christos #define AR_MAC_REG_BSSID_L (AR_MAC_REG_BASE + 0x618)
44 1.1 christos #define AR_MAC_REG_BSSID_H (AR_MAC_REG_BASE + 0x61c)
45 1.1 christos #define AR_MAC_REG_GROUP_HASH_TBL_L (AR_MAC_REG_BASE + 0x624)
46 1.1 christos #define AR_MAC_REG_GROUP_HASH_TBL_H (AR_MAC_REG_BASE + 0x628)
47 1.1 christos #define AR_MAC_REG_BASIC_RATE (AR_MAC_REG_BASE + 0x630)
48 1.1 christos #define AR_MAC_REG_MANDATORY_RATE (AR_MAC_REG_BASE + 0x634)
49 1.1 christos #define AR_MAC_REG_RTS_CTS_RATE (AR_MAC_REG_BASE + 0x638)
50 1.1 christos #define AR_MAC_REG_BACKOFF_PROTECT (AR_MAC_REG_BASE + 0x63c)
51 1.1 christos #define AR_MAC_REG_RX_THRESHOLD (AR_MAC_REG_BASE + 0x640)
52 1.1 christos #define AR_MAC_REG_RX_PE_DELAY (AR_MAC_REG_BASE + 0x64c)
53 1.1 christos #define AR_MAC_REG_DYNAMIC_SIFS_ACK (AR_MAC_REG_BASE + 0x658)
54 1.1 christos #define AR_MAC_REG_SNIFFER (AR_MAC_REG_BASE + 0x674)
55 1.1 christos #define AR_MAC_REG_ACK_EXTENSION (AR_MAC_REG_BASE + 0x690)
56 1.1 christos #define AR_MAC_REG_EIFS_AND_SIFS (AR_MAC_REG_BASE + 0x698)
57 1.1 christos #define AR_MAC_REG_BUSY (AR_MAC_REG_BASE + 0x6e8)
58 1.1 christos #define AR_MAC_REG_BUSY_EXT (AR_MAC_REG_BASE + 0x6ec)
59 1.1 christos #define AR_MAC_REG_SLOT_TIME (AR_MAC_REG_BASE + 0x6f0)
60 1.1 christos #define AR_MAC_REG_AC0_CW (AR_MAC_REG_BASE + 0xb00)
61 1.1 christos #define AR_MAC_REG_AC1_CW (AR_MAC_REG_BASE + 0xb04)
62 1.1 christos #define AR_MAC_REG_AC2_CW (AR_MAC_REG_BASE + 0xb08)
63 1.1 christos #define AR_MAC_REG_AC3_CW (AR_MAC_REG_BASE + 0xb0c)
64 1.1 christos #define AR_MAC_REG_AC4_CW (AR_MAC_REG_BASE + 0xb10)
65 1.1 christos #define AR_MAC_REG_AC1_AC0_AIFS (AR_MAC_REG_BASE + 0xb14)
66 1.1 christos #define AR_MAC_REG_AC3_AC2_AIFS (AR_MAC_REG_BASE + 0xb18)
67 1.1 christos #define AR_MAC_REG_RETRY_MAX (AR_MAC_REG_BASE + 0xb28)
68 1.1 christos #define AR_MAC_REG_TXOP_NOT_ENOUGH_INDICATION \
69 1.1 christos (AR_MAC_REG_BASE + 0xb30)
70 1.1 christos #define AR_MAC_REG_AC1_AC0_TXOP (AR_MAC_REG_BASE + 0xb44)
71 1.1 christos #define AR_MAC_REG_AC3_AC2_TXOP (AR_MAC_REG_BASE + 0xb48)
72 1.1 christos #define AR_MAC_REG_OFDM_PHY_ERRORS (AR_MAC_REG_BASE + 0xcb4)
73 1.1 christos #define AR_MAC_REG_CCK_PHY_ERRORS (AR_MAC_REG_BASE + 0xcb8)
74 1.1 christos #define AR_MAC_REG_BCN_HT1 (AR_MAC_REG_BASE + 0xda0)
75 1.1 christos
76 1.1 christos /* Possible values for register AR_USB_MODE_CTRL. */
77 1.1 christos #define AR_USB_DS_ENA (1 << 0)
78 1.1 christos #define AR_USB_US_ENA (1 << 1)
79 1.1 christos #define AR_USB_US_PACKET_MODE (1 << 3)
80 1.1 christos #define AR_USB_RX_STREAM_4K (0 << 4)
81 1.1 christos #define AR_USB_RX_STREAM_8K (1 << 4)
82 1.1 christos #define AR_USB_RX_STREAM_16K (2 << 4)
83 1.1 christos #define AR_USB_RX_STREAM_32K (3 << 4)
84 1.1 christos #define AR_USB_TX_STREAM_MODE (1 << 6)
85 1.1 christos
86 1.1 christos #define AR_LED0_ON (1 << 0)
87 1.1 christos #define AR_LED1_ON (1 << 1)
88 1.1 christos
89 1.1 christos /*
90 1.1 christos * PHY registers.
91 1.1 christos */
92 1.1 christos #define AR_PHY_BASE 0x1c5800
93 1.1 christos #define AR_PHY(reg) (AR_PHY_BASE + (reg) * 4)
94 1.1 christos #define AR_PHY_TURBO (AR_PHY_BASE + 0x0004)
95 1.1 christos #define AR_PHY_RF_CTL3 (AR_PHY_BASE + 0x0028)
96 1.1 christos #define AR_PHY_RF_CTL4 (AR_PHY_BASE + 0x0034)
97 1.1 christos #define AR_PHY_SETTLING (AR_PHY_BASE + 0x0044)
98 1.1 christos #define AR_PHY_RXGAIN (AR_PHY_BASE + 0x0048)
99 1.1 christos #define AR_PHY_DESIRED_SZ (AR_PHY_BASE + 0x0050)
100 1.1 christos #define AR_PHY_FIND_SIG (AR_PHY_BASE + 0x0058)
101 1.1 christos #define AR_PHY_AGC_CTL1 (AR_PHY_BASE + 0x005c)
102 1.1 christos #define AR_PHY_SFCORR (AR_PHY_BASE + 0x0068)
103 1.1 christos #define AR_PHY_SFCORR_LOW (AR_PHY_BASE + 0x006c)
104 1.1 christos #define AR_PHY_TIMING_CTRL4 (AR_PHY_BASE + 0x0120)
105 1.1 christos #define AR_PHY_TIMING5 (AR_PHY_BASE + 0x0124)
106 1.1 christos #define AR_PHY_POWER_TX_RATE1 (AR_PHY_BASE + 0x0134)
107 1.1 christos #define AR_PHY_POWER_TX_RATE2 (AR_PHY_BASE + 0x0138)
108 1.1 christos #define AR_PHY_POWER_TX_RATE_MAX (AR_PHY_BASE + 0x013c)
109 1.1 christos #define AR_PHY_SWITCH_CHAIN_0 (AR_PHY_BASE + 0x0160)
110 1.1 christos #define AR_PHY_SWITCH_COM (AR_PHY_BASE + 0x0164)
111 1.1 christos #define AR_PHY_HEAVY_CLIP_ENABLE (AR_PHY_BASE + 0x01e0)
112 1.1 christos #define AR_PHY_CCK_DETECT (AR_PHY_BASE + 0x0a08)
113 1.1 christos #define AR_PHY_GAIN_2GHZ (AR_PHY_BASE + 0x0a0c)
114 1.1 christos #define AR_PHY_POWER_TX_RATE3 (AR_PHY_BASE + 0x0a34)
115 1.1 christos #define AR_PHY_POWER_TX_RATE4 (AR_PHY_BASE + 0x0a38)
116 1.1 christos #define AR_PHY_TPCRG1 (AR_PHY_BASE + 0x0a58)
117 1.1 christos #define AR_PHY_POWER_TX_RATE5 (AR_PHY_BASE + 0x0b8c)
118 1.1 christos #define AR_PHY_POWER_TX_RATE6 (AR_PHY_BASE + 0x0b90)
119 1.1 christos #define AR_PHY_POWER_TX_RATE7 (AR_PHY_BASE + 0x0bcc)
120 1.1 christos #define AR_PHY_POWER_TX_RATE8 (AR_PHY_BASE + 0x0bd0)
121 1.1 christos #define AR_PHY_POWER_TX_RATE9 (AR_PHY_BASE + 0x0bd4)
122 1.1 christos #define AR_PHY_CCA (AR_PHY_BASE + 0x3064)
123 1.1 christos
124 1.1 christos #define AR_SEEPROM_HW_TYPE_OFFSET 0x1374
125 1.1 christos #define AR_EEPROM_OFFSET 0x1600
126 1.1 christos
127 1.1 christos #define AR_BANK4_CHUP (1 << 0)
128 1.1 christos #define AR_BANK4_BMODE_LF_SYNTH_FREQ (1 << 1)
129 1.1 christos #define AR_BANK4_AMODE_REFSEL(x) ((x) << 2)
130 1.1 christos #define AR_BANK4_ADDR(x) ((x) << 5)
131 1.1 christos
132 1.1 christos /* Tx descriptor. */
133 1.1 christos struct ar_tx_head {
134 1.1 christos uint16_t len;
135 1.1 christos uint16_t macctl;
136 1.1 christos #define AR_TX_MAC_RTS (1 << 0)
137 1.1 christos #define AR_TX_MAC_CTS (1 << 1)
138 1.1 christos #define AR_TX_MAC_BACKOFF (1 << 3)
139 1.1 christos #define AR_TX_MAC_NOACK (1 << 2)
140 1.1 christos #define AR_TX_MAC_HW_DUR (1 << 9)
141 1.1 christos #define AR_TX_MAC_QID(qid) ((qid) << 10)
142 1.1 christos #define AR_TX_MAC_RATE_PROBING (1 << 15)
143 1.1 christos
144 1.1 christos uint32_t phyctl;
145 1.1 christos /* Modulation type. */
146 1.1 christos #define AR_TX_PHY_MT_CCK 0
147 1.1 christos #define AR_TX_PHY_MT_OFDM 1
148 1.1 christos #define AR_TX_PHY_MT_HT 2
149 1.1 christos #define AR_TX_PHY_GF (1 << 2)
150 1.1 christos #define AR_TX_PHY_BW_SHIFT 3
151 1.1 christos #define AR_TX_PHY_TPC_SHIFT 9
152 1.1 christos #define AR_TX_PHY_ANTMSK(msk) ((msk) << 15)
153 1.1 christos #define AR_TX_PHY_MCS(mcs) ((mcs) << 18)
154 1.1 christos #define AR_TX_PHY_SHGI (1 << 31)
155 1.1 christos } __packed;
156 1.1 christos
157 1.1 christos /* USB Rx stream mode header. */
158 1.1 christos struct ar_rx_head {
159 1.1 christos uint16_t len;
160 1.1 christos uint16_t tag;
161 1.1 christos #define AR_RX_HEAD_TAG 0x4e00
162 1.1 christos } __packed;
163 1.1 christos
164 1.1 christos /* Rx descriptor. */
165 1.1 christos struct ar_rx_tail {
166 1.1 christos uint8_t rssi_ant[3];
167 1.1 christos uint8_t rssi_ant_ext[3];
168 1.1 christos uint8_t rssi; /* Combined RSSI. */
169 1.1 christos uint8_t evm[2][6]; /* Error Vector Magnitude. */
170 1.1 christos uint8_t phy_err;
171 1.1 christos uint8_t sa_idx;
172 1.1 christos uint8_t da_idx;
173 1.1 christos uint8_t error;
174 1.1 christos #define AR_RX_ERROR_TIMEOUT (1 << 0)
175 1.1 christos #define AR_RX_ERROR_OVERRUN (1 << 1)
176 1.1 christos #define AR_RX_ERROR_DECRYPT (1 << 2)
177 1.1 christos #define AR_RX_ERROR_FCS (1 << 3)
178 1.1 christos #define AR_RX_ERROR_BAD_RA (1 << 4)
179 1.1 christos #define AR_RX_ERROR_PLCP (1 << 5)
180 1.1 christos #define AR_RX_ERROR_MMIC (1 << 6)
181 1.1 christos
182 1.1 christos uint8_t status;
183 1.1 christos /* Modulation type (same as AR_TX_PHY_MT). */
184 1.1 christos #define AR_RX_STATUS_MT_MASK 0x3
185 1.1 christos #define AR_RX_STATUS_MT_CCK 0
186 1.1 christos #define AR_RX_STATUS_MT_OFDM 1
187 1.1 christos #define AR_RX_STATUS_MT_HT 2
188 1.1 christos #define AR_RX_STATUS_SHPREAMBLE (1 << 3)
189 1.1 christos } __packed;
190 1.1 christos
191 1.1 christos #define AR_PLCP_HDR_LEN 12
192 1.1 christos /* Magic PLCP header for firmware notifications through Rx bulk pipe. */
193 1.1 christos static uint8_t AR_PLCP_HDR_INTR[] = {
194 1.1 christos 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
195 1.1 christos 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
196 1.1 christos };
197 1.1 christos
198 1.1 christos /* Firmware command/reply header. */
199 1.1 christos struct ar_cmd_hdr {
200 1.1 christos uint8_t len;
201 1.1 christos uint8_t code;
202 1.1 christos #define AR_CMD_RREG 0x00
203 1.1 christos #define AR_CMD_WREG 0x01
204 1.1 christos #define AR_CMD_RMEM 0x02
205 1.1 christos #define AR_CMD_WMEM 0x03
206 1.1 christos #define AR_CMD_BITAND 0x04
207 1.1 christos #define AR_CMD_BITOR 0x05
208 1.1 christos #define AR_CMD_EKEY 0x28
209 1.1 christos #define AR_CMD_DKEY 0x29
210 1.1 christos #define AR_CMD_FREQUENCY 0x30
211 1.1 christos #define AR_CMD_RF_INIT 0x31
212 1.1 christos #define AR_CMD_SYNTH 0x32
213 1.1 christos #define AR_CMD_FREQ_STRAT 0x33
214 1.1 christos #define AR_CMD_ECHO 0x80
215 1.1 christos #define AR_CMD_TALLY 0x81
216 1.1 christos #define AR_CMD_TALLY_APD 0x82
217 1.1 christos #define AR_CMD_CONFIG 0x83
218 1.1 christos #define AR_CMD_RESET 0x90
219 1.1 christos #define AR_CMD_DKRESET 0x91
220 1.1 christos #define AR_CMD_DKTX_STATUS 0x92
221 1.1 christos #define AR_CMD_FDC 0xa0
222 1.1 christos #define AR_CMD_WREEPROM 0xb0
223 1.1 christos #define AR_CMD_WFLASH AR_CMD_WREEPROM
224 1.1 christos #define AR_CMD_FLASH_ERASE 0xb1
225 1.1 christos #define AR_CMD_FLASH_PROG 0xb2
226 1.1 christos #define AR_CMD_FLASH_CHKSUM 0xb3
227 1.1 christos #define AR_CMD_FLASH_READ 0xb4
228 1.1 christos #define AR_CMD_FW_DL_INIT 0xb5
229 1.1 christos #define AR_CMD_MEM_WREEPROM 0xbb
230 1.1 christos /* Those have the 2 MSB set to 1. */
231 1.1 christos #define AR_EVT_BEACON 0x00
232 1.1 christos #define AR_EVT_TX_COMP 0x01
233 1.1 christos #define AR_EVT_TBTT 0x02
234 1.1 christos #define AR_EVT_ATIM 0x03
235 1.1 christos
236 1.1 christos uint16_t token; /* Driver private data. */
237 1.1 christos } __packed;
238 1.1 christos
239 1.1 christos /* Structure for command AR_CMD_RF_INIT/AR_CMD_FREQUENCY. */
240 1.1 christos struct ar_cmd_frequency {
241 1.1 christos uint32_t freq;
242 1.1 christos uint32_t dynht2040;
243 1.1 christos uint32_t htena;
244 1.1 christos uint32_t dsc_exp;
245 1.1 christos uint32_t dsc_man;
246 1.1 christos uint32_t dsc_shgi_exp;
247 1.1 christos uint32_t dsc_shgi_man;
248 1.1 christos uint32_t check_loop_count;
249 1.1 christos } __packed;
250 1.1 christos
251 1.1 christos /* Firmware reply for command AR_CMD_FREQUENCY. */
252 1.1 christos struct ar_rsp_frequency {
253 1.1 christos uint32_t status;
254 1.1 christos #define AR_CAL_ERR_AGC (1 << 0) /* AGC cal unfinished. */
255 1.1 christos #define AR_CAL_ERR_NF (1 << 1) /* Noise cal unfinished. */
256 1.1 christos #define AR_CAL_ERR_NF_VAL (1 << 2) /* NF value unexpected. */
257 1.1 christos
258 1.1 christos uint32_t nf[3]; /* Noisefloor. */
259 1.1 christos uint32_t nf_ext[3]; /* Noisefloor ext. */
260 1.1 christos } __packed;
261 1.1 christos
262 1.1 christos /* Structure for command AR_CMD_EKEY. */
263 1.1 christos struct ar_cmd_ekey {
264 1.1 christos uint16_t uid; /* user ID */
265 1.1 christos uint16_t kix;
266 1.1 christos uint16_t cipher;
267 1.1 christos #define AR_CIPHER_NONE 0
268 1.1 christos #define AR_CIPHER_WEP64 1
269 1.1 christos #define AR_CIPHER_TKIP 2
270 1.1 christos #define AR_CIPHER_AES 4
271 1.1 christos #define AR_CIPHER_WEP128 5
272 1.1 christos #define AR_CIPHER_WEP256 6
273 1.1 christos #define AR_CIPHER_CENC 7
274 1.1 christos
275 1.1 christos uint8_t macaddr[IEEE80211_ADDR_LEN];
276 1.1 christos uint8_t key[16];
277 1.1 christos } __packed;
278 1.1 christos
279 1.1 christos /* Structure for event AR_EVT_TX_COMP. */
280 1.1 christos struct ar_evt_tx_comp {
281 1.1 christos uint8_t macaddr[IEEE80211_ADDR_LEN];
282 1.1 christos uint32_t phy;
283 1.1 christos uint16_t status;
284 1.1 christos #define AR_TX_STATUS_COMP 0
285 1.1 christos #define AR_TX_STATUS_RETRY_COMP 1
286 1.1 christos #define AR_TX_STATUS_FAILED 2
287 1.1 christos } __packed;
288 1.1 christos
289 1.1 christos /* List of supported channels. */
290 1.1 christos static const uint8_t ar_chans[] = {
291 1.1 christos 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
292 1.1 christos 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124,
293 1.1 christos 128, 132, 136, 140, 149, 153, 157, 161, 165, 34, 38, 42, 46
294 1.1 christos };
295 1.1 christos
296 1.1 christos /*
297 1.1 christos * This data is automatically generated from the "otus.ini" file.
298 1.1 christos * It is stored in a different way though, to reduce kernel's .rodata
299 1.1 christos * section overhead (5.1KB instead of 8.5KB).
300 1.1 christos */
301 1.1 christos
302 1.1 christos /* NB: apply AR_PHY(). */
303 1.1 christos static const uint16_t ar5416_phy_regs[] = {
304 1.1 christos 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x008,
305 1.1 christos 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f, 0x010, 0x011,
306 1.1 christos 0x012, 0x013, 0x014, 0x015, 0x016, 0x017, 0x018, 0x01a, 0x01b,
307 1.1 christos 0x040, 0x041, 0x042, 0x043, 0x045, 0x046, 0x047, 0x048, 0x049,
308 1.1 christos 0x04a, 0x04b, 0x04d, 0x04e, 0x04f, 0x051, 0x052, 0x053, 0x055,
309 1.1 christos 0x056, 0x058, 0x059, 0x05c, 0x05d, 0x05e, 0x05f, 0x060, 0x061,
310 1.1 christos 0x062, 0x063, 0x064, 0x065, 0x066, 0x067, 0x068, 0x069, 0x06a,
311 1.1 christos 0x06b, 0x06c, 0x06d, 0x070, 0x071, 0x072, 0x073, 0x074, 0x075,
312 1.1 christos 0x076, 0x077, 0x078, 0x079, 0x07a, 0x07b, 0x07c, 0x07f, 0x080,
313 1.1 christos 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087, 0x088, 0x089,
314 1.1 christos 0x08a, 0x08b, 0x08c, 0x08d, 0x08e, 0x08f, 0x090, 0x091, 0x092,
315 1.1 christos 0x093, 0x094, 0x095, 0x096, 0x097, 0x098, 0x099, 0x09a, 0x09b,
316 1.1 christos 0x09c, 0x09d, 0x09e, 0x09f, 0x0a0, 0x0a1, 0x0a2, 0x0a3, 0x0a4,
317 1.1 christos 0x0a5, 0x0a6, 0x0a7, 0x0a8, 0x0a9, 0x0aa, 0x0ab, 0x0ac, 0x0ad,
318 1.1 christos 0x0ae, 0x0af, 0x0b0, 0x0b1, 0x0b2, 0x0b3, 0x0b4, 0x0b5, 0x0b6,
319 1.1 christos 0x0b7, 0x0b8, 0x0b9, 0x0ba, 0x0bb, 0x0bc, 0x0bd, 0x0be, 0x0bf,
320 1.1 christos 0x0c0, 0x0c1, 0x0c2, 0x0c3, 0x0c4, 0x0c5, 0x0c6, 0x0c7, 0x0c8,
321 1.1 christos 0x0c9, 0x0ca, 0x0cb, 0x0cc, 0x0cd, 0x0ce, 0x0cf, 0x0d0, 0x0d1,
322 1.1 christos 0x0d2, 0x0d3, 0x0d4, 0x0d5, 0x0d6, 0x0d7, 0x0d8, 0x0d9, 0x0da,
323 1.1 christos 0x0db, 0x0dc, 0x0dd, 0x0de, 0x0df, 0x0e0, 0x0e1, 0x0e2, 0x0e3,
324 1.1 christos 0x0e4, 0x0e5, 0x0e6, 0x0e7, 0x0e8, 0x0e9, 0x0ea, 0x0eb, 0x0ec,
325 1.1 christos 0x0ed, 0x0ee, 0x0ef, 0x0f0, 0x0f1, 0x0f2, 0x0f3, 0x0f4, 0x0f5,
326 1.1 christos 0x0f6, 0x0f7, 0x0f8, 0x0f9, 0x0fa, 0x0fb, 0x0fc, 0x0fd, 0x0fe,
327 1.1 christos 0x0ff, 0x100, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109,
328 1.1 christos 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, 0x13c, 0x13d, 0x13e,
329 1.1 christos 0x13f, 0x280, 0x281, 0x282, 0x283, 0x284, 0x285, 0x286, 0x287,
330 1.1 christos 0x288, 0x289, 0x28a, 0x28b, 0x28c, 0x28d, 0x28e, 0x28f, 0x290,
331 1.1 christos 0x291, 0x292, 0x293, 0x294, 0x295, 0x296, 0x297, 0x298, 0x299,
332 1.1 christos 0x29a, 0x29b, 0x29d, 0x29e, 0x29f, 0x2c0, 0x2c1, 0x2c2, 0x2c3,
333 1.1 christos 0x2c4, 0x2c5, 0x2c6, 0x2c7, 0x2c8, 0x2c9, 0x2ca, 0x2cb, 0x2cc,
334 1.1 christos 0x2cd, 0x2ce, 0x2cf, 0x2d0, 0x2d1, 0x2d2, 0x2d3, 0x2d4, 0x2d5,
335 1.1 christos 0x2d6, 0x2e2, 0x2e3, 0x2e4, 0x2e5, 0x2e6, 0x2e7, 0x2e8, 0x2e9,
336 1.1 christos 0x2ea, 0x2eb, 0x2ec, 0x2ed, 0x2ee, 0x2ef, 0x2f0, 0x2f1, 0x2f2,
337 1.1 christos 0x2f3, 0x2f4, 0x2f5, 0x2f6, 0x2f7, 0x2f8, 0x412, 0x448, 0x458,
338 1.1 christos 0x683, 0x69b, 0x812, 0x848, 0x858, 0xa83, 0xa9b, 0xc19, 0xc57,
339 1.1 christos 0xc5a, 0xc6f, 0xe9c, 0xed7, 0xed8, 0xed9, 0xeda, 0xedb, 0xedc,
340 1.1 christos 0xedd, 0xede, 0xedf, 0xee0, 0xee1
341 1.1 christos };
342 1.1 christos
343 1.1 christos static const uint32_t ar5416_phy_vals_5ghz_20mhz[] = {
344 1.1 christos 0x00000007, 0x00000300, 0x00000000, 0xad848e19, 0x7d14e000,
345 1.1 christos 0x9c0a9f6b, 0x00000090, 0x00000000, 0x02020200, 0x00000e0e,
346 1.1 christos 0x0a020001, 0x0000a000, 0x00000000, 0x00000e0e, 0x00000007,
347 1.1 christos 0x00200400, 0x206a002e, 0x1372161e, 0x001a6a65, 0x1284233c,
348 1.1 christos 0x6c48b4e4, 0x00000859, 0x7ec80d2e, 0x31395c5e, 0x0004dd10,
349 1.1 christos 0x409a4190, 0x050cb081, 0x00000000, 0x00000000, 0x00000000,
350 1.1 christos 0x00000000, 0x000007d0, 0x00000118, 0x10000fff, 0x0510081c,
351 1.1 christos 0xd0058a15, 0x00000001, 0x00000004, 0x3f3f3f3f, 0x3f3f3f3f,
352 1.1 christos 0x0000007f, 0xdfb81020, 0x9280b212, 0x00020028, 0x5d50e188,
353 1.1 christos 0x00081fff, 0x00009b40, 0x00001120, 0x190fb515, 0x00000000,
354 1.1 christos 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
355 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
356 1.1 christos 0x00000000, 0x00000007, 0x001fff00, 0x006f00c4, 0x03051000,
357 1.1 christos 0x00000820, 0x038919be, 0x06336f77, 0x60f6532c, 0x08f186c8,
358 1.1 christos 0x00046384, 0x00000000, 0x00000000, 0x00000000, 0x00000200,
359 1.1 christos 0x64646464, 0x3c787878, 0x000000aa, 0x00000000, 0x00001042,
360 1.1 christos 0x00000000, 0x00000040, 0x00000080, 0x000001a1, 0x000001e1,
361 1.1 christos 0x00000021, 0x00000061, 0x00000168, 0x000001a8, 0x000001e8,
362 1.1 christos 0x00000028, 0x00000068, 0x00000189, 0x000001c9, 0x00000009,
363 1.1 christos 0x00000049, 0x00000089, 0x00000170, 0x000001b0, 0x000001f0,
364 1.1 christos 0x00000030, 0x00000070, 0x00000191, 0x000001d1, 0x00000011,
365 1.1 christos 0x00000051, 0x00000091, 0x000001b8, 0x000001f8, 0x00000038,
366 1.1 christos 0x00000078, 0x00000199, 0x000001d9, 0x00000019, 0x00000059,
367 1.1 christos 0x00000099, 0x000000d9, 0x000000f9, 0x000000f9, 0x000000f9,
368 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
369 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
370 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
371 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
372 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x00000000,
373 1.1 christos 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005,
374 1.1 christos 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c,
375 1.1 christos 0x0000000d, 0x00000010, 0x00000011, 0x00000012, 0x00000013,
376 1.1 christos 0x00000014, 0x00000015, 0x00000018, 0x00000019, 0x0000001a,
377 1.1 christos 0x0000001b, 0x0000001c, 0x0000001d, 0x00000020, 0x00000021,
378 1.1 christos 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000028,
379 1.1 christos 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d,
380 1.1 christos 0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034,
381 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
382 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
383 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
384 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
385 1.1 christos 0x00000035, 0x00000010, 0x0000001a, 0x00000000, 0x00000000,
386 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
387 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
388 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
389 1.1 christos 0x00000000, 0x00000008, 0x00000440, 0xd6be4788, 0x012e8160,
390 1.1 christos 0x40806333, 0x00106c10, 0x009c4060, 0x1883800a, 0x018830c6,
391 1.1 christos 0x00000400, 0x000009b5, 0x00000000, 0x00000108, 0x3f3f3f3f,
392 1.1 christos 0x3f3f3f3f, 0x13c889af, 0x38490a20, 0x00007bb6, 0x0fff3ffc,
393 1.1 christos 0x00000001, 0x0000a000, 0x00000000, 0x0cc75380, 0x0f0f0f01,
394 1.1 christos 0xdfa91f01, 0x00418a11, 0x00000000, 0x09249126, 0x0a1a9caa,
395 1.1 christos 0x1ce739ce, 0x051701ce, 0x18010000, 0x30032602, 0x48073e06,
396 1.1 christos 0x560b4c0a, 0x641a600f, 0x7a4f6e1b, 0x8c5b7e5a, 0x9d0f96cf,
397 1.1 christos 0xb51fa69f, 0xcb3fbd07, 0x0000d7bf, 0x00000000, 0x00000000,
398 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
399 1.1 christos 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x0003ffff, 0x79a8aa1f,
400 1.1 christos 0x08000000, 0x3f3f3f3f, 0x3f3f3f3f, 0x1ce739ce, 0x000001ce,
401 1.1 christos 0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
402 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
403 1.1 christos 0x00000000, 0x00000000, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f,
404 1.1 christos 0x00000000, 0x1ce739ce, 0x000000c0, 0x00180a65, 0x0510001c,
405 1.1 christos 0x00009b40, 0x012e8160, 0x09249126, 0x00180a65, 0x0510001c,
406 1.1 christos 0x00009b40, 0x012e8160, 0x09249126, 0x0001c600, 0x004b6a8e,
407 1.1 christos 0x000003ce, 0x00181400, 0x00820820, 0x066c420f, 0x0f282207,
408 1.1 christos 0x17601685, 0x1f801104, 0x37a00c03, 0x3fc40883, 0x57c00803,
409 1.1 christos 0x5fd80682, 0x7fe00482, 0x7f3c7bba, 0xf3307ff0
410 1.1 christos };
411 1.1 christos
412 1.1 christos #ifdef notyet
413 1.1 christos static const uint32_t ar5416_phy_vals_5ghz_40mhz[] = {
414 1.1 christos 0x00000007, 0x000003c4, 0x00000000, 0xad848e19, 0x7d14e000,
415 1.1 christos 0x9c0a9f6b, 0x00000090, 0x00000000, 0x02020200, 0x00000e0e,
416 1.1 christos 0x0a020001, 0x0000a000, 0x00000000, 0x00000e0e, 0x00000007,
417 1.1 christos 0x00200400, 0x206a002e, 0x13721c1e, 0x001a6a65, 0x1284233c,
418 1.1 christos 0x6c48b4e4, 0x00000859, 0x7ec80d2e, 0x31395c5e, 0x0004dd10,
419 1.1 christos 0x409a4190, 0x050cb081, 0x00000000, 0x00000000, 0x00000000,
420 1.1 christos 0x00000000, 0x000007d0, 0x00000230, 0x10000fff, 0x0510081c,
421 1.1 christos 0xd0058a15, 0x00000001, 0x00000004, 0x3f3f3f3f, 0x3f3f3f3f,
422 1.1 christos 0x0000007f, 0xdfb81020, 0x9280b212, 0x00020028, 0x5d50e188,
423 1.1 christos 0x00081fff, 0x00009b40, 0x00001120, 0x190fb515, 0x00000000,
424 1.1 christos 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
425 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
426 1.1 christos 0x00000000, 0x00000007, 0x001fff00, 0x006f00c4, 0x03051000,
427 1.1 christos 0x00000820, 0x038919be, 0x06336f77, 0x60f6532c, 0x08f186c8,
428 1.1 christos 0x00046384, 0x00000000, 0x00000000, 0x00000000, 0x00000200,
429 1.1 christos 0x64646464, 0x3c787878, 0x000000aa, 0x00000000, 0x00001042,
430 1.1 christos 0x00000000, 0x00000040, 0x00000080, 0x000001a1, 0x000001e1,
431 1.1 christos 0x00000021, 0x00000061, 0x00000168, 0x000001a8, 0x000001e8,
432 1.1 christos 0x00000028, 0x00000068, 0x00000189, 0x000001c9, 0x00000009,
433 1.1 christos 0x00000049, 0x00000089, 0x00000170, 0x000001b0, 0x000001f0,
434 1.1 christos 0x00000030, 0x00000070, 0x00000191, 0x000001d1, 0x00000011,
435 1.1 christos 0x00000051, 0x00000091, 0x000001b8, 0x000001f8, 0x00000038,
436 1.1 christos 0x00000078, 0x00000199, 0x000001d9, 0x00000019, 0x00000059,
437 1.1 christos 0x00000099, 0x000000d9, 0x000000f9, 0x000000f9, 0x000000f9,
438 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
439 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
440 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
441 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
442 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x00000000,
443 1.1 christos 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005,
444 1.1 christos 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c,
445 1.1 christos 0x0000000d, 0x00000010, 0x00000011, 0x00000012, 0x00000013,
446 1.1 christos 0x00000014, 0x00000015, 0x00000018, 0x00000019, 0x0000001a,
447 1.1 christos 0x0000001b, 0x0000001c, 0x0000001d, 0x00000020, 0x00000021,
448 1.1 christos 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000028,
449 1.1 christos 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d,
450 1.1 christos 0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034,
451 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
452 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
453 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
454 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
455 1.1 christos 0x00000035, 0x00000010, 0x0000001a, 0x00000000, 0x00000000,
456 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
457 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
458 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
459 1.1 christos 0x00000000, 0x00000008, 0x00000440, 0xd6be4788, 0x012e8160,
460 1.1 christos 0x40806333, 0x00106c10, 0x009c4060, 0x1883800a, 0x018830c6,
461 1.1 christos 0x00000400, 0x000009b5, 0x00000000, 0x00000210, 0x3f3f3f3f,
462 1.1 christos 0x3f3f3f3f, 0x13c889af, 0x38490a20, 0x00007bb6, 0x0fff3ffc,
463 1.1 christos 0x00000001, 0x0000a000, 0x00000000, 0x0cc75380, 0x0f0f0f01,
464 1.1 christos 0xdfa91f01, 0x00418a11, 0x00000000, 0x09249126, 0x0a1a9caa,
465 1.1 christos 0x1ce739ce, 0x051701ce, 0x18010000, 0x30032602, 0x48073e06,
466 1.1 christos 0x560b4c0a, 0x641a600f, 0x7a4f6e1b, 0x8c5b7e5a, 0x9d0f96cf,
467 1.1 christos 0xb51fa69f, 0xcb3fbcbf, 0x0000d7bf, 0x00000000, 0x00000000,
468 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
469 1.1 christos 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x0003ffff, 0x79a8aa1f,
470 1.1 christos 0x08000000, 0x3f3f3f3f, 0x3f3f3f3f, 0x1ce739ce, 0x000001ce,
471 1.1 christos 0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
472 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
473 1.1 christos 0x00000000, 0x00000000, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f,
474 1.1 christos 0x00000000, 0x1ce739ce, 0x000000c0, 0x00180a65, 0x0510001c,
475 1.1 christos 0x00009b40, 0x012e8160, 0x09249126, 0x00180a65, 0x0510001c,
476 1.1 christos 0x00009b40, 0x012e8160, 0x09249126, 0x0001c600, 0x004b6a8e,
477 1.1 christos 0x000003ce, 0x00181400, 0x00820820, 0x066c420f, 0x0f282207,
478 1.1 christos 0x17601685, 0x1f801104, 0x37a00c03, 0x3fc40883, 0x57c00803,
479 1.1 christos 0x5fd80682, 0x7fe00482, 0x7f3c7bba, 0xf3307ff0
480 1.1 christos };
481 1.1 christos #endif
482 1.1 christos
483 1.1 christos #ifdef notyet
484 1.1 christos static const uint32_t ar5416_phy_vals_2ghz_40mhz[] = {
485 1.1 christos 0x00000007, 0x000003c4, 0x00000000, 0xad848e19, 0x7d14e000,
486 1.1 christos 0x9c0a9f6b, 0x00000090, 0x00000000, 0x02020200, 0x00000e0e,
487 1.1 christos 0x0a020001, 0x0000a000, 0x00000000, 0x00000e0e, 0x00000007,
488 1.1 christos 0x00200400, 0x206a002e, 0x13721c24, 0x00197a68, 0x1284233c,
489 1.1 christos 0x6c48b0e4, 0x00000859, 0x7ec80d2e, 0x31395c5e, 0x0004dd20,
490 1.1 christos 0x409a4190, 0x050cb081, 0x00000000, 0x00000000, 0x00000000,
491 1.1 christos 0x00000000, 0x00000898, 0x00000268, 0x10000fff, 0x0510001c,
492 1.1 christos 0xd0058a15, 0x00000001, 0x00000004, 0x3f3f3f3f, 0x3f3f3f3f,
493 1.1 christos 0x0000007f, 0xdfb81020, 0x9280b212, 0x00020028, 0x5d50e188,
494 1.1 christos 0x00081fff, 0x00009b40, 0x00001120, 0x190fb515, 0x00000000,
495 1.1 christos 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
496 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
497 1.1 christos 0x00000000, 0x00000007, 0x001fff00, 0x006f00c4, 0x03051000,
498 1.1 christos 0x00000820, 0x038919be, 0x06336f77, 0x60f6532c, 0x08f186c8,
499 1.1 christos 0x00046384, 0x00000000, 0x00000000, 0x00000000, 0x00000200,
500 1.1 christos 0x64646464, 0x3c787878, 0x000000aa, 0x00000000, 0x00001042,
501 1.1 christos 0x00000000, 0x00000040, 0x00000080, 0x00000141, 0x00000181,
502 1.1 christos 0x000001c1, 0x00000001, 0x00000041, 0x000001a8, 0x000001e8,
503 1.1 christos 0x00000028, 0x00000068, 0x000000a8, 0x00000169, 0x000001a9,
504 1.1 christos 0x000001e9, 0x00000029, 0x00000069, 0x00000190, 0x000001d0,
505 1.1 christos 0x00000010, 0x00000050, 0x00000090, 0x00000151, 0x00000191,
506 1.1 christos 0x000001d1, 0x00000011, 0x00000051, 0x00000198, 0x000001d8,
507 1.1 christos 0x00000018, 0x00000058, 0x00000098, 0x00000159, 0x00000199,
508 1.1 christos 0x000001d9, 0x00000019, 0x00000059, 0x00000099, 0x000000d9,
509 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
510 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
511 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
512 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
513 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x00000000,
514 1.1 christos 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005,
515 1.1 christos 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c,
516 1.1 christos 0x0000000d, 0x00000010, 0x00000011, 0x00000012, 0x00000013,
517 1.1 christos 0x00000014, 0x00000015, 0x00000018, 0x00000019, 0x0000001a,
518 1.1 christos 0x0000001b, 0x0000001c, 0x0000001d, 0x00000020, 0x00000021,
519 1.1 christos 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000028,
520 1.1 christos 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d,
521 1.1 christos 0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034,
522 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
523 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
524 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
525 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
526 1.1 christos 0x00000035, 0x00000010, 0x0000001a, 0x00000000, 0x00000000,
527 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
528 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
529 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
530 1.1 christos 0x00000000, 0x0000000e, 0x00000440, 0xd03e4788, 0x012a8160,
531 1.1 christos 0x40806333, 0x00106c10, 0x009c4060, 0x1883800a, 0x018830c6,
532 1.1 christos 0x00000400, 0x000009b5, 0x00000000, 0x00000210, 0x3f3f3f3f,
533 1.1 christos 0x3f3f3f3f, 0x13c889af, 0x38490a20, 0x00007bb6, 0x0fff3ffc,
534 1.1 christos 0x00000001, 0x0000a000, 0x00000000, 0x0cc75380, 0x0f0f0f01,
535 1.1 christos 0xdfa91f01, 0x00418a11, 0x00000000, 0x09249126, 0x0a1a7caa,
536 1.1 christos 0x1ce739ce, 0x051701ce, 0x18010000, 0x2e032402, 0x4a0a3c06,
537 1.1 christos 0x621a540b, 0x764f6c1b, 0x845b7a5a, 0x950f8ccf, 0xa5cf9b4f,
538 1.1 christos 0xbddfaf1f, 0xd1ffc93f, 0x00000000, 0x00000000, 0x00000000,
539 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
540 1.1 christos 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x0003ffff, 0x79a8aa1f,
541 1.1 christos 0x08000000, 0x3f3f3f3f, 0x3f3f3f3f, 0x1ce739ce, 0x000001ce,
542 1.1 christos 0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
543 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
544 1.1 christos 0x00000000, 0x00000000, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f,
545 1.1 christos 0x00000000, 0x1ce739ce, 0x000000c0, 0x00180a68, 0x0510001c,
546 1.1 christos 0x00009b40, 0x012a8160, 0x09249126, 0x00180a68, 0x0510001c,
547 1.1 christos 0x00009b40, 0x012a8160, 0x09249126, 0x0001c600, 0x004b6a8e,
548 1.1 christos 0x000003ce, 0x00181400, 0x00820820, 0x066c420f, 0x0f282207,
549 1.1 christos 0x17601685, 0x1f801104, 0x37a00c03, 0x3fc40883, 0x57c00803,
550 1.1 christos 0x5fd80682, 0x7fe00482, 0x7f3c7bba, 0xf3307ff0
551 1.1 christos };
552 1.1 christos #endif
553 1.1 christos
554 1.1 christos static const uint32_t ar5416_phy_vals_2ghz_20mhz[] = {
555 1.1 christos 0x00000007, 0x00000300, 0x00000000, 0xad848e19, 0x7d14e000,
556 1.1 christos 0x9c0a9f6b, 0x00000090, 0x00000000, 0x02020200, 0x00000e0e,
557 1.1 christos 0x0a020001, 0x0000a000, 0x00000000, 0x00000e0e, 0x00000007,
558 1.1 christos 0x00200400, 0x206a002e, 0x137216a4, 0x00197a68, 0x1284233c,
559 1.1 christos 0x6c48b0e4, 0x00000859, 0x7ec80d2e, 0x31395c5e, 0x0004dd20,
560 1.1 christos 0x409a4190, 0x050cb081, 0x00000000, 0x00000000, 0x00000000,
561 1.1 christos 0x00000000, 0x00000898, 0x00000134, 0x10000fff, 0x0510001c,
562 1.1 christos 0xd0058a15, 0x00000001, 0x00000004, 0x3f3f3f3f, 0x3f3f3f3f,
563 1.1 christos 0x0000007f, 0xdfb81020, 0x9280b212, 0x00020028, 0x5d50e188,
564 1.1 christos 0x00081fff, 0x00009b40, 0x00001120, 0x190fb515, 0x00000000,
565 1.1 christos 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
566 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
567 1.1 christos 0x00000000, 0x00000007, 0x001fff00, 0x006f00c4, 0x03051000,
568 1.1 christos 0x00000820, 0x038919be, 0x06336f77, 0x60f6532c, 0x08f186c8,
569 1.1 christos 0x00046384, 0x00000000, 0x00000000, 0x00000000, 0x00000200,
570 1.1 christos 0x64646464, 0x3c787878, 0x000000aa, 0x00000000, 0x00001042,
571 1.1 christos 0x00000000, 0x00000040, 0x00000080, 0x00000141, 0x00000181,
572 1.1 christos 0x000001c1, 0x00000001, 0x00000041, 0x000001a8, 0x000001e8,
573 1.1 christos 0x00000028, 0x00000068, 0x000000a8, 0x00000169, 0x000001a9,
574 1.1 christos 0x000001e9, 0x00000029, 0x00000069, 0x00000190, 0x000001d0,
575 1.1 christos 0x00000010, 0x00000050, 0x00000090, 0x00000151, 0x00000191,
576 1.1 christos 0x000001d1, 0x00000011, 0x00000051, 0x00000198, 0x000001d8,
577 1.1 christos 0x00000018, 0x00000058, 0x00000098, 0x00000159, 0x00000199,
578 1.1 christos 0x000001d9, 0x00000019, 0x00000059, 0x00000099, 0x000000d9,
579 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
580 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
581 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
582 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
583 1.1 christos 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x00000000,
584 1.1 christos 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005,
585 1.1 christos 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c,
586 1.1 christos 0x0000000d, 0x00000010, 0x00000011, 0x00000012, 0x00000013,
587 1.1 christos 0x00000014, 0x00000015, 0x00000018, 0x00000019, 0x0000001a,
588 1.1 christos 0x0000001b, 0x0000001c, 0x0000001d, 0x00000020, 0x00000021,
589 1.1 christos 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000028,
590 1.1 christos 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d,
591 1.1 christos 0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034,
592 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
593 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
594 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
595 1.1 christos 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
596 1.1 christos 0x00000035, 0x00000010, 0x0000001a, 0x00000000, 0x00000000,
597 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
598 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
599 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
600 1.1 christos 0x00000000, 0x0000000e, 0x00000440, 0xd03e4788, 0x012a8160,
601 1.1 christos 0x40806333, 0x00106c10, 0x009c4060, 0x1883800a, 0x018830c6,
602 1.1 christos 0x00000400, 0x000009b5, 0x00000000, 0x00000108, 0x3f3f3f3f,
603 1.1 christos 0x3f3f3f3f, 0x13c889af, 0x38490a20, 0x00007bb6, 0x0fff3ffc,
604 1.1 christos 0x00000001, 0x0000a000, 0x00000000, 0x0cc75380, 0x0f0f0f01,
605 1.1 christos 0xdfa91f01, 0x00418a11, 0x00000000, 0x09249126, 0x0a1a7caa,
606 1.1 christos 0x1ce739ce, 0x051701ce, 0x18010000, 0x2e032402, 0x4a0a3c06,
607 1.1 christos 0x621a540b, 0x764f6c1b, 0x845b7a5a, 0x950f8ccf, 0xa5cf9b4f,
608 1.1 christos 0xbddfaf1f, 0xd1ffc93f, 0x00000000, 0x00000000, 0x00000000,
609 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
610 1.1 christos 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x0003ffff, 0x79a8aa1f,
611 1.1 christos 0x08000000, 0x3f3f3f3f, 0x3f3f3f3f, 0x1ce739ce, 0x000001ce,
612 1.1 christos 0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
613 1.1 christos 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
614 1.1 christos 0x00000000, 0x00000000, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f,
615 1.1 christos 0x00000000, 0x1ce739ce, 0x000000c0, 0x00180a68, 0x0510001c,
616 1.1 christos 0x00009b40, 0x012a8160, 0x09249126, 0x00180a68, 0x0510001c,
617 1.1 christos 0x00009b40, 0x012a8160, 0x09249126, 0x0001c600, 0x004b6a8e,
618 1.1 christos 0x000003ce, 0x00181400, 0x00820820, 0x066c420f, 0x0f282207,
619 1.1 christos 0x17601685, 0x1f801104, 0x37a00c03, 0x3fc40883, 0x57c00803,
620 1.1 christos 0x5fd80682, 0x7fe00482, 0x7f3c7bba, 0xf3307ff0
621 1.1 christos };
622 1.1 christos
623 1.1 christos /* NB: apply AR_PHY(). */
624 1.1 christos static const uint8_t ar5416_banks_regs[] = {
625 1.1 christos 0x2c, 0x38, 0x2c, 0x3b, 0x2c, 0x38, 0x3c, 0x2c, 0x3a, 0x2c, 0x39,
626 1.1 christos 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
627 1.1 christos 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
628 1.1 christos 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
629 1.1 christos 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
630 1.1 christos 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x38, 0x2c, 0x2c,
631 1.1 christos 0x2c, 0x3c
632 1.1 christos };
633 1.1 christos
634 1.1 christos static const uint32_t ar5416_banks_vals_5ghz[] = {
635 1.1 christos 0x1e5795e5, 0x02008020, 0x02108421, 0x00000008, 0x0e73ff17,
636 1.1 christos 0x00000420, 0x01400018, 0x000001a1, 0x00000001, 0x00000013,
637 1.1 christos 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
638 1.1 christos 0x00000000, 0x00004000, 0x00006c00, 0x00002c00, 0x00004800,
639 1.1 christos 0x00004000, 0x00006000, 0x00001000, 0x00004000, 0x00007c00,
640 1.1 christos 0x00007c00, 0x00007c00, 0x00007c00, 0x00007c00, 0x00087c00,
641 1.1 christos 0x00007c00, 0x00005400, 0x00000c00, 0x00001800, 0x00007c00,
642 1.1 christos 0x00006c00, 0x00006c00, 0x00007c00, 0x00002c00, 0x00003c00,
643 1.1 christos 0x00003800, 0x00001c00, 0x00000800, 0x00000408, 0x00004c15,
644 1.1 christos 0x00004188, 0x0000201e, 0x00010408, 0x00000801, 0x00000c08,
645 1.1 christos 0x0000181e, 0x00001016, 0x00002800, 0x00004010, 0x0000081c,
646 1.1 christos 0x00000115, 0x00000015, 0x00000066, 0x0000001c, 0x00000000,
647 1.1 christos 0x00000004, 0x00000015, 0x0000001f, 0x00000000, 0x000000a0,
648 1.1 christos 0x00000000, 0x00000040, 0x0000001c
649 1.1 christos };
650 1.1 christos
651 1.1 christos static const uint32_t ar5416_banks_vals_2ghz[] = {
652 1.1 christos 0x1e5795e5, 0x02008020, 0x02108421, 0x00000008, 0x0e73ff17,
653 1.1 christos 0x00000420, 0x01c00018, 0x000001a1, 0x00000001, 0x00000013,
654 1.1 christos 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
655 1.1 christos 0x00000000, 0x00004000, 0x00006c00, 0x00002c00, 0x00004800,
656 1.1 christos 0x00004000, 0x00006000, 0x00001000, 0x00004000, 0x00007c00,
657 1.1 christos 0x00007c00, 0x00007c00, 0x00007c00, 0x00007c00, 0x00087c00,
658 1.1 christos 0x00007c00, 0x00005400, 0x00000c00, 0x00001800, 0x00007c00,
659 1.1 christos 0x00006c00, 0x00006c00, 0x00007c00, 0x00002c00, 0x00003c00,
660 1.1 christos 0x00003800, 0x00001c00, 0x00000800, 0x00000408, 0x00004c15,
661 1.1 christos 0x00004188, 0x0000201e, 0x00010408, 0x00000801, 0x00000c08,
662 1.1 christos 0x0000181e, 0x00001016, 0x00002800, 0x00004010, 0x0000081c,
663 1.1 christos 0x00000115, 0x00000015, 0x00000066, 0x0000001c, 0x00000000,
664 1.1 christos 0x00000004, 0x00000015, 0x0000001f, 0x00000400, 0x000000a0,
665 1.1 christos 0x00000000, 0x00000040, 0x0000001c
666 1.1 christos };
667 1.1 christos
668 1.1 christos /*
669 1.1 christos * EEPROM.
670 1.1 christos */
671 1.1 christos /* Possible flags for opCapFlags. */
672 1.1 christos #define AR5416_OPFLAGS_11A 0x01
673 1.1 christos #define AR5416_OPFLAGS_11G 0x02
674 1.1 christos #define AR5416_OPFLAGS_5G_HT40 0x04
675 1.1 christos #define AR5416_OPFLAGS_2G_HT40 0x08
676 1.1 christos #define AR5416_OPFLAGS_5G_HT20 0x10
677 1.1 christos #define AR5416_OPFLAGS_2G_HT20 0x20
678 1.1 christos
679 1.1 christos #define AR5416_NUM_5G_CAL_PIERS 8
680 1.1 christos #define AR5416_NUM_2G_CAL_PIERS 4
681 1.1 christos #define AR5416_NUM_5G_20_TARGET_POWERS 8
682 1.1 christos #define AR5416_NUM_5G_40_TARGET_POWERS 8
683 1.1 christos #define AR5416_NUM_2G_CCK_TARGET_POWERS 3
684 1.1 christos #define AR5416_NUM_2G_20_TARGET_POWERS 4
685 1.1 christos #define AR5416_NUM_2G_40_TARGET_POWERS 4
686 1.1 christos #define AR5416_NUM_CTLS 24
687 1.1 christos #define AR5416_NUM_BAND_EDGES 8
688 1.1 christos #define AR5416_NUM_PD_GAINS 4
689 1.1 christos #define AR5416_PD_GAIN_ICEPTS 5
690 1.1 christos #define AR5416_EEPROM_MODAL_SPURS 5
691 1.1 christos #define AR5416_MAX_CHAINS 2
692 1.1 christos
693 1.1 christos typedef struct BaseEepHeader {
694 1.1 christos uint16_t length;
695 1.1 christos uint16_t checksum;
696 1.1 christos uint16_t version;
697 1.1 christos uint8_t opCapFlags;
698 1.1 christos uint8_t eepMisc;
699 1.1 christos uint16_t regDmn[2];
700 1.1 christos uint8_t macAddr[6];
701 1.1 christos uint8_t rxMask;
702 1.1 christos uint8_t txMask;
703 1.1 christos uint16_t rfSilent;
704 1.1 christos uint16_t blueToothOptions;
705 1.1 christos uint16_t deviceCap;
706 1.1 christos uint32_t binBuildNumber;
707 1.1 christos uint8_t deviceType;
708 1.1 christos uint8_t futureBase[33];
709 1.1 christos } __packed BASE_EEP_HEADER;
710 1.1 christos
711 1.1 christos typedef struct spurChanStruct {
712 1.1 christos uint16_t spurChan;
713 1.1 christos uint8_t spurRangeLow;
714 1.1 christos uint8_t spurRangeHigh;
715 1.1 christos } __packed SPUR_CHAN;
716 1.1 christos
717 1.1 christos typedef struct ModalEepHeader {
718 1.1 christos uint32_t antCtrlChain[AR5416_MAX_CHAINS];
719 1.1 christos uint32_t antCtrlCommon;
720 1.1 christos int8_t antennaGainCh[AR5416_MAX_CHAINS];
721 1.1 christos uint8_t switchSettling;
722 1.1 christos uint8_t txRxAttenCh[AR5416_MAX_CHAINS];
723 1.1 christos uint8_t rxTxMarginCh[AR5416_MAX_CHAINS];
724 1.1 christos uint8_t adcDesiredSize;
725 1.1 christos int8_t pgaDesiredSize;
726 1.1 christos uint8_t xlnaGainCh[AR5416_MAX_CHAINS];
727 1.1 christos uint8_t txEndToXpaOff;
728 1.1 christos uint8_t txEndToRxOn;
729 1.1 christos uint8_t txFrameToXpaOn;
730 1.1 christos uint8_t thresh62;
731 1.1 christos uint8_t noiseFloorThreshCh[AR5416_MAX_CHAINS];
732 1.1 christos uint8_t xpdGain;
733 1.1 christos uint8_t xpd;
734 1.1 christos int8_t iqCalICh[AR5416_MAX_CHAINS];
735 1.1 christos int8_t iqCalQCh[AR5416_MAX_CHAINS];
736 1.1 christos uint8_t pdGainOverlap;
737 1.1 christos uint8_t ob;
738 1.1 christos uint8_t db;
739 1.1 christos uint8_t xpaBiasLvl;
740 1.1 christos uint8_t pwrDecreaseFor2Chain;
741 1.1 christos uint8_t pwrDecreaseFor3Chain;
742 1.1 christos uint8_t txFrameToDataStart;
743 1.1 christos uint8_t txFrameToPaOn;
744 1.1 christos uint8_t ht40PowerIncForPdadc;
745 1.1 christos uint8_t bswAtten[AR5416_MAX_CHAINS];
746 1.1 christos uint8_t bswMargin[AR5416_MAX_CHAINS];
747 1.1 christos uint8_t swSettleHt40;
748 1.1 christos uint8_t futureModal[22];
749 1.1 christos SPUR_CHAN spurChans[AR5416_EEPROM_MODAL_SPURS];
750 1.1 christos } __packed MODAL_EEP_HEADER;
751 1.1 christos
752 1.1 christos typedef struct calDataPerFreq {
753 1.1 christos uint8_t pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
754 1.1 christos uint8_t vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
755 1.1 christos } __packed CAL_DATA_PER_FREQ;
756 1.1 christos
757 1.1 christos typedef struct CalTargetPowerLegacy {
758 1.1 christos uint8_t bChannel;
759 1.1 christos uint8_t tPow2x[4];
760 1.1 christos } __packed CAL_TARGET_POWER_LEG;
761 1.1 christos
762 1.1 christos typedef struct CalTargetPowerHt {
763 1.1 christos uint8_t bChannel;
764 1.1 christos uint8_t tPow2x[8];
765 1.1 christos } __packed CAL_TARGET_POWER_HT;
766 1.1 christos
767 1.1 christos typedef struct CalCtlEdges {
768 1.1 christos uint8_t bChannel;
769 1.1 christos uint8_t tPowerFlag;
770 1.1 christos } __packed CAL_CTL_EDGES;
771 1.1 christos
772 1.1 christos typedef struct CalCtlData {
773 1.1 christos CAL_CTL_EDGES ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES];
774 1.1 christos } __packed CAL_CTL_DATA;
775 1.1 christos
776 1.1 christos typedef struct ar5416eeprom {
777 1.1 christos BASE_EEP_HEADER baseEepHeader;
778 1.1 christos uint8_t custData[64];
779 1.1 christos MODAL_EEP_HEADER modalHeader[2];
780 1.1 christos uint8_t calFreqPier5G[AR5416_NUM_5G_CAL_PIERS];
781 1.1 christos uint8_t calFreqPier2G[AR5416_NUM_2G_CAL_PIERS];
782 1.1 christos CAL_DATA_PER_FREQ calPierData5G[AR5416_MAX_CHAINS]
783 1.1 christos [AR5416_NUM_5G_CAL_PIERS];
784 1.1 christos CAL_DATA_PER_FREQ calPierData2G[AR5416_MAX_CHAINS]
785 1.1 christos [AR5416_NUM_2G_CAL_PIERS];
786 1.1 christos CAL_TARGET_POWER_LEG calTPow5G[AR5416_NUM_5G_20_TARGET_POWERS];
787 1.1 christos CAL_TARGET_POWER_HT calTPow5GHT20[AR5416_NUM_5G_20_TARGET_POWERS];
788 1.1 christos CAL_TARGET_POWER_HT calTPow5GHT40[AR5416_NUM_5G_40_TARGET_POWERS];
789 1.1 christos CAL_TARGET_POWER_LEG calTPowCck[AR5416_NUM_2G_CCK_TARGET_POWERS];
790 1.1 christos CAL_TARGET_POWER_LEG calTPow2G[AR5416_NUM_2G_20_TARGET_POWERS];
791 1.1 christos CAL_TARGET_POWER_HT calTPow2GHT20[AR5416_NUM_2G_20_TARGET_POWERS];
792 1.1 christos CAL_TARGET_POWER_HT calTPow2GHT40[AR5416_NUM_2G_40_TARGET_POWERS];
793 1.1 christos uint8_t ctlIndex[AR5416_NUM_CTLS];
794 1.1 christos CAL_CTL_DATA ctlData[AR5416_NUM_CTLS];
795 1.1 christos uint8_t padding;
796 1.1 christos } __packed AR5416_EEPROM;
797 1.1 christos
798 1.1 christos
799 1.1 christos #define OTUS_TX_DATA_LIST_COUNT 8
800 1.1 christos #define OTUS_RX_DATA_LIST_COUNT 1
801 1.1 christos
802 1.1 christos #define OTUS_CMD_TIMEOUT 1000
803 1.1 christos #define OTUS_TX_TIMEOUT 1000
804 1.1 christos
805 1.1 christos #define OTUS_UID(aid) (IEEE80211_AID(aid) + 4)
806 1.1 christos
807 1.1 christos #define OTUS_MAX_TXCMDSZ 64
808 1.1 christos #define OTUS_RXBUFSZ (8 * 1024)
809 1.1 christos #define OTUS_TXBUFSZ (4 * 1024)
810 1.1 christos
811 1.1 christos /* Default EDCA parameters for when QoS is disabled. */
812 1.1 christos static const struct ieee80211_edca_ac_params otus_edca_def[EDCA_NUM_AC] = {
813 1.1 christos { 4, 10, 3, 0 },
814 1.1 christos { 4, 10, 7, 0 },
815 1.1 christos { 3, 4, 2, 94 },
816 1.1 christos { 2, 3, 2, 47 }
817 1.1 christos };
818 1.1 christos
819 1.1 christos #define OTUS_RIDX_CCK1 0
820 1.1 christos #define OTUS_RIDX_OFDM6 4
821 1.1 christos #define OTUS_RIDX_OFDM24 8
822 1.1 christos #define OTUS_RIDX_MAX 11
823 1.1 christos static const struct otus_rate {
824 1.1 christos uint8_t rate;
825 1.1 christos uint8_t mcs;
826 1.1 christos } otus_rates[] = {
827 1.1 christos { 2, 0x0 },
828 1.1 christos { 4, 0x1 },
829 1.1 christos { 11, 0x2 },
830 1.1 christos { 22, 0x3 },
831 1.1 christos { 12, 0xb },
832 1.1 christos { 18, 0xf },
833 1.1 christos { 24, 0xa },
834 1.1 christos { 36, 0xe },
835 1.1 christos { 48, 0x9 },
836 1.1 christos { 72, 0xd },
837 1.1 christos { 96, 0x8 },
838 1.1 christos { 108, 0xc }
839 1.1 christos };
840 1.1 christos
841 1.1 christos struct otus_rx_radiotap_header {
842 1.1 christos struct ieee80211_radiotap_header wr_ihdr;
843 1.1 christos uint8_t wr_flags;
844 1.1 christos uint8_t wr_rate;
845 1.1 christos uint16_t wr_chan_freq;
846 1.1 christos uint16_t wr_chan_flags;
847 1.1 christos uint8_t wr_antsignal;
848 1.1 christos } __packed;
849 1.1 christos
850 1.1 christos #define OTUS_RX_RADIOTAP_PRESENT \
851 1.1 christos (1 << IEEE80211_RADIOTAP_FLAGS | \
852 1.1 christos 1 << IEEE80211_RADIOTAP_RATE | \
853 1.1 christos 1 << IEEE80211_RADIOTAP_CHANNEL | \
854 1.1 christos 1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)
855 1.1 christos
856 1.1 christos struct otus_tx_radiotap_header {
857 1.1 christos struct ieee80211_radiotap_header wt_ihdr;
858 1.1 christos uint8_t wt_flags;
859 1.1 christos uint8_t wt_rate;
860 1.1 christos uint16_t wt_chan_freq;
861 1.1 christos uint16_t wt_chan_flags;
862 1.1 christos } __packed;
863 1.1 christos
864 1.1 christos #define OTUS_TX_RADIOTAP_PRESENT \
865 1.1 christos (1 << IEEE80211_RADIOTAP_FLAGS | \
866 1.1 christos 1 << IEEE80211_RADIOTAP_RATE | \
867 1.1 christos 1 << IEEE80211_RADIOTAP_CHANNEL)
868 1.1 christos
869 1.1 christos struct otus_softc;
870 1.1 christos
871 1.1 christos struct otus_tx_cmd {
872 1.1 christos usbd_xfer_handle xfer;
873 1.1 christos uint8_t *buf;
874 1.1 christos void *odata;
875 1.1 christos uint16_t token;
876 1.1 christos uint8_t done;
877 1.1 christos };
878 1.1 christos
879 1.1 christos struct otus_rx_data {
880 1.1 christos struct otus_softc *sc;
881 1.1 christos usbd_xfer_handle xfer;
882 1.1 christos uint8_t *buf;
883 1.1 christos };
884 1.1 christos
885 1.1 christos struct otus_tx_data {
886 1.1 christos struct otus_softc *sc;
887 1.1 christos usbd_xfer_handle xfer;
888 1.1 christos uint8_t *buf;
889 1.1 christos };
890 1.1 christos
891 1.1 christos struct otus_host_cmd {
892 1.1 christos void (*cb)(struct otus_softc *, void *);
893 1.1 christos uint8_t data[256];
894 1.1 christos };
895 1.1 christos
896 1.1 christos #define OTUS_HOST_CMD_RING_COUNT 32
897 1.1 christos struct otus_host_cmd_ring {
898 1.1 christos struct otus_host_cmd cmd[OTUS_HOST_CMD_RING_COUNT];
899 1.1 christos int cur;
900 1.1 christos int next;
901 1.1 christos int queued;
902 1.1 christos };
903 1.1 christos
904 1.1 christos struct otus_node {
905 1.1 christos struct ieee80211_node ni;
906 1.1 christos struct ieee80211_amrr_node amn;
907 1.1 christos uint8_t ridx[IEEE80211_RATE_MAXSIZE];
908 1.1 christos };
909 1.1 christos
910 1.1 christos struct otus_cmd_newstate {
911 1.1 christos enum ieee80211_state state;
912 1.1 christos int arg;
913 1.1 christos };
914 1.1 christos
915 1.1 christos struct otus_cmd_key {
916 1.1 christos struct ieee80211_key key;
917 1.1 christos uint16_t associd;
918 1.1 christos };
919 1.1 christos
920 1.1 christos struct otus_softc {
921 1.1 christos struct device sc_dev;
922 1.1 christos struct ieee80211com sc_ic;
923 1.1 christos int (*sc_newstate)(struct ieee80211com *,
924 1.1 christos enum ieee80211_state, int);
925 1.1 christos void (*sc_led_newstate)(struct otus_softc *);
926 1.1 christos
927 1.1 christos usbd_device_handle sc_udev;
928 1.1 christos usbd_interface_handle sc_iface;
929 1.1 christos
930 1.1 christos struct ar5416eeprom eeprom;
931 1.1 christos uint8_t capflags;
932 1.1 christos uint8_t rxmask;
933 1.1 christos uint8_t txmask;
934 1.1 christos
935 1.1 christos usbd_pipe_handle data_tx_pipe;
936 1.1 christos usbd_pipe_handle data_rx_pipe;
937 1.1 christos usbd_pipe_handle cmd_tx_pipe;
938 1.1 christos usbd_pipe_handle cmd_rx_pipe;
939 1.1 christos uint8_t *ibuf;
940 1.1 christos
941 1.1 christos int sc_if_flags;
942 1.1 christos int sc_tx_timer;
943 1.1 christos int fixed_ridx;
944 1.1 christos int bb_reset;
945 1.1 christos
946 1.1 christos struct ieee80211_channel *sc_curchan;
947 1.1 christos
948 1.1 christos struct usb_task sc_task;
949 1.1 christos struct timeout scan_to;
950 1.1 christos struct timeout calib_to;
951 1.1 christos struct ieee80211_amrr amrr;
952 1.1 christos
953 1.1 christos int write_idx;
954 1.1 christos int tx_cur;
955 1.1 christos int tx_queued;
956 1.1 christos uint32_t led_state;
957 1.1 christos
958 1.1 christos const uint32_t *phy_vals;
959 1.1 christos
960 1.1 christos struct {
961 1.1 christos uint32_t reg;
962 1.1 christos uint32_t val;
963 1.1 christos } __packed write_buf[AR_MAX_WRITE_IDX + 1];
964 1.1 christos
965 1.1 christos struct otus_host_cmd_ring cmdq;
966 1.1 christos struct otus_tx_cmd tx_cmd;
967 1.1 christos struct otus_tx_data tx_data[OTUS_TX_DATA_LIST_COUNT];
968 1.1 christos struct otus_rx_data rx_data[OTUS_RX_DATA_LIST_COUNT];
969 1.1 christos
970 1.1 christos #if NBPFILTER > 0
971 1.1 christos caddr_t sc_drvbpf;
972 1.1 christos
973 1.1 christos union {
974 1.1 christos struct otus_rx_radiotap_header th;
975 1.1 christos uint8_t pad[64];
976 1.1 christos } sc_rxtapu;
977 1.1 christos #define sc_rxtap sc_rxtapu.th
978 1.1 christos int sc_rxtap_len;
979 1.1 christos
980 1.1 christos union {
981 1.1 christos struct otus_tx_radiotap_header th;
982 1.1 christos uint8_t pad[64];
983 1.1 christos } sc_txtapu;
984 1.1 christos #define sc_txtap sc_txtapu.th
985 1.1 christos int sc_txtap_len;
986 1.1 christos #endif
987 1.1 christos };
988