Pull bugzilla-9429 into release branch
[pv_ops_mirror.git] / drivers / net / wireless / rtl818x.h
blob880d4becae312b92de01681762c919ec44730824
1 /*
2 * Definitions for RTL818x hardware
4 * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
5 * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
7 * Based on the r8187 driver, which is:
8 * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, 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.
15 #ifndef RTL818X_H
16 #define RTL818X_H
18 struct rtl818x_csr {
19 u8 MAC[6];
20 u8 reserved_0[2];
21 __le32 MAR[2];
22 u8 RX_FIFO_COUNT;
23 u8 reserved_1;
24 u8 TX_FIFO_COUNT;
25 u8 BQREQ;
26 u8 reserved_2[4];
27 __le32 TSFT[2];
28 __le32 TLPDA;
29 __le32 TNPDA;
30 __le32 THPDA;
31 __le16 BRSR;
32 u8 BSSID[6];
33 u8 RESP_RATE;
34 u8 EIFS;
35 u8 reserved_3[1];
36 u8 CMD;
37 #define RTL818X_CMD_TX_ENABLE (1 << 2)
38 #define RTL818X_CMD_RX_ENABLE (1 << 3)
39 #define RTL818X_CMD_RESET (1 << 4)
40 u8 reserved_4[4];
41 __le16 INT_MASK;
42 __le16 INT_STATUS;
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)
59 __le32 TX_CONF;
60 #define RTL818X_TX_CONF_LOOPBACK_MAC (1 << 17)
61 #define RTL818X_TX_CONF_NO_ICV (1 << 19)
62 #define RTL818X_TX_CONF_DISCW (1 << 20)
63 #define RTL818X_TX_CONF_R8180_ABCD (2 << 25)
64 #define RTL818X_TX_CONF_R8180_F (3 << 25)
65 #define RTL818X_TX_CONF_R8185_ABC (4 << 25)
66 #define RTL818X_TX_CONF_R8185_D (5 << 25)
67 #define RTL818X_TX_CONF_HWVER_MASK (7 << 25)
68 #define RTL818X_TX_CONF_CW_MIN (1 << 31)
69 __le32 RX_CONF;
70 #define RTL818X_RX_CONF_MONITOR (1 << 0)
71 #define RTL818X_RX_CONF_NICMAC (1 << 1)
72 #define RTL818X_RX_CONF_MULTICAST (1 << 2)
73 #define RTL818X_RX_CONF_BROADCAST (1 << 3)
74 #define RTL818X_RX_CONF_FCS (1 << 5)
75 #define RTL818X_RX_CONF_DATA (1 << 18)
76 #define RTL818X_RX_CONF_CTRL (1 << 19)
77 #define RTL818X_RX_CONF_MGMT (1 << 20)
78 #define RTL818X_RX_CONF_BSSID (1 << 23)
79 #define RTL818X_RX_CONF_RX_AUTORESETPHY (1 << 28)
80 #define RTL818X_RX_CONF_ONLYERLPKT (1 << 31)
81 __le32 INT_TIMEOUT;
82 __le32 TBDA;
83 u8 EEPROM_CMD;
84 #define RTL818X_EEPROM_CMD_READ (1 << 0)
85 #define RTL818X_EEPROM_CMD_WRITE (1 << 1)
86 #define RTL818X_EEPROM_CMD_CK (1 << 2)
87 #define RTL818X_EEPROM_CMD_CS (1 << 3)
88 #define RTL818X_EEPROM_CMD_NORMAL (0 << 6)
89 #define RTL818X_EEPROM_CMD_LOAD (1 << 6)
90 #define RTL818X_EEPROM_CMD_PROGRAM (2 << 6)
91 #define RTL818X_EEPROM_CMD_CONFIG (3 << 6)
92 u8 CONFIG0;
93 u8 CONFIG1;
94 u8 CONFIG2;
95 __le32 ANAPARAM;
96 u8 MSR;
97 #define RTL818X_MSR_NO_LINK (0 << 2)
98 #define RTL818X_MSR_ADHOC (1 << 2)
99 #define RTL818X_MSR_INFRA (2 << 2)
100 u8 CONFIG3;
101 #define RTL818X_CONFIG3_ANAPARAM_WRITE (1 << 6)
102 u8 CONFIG4;
103 #define RTL818X_CONFIG4_POWEROFF (1 << 6)
104 #define RTL818X_CONFIG4_VCOOFF (1 << 7)
105 u8 TESTR;
106 u8 reserved_9[2];
107 __le16 PGSELECT;
108 __le32 ANAPARAM2;
109 u8 reserved_10[12];
110 __le16 BEACON_INTERVAL;
111 __le16 ATIM_WND;
112 __le16 BEACON_INTERVAL_TIME;
113 __le16 ATIMTR_INTERVAL;
114 u8 reserved_11[4];
115 u8 PHY[4];
116 __le16 RFPinsOutput;
117 __le16 RFPinsEnable;
118 __le16 RFPinsSelect;
119 __le16 RFPinsInput;
120 __le32 RF_PARA;
121 __le32 RF_TIMING;
122 u8 GP_ENABLE;
123 u8 GPIO;
124 u8 reserved_12[10];
125 u8 TX_AGC_CTL;
126 #define RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT (1 << 0)
127 #define RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT (1 << 1)
128 #define RTL818X_TX_AGC_CTL_FEEDBACK_ANT (1 << 2)
129 u8 TX_GAIN_CCK;
130 u8 TX_GAIN_OFDM;
131 u8 TX_ANTENNA;
132 u8 reserved_13[16];
133 u8 WPA_CONF;
134 u8 reserved_14[3];
135 u8 SIFS;
136 u8 DIFS;
137 u8 SLOT;
138 u8 reserved_15[5];
139 u8 CW_CONF;
140 #define RTL818X_CW_CONF_PERPACKET_CW_SHIFT (1 << 0)
141 #define RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT (1 << 1)
142 u8 CW_VAL;
143 u8 RATE_FALLBACK;
144 u8 reserved_16[25];
145 u8 CONFIG5;
146 u8 TX_DMA_POLLING;
147 u8 reserved_17[2];
148 __le16 CWR;
149 u8 RETRY_CTR;
150 u8 reserved_18[5];
151 __le32 RDSAR;
152 u8 reserved_19[18];
153 u16 TALLY_CNT;
154 u8 TALLY_SEL;
155 } __attribute__((packed));
157 static const struct ieee80211_rate rtl818x_rates[] = {
158 { .rate = 10,
159 .val = 0,
160 .flags = IEEE80211_RATE_CCK },
161 { .rate = 20,
162 .val = 1,
163 .flags = IEEE80211_RATE_CCK },
164 { .rate = 55,
165 .val = 2,
166 .flags = IEEE80211_RATE_CCK },
167 { .rate = 110,
168 .val = 3,
169 .flags = IEEE80211_RATE_CCK },
170 { .rate = 60,
171 .val = 4,
172 .flags = IEEE80211_RATE_OFDM },
173 { .rate = 90,
174 .val = 5,
175 .flags = IEEE80211_RATE_OFDM },
176 { .rate = 120,
177 .val = 6,
178 .flags = IEEE80211_RATE_OFDM },
179 { .rate = 180,
180 .val = 7,
181 .flags = IEEE80211_RATE_OFDM },
182 { .rate = 240,
183 .val = 8,
184 .flags = IEEE80211_RATE_OFDM },
185 { .rate = 360,
186 .val = 9,
187 .flags = IEEE80211_RATE_OFDM },
188 { .rate = 480,
189 .val = 10,
190 .flags = IEEE80211_RATE_OFDM },
191 { .rate = 540,
192 .val = 11,
193 .flags = IEEE80211_RATE_OFDM },
196 static const struct ieee80211_channel rtl818x_channels[] = {
197 { .chan = 1,
198 .freq = 2412},
199 { .chan = 2,
200 .freq = 2417},
201 { .chan = 3,
202 .freq = 2422},
203 { .chan = 4,
204 .freq = 2427},
205 { .chan = 5,
206 .freq = 2432},
207 { .chan = 6,
208 .freq = 2437},
209 { .chan = 7,
210 .freq = 2442},
211 { .chan = 8,
212 .freq = 2447},
213 { .chan = 9,
214 .freq = 2452},
215 { .chan = 10,
216 .freq = 2457},
217 { .chan = 11,
218 .freq = 2462},
219 { .chan = 12,
220 .freq = 2467},
221 { .chan = 13,
222 .freq = 2472},
223 { .chan = 14,
224 .freq = 2484}
227 #endif /* RTL818X_H */