blob: b2adb2a281c2e9035cdd17f52d4c40386a4b408b [file] [log] [blame]
Nick Kossifidisc6e387a2008-08-29 22:45:39 +03001/*
2 * Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org>
3 * Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 *
17 */
18
19/*
Bruno Randolf03417bc2010-06-16 19:12:17 +090020 * RX/TX descriptor structures
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030021 */
22
23/*
Bruno Randolf03417bc2010-06-16 19:12:17 +090024 * Common hardware RX control descriptor
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030025 */
26struct ath5k_hw_rx_ctl {
27 u32 rx_control_0; /* RX control word 0 */
28 u32 rx_control_1; /* RX control word 1 */
29} __packed;
30
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030031/* RX control word 1 fields/flags */
Bruno Randolf03417bc2010-06-16 19:12:17 +090032#define AR5K_DESC_RX_CTL1_BUF_LEN 0x00000fff /* data buffer length */
33#define AR5K_DESC_RX_CTL1_INTREQ 0x00002000 /* RX interrupt request */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030034
35/*
Bruno Randolf03417bc2010-06-16 19:12:17 +090036 * Common hardware RX status descriptor
37 * 5210, 5211 and 5212 differ only in the fields and flags defined below
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030038 */
39struct ath5k_hw_rx_status {
40 u32 rx_status_0; /* RX status word 0 */
41 u32 rx_status_1; /* RX status word 1 */
42} __packed;
43
44/* 5210/5211 */
45/* RX status word 0 fields/flags */
Bruno Randolf03417bc2010-06-16 19:12:17 +090046#define AR5K_5210_RX_DESC_STATUS0_DATA_LEN 0x00000fff /* RX data length */
47#define AR5K_5210_RX_DESC_STATUS0_MORE 0x00001000 /* more desc for this frame */
Bruno Randolf1884a362010-06-16 19:12:28 +090048#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5210 0x00004000 /* [5210] receive on ant 1 */
Bruno Randolf03417bc2010-06-16 19:12:17 +090049#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE 0x00078000 /* reception rate */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030050#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE_S 15
Bruno Randolf03417bc2010-06-16 19:12:17 +090051#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL 0x07f80000 /* rssi */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030052#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL_S 19
Bruno Randolf03417bc2010-06-16 19:12:17 +090053#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5211 0x38000000 /* [5211] receive antenna */
54#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5211_S 27
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030055
56/* RX status word 1 fields/flags */
Bruno Randolf03417bc2010-06-16 19:12:17 +090057#define AR5K_5210_RX_DESC_STATUS1_DONE 0x00000001 /* descriptor complete */
58#define AR5K_5210_RX_DESC_STATUS1_FRAME_RECEIVE_OK 0x00000002 /* reception success */
59#define AR5K_5210_RX_DESC_STATUS1_CRC_ERROR 0x00000004 /* CRC error */
60#define AR5K_5210_RX_DESC_STATUS1_FIFO_OVERRUN_5210 0x00000008 /* [5210] FIFO overrun */
61#define AR5K_5210_RX_DESC_STATUS1_DECRYPT_CRC_ERROR 0x00000010 /* decyption CRC failure */
62#define AR5K_5210_RX_DESC_STATUS1_PHY_ERROR 0x000000e0 /* PHY error */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030063#define AR5K_5210_RX_DESC_STATUS1_PHY_ERROR_S 5
Bruno Randolf03417bc2010-06-16 19:12:17 +090064#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX_VALID 0x00000100 /* key index valid */
65#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX 0x00007e00 /* decyption key index */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030066#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX_S 9
Bruno Randolf03417bc2010-06-16 19:12:17 +090067#define AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP 0x0fff8000 /* 13 bit of TSF */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030068#define AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP_S 15
Bruno Randolf03417bc2010-06-16 19:12:17 +090069#define AR5K_5210_RX_DESC_STATUS1_KEY_CACHE_MISS 0x10000000 /* key cache miss */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030070
71/* 5212 */
72/* RX status word 0 fields/flags */
Bruno Randolf03417bc2010-06-16 19:12:17 +090073#define AR5K_5212_RX_DESC_STATUS0_DATA_LEN 0x00000fff /* RX data length */
74#define AR5K_5212_RX_DESC_STATUS0_MORE 0x00001000 /* more desc for this frame */
75#define AR5K_5212_RX_DESC_STATUS0_DECOMP_CRC_ERROR 0x00002000 /* decompression CRC error */
76#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE 0x000f8000 /* reception rate */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030077#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE_S 15
Bruno Randolf03417bc2010-06-16 19:12:17 +090078#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL 0x0ff00000 /* rssi */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030079#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL_S 20
Bruno Randolf03417bc2010-06-16 19:12:17 +090080#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA 0xf0000000 /* receive antenna */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030081#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA_S 28
82
83/* RX status word 1 fields/flags */
Bruno Randolf03417bc2010-06-16 19:12:17 +090084#define AR5K_5212_RX_DESC_STATUS1_DONE 0x00000001 /* descriptor complete */
85#define AR5K_5212_RX_DESC_STATUS1_FRAME_RECEIVE_OK 0x00000002 /* frame reception success */
86#define AR5K_5212_RX_DESC_STATUS1_CRC_ERROR 0x00000004 /* CRC error */
87#define AR5K_5212_RX_DESC_STATUS1_DECRYPT_CRC_ERROR 0x00000008 /* decryption CRC failure */
88#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR 0x00000010 /* PHY error */
89#define AR5K_5212_RX_DESC_STATUS1_MIC_ERROR 0x00000020 /* MIC decrypt error */
90#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX_VALID 0x00000100 /* key index valid */
91#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX 0x0000fe00 /* decryption key index */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030092#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX_S 9
Bruno Randolf03417bc2010-06-16 19:12:17 +090093#define AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP 0x7fff0000 /* first 15bit of the TSF */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030094#define AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP_S 16
Bruno Randolf03417bc2010-06-16 19:12:17 +090095#define AR5K_5212_RX_DESC_STATUS1_KEY_CACHE_MISS 0x80000000 /* key cache miss */
96#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE 0x0000ff00 /* phy error code overlays key index and valid fields */
Bruno Randolf62412a82010-06-16 19:12:12 +090097#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE_S 8
Nick Kossifidisc6e387a2008-08-29 22:45:39 +030098
Bruno Randolfda351112010-03-25 14:49:42 +090099/**
100 * enum ath5k_phy_error_code - PHY Error codes
101 */
102enum ath5k_phy_error_code {
Bruno Randolf03417bc2010-06-16 19:12:17 +0900103 AR5K_RX_PHY_ERROR_UNDERRUN = 0, /* Transmit underrun, [5210] No error */
Bruno Randolfda351112010-03-25 14:49:42 +0900104 AR5K_RX_PHY_ERROR_TIMING = 1, /* Timing error */
105 AR5K_RX_PHY_ERROR_PARITY = 2, /* Illegal parity */
106 AR5K_RX_PHY_ERROR_RATE = 3, /* Illegal rate */
107 AR5K_RX_PHY_ERROR_LENGTH = 4, /* Illegal length */
Bruno Randolf03417bc2010-06-16 19:12:17 +0900108 AR5K_RX_PHY_ERROR_RADAR = 5, /* Radar detect, [5210] 64 QAM rate */
Bruno Randolfda351112010-03-25 14:49:42 +0900109 AR5K_RX_PHY_ERROR_SERVICE = 6, /* Illegal service */
110 AR5K_RX_PHY_ERROR_TOR = 7, /* Transmit override receive */
111 /* these are specific to the 5212 */
112 AR5K_RX_PHY_ERROR_OFDM_TIMING = 17,
113 AR5K_RX_PHY_ERROR_OFDM_SIGNAL_PARITY = 18,
114 AR5K_RX_PHY_ERROR_OFDM_RATE_ILLEGAL = 19,
115 AR5K_RX_PHY_ERROR_OFDM_LENGTH_ILLEGAL = 20,
116 AR5K_RX_PHY_ERROR_OFDM_POWER_DROP = 21,
117 AR5K_RX_PHY_ERROR_OFDM_SERVICE = 22,
118 AR5K_RX_PHY_ERROR_OFDM_RESTART = 23,
119 AR5K_RX_PHY_ERROR_CCK_TIMING = 25,
120 AR5K_RX_PHY_ERROR_CCK_HEADER_CRC = 26,
121 AR5K_RX_PHY_ERROR_CCK_RATE_ILLEGAL = 27,
122 AR5K_RX_PHY_ERROR_CCK_SERVICE = 30,
123 AR5K_RX_PHY_ERROR_CCK_RESTART = 31,
124};
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300125
126/*
127 * 5210/5211 hardware 2-word TX control descriptor
128 */
129struct ath5k_hw_2w_tx_ctl {
130 u32 tx_control_0; /* TX control word 0 */
131 u32 tx_control_1; /* TX control word 1 */
132} __packed;
133
134/* TX control word 0 fields/flags */
Bruno Randolf03417bc2010-06-16 19:12:17 +0900135#define AR5K_2W_TX_DESC_CTL0_FRAME_LEN 0x00000fff /* frame length */
136#define AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210 0x0003f000 /* [5210] header length */
137#define AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210_S 12
138#define AR5K_2W_TX_DESC_CTL0_XMIT_RATE 0x003c0000 /* tx rate */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300139#define AR5K_2W_TX_DESC_CTL0_XMIT_RATE_S 18
Bruno Randolf03417bc2010-06-16 19:12:17 +0900140#define AR5K_2W_TX_DESC_CTL0_RTSENA 0x00400000 /* RTS/CTS enable */
141#define AR5K_2W_TX_DESC_CTL0_LONG_PACKET_5210 0x00800000 /* [5210] long packet */
Bruno Randolf1884a362010-06-16 19:12:28 +0900142#define AR5K_2W_TX_DESC_CTL0_VEOL_5211 0x00800000 /* [5211] virtual end-of-list */
Bruno Randolf03417bc2010-06-16 19:12:17 +0900143#define AR5K_2W_TX_DESC_CTL0_CLRDMASK 0x01000000 /* clear destination mask */
144#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5210 0x02000000 /* [5210] antenna selection */
145#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5211 0x1e000000 /* [5211] antenna selection */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300146#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT \
147 (ah->ah_version == AR5K_AR5210 ? \
148 AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5210 : \
149 AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5211)
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300150#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_S 25
Bruno Randolf03417bc2010-06-16 19:12:17 +0900151#define AR5K_2W_TX_DESC_CTL0_FRAME_TYPE_5210 0x1c000000 /* [5210] frame type */
152#define AR5K_2W_TX_DESC_CTL0_FRAME_TYPE_5210_S 26
153#define AR5K_2W_TX_DESC_CTL0_INTREQ 0x20000000 /* TX interrupt request */
154#define AR5K_2W_TX_DESC_CTL0_ENCRYPT_KEY_VALID 0x40000000 /* key is valid */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300155
156/* TX control word 1 fields/flags */
Bruno Randolf03417bc2010-06-16 19:12:17 +0900157#define AR5K_2W_TX_DESC_CTL1_BUF_LEN 0x00000fff /* data buffer length */
158#define AR5K_2W_TX_DESC_CTL1_MORE 0x00001000 /* more desc for this frame */
159#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5210 0x0007e000 /* [5210] key table index */
160#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5211 0x000fe000 /* [5211] key table index */
161#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX \
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300162 (ah->ah_version == AR5K_AR5210 ? \
Bruno Randolf03417bc2010-06-16 19:12:17 +0900163 AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5210 : \
164 AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5211)
165#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_S 13
166#define AR5K_2W_TX_DESC_CTL1_FRAME_TYPE_5211 0x00700000 /* [5211] frame type */
167#define AR5K_2W_TX_DESC_CTL1_FRAME_TYPE_5211_S 20
Bruno Randolf1884a362010-06-16 19:12:28 +0900168#define AR5K_2W_TX_DESC_CTL1_NOACK_5211 0x00800000 /* [5211] no ACK */
Bruno Randolf03417bc2010-06-16 19:12:17 +0900169#define AR5K_2W_TX_DESC_CTL1_RTS_DURATION_5210 0xfff80000 /* [5210] lower 13 bit of duration */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300170
171/* Frame types */
Bruno Randolf2237e922010-06-16 19:12:22 +0900172#define AR5K_AR5210_TX_DESC_FRAME_TYPE_NORMAL 0
173#define AR5K_AR5210_TX_DESC_FRAME_TYPE_ATIM 1
174#define AR5K_AR5210_TX_DESC_FRAME_TYPE_PSPOLL 2
175#define AR5K_AR5210_TX_DESC_FRAME_TYPE_NO_DELAY 3
176#define AR5K_AR5211_TX_DESC_FRAME_TYPE_BEACON 3
177#define AR5K_AR5210_TX_DESC_FRAME_TYPE_PIFS 4
178#define AR5K_AR5211_TX_DESC_FRAME_TYPE_PRESP 4
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300179
180/*
181 * 5212 hardware 4-word TX control descriptor
182 */
183struct ath5k_hw_4w_tx_ctl {
184 u32 tx_control_0; /* TX control word 0 */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300185 u32 tx_control_1; /* TX control word 1 */
Bruno Randolf03417bc2010-06-16 19:12:17 +0900186 u32 tx_control_2; /* TX control word 2 */
187 u32 tx_control_3; /* TX control word 3 */
188} __packed;
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300189
Bruno Randolf03417bc2010-06-16 19:12:17 +0900190/* TX control word 0 fields/flags */
191#define AR5K_4W_TX_DESC_CTL0_FRAME_LEN 0x00000fff /* frame length */
192#define AR5K_4W_TX_DESC_CTL0_XMIT_POWER 0x003f0000 /* transmit power */
193#define AR5K_4W_TX_DESC_CTL0_XMIT_POWER_S 16
194#define AR5K_4W_TX_DESC_CTL0_RTSENA 0x00400000 /* RTS/CTS enable */
195#define AR5K_4W_TX_DESC_CTL0_VEOL 0x00800000 /* virtual end-of-list */
196#define AR5K_4W_TX_DESC_CTL0_CLRDMASK 0x01000000 /* clear destination mask */
197#define AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT 0x1e000000 /* TX antenna selection */
198#define AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT_S 25
199#define AR5K_4W_TX_DESC_CTL0_INTREQ 0x20000000 /* TX interrupt request */
200#define AR5K_4W_TX_DESC_CTL0_ENCRYPT_KEY_VALID 0x40000000 /* destination index valid */
201#define AR5K_4W_TX_DESC_CTL0_CTSENA 0x80000000 /* precede frame with CTS */
202
203/* TX control word 1 fields/flags */
204#define AR5K_4W_TX_DESC_CTL1_BUF_LEN 0x00000fff /* data buffer length */
205#define AR5K_4W_TX_DESC_CTL1_MORE 0x00001000 /* more desc for this frame */
206#define AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_IDX 0x000fe000 /* destination table index */
207#define AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_IDX_S 13
208#define AR5K_4W_TX_DESC_CTL1_FRAME_TYPE 0x00f00000 /* frame type */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300209#define AR5K_4W_TX_DESC_CTL1_FRAME_TYPE_S 20
Bruno Randolf03417bc2010-06-16 19:12:17 +0900210#define AR5K_4W_TX_DESC_CTL1_NOACK 0x01000000 /* no ACK */
211#define AR5K_4W_TX_DESC_CTL1_COMP_PROC 0x06000000 /* compression processing */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300212#define AR5K_4W_TX_DESC_CTL1_COMP_PROC_S 25
Bruno Randolf03417bc2010-06-16 19:12:17 +0900213#define AR5K_4W_TX_DESC_CTL1_COMP_IV_LEN 0x18000000 /* length of frame IV */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300214#define AR5K_4W_TX_DESC_CTL1_COMP_IV_LEN_S 27
Bruno Randolf03417bc2010-06-16 19:12:17 +0900215#define AR5K_4W_TX_DESC_CTL1_COMP_ICV_LEN 0x60000000 /* length of frame ICV */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300216#define AR5K_4W_TX_DESC_CTL1_COMP_ICV_LEN_S 29
217
Bruno Randolf03417bc2010-06-16 19:12:17 +0900218/* TX control word 2 fields/flags */
219#define AR5K_4W_TX_DESC_CTL2_RTS_DURATION 0x00007fff /* RTS/CTS duration */
220#define AR5K_4W_TX_DESC_CTL2_DURATION_UPD_EN 0x00008000 /* frame duration update */
221#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0 0x000f0000 /* series 0 max attempts */
222#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0_S 16
223#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES1 0x00f00000 /* series 1 max attempts */
224#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES1_S 20
225#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES2 0x0f000000 /* series 2 max attempts */
226#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES2_S 24
227#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES3 0xf0000000 /* series 3 max attempts */
228#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES3_S 28
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300229
Bruno Randolf03417bc2010-06-16 19:12:17 +0900230/* TX control word 3 fields/flags */
231#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE0 0x0000001f /* series 0 tx rate */
232#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE1 0x000003e0 /* series 1 tx rate */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300233#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE1_S 5
Bruno Randolf03417bc2010-06-16 19:12:17 +0900234#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE2 0x00007c00 /* series 2 tx rate */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300235#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE2_S 10
Bruno Randolf03417bc2010-06-16 19:12:17 +0900236#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE3 0x000f8000 /* series 3 tx rate */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300237#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE3_S 15
Bruno Randolf03417bc2010-06-16 19:12:17 +0900238#define AR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE 0x01f00000 /* RTS or CTS rate */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300239#define AR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE_S 20
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300240
241/*
242 * Common TX status descriptor
243 */
244struct ath5k_hw_tx_status {
245 u32 tx_status_0; /* TX status word 0 */
246 u32 tx_status_1; /* TX status word 1 */
247} __packed;
248
249/* TX status word 0 fields/flags */
Bruno Randolf03417bc2010-06-16 19:12:17 +0900250#define AR5K_DESC_TX_STATUS0_FRAME_XMIT_OK 0x00000001 /* TX success */
251#define AR5K_DESC_TX_STATUS0_EXCESSIVE_RETRIES 0x00000002 /* excessive retries */
252#define AR5K_DESC_TX_STATUS0_FIFO_UNDERRUN 0x00000004 /* FIFO underrun */
253#define AR5K_DESC_TX_STATUS0_FILTERED 0x00000008 /* TX filter indication */
254/* according to the HAL sources the spec has short/long retry counts reversed.
255 * we have it reversed to the HAL sources as well, for 5210 and 5211.
256 * For 5212 these fields are defined as RTS_FAIL_COUNT and DATA_FAIL_COUNT,
257 * but used respectively as SHORT and LONG retry count in the code later. This
258 * is consistent with the definitions here... TODO: check */
259#define AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT 0x000000f0 /* short retry count */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300260#define AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT_S 4
Bruno Randolf03417bc2010-06-16 19:12:17 +0900261#define AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT 0x00000f00 /* long retry count */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300262#define AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT_S 8
Bruno Randolf03417bc2010-06-16 19:12:17 +0900263#define AR5K_DESC_TX_STATUS0_VIRTCOLL_CT_5211 0x0000f000 /* [5211+] virtual collision count */
264#define AR5K_DESC_TX_STATUS0_VIRTCOLL_CT_5212_S 12
265#define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP 0xffff0000 /* TX timestamp */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300266#define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP_S 16
267
268/* TX status word 1 fields/flags */
Bruno Randolf03417bc2010-06-16 19:12:17 +0900269#define AR5K_DESC_TX_STATUS1_DONE 0x00000001 /* descriptor complete */
270#define AR5K_DESC_TX_STATUS1_SEQ_NUM 0x00001ffe /* TX sequence number */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300271#define AR5K_DESC_TX_STATUS1_SEQ_NUM_S 1
Bruno Randolf03417bc2010-06-16 19:12:17 +0900272#define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH 0x001fe000 /* signal strength of ACK */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300273#define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH_S 13
Bruno Randolf03417bc2010-06-16 19:12:17 +0900274#define AR5K_DESC_TX_STATUS1_FINAL_TS_IX_5212 0x00600000 /* [5212] final TX attempt series ix */
275#define AR5K_DESC_TX_STATUS1_FINAL_TS_IX_5212_S 21
276#define AR5K_DESC_TX_STATUS1_COMP_SUCCESS_5212 0x00800000 /* [5212] compression status */
277#define AR5K_DESC_TX_STATUS1_XMIT_ANTENNA_5212 0x01000000 /* [5212] transmit antenna */
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300278
279/*
280 * 5210/5211 hardware TX descriptor
281 */
282struct ath5k_hw_5210_tx_desc {
283 struct ath5k_hw_2w_tx_ctl tx_ctl;
284 struct ath5k_hw_tx_status tx_stat;
285} __packed;
286
287/*
288 * 5212 hardware TX descriptor
289 */
290struct ath5k_hw_5212_tx_desc {
291 struct ath5k_hw_4w_tx_ctl tx_ctl;
292 struct ath5k_hw_tx_status tx_stat;
293} __packed;
294
295/*
Bruno Randolf03417bc2010-06-16 19:12:17 +0900296 * Common hardware RX descriptor
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300297 */
298struct ath5k_hw_all_rx_desc {
Bruno Randolf62412a82010-06-16 19:12:12 +0900299 struct ath5k_hw_rx_ctl rx_ctl;
300 struct ath5k_hw_rx_status rx_stat;
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300301} __packed;
302
303/*
Bruno Randolf03417bc2010-06-16 19:12:17 +0900304 * Atheros hardware DMA descriptor
Nick Kossifidisc6e387a2008-08-29 22:45:39 +0300305 * This is read and written to by the hardware
306 */
307struct ath5k_desc {
308 u32 ds_link; /* physical address of the next descriptor */
309 u32 ds_data; /* physical address of data buffer (skb) */
310
311 union {
312 struct ath5k_hw_5210_tx_desc ds_tx5210;
313 struct ath5k_hw_5212_tx_desc ds_tx5212;
314 struct ath5k_hw_all_rx_desc ds_rx;
315 } ud;
316} __packed;
317
318#define AR5K_RXDESC_INTREQ 0x0020
319
320#define AR5K_TXDESC_CLRDMASK 0x0001
321#define AR5K_TXDESC_NOACK 0x0002 /*[5211+]*/
322#define AR5K_TXDESC_RTSENA 0x0004
323#define AR5K_TXDESC_CTSENA 0x0008
324#define AR5K_TXDESC_INTREQ 0x0010
325#define AR5K_TXDESC_VEOL 0x0020 /*[5211+]*/