2 * Definitions for RTL818x hardware
4 * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
5 * Copyright 2007 Andrea Merello <andrea.merello@gmail.com>
7 * Based on the r8187 driver, which is:
8 * Copyright 2005 Andrea Merello <andrea.merello@gmail.com>, et al.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
37 #define RTL818X_CMD_TX_ENABLE (1 << 2)
38 #define RTL818X_CMD_RX_ENABLE (1 << 3)
39 #define RTL818X_CMD_RESET (1 << 4)
43 #define RTL818X_INT_RX_OK (1 << 0)
44 #define RTL818X_INT_RX_ERR (1 << 1)
45 #define RTL818X_INT_TXL_OK (1 << 2)
46 #define RTL818X_INT_TXL_ERR (1 << 3)
47 #define RTL818X_INT_RX_DU (1 << 4)
48 #define RTL818X_INT_RX_FO (1 << 5)
49 #define RTL818X_INT_TXN_OK (1 << 6)
50 #define RTL818X_INT_TXN_ERR (1 << 7)
51 #define RTL818X_INT_TXH_OK (1 << 8)
52 #define RTL818X_INT_TXH_ERR (1 << 9)
53 #define RTL818X_INT_TXB_OK (1 << 10)
54 #define RTL818X_INT_TXB_ERR (1 << 11)
55 #define RTL818X_INT_ATIM (1 << 12)
56 #define RTL818X_INT_BEACON (1 << 13)
57 #define RTL818X_INT_TIME_OUT (1 << 14)
58 #define RTL818X_INT_TX_FO (1 << 15)
60 #define RTL818X_TX_CONF_LOOPBACK_MAC (1 << 17)
61 #define RTL818X_TX_CONF_LOOPBACK_CONT (3 << 17)
62 #define RTL818X_TX_CONF_NO_ICV (1 << 19)
63 #define RTL818X_TX_CONF_DISCW (1 << 20)
64 #define RTL818X_TX_CONF_SAT_HWPLCP (1 << 24)
65 #define RTL818X_TX_CONF_R8180_ABCD (2 << 25)
66 #define RTL818X_TX_CONF_R8180_F (3 << 25)
67 #define RTL818X_TX_CONF_R8185_ABC (4 << 25)
68 #define RTL818X_TX_CONF_R8185_D (5 << 25)
69 #define RTL818X_TX_CONF_R8187vD (5 << 25)
70 #define RTL818X_TX_CONF_R8187vD_B (6 << 25)
71 #define RTL818X_TX_CONF_HWVER_MASK (7 << 25)
72 #define RTL818X_TX_CONF_DISREQQSIZE (1 << 28)
73 #define RTL818X_TX_CONF_PROBE_DTS (1 << 29)
74 #define RTL818X_TX_CONF_HW_SEQNUM (1 << 30)
75 #define RTL818X_TX_CONF_CW_MIN (1 << 31)
77 #define RTL818X_RX_CONF_MONITOR (1 << 0)
78 #define RTL818X_RX_CONF_NICMAC (1 << 1)
79 #define RTL818X_RX_CONF_MULTICAST (1 << 2)
80 #define RTL818X_RX_CONF_BROADCAST (1 << 3)
81 #define RTL818X_RX_CONF_FCS (1 << 5)
82 #define RTL818X_RX_CONF_DATA (1 << 18)
83 #define RTL818X_RX_CONF_CTRL (1 << 19)
84 #define RTL818X_RX_CONF_MGMT (1 << 20)
85 #define RTL818X_RX_CONF_ADDR3 (1 << 21)
86 #define RTL818X_RX_CONF_PM (1 << 22)
87 #define RTL818X_RX_CONF_BSSID (1 << 23)
88 #define RTL818X_RX_CONF_RX_AUTORESETPHY (1 << 28)
89 #define RTL818X_RX_CONF_CSDM1 (1 << 29)
90 #define RTL818X_RX_CONF_CSDM2 (1 << 30)
91 #define RTL818X_RX_CONF_ONLYERLPKT (1 << 31)
95 #define RTL818X_EEPROM_CMD_READ (1 << 0)
96 #define RTL818X_EEPROM_CMD_WRITE (1 << 1)
97 #define RTL818X_EEPROM_CMD_CK (1 << 2)
98 #define RTL818X_EEPROM_CMD_CS (1 << 3)
99 #define RTL818X_EEPROM_CMD_NORMAL (0 << 6)
100 #define RTL818X_EEPROM_CMD_LOAD (1 << 6)
101 #define RTL818X_EEPROM_CMD_PROGRAM (2 << 6)
102 #define RTL818X_EEPROM_CMD_CONFIG (3 << 6)
106 #define RTL818X_CONFIG2_ANTENNA_DIV (1 << 6)
109 #define RTL818X_MSR_NO_LINK (0 << 2)
110 #define RTL818X_MSR_ADHOC (1 << 2)
111 #define RTL818X_MSR_INFRA (2 << 2)
112 #define RTL818X_MSR_MASTER (3 << 2)
113 #define RTL818X_MSR_ENEDCA (4 << 2)
115 #define RTL818X_CONFIG3_ANAPARAM_WRITE (1 << 6)
116 #define RTL818X_CONFIG3_GNT_SELECT (1 << 7)
118 #define RTL818X_CONFIG4_POWEROFF (1 << 6)
119 #define RTL818X_CONFIG4_VCOOFF (1 << 7)
126 __le16 BEACON_INTERVAL;
128 __le16 BEACON_INTERVAL_TIME;
129 __le16 ATIMTR_INTERVAL;
131 u8 CARRIER_SENSE_COUNTER;
147 #define RTL818X_TX_AGC_CTL_PERPACKET_GAIN (1 << 0)
148 #define RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL (1 << 1)
149 #define RTL818X_TX_AGC_CTL_FEEDBACK_ANT (1 << 2)
161 #define RTL818X_CW_CONF_PERPACKET_CW (1 << 0)
162 #define RTL818X_CW_CONF_PERPACKET_RETRY (1 << 1)
165 #define RTL818X_RATE_FALLBACK_ENABLE (1 << 7)
175 /* RTL818X_R8187B_*: magic numbers from ioregisters */
176 #define RTL818X_R8187B_B 0
177 #define RTL818X_R8187B_D 1
178 #define RTL818X_R8187B_E 2
190 struct rtl818x_rf_ops {
192 void (*init)(struct ieee80211_hw *);
193 void (*stop)(struct ieee80211_hw *);
194 void (*set_chan)(struct ieee80211_hw *, struct ieee80211_conf *);
195 void (*conf_erp)(struct ieee80211_hw *, struct ieee80211_bss_conf *);
196 u8 (*calc_rssi)(u8 agc, u8 sq);
200 * enum rtl818x_tx_desc_flags - Tx/Rx flags are common between RTL818X chips
202 * @RTL818X_TX_DESC_FLAG_NO_ENC: Disable hardware based encryption.
203 * @RTL818X_TX_DESC_FLAG_TX_OK: TX frame was ACKed.
204 * @RTL818X_TX_DESC_FLAG_SPLCP: Use short preamble.
205 * @RTL818X_TX_DESC_FLAG_MOREFRAG: More fragments follow.
206 * @RTL818X_TX_DESC_FLAG_CTS: Use CTS-to-self protection.
207 * @RTL818X_TX_DESC_FLAG_RTS: Use RTS/CTS protection.
208 * @RTL818X_TX_DESC_FLAG_LS: Last segment of the frame.
209 * @RTL818X_TX_DESC_FLAG_FS: First segment of the frame.
211 enum rtl818x_tx_desc_flags {
212 RTL818X_TX_DESC_FLAG_NO_ENC = (1 << 15),
213 RTL818X_TX_DESC_FLAG_TX_OK = (1 << 15),
214 RTL818X_TX_DESC_FLAG_SPLCP = (1 << 16),
215 RTL818X_TX_DESC_FLAG_RX_UNDER = (1 << 16),
216 RTL818X_TX_DESC_FLAG_MOREFRAG = (1 << 17),
217 RTL818X_TX_DESC_FLAG_CTS = (1 << 18),
218 RTL818X_TX_DESC_FLAG_RTS = (1 << 23),
219 RTL818X_TX_DESC_FLAG_LS = (1 << 28),
220 RTL818X_TX_DESC_FLAG_FS = (1 << 29),
221 RTL818X_TX_DESC_FLAG_DMA = (1 << 30),
222 RTL818X_TX_DESC_FLAG_OWN = (1 << 31)
225 enum rtl818x_rx_desc_flags {
226 RTL818X_RX_DESC_FLAG_ICV_ERR = (1 << 12),
227 RTL818X_RX_DESC_FLAG_CRC32_ERR = (1 << 13),
228 RTL818X_RX_DESC_FLAG_PM = (1 << 14),
229 RTL818X_RX_DESC_FLAG_RX_ERR = (1 << 15),
230 RTL818X_RX_DESC_FLAG_BCAST = (1 << 16),
231 RTL818X_RX_DESC_FLAG_PAM = (1 << 17),
232 RTL818X_RX_DESC_FLAG_MCAST = (1 << 18),
233 RTL818X_RX_DESC_FLAG_QOS = (1 << 19), /* RTL8187(B) only */
234 RTL818X_RX_DESC_FLAG_TRSW = (1 << 24), /* RTL8187(B) only */
235 RTL818X_RX_DESC_FLAG_SPLCP = (1 << 25),
236 RTL818X_RX_DESC_FLAG_FOF = (1 << 26),
237 RTL818X_RX_DESC_FLAG_DMA_FAIL = (1 << 27),
238 RTL818X_RX_DESC_FLAG_LS = (1 << 28),
239 RTL818X_RX_DESC_FLAG_FS = (1 << 29),
240 RTL818X_RX_DESC_FLAG_EOR = (1 << 30),
241 RTL818X_RX_DESC_FLAG_OWN = (1 << 31)
244 #endif /* RTL818X_H */