xref: /illumos-gate/usr/src/uts/common/io/urtw/urtw_reg.h (revision 56e2cc86321ec889bf83a888d902c60d6fb2ef8d)
1 /*
2  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright (c) 2008 Weongyo Jeong
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer,
15  *    without modification.
16  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
17  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
18  *    redistribution must be conditioned upon including a substantially
19  *    similar Disclaimer requirement for further binary redistribution.
20  *
21  * NO WARRANTY
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
25  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
26  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
27  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
30  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32  * THE POSSIBILITY OF SUCH DAMAGES.
33  */
34 
35 #ifndef _URTW_REG_H
36 #define	_URTW_REG_H
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 /* for 8187  */
43 #define	URTW_MAC0			0x0000		/* 1 byte  */
44 #define	URTW_MAC1			0x0001		/* 1 byte  */
45 #define	URTW_MAC2			0x0002		/* 1 byte  */
46 #define	URTW_MAC3			0x0003		/* 1 byte  */
47 #define	URTW_MAC4			0x0004		/* 1 byte  */
48 #define	URTW_MAC5			0x0005		/* 1 byte  */
49 #define	URTW_BRSR			0x002c		/* 2 byte  */
50 #define	URTW_BRSR_MBR_8185		(0x0fff)
51 #define	URTW_BSSID			0x002e		/* 6 byte  */
52 #define	URTW_RESP_RATE			0x0034		/* 1 byte  */
53 #define	URTW_RESP_MAX_RATE_SHIFT	(4)
54 #define	URTW_RESP_MIN_RATE_SHIFT	(0)
55 #define	URTW_EIFS			0x0035		/* 1 byte  */
56 #define	URTW_INTR_MASK			0x003c		/* 2 byte  */
57 #define	URTW_CMD			0x0037		/* 1 byte  */
58 #define	URTW_CMD_TX_ENABLE		(0x4)
59 #define	URTW_CMD_RX_ENABLE		(0x8)
60 #define	URTW_CMD_RST			(0x10)
61 #define	URTW_TX_CONF			0x0040		/* 4 byte  */
62 #define	URTW_TX_LOOPBACK_SHIFT		(17)
63 #define	URTW_TX_LOOPBACK_NONE		(0 << URTW_TX_LOOPBACK_SHIFT)
64 #define	URTW_TX_LOOPBACK_MAC		(1 << URTW_TX_LOOPBACK_SHIFT)
65 #define	URTW_TX_LOOPBACK_BASEBAND	(2 << URTW_TX_LOOPBACK_SHIFT)
66 #define	URTW_TX_LOOPBACK_CONTINUE	(3 << URTW_TX_LOOPBACK_SHIFT)
67 #define	URTW_TX_LOOPBACK_MASK		(0x60000)
68 #define	URTW_TX_DPRETRY_MASK		(0xff00)
69 #define	URTW_TX_RTSRETRY_MASK		(0xff)
70 #define	URTW_TX_DPRETRY_SHIFT		(0)
71 #define	URTW_TX_RTSRETRY_SHIFT		(8)
72 #define	URTW_TX_NOCRC			(0x10000)
73 #define	URTW_TX_MXDMA_MASK		(0xe00000)
74 #define	URTW_TX_MXDMA_1024		(6 << URTW_TX_MXDMA_SHIFT)
75 #define	URTW_TX_MXDMA_2048		(7 << URTW_TX_MXDMA_SHIFT)
76 #define	URTW_TX_MXDMA_SHIFT		(21)
77 #define	URTW_TX_CWMIN			(1 << 31)
78 #define	URTW_TX_DISCW			(1 << 20)
79 #define	URTW_TX_SWPLCPLEN		(1 << 24)
80 #define	URTW_TX_NOICV			(0x80000)
81 #define	URTW_RX				0x0044		/* 4 byte  */
82 #define	URTW_RX_9356SEL			(1 << 6)
83 #define	URTW_RX_FILTER_MASK			\
84 	(URTW_RX_FILTER_ALLMAC | URTW_RX_FILTER_NICMAC |\
85 	URTW_RX_FILTER_MCAST | \
86 	URTW_RX_FILTER_BCAST | URTW_RX_FILTER_CRCERR |\
87 	URTW_RX_FILTER_ICVERR | \
88 	URTW_RX_FILTER_DATA | URTW_RX_FILTER_CTL |\
89 	URTW_RX_FILTER_MNG |	\
90 	(1 << 21) |\
91 	URTW_RX_FILTER_PWR | URTW_RX_CHECK_BSSID)
92 #define	URTW_RX_FILTER_ALLMAC		(0x00000001)
93 #define	URTW_RX_FILTER_NICMAC		(0x00000002)
94 #define	URTW_RX_FILTER_MCAST		(0x00000004)
95 #define	URTW_RX_FILTER_BCAST		(0x00000008)
96 #define	URTW_RX_FILTER_CRCERR		(0x00000020)
97 #define	URTW_RX_FILTER_ICVERR		(0x00001000)
98 #define	URTW_RX_FILTER_DATA		(0x00040000)
99 #define	URTW_RX_FILTER_CTL		(0x00080000)
100 #define	URTW_RX_FILTER_MNG		(0x00100000)
101 #define	URTW_RX_FILTER_PWR		(0x00400000)
102 #define	URTW_RX_CHECK_BSSID		(0x00800000)
103 #define	URTW_RX_FIFO_THRESHOLD_MASK	((1 << 13) | (1 << 14) | (1 << 15))
104 #define	URTW_RX_FIFO_THRESHOLD_SHIFT	(13)
105 #define	URTW_RX_FIFO_THRESHOLD_128	(3)
106 #define	URTW_RX_FIFO_THRESHOLD_256	(4)
107 #define	URTW_RX_FIFO_THRESHOLD_512	(5)
108 #define	URTW_RX_FIFO_THRESHOLD_1024	(6)
109 #define	URTW_RX_FIFO_THRESHOLD_NONE	(7 << URTW_RX_FIFO_THRESHOLD_SHIFT)
110 #define	URTW_RX_AUTORESETPHY		(1 << URTW_RX_AUTORESETPHY_SHIFT)
111 #define	URTW_RX_AUTORESETPHY_SHIFT	(28)
112 #define	URTW_MAX_RX_DMA_MASK		((1<<8) | (1<<9) | (1<<10))
113 #define	URTW_MAX_RX_DMA_2048		(0x1c00)
114 #define	URTW_MAX_RX_DMA_1024		(6)
115 #define	URTW_MAX_RX_DMA_SHIFT		(10)
116 #define	URTW_RCR_ONLYERLPKT		(0x80000000)
117 #define	URTW_INT_TIMEOUT		0x0048		/* 4 byte  */
118 #define	URTW_EPROM_CMD			0x0050		/* 1 byte  */
119 #define	URTW_EPROM_CMD_NORMAL		(0x0)
120 #define	URTW_EPROM_CMD_NORMAL_MODE				\
121 	(URTW_EPROM_CMD_NORMAL << URTW_EPROM_CMD_SHIFT)
122 #define	URTW_EPROM_CMD_LOAD		(0x1)
123 #define	URTW_EPROM_CMD_PROGRAM		(0x2)
124 #define	URTW_EPROM_CMD_PROGRAM_MODE				\
125 	(URTW_EPROM_CMD_PROGRAM << URTW_EPROM_CMD_SHIFT)
126 #define	URTW_EPROM_CMD_CONFIG		(0x3)
127 #define	URTW_EPROM_CMD_SHIFT		(6)
128 #define	URTW_EPROM_CMD_MASK		((1 << 7) | (1 << 6))
129 #define	URTW_EPROM_READBIT		(0x1)
130 #define	URTW_EPROM_WRITEBIT		(0x2)
131 #define	URTW_EPROM_CK			(0x4)
132 #define	URTW_EPROM_CS			(0x8)
133 #define	URTW_CONFIG2			0x0053
134 #define	URTW_ANAPARAM			0x0054		/* 4 byte  */
135 #define	URTW_8225_ANAPARAM_ON		(0xa0000a59)
136 #define	URTW_MSR			0x0058		/* 1 byte  */
137 #define	URTW_MSR_LINK_MASK		((1 << 2) | (1 << 3))
138 #define	URTW_MSR_LINK_SHIFT		(2)
139 #define	URTW_MSR_LINK_NONE		(0 << URTW_MSR_LINK_SHIFT)
140 #define	URTW_MSR_LINK_ADHOC		(1 << URTW_MSR_LINK_SHIFT)
141 #define	URTW_MSR_LINK_STA		(2 << URTW_MSR_LINK_SHIFT)
142 #define	URTW_MSR_LINK_HOSTAP		(3 << URTW_MSR_LINK_SHIFT)
143 #define	URTW_CONFIG3			0x0059		/* 1 byte  */
144 #define	URTW_CONFIG3_ANAPARAM_WRITE	(0x40)
145 #define	URTW_CONFIG3_ANAPARAM_W_SHIFT	(6)
146 #define	URTW_PSR			0x005e		/* 1 byte  */
147 #define	URTW_ANAPARAM2			0x0060		/* 4 byte  */
148 #define	URTW_8225_ANAPARAM2_ON		(0x860c7312)
149 #define	URTW_BEACON_INTERVAL		0x0070		/* 2 byte  */
150 #define	URTW_ATIM_WND			0x0072		/* 2 byte  */
151 #define	URTW_BEACON_INTERVAL_TIME	0x0074		/* 2 byte  */
152 #define	URTW_ATIM_TR_ITV		0x0076		/* 2 byte  */
153 #define	URTW_RF_PINS_OUTPUT		0x0080		/* 2 byte  */
154 #define	URTW_BB_HOST_BANG_CLK		(1 << 1)
155 #define	URTW_BB_HOST_BANG_EN		(1 << 2)
156 #define	URTW_BB_HOST_BANG_RW		(1 << 3)
157 #define	URTW_RF_PINS_ENABLE		0x0082		/* 2 byte  */
158 #define	URTW_RF_PINS_SELECT		0x0084		/* 2 byte  */
159 #define	URTW_RF_PINS_INPUT		0x0086		/* 2 byte  */
160 #define	URTW_RF_PARA			0x0088		/* 4 byte  */
161 #define	URTW_RF_TIMING			0x008c		/* 4 byte  */
162 #define	URTW_GP_ENABLE			0x0090		/* 1 byte  */
163 #define	URTW_GPIO			0x0091		/* 1 byte  */
164 #define	URTW_TX_AGC_CTL			0x009c		/* 1 byte  */
165 #define	URTW_TX_AGC_CTL_PERPACKET_GAIN	(0x1)
166 #define	URTW_TX_AGC_CTL_PERPACKET_ANTSEL	(0x2)
167 #define	URTW_TX_AGC_CTL_FEEDBACK_ANT	(0x4)
168 #define	URTW_TX_GAIN_CCK		0x009d		/* 1 byte  */
169 #define	URTW_TX_GAIN_OFDM		0x009e		/* 1 byte  */
170 #define	URTW_TX_ANTENNA			0x009f		/* 1 byte  */
171 #define	URTW_WPA_CONFIG			0x00b0		/* 1 byte  */
172 #define	URTW_SIFS			0x00b4		/* 1 byte  */
173 #define	URTW_DIFS			0x00b5		/* 1 byte  */
174 #define	URTW_SLOT			0x00b6		/* 1 byte  */
175 #define	URTW_CW_CONF			0x00bc		/* 1 byte  */
176 #define	URTW_CW_CONF_PERPACKET_RETRY	(0x2)
177 #define	URTW_CW_CONF_PERPACKET_CW	(0x1)
178 #define	URTW_CW_VAL			0x00bd		/* 1 byte  */
179 #define	URTW_RATE_FALLBACK		0x00be		/* 1 byte  */
180 #define	URTW_TALLY_SEL			0x00fc		/* 1 byte  */
181 
182 /* for EEPROM  */
183 #define	URTW_EPROM_TXPW_BASE		0x05
184 #define	URTW_EPROM_RFCHIPID		0x06
185 #define	URTW_EPROM_RFCHIPID_RTL8225U	(5)
186 #define	URTW_EPROM_MACADDR		0x07
187 #define	URTW_EPROM_TXPW0		0x16
188 #define	URTW_EPROM_TXPW2		0x1b
189 #define	URTW_EPROM_TXPW1		0x3d
190 #define	URTW_EPROM_SWREV		0x3f
191 #define	URTW_EPROM_CID_MASK		(0xff)
192 #define	URTW_EPROM_CID_RSVD0		(0x00)
193 #define	URTW_EPROM_CID_RSVD1		(0xff)
194 #define	URTW_EPROM_CID_ALPHA0		(0x01)
195 #define	URTW_EPROM_CID_SERCOMM_PS	(0x02)
196 #define	URTW_EPROM_CID_HW_LED		(0x03)
197 
198 /* LED  */
199 #define	URTW_CID_DEFAULT		0
200 #define	URTW_CID_8187_ALPHA0		1
201 #define	URTW_CID_8187_SERCOMM_PS	2
202 #define	URTW_CID_8187_HW_LED		3
203 #define	URTW_SW_LED_MODE0		0
204 #define	URTW_SW_LED_MODE1		1
205 #define	URTW_SW_LED_MODE2		2
206 #define	URTW_SW_LED_MODE3		3
207 #define	URTW_HW_LED			4
208 #define	URTW_LED_CTL_POWER_ON		0
209 #define	URTW_LED_CTL_LINK		2
210 #define	URTW_LED_CTL_TX			4
211 #define	URTW_LED_PIN_GPIO0		0
212 #define	URTW_LED_PIN_LED0		1
213 #define	URTW_LED_PIN_LED1		2
214 #define	URTW_LED_UNKNOWN		0
215 #define	URTW_LED_ON			1
216 #define	URTW_LED_OFF			2
217 #define	URTW_LED_BLINK_NORMAL		3
218 #define	URTW_LED_BLINK_SLOWLY		4
219 #define	URTW_LED_POWER_ON_BLINK		5
220 #define	URTW_LED_SCAN_BLINK		6
221 #define	URTW_LED_NO_LINK_BLINK		7
222 #define	URTW_LED_BLINK_CM3		8
223 
224 /* for extra area  */
225 #define	URTW_EPROM_DISABLE		0
226 #define	URTW_EPROM_ENABLE		1
227 #define	URTW_EPROM_DELAY		10
228 #define	URTW_8187_GETREGS_REQ		5
229 #define	URTW_8187_SETREGS_REQ		5
230 #define	URTW_8225_RF_MAX_SENS		6
231 #define	URTW_8225_RF_DEF_SENS		4
232 #define	URTW_DEFAULT_RTS_RETRY		7
233 #define	URTW_DEFAULT_TX_RETRY		7
234 #define	URTW_DEFAULT_RTS_THRESHOLD	2342U
235 
236 #ifdef __cplusplus
237 }
238 #endif
239 
240 #endif /* _URTW_REG_H */
241