xref: /titanic_41/usr/src/uts/common/io/rtw/max2820reg.h (revision 721df37ded2cce623b0249cc35a872c3ce291b9b)
1 /*
2  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright (c) 2004 David Young.  All rights reserved.
8  *
9  * This code was written by David Young.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. Neither the name of the author nor the names of any co-contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY
24  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
26  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL David
27  * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
34  * OF SUCH DAMAGE.
35  */
36 #ifndef _MAX2820REG_H_
37 #define	_MAX2820REG_H_
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * Serial bus format for Maxim MAX2820/MAX2820A/MAX2821/MAX2821A
45  * 2.4GHz 802.11b Zero-IF Transceivers
46  */
47 #define	MAX2820_TWI_ADDR_MASK	BITS(15, 12)
48 #define	MAX2820_TWI_DATA_MASK	BITS(11, 0)
49 
50 /*
51  * Registers for Maxim MAX2820/MAX2820A/MAX2821/MAX2821A 2.4GHz
52  * 802.11b Zero-IF Transceivers
53  */
54 #define	MAX2820_TEST		0		/* Test Register */
55 #define	MAX2820_TEST_DEFAULT	BITS(2, 0)	/* Always set to this value. */
56 
57 #define	MAX2820_ENABLE		1		/* Block-Enable Register */
58 #define	MAX2820_ENABLE_RSVD1	BIT(11)		/* reserved */
59 /*
60  * Transmit Baseband Filters Enable
61  * PAB_EN = SHDNB && (MAX2820_ENABLE_PAB || TX_ON)
62  */
63 #define	MAX2820_ENABLE_PAB	BIT(10)
64 /*
65  * Transmit Baseband Filters Enable
66  * TXFLT_EN = SHDNB && (MAX2820_ENABLE_TXFLT || TX_ON)
67  */
68 #define	MAX2820_ENABLE_TXFLT	BIT(9)
69 /*
70  * Tx Upconverter, VGA, and Driver Amp Enable
71  * TXUVD_EN = SHDNB && (MAX2820_ENABLE_TXUVD || TX_ON)
72  */
73 #define	MAX2820_ENABLE_TXUVD	BIT(8)
74 /*
75  * Receive Detector Enable
76  * DET_EN = SHDNB && (MAX2820_ENABLE_DET || RX_ON)
77  */
78 #define	MAX2820_ENABLE_DET	BIT(7)
79 /*
80  * Rx Downconverter, Filters, and AGC Amps Enable
81  * RXDFA_EN = SHDNB && (MAX2820_ENABLE_RXDFA || RX_ON)
82  */
83 #define	MAX2820_ENABLE_RXDFA	BIT(6)
84 /*
85  * Receive LNA Enable
86  * AT_EN = SHDNB && (MAX2820_ENABLE_RXLNA || RX_ON)
87  */
88 #define	MAX2820_ENABLE_RXLNA	BIT(5)
89 /*
90  * Auto-tuner Enable
91  * AT_EN = SHDNB && (MAX2820_ENABLE_AT || RX_ON || TX_ON)
92  */
93 #define	MAX2820_ENABLE_AT	BIT(4)
94 /*
95  * PLL Charge-Pump Enable
96  * CP_EN = SHDNB && MAX2820_ENABLE_CP
97  */
98 #define	MAX2820_ENABLE_CP	BIT(3)
99 /*
100  * PLL Enable
101  * PLL_EN = SHDNB && MAX2820_ENABLE_PLL
102  */
103 #define	MAX2820_ENABLE_PLL	BIT(2)
104 /*
105  * VCO Enable
106  * VCO_EN = SHDNB && MAX2820_ENABLE_VCO
107  */
108 #define	MAX2820_ENABLE_VCO	BIT(1)
109 #define	MAX2820_ENABLE_RSVD0	BIT(0)		/* reserved */
110 #define	MAX2820_ENABLE_DEFAULT \
111 	(MAX2820_ENABLE_AT|MAX2820_ENABLE_CP|\
112 	MAX2820_ENABLE_PLL|MAX2820_ENABLE_VCO)
113 
114 #define	MAX2820_SYNTH		2	/* Synthesizer Register */
115 #define	MAX2820_SYNTH_RSVD0	BITS(11, 7)	/* reserved */
116 /*
117  * Charge-Pump Current Select
118  * 0 = +/-1mA
119  * 1 = +/-2mA
120  */
121 #define	MAX2820_SYNTH_ICP	BIT(6)
122 /*
123  * Reference Frequency Divider
124  * 0 = 22MHz
125  * 1 = 44MHz
126  */
127 #define	MAX2820_SYNTH_R_MASK	BITS(5, 0)
128 #define	MAX2820_SYNTH_R_22MHZ	LSHIFT(0, MAX2820_SYNTH_R_MASK)
129 #define	MAX2820_SYNTH_R_44MHZ	LSHIFT(1, MAX2820_SYNTH_R_MASK)
130 #define	MAX2820_SYNTH_ICP_DEFAULT	MAX2820_SYNTH_ICP
131 #define	MAX2820_SYNTH_R_DEFAULT		LSHIFT(0, MAX2820_SYNTH_R_MASK)
132 
133 #define	MAX2820_CHANNEL		3	/* Channel Frequency Register */
134 #define	MAX2820_CHANNEL_RSVD	BITS(11, 7)	/* reserved */
135 /*
136  * Channel Frequency Select
137  * fLO = 2400MHz + CF * 1MHz
138  */
139 #define	MAX2820_CHANNEL_CF_MASK	BITS(6, 0)
140 #define	MAX2820_CHANNEL_RSVD_DEFAULT	LSHIFT(0, MAX2820_CHANNEL_RSVD)
141 #define	MAX2820_CHANNEL_CF_DEFAULT	LSHIFT(37, MAX2820_CHANNEL_CF_MASK)
142 
143 /*
144  * Receiver Settings Register
145  * MAX2820/MAX2821
146  */
147 #define	MAX2820_RECEIVE		4
148 /*
149  * VGA DC Offset Nulling Parameter 2
150  */
151 #define	MAX2820_RECEIVE_2C_MASK	BITS(11, 9)
152 /*
153  * VGA DC Offset Nulling Parameter 1
154  */
155 #define	MAX2820_RECEIVE_1C_MASK	BITS(8, 6)
156 /*
157  * Rx Level Detector Midpoint
158  * Select
159  * 11, 01 = 50.2mVp
160  * 10     = 70.9mVp
161  * 00     = 35.5mVp
162  */
163 #define	MAX2820_RECEIVE_DL_MASK	BITS(5, 4)
164 /*
165  * Special Function Select
166  * 0 = OFF
167  * 1 = ON
168  */
169 #define	MAX2820_RECEIVE_SF	BIT(3)
170 /*
171  * Receive Filter -3dB Frequency
172  * Select (all frequencies are
173  * approximate)
174  */
175 #define	MAX2820_RECEIVE_BW_MASK	BITS(2, 0)
176 /* 8.5MHz */
177 #define	MAX2820_RECEIVE_BW_8_5MHZ	LSHIFT(0, MAX2820_RECEIVE_BW_MASK)
178 #define	MAX2820_RECEIVE_BW_8MHZ		LSHIFT(1, MAX2820_RECEIVE_BW_MASK)
179 #define	MAX2820_RECEIVE_BW_7_5MHZ	LSHIFT(2, MAX2820_RECEIVE_BW_MASK)
180 #define	MAX2820_RECEIVE_BW_7MHZ		LSHIFT(3, MAX2820_RECEIVE_BW_MASK)
181 #define	MAX2820_RECEIVE_BW_6_5MHZ	LSHIFT(4, MAX2820_RECEIVE_BW_MASK)
182 #define	MAX2820_RECEIVE_BW_6MHZ		LSHIFT(5, MAX2820_RECEIVE_BW_MASK)
183 #define	MAX2820_RECEIVE_2C_DEFAULT	LSHIFT(7, MAX2820_RECEIVE_2C_MASK)
184 #define	MAX2820_RECEIVE_1C_DEFAULT	LSHIFT(7, MAX2820_RECEIVE_1C_MASK)
185 #define	MAX2820_RECEIVE_DL_DEFAULT	LSHIFT(1, MAX2820_RECEIVE_DL_MASK)
186 #define	MAX2820_RECEIVE_SF_DEFAULT	LSHIFT(0, MAX2820_RECEIVE_SF)
187 #define	MAX2820_RECEIVE_BW_DEFAULT	MAX2820_RECEIVE_BW_7_5MHZ
188 
189 /*
190  * Receiver Settings Register,
191  * MAX2820A/MAX2821A
192  */
193 #define	MAX2820A_RECEIVE	4
194 /* VGA DC Offset Nulling Parameter 2 */
195 #define	MAX2820A_RECEIVE_2C_MASK	BITS(11, 9)
196 #define	MAX2820A_RECEIVE_2C_DEFAULT	LSHIFT(7, MAX2820A_RECEIVE_2C_MASK)
197 /* VGA DC Offset Nulling Parameter 1 */
198 #define	MAX2820A_RECEIVE_1C_MASK	BITS(8, 6)
199 #define	MAX2820A_RECEIVE_1C_DEFAULT	LSHIFT(7, MAX2820A_RECEIVE_1C_MASK)
200 #define	MAX2820A_RECEIVE_RSVD0_MASK	BITS(5, 3)
201 #define	MAX2820A_RECEIVE_RSVD0_DEFAULT	LSHIFT(2, MAX2820A_RECEIVE_RSVD0_MASK)
202 #define	MAX2820A_RECEIVE_RSVD1_MASK	BITS(2, 0)
203 #define	MAX2820A_RECEIVE_RSVD1_DEFAULT	LSHIFT(2, MAX2820_RECEIVE_RSVD1_MASK)
204 
205 #define	MAX2820_TRANSMIT	5	/* Transmitter Settings Reg. */
206 #define	MAX2820_TRANSMIT_RSVD_MASK	BITS(11, 4)	/* reserved */
207 /*
208  * PA Bias Select
209  * 15 = Highest
210  * 0 = Lowest
211  */
212 #define	MAX2820_TRANSMIT_PA_MASK	BITS(3, 0)
213 #define	MAX2820_TRANSMIT_PA_DEFAULT	LSHIFT(0, MAX2820_TRANSMIT_PA_MASK)
214 
215 #ifdef __cplusplus
216 }
217 #endif
218 
219 #endif /* _MAX2820REG_H_ */
220