aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2010-06-16 06:12:17 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-16 14:59:05 -0400
commit03417bc605ef03cd851f13e36581cf2e1304755d (patch)
tree10f0778ae159f8744ef2644d6f522429e750aa1f /drivers/net
parent62412a8f0ded6e5741c67c24f9e7c5b2bc33e042 (diff)
ath5k: review and add comments for descriptors
I carefully reviewed desh.h against the HAL sources. Added comments and made differences between 5210, 5211 and 5212 more clear by adding _521x to the defines which are specific to that chipset. Renamed some defines. No functional changes. Signed-off-by: Bruno Randolf <br1@einfach.org> Acked-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath5k/desc.c22
-rw-r--r--drivers/net/wireless/ath/ath5k/desc.h276
2 files changed, 144 insertions, 154 deletions
diff --git a/drivers/net/wireless/ath/ath5k/desc.c b/drivers/net/wireless/ath/ath5k/desc.c
index eb1427ce6cb5..41a490e4968e 100644
--- a/drivers/net/wireless/ath/ath5k/desc.c
+++ b/drivers/net/wireless/ath/ath5k/desc.c
@@ -95,10 +95,10 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
95 * XXX: I only found that on 5210 code, does it work on 5211 ? 95 * XXX: I only found that on 5210 code, does it work on 5211 ?
96 */ 96 */
97 if (ah->ah_version == AR5K_AR5210) { 97 if (ah->ah_version == AR5K_AR5210) {
98 if (hdr_len & ~AR5K_2W_TX_DESC_CTL0_HEADER_LEN) 98 if (hdr_len & ~AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210)
99 return -EINVAL; 99 return -EINVAL;
100 tx_ctl->tx_control_0 |= 100 tx_ctl->tx_control_0 |=
101 AR5K_REG_SM(hdr_len, AR5K_2W_TX_DESC_CTL0_HEADER_LEN); 101 AR5K_REG_SM(hdr_len, AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210);
102 } 102 }
103 103
104 /*Differences between 5210-5211*/ 104 /*Differences between 5210-5211*/
@@ -114,7 +114,7 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
114 } 114 }
115 115
116 tx_ctl->tx_control_0 |= 116 tx_ctl->tx_control_0 |=
117 AR5K_REG_SM(frame_type, AR5K_2W_TX_DESC_CTL0_FRAME_TYPE) | 117 AR5K_REG_SM(frame_type, AR5K_2W_TX_DESC_CTL0_FRAME_TYPE_5210) |
118 AR5K_REG_SM(tx_rate0, AR5K_2W_TX_DESC_CTL0_XMIT_RATE); 118 AR5K_REG_SM(tx_rate0, AR5K_2W_TX_DESC_CTL0_XMIT_RATE);
119 119
120 } else { 120 } else {
@@ -123,7 +123,7 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
123 AR5K_REG_SM(antenna_mode, 123 AR5K_REG_SM(antenna_mode,
124 AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT); 124 AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT);
125 tx_ctl->tx_control_1 |= 125 tx_ctl->tx_control_1 |=
126 AR5K_REG_SM(type, AR5K_2W_TX_DESC_CTL1_FRAME_TYPE); 126 AR5K_REG_SM(type, AR5K_2W_TX_DESC_CTL1_FRAME_TYPE_5211);
127 } 127 }
128#define _TX_FLAGS(_c, _flag) \ 128#define _TX_FLAGS(_c, _flag) \
129 if (flags & AR5K_TXDESC_##_flag) { \ 129 if (flags & AR5K_TXDESC_##_flag) { \
@@ -147,7 +147,7 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
147 AR5K_2W_TX_DESC_CTL0_ENCRYPT_KEY_VALID; 147 AR5K_2W_TX_DESC_CTL0_ENCRYPT_KEY_VALID;
148 tx_ctl->tx_control_1 |= 148 tx_ctl->tx_control_1 |=
149 AR5K_REG_SM(key_index, 149 AR5K_REG_SM(key_index,
150 AR5K_2W_TX_DESC_CTL1_ENCRYPT_KEY_INDEX); 150 AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX);
151 } 151 }
152 152
153 /* 153 /*
@@ -156,7 +156,7 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
156 if ((ah->ah_version == AR5K_AR5210) && 156 if ((ah->ah_version == AR5K_AR5210) &&
157 (flags & (AR5K_TXDESC_RTSENA | AR5K_TXDESC_CTSENA))) 157 (flags & (AR5K_TXDESC_RTSENA | AR5K_TXDESC_CTSENA)))
158 tx_ctl->tx_control_1 |= rtscts_duration & 158 tx_ctl->tx_control_1 |= rtscts_duration &
159 AR5K_2W_TX_DESC_CTL1_RTS_DURATION; 159 AR5K_2W_TX_DESC_CTL1_RTS_DURATION_5210;
160 160
161 return 0; 161 return 0;
162} 162}
@@ -255,7 +255,7 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
255 if (key_index != AR5K_TXKEYIX_INVALID) { 255 if (key_index != AR5K_TXKEYIX_INVALID) {
256 tx_ctl->tx_control_0 |= AR5K_4W_TX_DESC_CTL0_ENCRYPT_KEY_VALID; 256 tx_ctl->tx_control_0 |= AR5K_4W_TX_DESC_CTL0_ENCRYPT_KEY_VALID;
257 tx_ctl->tx_control_1 |= AR5K_REG_SM(key_index, 257 tx_ctl->tx_control_1 |= AR5K_REG_SM(key_index,
258 AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_INDEX); 258 AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_IDX);
259 } 259 }
260 260
261 /* 261 /*
@@ -409,11 +409,11 @@ static int ath5k_hw_proc_4word_tx_status(struct ath5k_hw *ah,
409 ts->ts_rssi = AR5K_REG_MS(tx_status->tx_status_1, 409 ts->ts_rssi = AR5K_REG_MS(tx_status->tx_status_1,
410 AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH); 410 AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH);
411 ts->ts_antenna = (tx_status->tx_status_1 & 411 ts->ts_antenna = (tx_status->tx_status_1 &
412 AR5K_DESC_TX_STATUS1_XMIT_ANTENNA) ? 2 : 1; 412 AR5K_DESC_TX_STATUS1_XMIT_ANTENNA_5212) ? 2 : 1;
413 ts->ts_status = 0; 413 ts->ts_status = 0;
414 414
415 ts->ts_final_idx = AR5K_REG_MS(tx_status->tx_status_1, 415 ts->ts_final_idx = AR5K_REG_MS(tx_status->tx_status_1,
416 AR5K_DESC_TX_STATUS1_FINAL_TS_INDEX); 416 AR5K_DESC_TX_STATUS1_FINAL_TS_IX_5212);
417 417
418 /* The longretry counter has the number of un-acked retries 418 /* The longretry counter has the number of un-acked retries
419 * for the final rate. To get the total number of retries 419 * for the final rate. To get the total number of retries
@@ -527,7 +527,7 @@ static int ath5k_hw_proc_5210_rx_status(struct ath5k_hw *ah,
527 rs->rs_rate = AR5K_REG_MS(rx_status->rx_status_0, 527 rs->rs_rate = AR5K_REG_MS(rx_status->rx_status_0,
528 AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE); 528 AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE);
529 rs->rs_antenna = AR5K_REG_MS(rx_status->rx_status_0, 529 rs->rs_antenna = AR5K_REG_MS(rx_status->rx_status_0,
530 AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANTENNA); 530 AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5211);
531 rs->rs_more = !!(rx_status->rx_status_0 & 531 rs->rs_more = !!(rx_status->rx_status_0 &
532 AR5K_5210_RX_DESC_STATUS0_MORE); 532 AR5K_5210_RX_DESC_STATUS0_MORE);
533 /* TODO: this timestamp is 13 bit, later on we assume 15 bit */ 533 /* TODO: this timestamp is 13 bit, later on we assume 15 bit */
@@ -555,7 +555,7 @@ static int ath5k_hw_proc_5210_rx_status(struct ath5k_hw *ah,
555 rs->rs_status |= AR5K_RXERR_CRC; 555 rs->rs_status |= AR5K_RXERR_CRC;
556 556
557 if (rx_status->rx_status_1 & 557 if (rx_status->rx_status_1 &
558 AR5K_5210_RX_DESC_STATUS1_FIFO_OVERRUN) 558 AR5K_5210_RX_DESC_STATUS1_FIFO_OVERRUN_5210)
559 rs->rs_status |= AR5K_RXERR_FIFO; 559 rs->rs_status |= AR5K_RXERR_FIFO;
560 560
561 if (rx_status->rx_status_1 & 561 if (rx_status->rx_status_1 &
diff --git a/drivers/net/wireless/ath/ath5k/desc.h b/drivers/net/wireless/ath/ath5k/desc.h
index 45f26446dbff..50f9a12b5acd 100644
--- a/drivers/net/wireless/ath/ath5k/desc.h
+++ b/drivers/net/wireless/ath/ath5k/desc.h
@@ -17,28 +17,24 @@
17 */ 17 */
18 18
19/* 19/*
20 * Internal RX/TX descriptor structures 20 * RX/TX descriptor structures
21 * (rX: reserved fields possibily used by future versions of the ar5k chipset)
22 */ 21 */
23 22
24/* 23/*
25 * common hardware RX control descriptor 24 * Common hardware RX control descriptor
26 */ 25 */
27struct ath5k_hw_rx_ctl { 26struct ath5k_hw_rx_ctl {
28 u32 rx_control_0; /* RX control word 0 */ 27 u32 rx_control_0; /* RX control word 0 */
29 u32 rx_control_1; /* RX control word 1 */ 28 u32 rx_control_1; /* RX control word 1 */
30} __packed; 29} __packed;
31 30
32/* RX control word 0 field/sflags */
33#define AR5K_DESC_RX_CTL0 0x00000000
34
35/* RX control word 1 fields/flags */ 31/* RX control word 1 fields/flags */
36#define AR5K_DESC_RX_CTL1_BUF_LEN 0x00000fff 32#define AR5K_DESC_RX_CTL1_BUF_LEN 0x00000fff /* data buffer length */
37#define AR5K_DESC_RX_CTL1_INTREQ 0x00002000 33#define AR5K_DESC_RX_CTL1_INTREQ 0x00002000 /* RX interrupt request */
38 34
39/* 35/*
40 * common hardware RX status descriptor 36 * Common hardware RX status descriptor
41 * 5210/11 and 5212 differ only in the flags defined below 37 * 5210, 5211 and 5212 differ only in the fields and flags defined below
42 */ 38 */
43struct ath5k_hw_rx_status { 39struct ath5k_hw_rx_status {
44 u32 rx_status_0; /* RX status word 0 */ 40 u32 rx_status_0; /* RX status word 0 */
@@ -47,68 +43,69 @@ struct ath5k_hw_rx_status {
47 43
48/* 5210/5211 */ 44/* 5210/5211 */
49/* RX status word 0 fields/flags */ 45/* RX status word 0 fields/flags */
50#define AR5K_5210_RX_DESC_STATUS0_DATA_LEN 0x00000fff 46#define AR5K_5210_RX_DESC_STATUS0_DATA_LEN 0x00000fff /* RX data length */
51#define AR5K_5210_RX_DESC_STATUS0_MORE 0x00001000 47#define AR5K_5210_RX_DESC_STATUS0_MORE 0x00001000 /* more desc for this frame */
52#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE 0x00078000 48#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5210 0x00004000 /* [5210] receive on ant 1 TODO */
49#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE 0x00078000 /* reception rate */
53#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE_S 15 50#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE_S 15
54#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL 0x07f80000 51#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL 0x07f80000 /* rssi */
55#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL_S 19 52#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL_S 19
56#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANTENNA 0x38000000 53#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5211 0x38000000 /* [5211] receive antenna */
57#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANTENNA_S 27 54#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5211_S 27
58 55
59/* RX status word 1 fields/flags */ 56/* RX status word 1 fields/flags */
60#define AR5K_5210_RX_DESC_STATUS1_DONE 0x00000001 57#define AR5K_5210_RX_DESC_STATUS1_DONE 0x00000001 /* descriptor complete */
61#define AR5K_5210_RX_DESC_STATUS1_FRAME_RECEIVE_OK 0x00000002 58#define AR5K_5210_RX_DESC_STATUS1_FRAME_RECEIVE_OK 0x00000002 /* reception success */
62#define AR5K_5210_RX_DESC_STATUS1_CRC_ERROR 0x00000004 59#define AR5K_5210_RX_DESC_STATUS1_CRC_ERROR 0x00000004 /* CRC error */
63#define AR5K_5210_RX_DESC_STATUS1_FIFO_OVERRUN 0x00000008 60#define AR5K_5210_RX_DESC_STATUS1_FIFO_OVERRUN_5210 0x00000008 /* [5210] FIFO overrun */
64#define AR5K_5210_RX_DESC_STATUS1_DECRYPT_CRC_ERROR 0x00000010 61#define AR5K_5210_RX_DESC_STATUS1_DECRYPT_CRC_ERROR 0x00000010 /* decyption CRC failure */
65#define AR5K_5210_RX_DESC_STATUS1_PHY_ERROR 0x000000e0 62#define AR5K_5210_RX_DESC_STATUS1_PHY_ERROR 0x000000e0 /* PHY error */
66#define AR5K_5210_RX_DESC_STATUS1_PHY_ERROR_S 5 63#define AR5K_5210_RX_DESC_STATUS1_PHY_ERROR_S 5
67#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX_VALID 0x00000100 64#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX_VALID 0x00000100 /* key index valid */
68#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX 0x00007e00 65#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX 0x00007e00 /* decyption key index */
69#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX_S 9 66#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX_S 9
70#define AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP 0x0fff8000 67#define AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP 0x0fff8000 /* 13 bit of TSF */
71#define AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP_S 15 68#define AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP_S 15
72#define AR5K_5210_RX_DESC_STATUS1_KEY_CACHE_MISS 0x10000000 69#define AR5K_5210_RX_DESC_STATUS1_KEY_CACHE_MISS 0x10000000 /* key cache miss */
73 70
74/* 5212 */ 71/* 5212 */
75/* RX status word 0 fields/flags */ 72/* RX status word 0 fields/flags */
76#define AR5K_5212_RX_DESC_STATUS0_DATA_LEN 0x00000fff 73#define AR5K_5212_RX_DESC_STATUS0_DATA_LEN 0x00000fff /* RX data length */
77#define AR5K_5212_RX_DESC_STATUS0_MORE 0x00001000 74#define AR5K_5212_RX_DESC_STATUS0_MORE 0x00001000 /* more desc for this frame */
78#define AR5K_5212_RX_DESC_STATUS0_DECOMP_CRC_ERROR 0x00002000 75#define AR5K_5212_RX_DESC_STATUS0_DECOMP_CRC_ERROR 0x00002000 /* decompression CRC error */
79#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE 0x000f8000 76#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE 0x000f8000 /* reception rate */
80#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE_S 15 77#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE_S 15
81#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL 0x0ff00000 78#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL 0x0ff00000 /* rssi */
82#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL_S 20 79#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL_S 20
83#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA 0xf0000000 80#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA 0xf0000000 /* receive antenna */
84#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA_S 28 81#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA_S 28
85 82
86/* RX status word 1 fields/flags */ 83/* RX status word 1 fields/flags */
87#define AR5K_5212_RX_DESC_STATUS1_DONE 0x00000001 84#define AR5K_5212_RX_DESC_STATUS1_DONE 0x00000001 /* descriptor complete */
88#define AR5K_5212_RX_DESC_STATUS1_FRAME_RECEIVE_OK 0x00000002 85#define AR5K_5212_RX_DESC_STATUS1_FRAME_RECEIVE_OK 0x00000002 /* frame reception success */
89#define AR5K_5212_RX_DESC_STATUS1_CRC_ERROR 0x00000004 86#define AR5K_5212_RX_DESC_STATUS1_CRC_ERROR 0x00000004 /* CRC error */
90#define AR5K_5212_RX_DESC_STATUS1_DECRYPT_CRC_ERROR 0x00000008 87#define AR5K_5212_RX_DESC_STATUS1_DECRYPT_CRC_ERROR 0x00000008 /* decryption CRC failure */
91#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR 0x00000010 88#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR 0x00000010 /* PHY error */
92#define AR5K_5212_RX_DESC_STATUS1_MIC_ERROR 0x00000020 89#define AR5K_5212_RX_DESC_STATUS1_MIC_ERROR 0x00000020 /* MIC decrypt error */
93#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX_VALID 0x00000100 90#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX_VALID 0x00000100 /* key index valid */
94#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX 0x0000fe00 91#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX 0x0000fe00 /* decryption key index */
95#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX_S 9 92#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX_S 9
96#define AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP 0x7fff0000 93#define AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP 0x7fff0000 /* first 15bit of the TSF */
97#define AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP_S 16 94#define AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP_S 16
98#define AR5K_5212_RX_DESC_STATUS1_KEY_CACHE_MISS 0x80000000 95#define AR5K_5212_RX_DESC_STATUS1_KEY_CACHE_MISS 0x80000000 /* key cache miss */
99#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE 0x0000ff00 96#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE 0x0000ff00 /* phy error code overlays key index and valid fields */
100#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE_S 8 97#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE_S 8
101 98
102/** 99/**
103 * enum ath5k_phy_error_code - PHY Error codes 100 * enum ath5k_phy_error_code - PHY Error codes
104 */ 101 */
105enum ath5k_phy_error_code { 102enum ath5k_phy_error_code {
106 AR5K_RX_PHY_ERROR_UNDERRUN = 0, /* Transmit underrun */ 103 AR5K_RX_PHY_ERROR_UNDERRUN = 0, /* Transmit underrun, [5210] No error */
107 AR5K_RX_PHY_ERROR_TIMING = 1, /* Timing error */ 104 AR5K_RX_PHY_ERROR_TIMING = 1, /* Timing error */
108 AR5K_RX_PHY_ERROR_PARITY = 2, /* Illegal parity */ 105 AR5K_RX_PHY_ERROR_PARITY = 2, /* Illegal parity */
109 AR5K_RX_PHY_ERROR_RATE = 3, /* Illegal rate */ 106 AR5K_RX_PHY_ERROR_RATE = 3, /* Illegal rate */
110 AR5K_RX_PHY_ERROR_LENGTH = 4, /* Illegal length */ 107 AR5K_RX_PHY_ERROR_LENGTH = 4, /* Illegal length */
111 AR5K_RX_PHY_ERROR_RADAR = 5, /* Radar detect */ 108 AR5K_RX_PHY_ERROR_RADAR = 5, /* Radar detect, [5210] 64 QAM rate */
112 AR5K_RX_PHY_ERROR_SERVICE = 6, /* Illegal service */ 109 AR5K_RX_PHY_ERROR_SERVICE = 6, /* Illegal service */
113 AR5K_RX_PHY_ERROR_TOR = 7, /* Transmit override receive */ 110 AR5K_RX_PHY_ERROR_TOR = 7, /* Transmit override receive */
114 /* these are specific to the 5212 */ 111 /* these are specific to the 5212 */
@@ -135,45 +132,41 @@ struct ath5k_hw_2w_tx_ctl {
135} __packed; 132} __packed;
136 133
137/* TX control word 0 fields/flags */ 134/* TX control word 0 fields/flags */
138#define AR5K_2W_TX_DESC_CTL0_FRAME_LEN 0x00000fff 135#define AR5K_2W_TX_DESC_CTL0_FRAME_LEN 0x00000fff /* frame length */
139#define AR5K_2W_TX_DESC_CTL0_HEADER_LEN 0x0003f000 /*[5210 ?]*/ 136#define AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210 0x0003f000 /* [5210] header length */
140#define AR5K_2W_TX_DESC_CTL0_HEADER_LEN_S 12 137#define AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210_S 12
141#define AR5K_2W_TX_DESC_CTL0_XMIT_RATE 0x003c0000 138#define AR5K_2W_TX_DESC_CTL0_XMIT_RATE 0x003c0000 /* tx rate */
142#define AR5K_2W_TX_DESC_CTL0_XMIT_RATE_S 18 139#define AR5K_2W_TX_DESC_CTL0_XMIT_RATE_S 18
143#define AR5K_2W_TX_DESC_CTL0_RTSENA 0x00400000 140#define AR5K_2W_TX_DESC_CTL0_RTSENA 0x00400000 /* RTS/CTS enable */
144#define AR5K_2W_TX_DESC_CTL0_CLRDMASK 0x01000000 141#define AR5K_2W_TX_DESC_CTL0_LONG_PACKET_5210 0x00800000 /* [5210] long packet */
145#define AR5K_2W_TX_DESC_CTL0_LONG_PACKET 0x00800000 /*[5210]*/ 142#define AR5K_2W_TX_DESC_CTL0_VEOL 0x00800000 /* [5211] virtual end-of-list TODO */
146#define AR5K_2W_TX_DESC_CTL0_VEOL 0x00800000 /*[5211]*/ 143#define AR5K_2W_TX_DESC_CTL0_CLRDMASK 0x01000000 /* clear destination mask */
147#define AR5K_2W_TX_DESC_CTL0_FRAME_TYPE 0x1c000000 /*[5210]*/ 144#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5210 0x02000000 /* [5210] antenna selection */
148#define AR5K_2W_TX_DESC_CTL0_FRAME_TYPE_S 26 145#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5211 0x1e000000 /* [5211] antenna selection */
149#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5210 0x02000000
150#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5211 0x1e000000
151
152#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT \ 146#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT \
153 (ah->ah_version == AR5K_AR5210 ? \ 147 (ah->ah_version == AR5K_AR5210 ? \
154 AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5210 : \ 148 AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5210 : \
155 AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5211) 149 AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5211)
156
157#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_S 25 150#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_S 25
158#define AR5K_2W_TX_DESC_CTL0_INTREQ 0x20000000 151#define AR5K_2W_TX_DESC_CTL0_FRAME_TYPE_5210 0x1c000000 /* [5210] frame type */
159#define AR5K_2W_TX_DESC_CTL0_ENCRYPT_KEY_VALID 0x40000000 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 */
160 155
161/* TX control word 1 fields/flags */ 156/* TX control word 1 fields/flags */
162#define AR5K_2W_TX_DESC_CTL1_BUF_LEN 0x00000fff 157#define AR5K_2W_TX_DESC_CTL1_BUF_LEN 0x00000fff /* data buffer length */
163#define AR5K_2W_TX_DESC_CTL1_MORE 0x00001000 158#define AR5K_2W_TX_DESC_CTL1_MORE 0x00001000 /* more desc for this frame */
164#define AR5K_2W_TX_DESC_CTL1_ENCRYPT_KEY_INDEX_5210 0x0007e000 159#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5210 0x0007e000 /* [5210] key table index */
165#define AR5K_2W_TX_DESC_CTL1_ENCRYPT_KEY_INDEX_5211 0x000fe000 160#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5211 0x000fe000 /* [5211] key table index */
166 161#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX \
167#define AR5K_2W_TX_DESC_CTL1_ENCRYPT_KEY_INDEX \
168 (ah->ah_version == AR5K_AR5210 ? \ 162 (ah->ah_version == AR5K_AR5210 ? \
169 AR5K_2W_TX_DESC_CTL1_ENCRYPT_KEY_INDEX_5210 : \ 163 AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5210 : \
170 AR5K_2W_TX_DESC_CTL1_ENCRYPT_KEY_INDEX_5211) 164 AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5211)
171 165#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_S 13
172#define AR5K_2W_TX_DESC_CTL1_ENCRYPT_KEY_INDEX_S 13 166#define AR5K_2W_TX_DESC_CTL1_FRAME_TYPE_5211 0x00700000 /* [5211] frame type */
173#define AR5K_2W_TX_DESC_CTL1_FRAME_TYPE 0x00700000 /*[5211]*/ 167#define AR5K_2W_TX_DESC_CTL1_FRAME_TYPE_5211_S 20
174#define AR5K_2W_TX_DESC_CTL1_FRAME_TYPE_S 20 168#define AR5K_2W_TX_DESC_CTL1_NOACK 0x00800000 /* [5211] no ACK TODO */
175#define AR5K_2W_TX_DESC_CTL1_NOACK 0x00800000 /*[5211]*/ 169#define AR5K_2W_TX_DESC_CTL1_RTS_DURATION_5210 0xfff80000 /* [5210] lower 13 bit of duration */
176#define AR5K_2W_TX_DESC_CTL1_RTS_DURATION 0xfff80000 /*[5210 ?]*/
177 170
178/* Frame types */ 171/* Frame types */
179#define AR5K_AR5210_TX_DESC_FRAME_TYPE_NORMAL 0x00 172#define AR5K_AR5210_TX_DESC_FRAME_TYPE_NORMAL 0x00
@@ -187,60 +180,61 @@ struct ath5k_hw_2w_tx_ctl {
187 */ 180 */
188struct ath5k_hw_4w_tx_ctl { 181struct ath5k_hw_4w_tx_ctl {
189 u32 tx_control_0; /* TX control word 0 */ 182 u32 tx_control_0; /* TX control word 0 */
183 u32 tx_control_1; /* TX control word 1 */
184 u32 tx_control_2; /* TX control word 2 */
185 u32 tx_control_3; /* TX control word 3 */
186} __packed;
190 187
191#define AR5K_4W_TX_DESC_CTL0_FRAME_LEN 0x00000fff 188/* TX control word 0 fields/flags */
192#define AR5K_4W_TX_DESC_CTL0_XMIT_POWER 0x003f0000 189#define AR5K_4W_TX_DESC_CTL0_FRAME_LEN 0x00000fff /* frame length */
190#define AR5K_4W_TX_DESC_CTL0_XMIT_POWER 0x003f0000 /* transmit power */
193#define AR5K_4W_TX_DESC_CTL0_XMIT_POWER_S 16 191#define AR5K_4W_TX_DESC_CTL0_XMIT_POWER_S 16
194#define AR5K_4W_TX_DESC_CTL0_RTSENA 0x00400000 192#define AR5K_4W_TX_DESC_CTL0_RTSENA 0x00400000 /* RTS/CTS enable */
195#define AR5K_4W_TX_DESC_CTL0_VEOL 0x00800000 193#define AR5K_4W_TX_DESC_CTL0_VEOL 0x00800000 /* virtual end-of-list */
196#define AR5K_4W_TX_DESC_CTL0_CLRDMASK 0x01000000 194#define AR5K_4W_TX_DESC_CTL0_CLRDMASK 0x01000000 /* clear destination mask */
197#define AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT 0x1e000000 195#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 196#define AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT_S 25
199#define AR5K_4W_TX_DESC_CTL0_INTREQ 0x20000000 197#define AR5K_4W_TX_DESC_CTL0_INTREQ 0x20000000 /* TX interrupt request */
200#define AR5K_4W_TX_DESC_CTL0_ENCRYPT_KEY_VALID 0x40000000 198#define AR5K_4W_TX_DESC_CTL0_ENCRYPT_KEY_VALID 0x40000000 /* destination index valid */
201#define AR5K_4W_TX_DESC_CTL0_CTSENA 0x80000000 199#define AR5K_4W_TX_DESC_CTL0_CTSENA 0x80000000 /* precede frame with CTS */
202 200
203 u32 tx_control_1; /* TX control word 1 */ 201/* TX control word 1 fields/flags */
204 202#define AR5K_4W_TX_DESC_CTL1_BUF_LEN 0x00000fff /* data buffer length */
205#define AR5K_4W_TX_DESC_CTL1_BUF_LEN 0x00000fff 203#define AR5K_4W_TX_DESC_CTL1_MORE 0x00001000 /* more desc for this frame */
206#define AR5K_4W_TX_DESC_CTL1_MORE 0x00001000 204#define AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_IDX 0x000fe000 /* destination table index */
207#define AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_INDEX 0x000fe000 205#define AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_IDX_S 13
208#define AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_INDEX_S 13 206#define AR5K_4W_TX_DESC_CTL1_FRAME_TYPE 0x00f00000 /* frame type */
209#define AR5K_4W_TX_DESC_CTL1_FRAME_TYPE 0x00f00000
210#define AR5K_4W_TX_DESC_CTL1_FRAME_TYPE_S 20 207#define AR5K_4W_TX_DESC_CTL1_FRAME_TYPE_S 20
211#define AR5K_4W_TX_DESC_CTL1_NOACK 0x01000000 208#define AR5K_4W_TX_DESC_CTL1_NOACK 0x01000000 /* no ACK */
212#define AR5K_4W_TX_DESC_CTL1_COMP_PROC 0x06000000 209#define AR5K_4W_TX_DESC_CTL1_COMP_PROC 0x06000000 /* compression processing */
213#define AR5K_4W_TX_DESC_CTL1_COMP_PROC_S 25 210#define AR5K_4W_TX_DESC_CTL1_COMP_PROC_S 25
214#define AR5K_4W_TX_DESC_CTL1_COMP_IV_LEN 0x18000000 211#define AR5K_4W_TX_DESC_CTL1_COMP_IV_LEN 0x18000000 /* length of frame IV */
215#define AR5K_4W_TX_DESC_CTL1_COMP_IV_LEN_S 27 212#define AR5K_4W_TX_DESC_CTL1_COMP_IV_LEN_S 27
216#define AR5K_4W_TX_DESC_CTL1_COMP_ICV_LEN 0x60000000 213#define AR5K_4W_TX_DESC_CTL1_COMP_ICV_LEN 0x60000000 /* length of frame ICV */
217#define AR5K_4W_TX_DESC_CTL1_COMP_ICV_LEN_S 29 214#define AR5K_4W_TX_DESC_CTL1_COMP_ICV_LEN_S 29
218 215
219 u32 tx_control_2; /* TX control word 2 */ 216/* TX control word 2 fields/flags */
220 217#define AR5K_4W_TX_DESC_CTL2_RTS_DURATION 0x00007fff /* RTS/CTS duration */
221#define AR5K_4W_TX_DESC_CTL2_RTS_DURATION 0x00007fff 218#define AR5K_4W_TX_DESC_CTL2_DURATION_UPD_EN 0x00008000 /* frame duration update */
222#define AR5K_4W_TX_DESC_CTL2_DURATION_UPDATE_ENABLE 0x00008000 219#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0 0x000f0000 /* series 0 max attempts */
223#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0 0x000f0000 220#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0_S 16
224#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0_S 16 221#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES1 0x00f00000 /* series 1 max attempts */
225#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES1 0x00f00000 222#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES1_S 20
226#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES1_S 20 223#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES2 0x0f000000 /* series 2 max attempts */
227#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES2 0x0f000000 224#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES2_S 24
228#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES2_S 24 225#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES3 0xf0000000 /* series 3 max attempts */
229#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES3 0xf0000000 226#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES3_S 28
230#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES3_S 28 227
231 228/* TX control word 3 fields/flags */
232 u32 tx_control_3; /* TX control word 3 */ 229#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE0 0x0000001f /* series 0 tx rate */
233 230#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE1 0x000003e0 /* series 1 tx rate */
234#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE0 0x0000001f
235#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE1 0x000003e0
236#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE1_S 5 231#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE1_S 5
237#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE2 0x00007c00 232#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE2 0x00007c00 /* series 2 tx rate */
238#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE2_S 10 233#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE2_S 10
239#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE3 0x000f8000 234#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE3 0x000f8000 /* series 3 tx rate */
240#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE3_S 15 235#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE3_S 15
241#define AR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE 0x01f00000 236#define AR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE 0x01f00000 /* RTS or CTS rate */
242#define AR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE_S 20 237#define AR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE_S 20
243} __packed;
244 238
245/* 239/*
246 * Common TX status descriptor 240 * Common TX status descriptor
@@ -251,37 +245,34 @@ struct ath5k_hw_tx_status {
251} __packed; 245} __packed;
252 246
253/* TX status word 0 fields/flags */ 247/* TX status word 0 fields/flags */
254#define AR5K_DESC_TX_STATUS0_FRAME_XMIT_OK 0x00000001 248#define AR5K_DESC_TX_STATUS0_FRAME_XMIT_OK 0x00000001 /* TX success */
255#define AR5K_DESC_TX_STATUS0_EXCESSIVE_RETRIES 0x00000002 249#define AR5K_DESC_TX_STATUS0_EXCESSIVE_RETRIES 0x00000002 /* excessive retries */
256#define AR5K_DESC_TX_STATUS0_FIFO_UNDERRUN 0x00000004 250#define AR5K_DESC_TX_STATUS0_FIFO_UNDERRUN 0x00000004 /* FIFO underrun */
257#define AR5K_DESC_TX_STATUS0_FILTERED 0x00000008 251#define AR5K_DESC_TX_STATUS0_FILTERED 0x00000008 /* TX filter indication */
258/*??? 252/* according to the HAL sources the spec has short/long retry counts reversed.
259#define AR5K_DESC_TX_STATUS0_RTS_FAIL_COUNT 0x000000f0 253 * we have it reversed to the HAL sources as well, for 5210 and 5211.
260#define AR5K_DESC_TX_STATUS0_RTS_FAIL_COUNT_S 4 254 * For 5212 these fields are defined as RTS_FAIL_COUNT and DATA_FAIL_COUNT,
261*/ 255 * but used respectively as SHORT and LONG retry count in the code later. This
262#define AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT 0x000000f0 256 * is consistent with the definitions here... TODO: check */
257#define AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT 0x000000f0 /* short retry count */
263#define AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT_S 4 258#define AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT_S 4
264/*??? 259#define AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT 0x00000f00 /* long retry count */
265#define AR5K_DESC_TX_STATUS0_DATA_FAIL_COUNT 0x00000f00
266#define AR5K_DESC_TX_STATUS0_DATA_FAIL_COUNT_S 8
267*/
268#define AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT 0x00000f00
269#define AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT_S 8 260#define AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT_S 8
270#define AR5K_DESC_TX_STATUS0_VIRT_COLL_COUNT 0x0000f000 261#define AR5K_DESC_TX_STATUS0_VIRTCOLL_CT_5211 0x0000f000 /* [5211+] virtual collision count */
271#define AR5K_DESC_TX_STATUS0_VIRT_COLL_COUNT_S 12 262#define AR5K_DESC_TX_STATUS0_VIRTCOLL_CT_5212_S 12
272#define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP 0xffff0000 263#define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP 0xffff0000 /* TX timestamp */
273#define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP_S 16 264#define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP_S 16
274 265
275/* TX status word 1 fields/flags */ 266/* TX status word 1 fields/flags */
276#define AR5K_DESC_TX_STATUS1_DONE 0x00000001 267#define AR5K_DESC_TX_STATUS1_DONE 0x00000001 /* descriptor complete */
277#define AR5K_DESC_TX_STATUS1_SEQ_NUM 0x00001ffe 268#define AR5K_DESC_TX_STATUS1_SEQ_NUM 0x00001ffe /* TX sequence number */
278#define AR5K_DESC_TX_STATUS1_SEQ_NUM_S 1 269#define AR5K_DESC_TX_STATUS1_SEQ_NUM_S 1
279#define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH 0x001fe000 270#define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH 0x001fe000 /* signal strength of ACK */
280#define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH_S 13 271#define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH_S 13
281#define AR5K_DESC_TX_STATUS1_FINAL_TS_INDEX 0x00600000 272#define AR5K_DESC_TX_STATUS1_FINAL_TS_IX_5212 0x00600000 /* [5212] final TX attempt series ix */
282#define AR5K_DESC_TX_STATUS1_FINAL_TS_INDEX_S 21 273#define AR5K_DESC_TX_STATUS1_FINAL_TS_IX_5212_S 21
283#define AR5K_DESC_TX_STATUS1_COMP_SUCCESS 0x00800000 274#define AR5K_DESC_TX_STATUS1_COMP_SUCCESS_5212 0x00800000 /* [5212] compression status */
284#define AR5K_DESC_TX_STATUS1_XMIT_ANTENNA 0x01000000 275#define AR5K_DESC_TX_STATUS1_XMIT_ANTENNA_5212 0x01000000 /* [5212] transmit antenna */
285 276
286/* 277/*
287 * 5210/5211 hardware TX descriptor 278 * 5210/5211 hardware TX descriptor
@@ -300,7 +291,7 @@ struct ath5k_hw_5212_tx_desc {
300} __packed; 291} __packed;
301 292
302/* 293/*
303 * common hardware RX descriptor 294 * Common hardware RX descriptor
304 */ 295 */
305struct ath5k_hw_all_rx_desc { 296struct ath5k_hw_all_rx_desc {
306 struct ath5k_hw_rx_ctl rx_ctl; 297 struct ath5k_hw_rx_ctl rx_ctl;
@@ -308,7 +299,7 @@ struct ath5k_hw_all_rx_desc {
308} __packed; 299} __packed;
309 300
310/* 301/*
311 * Atheros hardware descriptor 302 * Atheros hardware DMA descriptor
312 * This is read and written to by the hardware 303 * This is read and written to by the hardware
313 */ 304 */
314struct ath5k_desc { 305struct ath5k_desc {
@@ -330,4 +321,3 @@ struct ath5k_desc {
330#define AR5K_TXDESC_CTSENA 0x0008 321#define AR5K_TXDESC_CTSENA 0x0008
331#define AR5K_TXDESC_INTREQ 0x0010 322#define AR5K_TXDESC_INTREQ 0x0010
332#define AR5K_TXDESC_VEOL 0x0020 /*[5211+]*/ 323#define AR5K_TXDESC_VEOL 0x0020 /*[5211+]*/
333