xref: /dflybsd-src/sys/dev/netif/ath/ath_hal/ar5416/ar2133.c (revision 572ff6f6e8b95055988f178b6ba12ce77bb5b3c2)
1*572ff6f6SMatthew Dillon /*
2*572ff6f6SMatthew Dillon  * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
3*572ff6f6SMatthew Dillon  * Copyright (c) 2002-2008 Atheros Communications, Inc.
4*572ff6f6SMatthew Dillon  *
5*572ff6f6SMatthew Dillon  * Permission to use, copy, modify, and/or distribute this software for any
6*572ff6f6SMatthew Dillon  * purpose with or without fee is hereby granted, provided that the above
7*572ff6f6SMatthew Dillon  * copyright notice and this permission notice appear in all copies.
8*572ff6f6SMatthew Dillon  *
9*572ff6f6SMatthew Dillon  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*572ff6f6SMatthew Dillon  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*572ff6f6SMatthew Dillon  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*572ff6f6SMatthew Dillon  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*572ff6f6SMatthew Dillon  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*572ff6f6SMatthew Dillon  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*572ff6f6SMatthew Dillon  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*572ff6f6SMatthew Dillon  *
17*572ff6f6SMatthew Dillon  * $FreeBSD$
18*572ff6f6SMatthew Dillon  */
19*572ff6f6SMatthew Dillon #include "opt_ah.h"
20*572ff6f6SMatthew Dillon 
21*572ff6f6SMatthew Dillon #include "ah.h"
22*572ff6f6SMatthew Dillon #include "ah_internal.h"
23*572ff6f6SMatthew Dillon 
24*572ff6f6SMatthew Dillon #include "ah_eeprom_v14.h"
25*572ff6f6SMatthew Dillon 
26*572ff6f6SMatthew Dillon #include "ar5416/ar5416.h"
27*572ff6f6SMatthew Dillon #include "ar5416/ar5416reg.h"
28*572ff6f6SMatthew Dillon #include "ar5416/ar5416phy.h"
29*572ff6f6SMatthew Dillon 
30*572ff6f6SMatthew Dillon #define N(a)    (sizeof(a)/sizeof(a[0]))
31*572ff6f6SMatthew Dillon 
32*572ff6f6SMatthew Dillon struct ar2133State {
33*572ff6f6SMatthew Dillon 	RF_HAL_FUNCS	base;		/* public state, must be first */
34*572ff6f6SMatthew Dillon 	uint16_t	pcdacTable[1];
35*572ff6f6SMatthew Dillon 
36*572ff6f6SMatthew Dillon 	uint32_t	*Bank0Data;
37*572ff6f6SMatthew Dillon 	uint32_t	*Bank1Data;
38*572ff6f6SMatthew Dillon 	uint32_t	*Bank2Data;
39*572ff6f6SMatthew Dillon 	uint32_t	*Bank3Data;
40*572ff6f6SMatthew Dillon 	uint32_t	*Bank6Data;
41*572ff6f6SMatthew Dillon 	uint32_t	*Bank7Data;
42*572ff6f6SMatthew Dillon 
43*572ff6f6SMatthew Dillon 	/* NB: Bank*Data storage follows */
44*572ff6f6SMatthew Dillon };
45*572ff6f6SMatthew Dillon #define	AR2133(ah)	((struct ar2133State *) AH5212(ah)->ah_rfHal)
46*572ff6f6SMatthew Dillon 
47*572ff6f6SMatthew Dillon #define	ar5416ModifyRfBuffer	ar5212ModifyRfBuffer	/*XXX*/
48*572ff6f6SMatthew Dillon 
49*572ff6f6SMatthew Dillon void	ar5416ModifyRfBuffer(uint32_t *rfBuf, uint32_t reg32,
50*572ff6f6SMatthew Dillon 	    uint32_t numBits, uint32_t firstBit, uint32_t column);
51*572ff6f6SMatthew Dillon 
52*572ff6f6SMatthew Dillon static void
ar2133WriteRegs(struct ath_hal * ah,u_int modesIndex,u_int freqIndex,int writes)53*572ff6f6SMatthew Dillon ar2133WriteRegs(struct ath_hal *ah, u_int modesIndex, u_int freqIndex,
54*572ff6f6SMatthew Dillon 	int writes)
55*572ff6f6SMatthew Dillon {
56*572ff6f6SMatthew Dillon 	(void) ath_hal_ini_write(ah, &AH5416(ah)->ah_ini_bb_rfgain,
57*572ff6f6SMatthew Dillon 		freqIndex, writes);
58*572ff6f6SMatthew Dillon }
59*572ff6f6SMatthew Dillon 
60*572ff6f6SMatthew Dillon /*
61*572ff6f6SMatthew Dillon  * Fix on 2.4 GHz band for orientation sensitivity issue by increasing
62*572ff6f6SMatthew Dillon  * rf_pwd_icsyndiv.
63*572ff6f6SMatthew Dillon  *
64*572ff6f6SMatthew Dillon  * Theoretical Rules:
65*572ff6f6SMatthew Dillon  *   if 2 GHz band
66*572ff6f6SMatthew Dillon  *      if forceBiasAuto
67*572ff6f6SMatthew Dillon  *         if synth_freq < 2412
68*572ff6f6SMatthew Dillon  *            bias = 0
69*572ff6f6SMatthew Dillon  *         else if 2412 <= synth_freq <= 2422
70*572ff6f6SMatthew Dillon  *            bias = 1
71*572ff6f6SMatthew Dillon  *         else // synth_freq > 2422
72*572ff6f6SMatthew Dillon  *            bias = 2
73*572ff6f6SMatthew Dillon  *      else if forceBias > 0
74*572ff6f6SMatthew Dillon  *         bias = forceBias & 7
75*572ff6f6SMatthew Dillon  *      else
76*572ff6f6SMatthew Dillon  *         no change, use value from ini file
77*572ff6f6SMatthew Dillon  *   else
78*572ff6f6SMatthew Dillon  *      no change, invalid band
79*572ff6f6SMatthew Dillon  *
80*572ff6f6SMatthew Dillon  *  1st Mod:
81*572ff6f6SMatthew Dillon  *    2422 also uses value of 2
82*572ff6f6SMatthew Dillon  *    <approved>
83*572ff6f6SMatthew Dillon  *
84*572ff6f6SMatthew Dillon  *  2nd Mod:
85*572ff6f6SMatthew Dillon  *    Less than 2412 uses value of 0, 2412 and above uses value of 2
86*572ff6f6SMatthew Dillon  */
87*572ff6f6SMatthew Dillon static void
ar2133ForceBias(struct ath_hal * ah,uint16_t synth_freq)88*572ff6f6SMatthew Dillon ar2133ForceBias(struct ath_hal *ah, uint16_t synth_freq)
89*572ff6f6SMatthew Dillon {
90*572ff6f6SMatthew Dillon         uint32_t tmp_reg;
91*572ff6f6SMatthew Dillon         int reg_writes = 0;
92*572ff6f6SMatthew Dillon         uint32_t new_bias = 0;
93*572ff6f6SMatthew Dillon 	struct ar2133State *priv = AR2133(ah);
94*572ff6f6SMatthew Dillon 
95*572ff6f6SMatthew Dillon 	/* XXX this is a bit of a silly check for 2.4ghz channels -adrian */
96*572ff6f6SMatthew Dillon         if (synth_freq >= 3000)
97*572ff6f6SMatthew Dillon                 return;
98*572ff6f6SMatthew Dillon 
99*572ff6f6SMatthew Dillon         if (synth_freq < 2412)
100*572ff6f6SMatthew Dillon                 new_bias = 0;
101*572ff6f6SMatthew Dillon         else if (synth_freq < 2422)
102*572ff6f6SMatthew Dillon                 new_bias = 1;
103*572ff6f6SMatthew Dillon         else
104*572ff6f6SMatthew Dillon                 new_bias = 2;
105*572ff6f6SMatthew Dillon 
106*572ff6f6SMatthew Dillon         /* pre-reverse this field */
107*572ff6f6SMatthew Dillon         tmp_reg = ath_hal_reverseBits(new_bias, 3);
108*572ff6f6SMatthew Dillon 
109*572ff6f6SMatthew Dillon         HALDEBUG(ah, HAL_DEBUG_ANY, "%s: Force rf_pwd_icsyndiv to %1d on %4d\n",
110*572ff6f6SMatthew Dillon                   __func__, new_bias, synth_freq);
111*572ff6f6SMatthew Dillon 
112*572ff6f6SMatthew Dillon         /* swizzle rf_pwd_icsyndiv */
113*572ff6f6SMatthew Dillon         ar5416ModifyRfBuffer(priv->Bank6Data, tmp_reg, 3, 181, 3);
114*572ff6f6SMatthew Dillon 
115*572ff6f6SMatthew Dillon         /* write Bank 6 with new params */
116*572ff6f6SMatthew Dillon         ath_hal_ini_bank_write(ah, &AH5416(ah)->ah_ini_bank6, priv->Bank6Data, reg_writes);
117*572ff6f6SMatthew Dillon }
118*572ff6f6SMatthew Dillon 
119*572ff6f6SMatthew Dillon /*
120*572ff6f6SMatthew Dillon  * Take the MHz channel value and set the Channel value
121*572ff6f6SMatthew Dillon  *
122*572ff6f6SMatthew Dillon  * ASSUMES: Writes enabled to analog bus
123*572ff6f6SMatthew Dillon  */
124*572ff6f6SMatthew Dillon static HAL_BOOL
ar2133SetChannel(struct ath_hal * ah,const struct ieee80211_channel * chan)125*572ff6f6SMatthew Dillon ar2133SetChannel(struct ath_hal *ah, const struct ieee80211_channel *chan)
126*572ff6f6SMatthew Dillon {
127*572ff6f6SMatthew Dillon 	uint32_t channelSel  = 0;
128*572ff6f6SMatthew Dillon 	uint32_t bModeSynth  = 0;
129*572ff6f6SMatthew Dillon 	uint32_t aModeRefSel = 0;
130*572ff6f6SMatthew Dillon 	uint32_t reg32       = 0;
131*572ff6f6SMatthew Dillon 	uint16_t freq;
132*572ff6f6SMatthew Dillon 	CHAN_CENTERS centers;
133*572ff6f6SMatthew Dillon 
134*572ff6f6SMatthew Dillon 	OS_MARK(ah, AH_MARK_SETCHANNEL, chan->ic_freq);
135*572ff6f6SMatthew Dillon 
136*572ff6f6SMatthew Dillon 	ar5416GetChannelCenters(ah, chan, &centers);
137*572ff6f6SMatthew Dillon 	freq = centers.synth_center;
138*572ff6f6SMatthew Dillon 
139*572ff6f6SMatthew Dillon 	if (freq < 4800) {
140*572ff6f6SMatthew Dillon 		uint32_t txctl;
141*572ff6f6SMatthew Dillon 
142*572ff6f6SMatthew Dillon 		if (((freq - 2192) % 5) == 0) {
143*572ff6f6SMatthew Dillon 			channelSel = ((freq - 672) * 2 - 3040)/10;
144*572ff6f6SMatthew Dillon 			bModeSynth = 0;
145*572ff6f6SMatthew Dillon 		} else if (((freq - 2224) % 5) == 0) {
146*572ff6f6SMatthew Dillon 			channelSel = ((freq - 704) * 2 - 3040) / 10;
147*572ff6f6SMatthew Dillon 			bModeSynth = 1;
148*572ff6f6SMatthew Dillon 		} else {
149*572ff6f6SMatthew Dillon 			HALDEBUG(ah, HAL_DEBUG_ANY,
150*572ff6f6SMatthew Dillon 			    "%s: invalid channel %u MHz\n", __func__, freq);
151*572ff6f6SMatthew Dillon 			return AH_FALSE;
152*572ff6f6SMatthew Dillon 		}
153*572ff6f6SMatthew Dillon 
154*572ff6f6SMatthew Dillon 		channelSel = (channelSel << 2) & 0xff;
155*572ff6f6SMatthew Dillon 		channelSel = ath_hal_reverseBits(channelSel, 8);
156*572ff6f6SMatthew Dillon 
157*572ff6f6SMatthew Dillon 		txctl = OS_REG_READ(ah, AR_PHY_CCK_TX_CTRL);
158*572ff6f6SMatthew Dillon 		if (freq == 2484) {
159*572ff6f6SMatthew Dillon 			/* Enable channel spreading for channel 14 */
160*572ff6f6SMatthew Dillon 			OS_REG_WRITE(ah, AR_PHY_CCK_TX_CTRL,
161*572ff6f6SMatthew Dillon 				txctl | AR_PHY_CCK_TX_CTRL_JAPAN);
162*572ff6f6SMatthew Dillon 		} else {
163*572ff6f6SMatthew Dillon 			OS_REG_WRITE(ah, AR_PHY_CCK_TX_CTRL,
164*572ff6f6SMatthew Dillon  			txctl &~ AR_PHY_CCK_TX_CTRL_JAPAN);
165*572ff6f6SMatthew Dillon 		}
166*572ff6f6SMatthew Dillon 	/*
167*572ff6f6SMatthew Dillon 	 * Handle programming the RF synth for odd frequencies in the
168*572ff6f6SMatthew Dillon 	 * 4.9->5GHz range.  This matches the programming from the
169*572ff6f6SMatthew Dillon 	 * later model 802.11abg RF synths.
170*572ff6f6SMatthew Dillon 	 *
171*572ff6f6SMatthew Dillon 	 * This interoperates on the quarter rate channels with the
172*572ff6f6SMatthew Dillon 	 * AR5112 and later RF synths.  Please note that the synthesiser
173*572ff6f6SMatthew Dillon 	 * isn't able to completely accurately represent these frequencies
174*572ff6f6SMatthew Dillon 	 * (as the resolution in this reference is 2.5MHz) and thus it will
175*572ff6f6SMatthew Dillon 	 * be slightly "off centre."  This matches the same slightly
176*572ff6f6SMatthew Dillon 	 * incorrect * centre frequency behaviour that the AR5112 and later
177*572ff6f6SMatthew Dillon 	 * channel selection code has.
178*572ff6f6SMatthew Dillon 	 *
179*572ff6f6SMatthew Dillon 	 * This is disabled because it hasn't been tested for regulatory
180*572ff6f6SMatthew Dillon 	 * compliance and neither have the NICs which would use it.
181*572ff6f6SMatthew Dillon 	 * So if you enable this code, you must first ensure that you've
182*572ff6f6SMatthew Dillon 	 * re-certified the NICs in question beforehand or you will be
183*572ff6f6SMatthew Dillon 	 * violating your local regulatory rules and breaking the law.
184*572ff6f6SMatthew Dillon 	 */
185*572ff6f6SMatthew Dillon #if 0
186*572ff6f6SMatthew Dillon 	} else if (((freq % 5) == 2) && (freq <= 5435)) {
187*572ff6f6SMatthew Dillon 		freq = freq - 2;
188*572ff6f6SMatthew Dillon 		channelSel = ath_hal_reverseBits(
189*572ff6f6SMatthew Dillon 		    (uint32_t) (((freq - 4800) * 10) / 25 + 1), 8);
190*572ff6f6SMatthew Dillon 		/* XXX what about for Howl/Sowl? */
191*572ff6f6SMatthew Dillon 		aModeRefSel = ath_hal_reverseBits(0, 2);
192*572ff6f6SMatthew Dillon #endif
193*572ff6f6SMatthew Dillon 	} else if ((freq % 20) == 0 && freq >= 5120) {
194*572ff6f6SMatthew Dillon 		channelSel = ath_hal_reverseBits(((freq - 4800) / 20 << 2), 8);
195*572ff6f6SMatthew Dillon 		if (AR_SREV_HOWL(ah) || AR_SREV_SOWL_10_OR_LATER(ah))
196*572ff6f6SMatthew Dillon 			aModeRefSel = ath_hal_reverseBits(3, 2);
197*572ff6f6SMatthew Dillon 		else
198*572ff6f6SMatthew Dillon 			aModeRefSel = ath_hal_reverseBits(1, 2);
199*572ff6f6SMatthew Dillon 	} else if ((freq % 10) == 0) {
200*572ff6f6SMatthew Dillon 		channelSel = ath_hal_reverseBits(((freq - 4800) / 10 << 1), 8);
201*572ff6f6SMatthew Dillon 		if (AR_SREV_HOWL(ah) || AR_SREV_SOWL_10_OR_LATER(ah))
202*572ff6f6SMatthew Dillon 			aModeRefSel = ath_hal_reverseBits(2, 2);
203*572ff6f6SMatthew Dillon 		else
204*572ff6f6SMatthew Dillon 			aModeRefSel = ath_hal_reverseBits(1, 2);
205*572ff6f6SMatthew Dillon 	} else if ((freq % 5) == 0) {
206*572ff6f6SMatthew Dillon 		channelSel = ath_hal_reverseBits((freq - 4800) / 5, 8);
207*572ff6f6SMatthew Dillon 		aModeRefSel = ath_hal_reverseBits(1, 2);
208*572ff6f6SMatthew Dillon 	} else {
209*572ff6f6SMatthew Dillon 		HALDEBUG(ah, HAL_DEBUG_UNMASKABLE,
210*572ff6f6SMatthew Dillon 		    "%s: invalid channel %u MHz\n",
211*572ff6f6SMatthew Dillon 		    __func__, freq);
212*572ff6f6SMatthew Dillon 		return AH_FALSE;
213*572ff6f6SMatthew Dillon 	}
214*572ff6f6SMatthew Dillon 
215*572ff6f6SMatthew Dillon 	/* Workaround for hw bug - AR5416 specific */
216*572ff6f6SMatthew Dillon 	if (AR_SREV_OWL(ah) && ah->ah_config.ah_ar5416_biasadj)
217*572ff6f6SMatthew Dillon 		ar2133ForceBias(ah, freq);
218*572ff6f6SMatthew Dillon 
219*572ff6f6SMatthew Dillon 	reg32 = (channelSel << 8) | (aModeRefSel << 2) | (bModeSynth << 1) |
220*572ff6f6SMatthew Dillon 		(1 << 5) | 0x1;
221*572ff6f6SMatthew Dillon 
222*572ff6f6SMatthew Dillon 	OS_REG_WRITE(ah, AR_PHY(0x37), reg32);
223*572ff6f6SMatthew Dillon 
224*572ff6f6SMatthew Dillon 	AH_PRIVATE(ah)->ah_curchan = chan;
225*572ff6f6SMatthew Dillon 	return AH_TRUE;
226*572ff6f6SMatthew Dillon 
227*572ff6f6SMatthew Dillon }
228*572ff6f6SMatthew Dillon 
229*572ff6f6SMatthew Dillon /*
230*572ff6f6SMatthew Dillon  * Return a reference to the requested RF Bank.
231*572ff6f6SMatthew Dillon  */
232*572ff6f6SMatthew Dillon static uint32_t *
ar2133GetRfBank(struct ath_hal * ah,int bank)233*572ff6f6SMatthew Dillon ar2133GetRfBank(struct ath_hal *ah, int bank)
234*572ff6f6SMatthew Dillon {
235*572ff6f6SMatthew Dillon 	struct ar2133State *priv = AR2133(ah);
236*572ff6f6SMatthew Dillon 
237*572ff6f6SMatthew Dillon 	HALASSERT(priv != AH_NULL);
238*572ff6f6SMatthew Dillon 	switch (bank) {
239*572ff6f6SMatthew Dillon 	case 1: return priv->Bank1Data;
240*572ff6f6SMatthew Dillon 	case 2: return priv->Bank2Data;
241*572ff6f6SMatthew Dillon 	case 3: return priv->Bank3Data;
242*572ff6f6SMatthew Dillon 	case 6: return priv->Bank6Data;
243*572ff6f6SMatthew Dillon 	case 7: return priv->Bank7Data;
244*572ff6f6SMatthew Dillon 	}
245*572ff6f6SMatthew Dillon 	HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown RF Bank %d requested\n",
246*572ff6f6SMatthew Dillon 	    __func__, bank);
247*572ff6f6SMatthew Dillon 	return AH_NULL;
248*572ff6f6SMatthew Dillon }
249*572ff6f6SMatthew Dillon 
250*572ff6f6SMatthew Dillon /*
251*572ff6f6SMatthew Dillon  * Reads EEPROM header info from device structure and programs
252*572ff6f6SMatthew Dillon  * all rf registers
253*572ff6f6SMatthew Dillon  *
254*572ff6f6SMatthew Dillon  * REQUIRES: Access to the analog rf device
255*572ff6f6SMatthew Dillon  */
256*572ff6f6SMatthew Dillon static HAL_BOOL
ar2133SetRfRegs(struct ath_hal * ah,const struct ieee80211_channel * chan,uint16_t modesIndex,uint16_t * rfXpdGain)257*572ff6f6SMatthew Dillon ar2133SetRfRegs(struct ath_hal *ah, const struct ieee80211_channel *chan,
258*572ff6f6SMatthew Dillon                 uint16_t modesIndex, uint16_t *rfXpdGain)
259*572ff6f6SMatthew Dillon {
260*572ff6f6SMatthew Dillon 	struct ar2133State *priv = AR2133(ah);
261*572ff6f6SMatthew Dillon 	int writes;
262*572ff6f6SMatthew Dillon 
263*572ff6f6SMatthew Dillon 	HALASSERT(priv);
264*572ff6f6SMatthew Dillon 
265*572ff6f6SMatthew Dillon 	/* Setup Bank 0 Write */
266*572ff6f6SMatthew Dillon 	ath_hal_ini_bank_setup(priv->Bank0Data, &AH5416(ah)->ah_ini_bank0, 1);
267*572ff6f6SMatthew Dillon 
268*572ff6f6SMatthew Dillon 	/* Setup Bank 1 Write */
269*572ff6f6SMatthew Dillon 	ath_hal_ini_bank_setup(priv->Bank1Data, &AH5416(ah)->ah_ini_bank1, 1);
270*572ff6f6SMatthew Dillon 
271*572ff6f6SMatthew Dillon 	/* Setup Bank 2 Write */
272*572ff6f6SMatthew Dillon 	ath_hal_ini_bank_setup(priv->Bank2Data, &AH5416(ah)->ah_ini_bank2, 1);
273*572ff6f6SMatthew Dillon 
274*572ff6f6SMatthew Dillon 	/* Setup Bank 3 Write */
275*572ff6f6SMatthew Dillon 	ath_hal_ini_bank_setup(priv->Bank3Data, &AH5416(ah)->ah_ini_bank3, modesIndex);
276*572ff6f6SMatthew Dillon 
277*572ff6f6SMatthew Dillon 	/* Setup Bank 6 Write */
278*572ff6f6SMatthew Dillon 	ath_hal_ini_bank_setup(priv->Bank6Data, &AH5416(ah)->ah_ini_bank6, modesIndex);
279*572ff6f6SMatthew Dillon 
280*572ff6f6SMatthew Dillon 	/* Only the 5 or 2 GHz OB/DB need to be set for a mode */
281*572ff6f6SMatthew Dillon 	if (IEEE80211_IS_CHAN_2GHZ(chan)) {
282*572ff6f6SMatthew Dillon 		HALDEBUG(ah, HAL_DEBUG_EEPROM, "%s: 2ghz: OB_2:%d, DB_2:%d\n",
283*572ff6f6SMatthew Dillon 		    __func__,
284*572ff6f6SMatthew Dillon 		    ath_hal_eepromGet(ah, AR_EEP_OB_2, AH_NULL),
285*572ff6f6SMatthew Dillon 		    ath_hal_eepromGet(ah, AR_EEP_DB_2, AH_NULL));
286*572ff6f6SMatthew Dillon 		ar5416ModifyRfBuffer(priv->Bank6Data,
287*572ff6f6SMatthew Dillon 		    ath_hal_eepromGet(ah, AR_EEP_OB_2, AH_NULL), 3, 197, 0);
288*572ff6f6SMatthew Dillon 		ar5416ModifyRfBuffer(priv->Bank6Data,
289*572ff6f6SMatthew Dillon 		    ath_hal_eepromGet(ah, AR_EEP_DB_2, AH_NULL), 3, 194, 0);
290*572ff6f6SMatthew Dillon 	} else {
291*572ff6f6SMatthew Dillon 		HALDEBUG(ah, HAL_DEBUG_EEPROM, "%s: 5ghz: OB_5:%d, DB_5:%d\n",
292*572ff6f6SMatthew Dillon 		    __func__,
293*572ff6f6SMatthew Dillon 		    ath_hal_eepromGet(ah, AR_EEP_OB_5, AH_NULL),
294*572ff6f6SMatthew Dillon 		    ath_hal_eepromGet(ah, AR_EEP_DB_5, AH_NULL));
295*572ff6f6SMatthew Dillon 		ar5416ModifyRfBuffer(priv->Bank6Data,
296*572ff6f6SMatthew Dillon 		    ath_hal_eepromGet(ah, AR_EEP_OB_5, AH_NULL), 3, 203, 0);
297*572ff6f6SMatthew Dillon 		ar5416ModifyRfBuffer(priv->Bank6Data,
298*572ff6f6SMatthew Dillon 		    ath_hal_eepromGet(ah, AR_EEP_DB_5, AH_NULL), 3, 200, 0);
299*572ff6f6SMatthew Dillon 	}
300*572ff6f6SMatthew Dillon 	/* Setup Bank 7 Setup */
301*572ff6f6SMatthew Dillon 	ath_hal_ini_bank_setup(priv->Bank7Data, &AH5416(ah)->ah_ini_bank7, 1);
302*572ff6f6SMatthew Dillon 
303*572ff6f6SMatthew Dillon 	/* Write Analog registers */
304*572ff6f6SMatthew Dillon 	writes = ath_hal_ini_bank_write(ah, &AH5416(ah)->ah_ini_bank0,
305*572ff6f6SMatthew Dillon 	    priv->Bank0Data, 0);
306*572ff6f6SMatthew Dillon 	writes = ath_hal_ini_bank_write(ah, &AH5416(ah)->ah_ini_bank1,
307*572ff6f6SMatthew Dillon 	    priv->Bank1Data, writes);
308*572ff6f6SMatthew Dillon 	writes = ath_hal_ini_bank_write(ah, &AH5416(ah)->ah_ini_bank2,
309*572ff6f6SMatthew Dillon 	    priv->Bank2Data, writes);
310*572ff6f6SMatthew Dillon 	writes = ath_hal_ini_bank_write(ah, &AH5416(ah)->ah_ini_bank3,
311*572ff6f6SMatthew Dillon 	    priv->Bank3Data, writes);
312*572ff6f6SMatthew Dillon 	writes = ath_hal_ini_bank_write(ah, &AH5416(ah)->ah_ini_bank6,
313*572ff6f6SMatthew Dillon 	    priv->Bank6Data, writes);
314*572ff6f6SMatthew Dillon 	(void) ath_hal_ini_bank_write(ah, &AH5416(ah)->ah_ini_bank7,
315*572ff6f6SMatthew Dillon 	    priv->Bank7Data, writes);
316*572ff6f6SMatthew Dillon 
317*572ff6f6SMatthew Dillon 	return AH_TRUE;
318*572ff6f6SMatthew Dillon #undef  RF_BANK_SETUP
319*572ff6f6SMatthew Dillon }
320*572ff6f6SMatthew Dillon 
321*572ff6f6SMatthew Dillon /*
322*572ff6f6SMatthew Dillon  * Read the transmit power levels from the structures taken from EEPROM
323*572ff6f6SMatthew Dillon  * Interpolate read transmit power values for this channel
324*572ff6f6SMatthew Dillon  * Organize the transmit power values into a table for writing into the hardware
325*572ff6f6SMatthew Dillon  */
326*572ff6f6SMatthew Dillon 
327*572ff6f6SMatthew Dillon static HAL_BOOL
ar2133SetPowerTable(struct ath_hal * ah,int16_t * pPowerMin,int16_t * pPowerMax,const struct ieee80211_channel * chan,uint16_t * rfXpdGain)328*572ff6f6SMatthew Dillon ar2133SetPowerTable(struct ath_hal *ah, int16_t *pPowerMin, int16_t *pPowerMax,
329*572ff6f6SMatthew Dillon 	const struct ieee80211_channel *chan, uint16_t *rfXpdGain)
330*572ff6f6SMatthew Dillon {
331*572ff6f6SMatthew Dillon 	return AH_TRUE;
332*572ff6f6SMatthew Dillon }
333*572ff6f6SMatthew Dillon 
334*572ff6f6SMatthew Dillon #if 0
335*572ff6f6SMatthew Dillon static int16_t
336*572ff6f6SMatthew Dillon ar2133GetMinPower(struct ath_hal *ah, EXPN_DATA_PER_CHANNEL_5112 *data)
337*572ff6f6SMatthew Dillon {
338*572ff6f6SMatthew Dillon     int i, minIndex;
339*572ff6f6SMatthew Dillon     int16_t minGain,minPwr,minPcdac,retVal;
340*572ff6f6SMatthew Dillon 
341*572ff6f6SMatthew Dillon     /* Assume NUM_POINTS_XPD0 > 0 */
342*572ff6f6SMatthew Dillon     minGain = data->pDataPerXPD[0].xpd_gain;
343*572ff6f6SMatthew Dillon     for (minIndex=0,i=1; i<NUM_XPD_PER_CHANNEL; i++) {
344*572ff6f6SMatthew Dillon         if (data->pDataPerXPD[i].xpd_gain < minGain) {
345*572ff6f6SMatthew Dillon             minIndex = i;
346*572ff6f6SMatthew Dillon             minGain = data->pDataPerXPD[i].xpd_gain;
347*572ff6f6SMatthew Dillon         }
348*572ff6f6SMatthew Dillon     }
349*572ff6f6SMatthew Dillon     minPwr = data->pDataPerXPD[minIndex].pwr_t4[0];
350*572ff6f6SMatthew Dillon     minPcdac = data->pDataPerXPD[minIndex].pcdac[0];
351*572ff6f6SMatthew Dillon     for (i=1; i<NUM_POINTS_XPD0; i++) {
352*572ff6f6SMatthew Dillon         if (data->pDataPerXPD[minIndex].pwr_t4[i] < minPwr) {
353*572ff6f6SMatthew Dillon             minPwr = data->pDataPerXPD[minIndex].pwr_t4[i];
354*572ff6f6SMatthew Dillon             minPcdac = data->pDataPerXPD[minIndex].pcdac[i];
355*572ff6f6SMatthew Dillon         }
356*572ff6f6SMatthew Dillon     }
357*572ff6f6SMatthew Dillon     retVal = minPwr - (minPcdac*2);
358*572ff6f6SMatthew Dillon     return(retVal);
359*572ff6f6SMatthew Dillon }
360*572ff6f6SMatthew Dillon #endif
361*572ff6f6SMatthew Dillon 
362*572ff6f6SMatthew Dillon static HAL_BOOL
ar2133GetChannelMaxMinPower(struct ath_hal * ah,const struct ieee80211_channel * chan,int16_t * maxPow,int16_t * minPow)363*572ff6f6SMatthew Dillon ar2133GetChannelMaxMinPower(struct ath_hal *ah,
364*572ff6f6SMatthew Dillon 	const struct ieee80211_channel *chan,
365*572ff6f6SMatthew Dillon 	int16_t *maxPow, int16_t *minPow)
366*572ff6f6SMatthew Dillon {
367*572ff6f6SMatthew Dillon #if 0
368*572ff6f6SMatthew Dillon     struct ath_hal_5212 *ahp = AH5212(ah);
369*572ff6f6SMatthew Dillon     int numChannels=0,i,last;
370*572ff6f6SMatthew Dillon     int totalD, totalF,totalMin;
371*572ff6f6SMatthew Dillon     EXPN_DATA_PER_CHANNEL_5112 *data=AH_NULL;
372*572ff6f6SMatthew Dillon     EEPROM_POWER_EXPN_5112 *powerArray=AH_NULL;
373*572ff6f6SMatthew Dillon 
374*572ff6f6SMatthew Dillon     *maxPow = 0;
375*572ff6f6SMatthew Dillon     if (IS_CHAN_A(chan)) {
376*572ff6f6SMatthew Dillon         powerArray = ahp->ah_modePowerArray5112;
377*572ff6f6SMatthew Dillon         data = powerArray[headerInfo11A].pDataPerChannel;
378*572ff6f6SMatthew Dillon         numChannels = powerArray[headerInfo11A].numChannels;
379*572ff6f6SMatthew Dillon     } else if (IS_CHAN_G(chan) || IS_CHAN_108G(chan)) {
380*572ff6f6SMatthew Dillon         /* XXX - is this correct? Should we also use the same power for turbo G? */
381*572ff6f6SMatthew Dillon         powerArray = ahp->ah_modePowerArray5112;
382*572ff6f6SMatthew Dillon         data = powerArray[headerInfo11G].pDataPerChannel;
383*572ff6f6SMatthew Dillon         numChannels = powerArray[headerInfo11G].numChannels;
384*572ff6f6SMatthew Dillon     } else if (IS_CHAN_B(chan)) {
385*572ff6f6SMatthew Dillon         powerArray = ahp->ah_modePowerArray5112;
386*572ff6f6SMatthew Dillon         data = powerArray[headerInfo11B].pDataPerChannel;
387*572ff6f6SMatthew Dillon         numChannels = powerArray[headerInfo11B].numChannels;
388*572ff6f6SMatthew Dillon     } else {
389*572ff6f6SMatthew Dillon         return (AH_TRUE);
390*572ff6f6SMatthew Dillon     }
391*572ff6f6SMatthew Dillon     /* Make sure the channel is in the range of the TP values
392*572ff6f6SMatthew Dillon      *  (freq piers)
393*572ff6f6SMatthew Dillon      */
394*572ff6f6SMatthew Dillon     if ((numChannels < 1) ||
395*572ff6f6SMatthew Dillon         (chan->channel < data[0].channelValue) ||
396*572ff6f6SMatthew Dillon         (chan->channel > data[numChannels-1].channelValue))
397*572ff6f6SMatthew Dillon         return(AH_FALSE);
398*572ff6f6SMatthew Dillon 
399*572ff6f6SMatthew Dillon     /* Linearly interpolate the power value now */
400*572ff6f6SMatthew Dillon     for (last=0,i=0;
401*572ff6f6SMatthew Dillon          (i<numChannels) && (chan->channel > data[i].channelValue);
402*572ff6f6SMatthew Dillon          last=i++);
403*572ff6f6SMatthew Dillon     totalD = data[i].channelValue - data[last].channelValue;
404*572ff6f6SMatthew Dillon     if (totalD > 0) {
405*572ff6f6SMatthew Dillon         totalF = data[i].maxPower_t4 - data[last].maxPower_t4;
406*572ff6f6SMatthew Dillon         *maxPow = (int8_t) ((totalF*(chan->channel-data[last].channelValue) + data[last].maxPower_t4*totalD)/totalD);
407*572ff6f6SMatthew Dillon 
408*572ff6f6SMatthew Dillon         totalMin = ar2133GetMinPower(ah,&data[i]) - ar2133GetMinPower(ah, &data[last]);
409*572ff6f6SMatthew Dillon         *minPow = (int8_t) ((totalMin*(chan->channel-data[last].channelValue) + ar2133GetMinPower(ah, &data[last])*totalD)/totalD);
410*572ff6f6SMatthew Dillon         return (AH_TRUE);
411*572ff6f6SMatthew Dillon     } else {
412*572ff6f6SMatthew Dillon         if (chan->channel == data[i].channelValue) {
413*572ff6f6SMatthew Dillon             *maxPow = data[i].maxPower_t4;
414*572ff6f6SMatthew Dillon             *minPow = ar2133GetMinPower(ah, &data[i]);
415*572ff6f6SMatthew Dillon             return(AH_TRUE);
416*572ff6f6SMatthew Dillon         } else
417*572ff6f6SMatthew Dillon             return(AH_FALSE);
418*572ff6f6SMatthew Dillon     }
419*572ff6f6SMatthew Dillon #else
420*572ff6f6SMatthew Dillon     *maxPow = *minPow = 0;
421*572ff6f6SMatthew Dillon 	return AH_FALSE;
422*572ff6f6SMatthew Dillon #endif
423*572ff6f6SMatthew Dillon }
424*572ff6f6SMatthew Dillon 
425*572ff6f6SMatthew Dillon /*
426*572ff6f6SMatthew Dillon  * The ordering of nfarray is thus:
427*572ff6f6SMatthew Dillon  *
428*572ff6f6SMatthew Dillon  * nfarray[0]:	Chain 0 ctl
429*572ff6f6SMatthew Dillon  * nfarray[1]:	Chain 1 ctl
430*572ff6f6SMatthew Dillon  * nfarray[2]:	Chain 2 ctl
431*572ff6f6SMatthew Dillon  * nfarray[3]:	Chain 0 ext
432*572ff6f6SMatthew Dillon  * nfarray[4]:	Chain 1 ext
433*572ff6f6SMatthew Dillon  * nfarray[5]:	Chain 2 ext
434*572ff6f6SMatthew Dillon  */
435*572ff6f6SMatthew Dillon static void
ar2133GetNoiseFloor(struct ath_hal * ah,int16_t nfarray[])436*572ff6f6SMatthew Dillon ar2133GetNoiseFloor(struct ath_hal *ah, int16_t nfarray[])
437*572ff6f6SMatthew Dillon {
438*572ff6f6SMatthew Dillon 	struct ath_hal_5416 *ahp = AH5416(ah);
439*572ff6f6SMatthew Dillon 	int16_t nf;
440*572ff6f6SMatthew Dillon 
441*572ff6f6SMatthew Dillon 	/*
442*572ff6f6SMatthew Dillon 	 * Blank nf array - some chips may only
443*572ff6f6SMatthew Dillon 	 * have one or two RX chainmasks enabled.
444*572ff6f6SMatthew Dillon 	 */
445*572ff6f6SMatthew Dillon 	nfarray[0] = nfarray[1] = nfarray[2] = 0;
446*572ff6f6SMatthew Dillon 	nfarray[3] = nfarray[4] = nfarray[5] = 0;
447*572ff6f6SMatthew Dillon 
448*572ff6f6SMatthew Dillon 	switch (ahp->ah_rx_chainmask) {
449*572ff6f6SMatthew Dillon         case 0x7:
450*572ff6f6SMatthew Dillon 		nf = MS(OS_REG_READ(ah, AR_PHY_CH2_CCA), AR_PHY_CH2_MINCCA_PWR);
451*572ff6f6SMatthew Dillon 		if (nf & 0x100)
452*572ff6f6SMatthew Dillon 			nf = 0 - ((nf ^ 0x1ff) + 1);
453*572ff6f6SMatthew Dillon 		HALDEBUG(ah, HAL_DEBUG_NFCAL,
454*572ff6f6SMatthew Dillon 		    "NF calibrated [ctl] [chain 2] is %d\n", nf);
455*572ff6f6SMatthew Dillon 		nfarray[2] = nf;
456*572ff6f6SMatthew Dillon 
457*572ff6f6SMatthew Dillon 		nf = MS(OS_REG_READ(ah, AR_PHY_CH2_EXT_CCA), AR_PHY_CH2_EXT_MINCCA_PWR);
458*572ff6f6SMatthew Dillon 		if (nf & 0x100)
459*572ff6f6SMatthew Dillon 			nf = 0 - ((nf ^ 0x1ff) + 1);
460*572ff6f6SMatthew Dillon 		HALDEBUG(ah, HAL_DEBUG_NFCAL,
461*572ff6f6SMatthew Dillon 		    "NF calibrated [ext] [chain 2] is %d\n", nf);
462*572ff6f6SMatthew Dillon 		nfarray[5] = nf;
463*572ff6f6SMatthew Dillon 		/* fall thru... */
464*572ff6f6SMatthew Dillon         case 0x3:
465*572ff6f6SMatthew Dillon         case 0x5:
466*572ff6f6SMatthew Dillon 		nf = MS(OS_REG_READ(ah, AR_PHY_CH1_CCA), AR_PHY_CH1_MINCCA_PWR);
467*572ff6f6SMatthew Dillon 		if (nf & 0x100)
468*572ff6f6SMatthew Dillon 			nf = 0 - ((nf ^ 0x1ff) + 1);
469*572ff6f6SMatthew Dillon 		HALDEBUG(ah, HAL_DEBUG_NFCAL,
470*572ff6f6SMatthew Dillon 		    "NF calibrated [ctl] [chain 1] is %d\n", nf);
471*572ff6f6SMatthew Dillon 		nfarray[1] = nf;
472*572ff6f6SMatthew Dillon 
473*572ff6f6SMatthew Dillon 
474*572ff6f6SMatthew Dillon 		nf = MS(OS_REG_READ(ah, AR_PHY_CH1_EXT_CCA), AR_PHY_CH1_EXT_MINCCA_PWR);
475*572ff6f6SMatthew Dillon 		if (nf & 0x100)
476*572ff6f6SMatthew Dillon 			nf = 0 - ((nf ^ 0x1ff) + 1);
477*572ff6f6SMatthew Dillon 		HALDEBUG(ah, HAL_DEBUG_NFCAL,
478*572ff6f6SMatthew Dillon 		    "NF calibrated [ext] [chain 1] is %d\n", nf);
479*572ff6f6SMatthew Dillon 		nfarray[4] = nf;
480*572ff6f6SMatthew Dillon 		/* fall thru... */
481*572ff6f6SMatthew Dillon         case 0x1:
482*572ff6f6SMatthew Dillon 		nf = MS(OS_REG_READ(ah, AR_PHY_CCA), AR_PHY_MINCCA_PWR);
483*572ff6f6SMatthew Dillon 		if (nf & 0x100)
484*572ff6f6SMatthew Dillon 			nf = 0 - ((nf ^ 0x1ff) + 1);
485*572ff6f6SMatthew Dillon 		HALDEBUG(ah, HAL_DEBUG_NFCAL,
486*572ff6f6SMatthew Dillon 		    "NF calibrated [ctl] [chain 0] is %d\n", nf);
487*572ff6f6SMatthew Dillon 		nfarray[0] = nf;
488*572ff6f6SMatthew Dillon 
489*572ff6f6SMatthew Dillon 		nf = MS(OS_REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR);
490*572ff6f6SMatthew Dillon 		if (nf & 0x100)
491*572ff6f6SMatthew Dillon 			nf = 0 - ((nf ^ 0x1ff) + 1);
492*572ff6f6SMatthew Dillon 		HALDEBUG(ah, HAL_DEBUG_NFCAL,
493*572ff6f6SMatthew Dillon 		    "NF calibrated [ext] [chain 0] is %d\n", nf);
494*572ff6f6SMatthew Dillon 		nfarray[3] = nf;
495*572ff6f6SMatthew Dillon 
496*572ff6f6SMatthew Dillon 		break;
497*572ff6f6SMatthew Dillon 	}
498*572ff6f6SMatthew Dillon }
499*572ff6f6SMatthew Dillon 
500*572ff6f6SMatthew Dillon /*
501*572ff6f6SMatthew Dillon  * Adjust NF based on statistical values for 5GHz frequencies.
502*572ff6f6SMatthew Dillon  * Stubbed:Not used by Fowl
503*572ff6f6SMatthew Dillon  */
504*572ff6f6SMatthew Dillon static int16_t
ar2133GetNfAdjust(struct ath_hal * ah,const HAL_CHANNEL_INTERNAL * c)505*572ff6f6SMatthew Dillon ar2133GetNfAdjust(struct ath_hal *ah, const HAL_CHANNEL_INTERNAL *c)
506*572ff6f6SMatthew Dillon {
507*572ff6f6SMatthew Dillon 	return 0;
508*572ff6f6SMatthew Dillon }
509*572ff6f6SMatthew Dillon 
510*572ff6f6SMatthew Dillon /*
511*572ff6f6SMatthew Dillon  * Free memory for analog bank scratch buffers
512*572ff6f6SMatthew Dillon  */
513*572ff6f6SMatthew Dillon static void
ar2133RfDetach(struct ath_hal * ah)514*572ff6f6SMatthew Dillon ar2133RfDetach(struct ath_hal *ah)
515*572ff6f6SMatthew Dillon {
516*572ff6f6SMatthew Dillon 	struct ath_hal_5212 *ahp = AH5212(ah);
517*572ff6f6SMatthew Dillon 
518*572ff6f6SMatthew Dillon 	HALASSERT(ahp->ah_rfHal != AH_NULL);
519*572ff6f6SMatthew Dillon 	ath_hal_free(ahp->ah_rfHal);
520*572ff6f6SMatthew Dillon 	ahp->ah_rfHal = AH_NULL;
521*572ff6f6SMatthew Dillon }
522*572ff6f6SMatthew Dillon 
523*572ff6f6SMatthew Dillon /*
524*572ff6f6SMatthew Dillon  * Allocate memory for analog bank scratch buffers
525*572ff6f6SMatthew Dillon  * Scratch Buffer will be reinitialized every reset so no need to zero now
526*572ff6f6SMatthew Dillon  */
527*572ff6f6SMatthew Dillon HAL_BOOL
ar2133RfAttach(struct ath_hal * ah,HAL_STATUS * status)528*572ff6f6SMatthew Dillon ar2133RfAttach(struct ath_hal *ah, HAL_STATUS *status)
529*572ff6f6SMatthew Dillon {
530*572ff6f6SMatthew Dillon 	struct ath_hal_5212 *ahp = AH5212(ah);
531*572ff6f6SMatthew Dillon 	struct ar2133State *priv;
532*572ff6f6SMatthew Dillon 	uint32_t *bankData;
533*572ff6f6SMatthew Dillon 
534*572ff6f6SMatthew Dillon 	HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s: attach AR2133 radio\n", __func__);
535*572ff6f6SMatthew Dillon 
536*572ff6f6SMatthew Dillon 	HALASSERT(ahp->ah_rfHal == AH_NULL);
537*572ff6f6SMatthew Dillon 	priv = ath_hal_malloc(sizeof(struct ar2133State)
538*572ff6f6SMatthew Dillon 	    + AH5416(ah)->ah_ini_bank0.rows * sizeof(uint32_t)
539*572ff6f6SMatthew Dillon 	    + AH5416(ah)->ah_ini_bank1.rows * sizeof(uint32_t)
540*572ff6f6SMatthew Dillon 	    + AH5416(ah)->ah_ini_bank2.rows * sizeof(uint32_t)
541*572ff6f6SMatthew Dillon 	    + AH5416(ah)->ah_ini_bank3.rows * sizeof(uint32_t)
542*572ff6f6SMatthew Dillon 	    + AH5416(ah)->ah_ini_bank6.rows * sizeof(uint32_t)
543*572ff6f6SMatthew Dillon 	    + AH5416(ah)->ah_ini_bank7.rows * sizeof(uint32_t)
544*572ff6f6SMatthew Dillon 	);
545*572ff6f6SMatthew Dillon 	if (priv == AH_NULL) {
546*572ff6f6SMatthew Dillon 		HALDEBUG(ah, HAL_DEBUG_ANY,
547*572ff6f6SMatthew Dillon 		    "%s: cannot allocate private state\n", __func__);
548*572ff6f6SMatthew Dillon 		*status = HAL_ENOMEM;		/* XXX */
549*572ff6f6SMatthew Dillon 		return AH_FALSE;
550*572ff6f6SMatthew Dillon 	}
551*572ff6f6SMatthew Dillon 	priv->base.rfDetach		= ar2133RfDetach;
552*572ff6f6SMatthew Dillon 	priv->base.writeRegs		= ar2133WriteRegs;
553*572ff6f6SMatthew Dillon 	priv->base.getRfBank		= ar2133GetRfBank;
554*572ff6f6SMatthew Dillon 	priv->base.setChannel		= ar2133SetChannel;
555*572ff6f6SMatthew Dillon 	priv->base.setRfRegs		= ar2133SetRfRegs;
556*572ff6f6SMatthew Dillon 	priv->base.setPowerTable	= ar2133SetPowerTable;
557*572ff6f6SMatthew Dillon 	priv->base.getChannelMaxMinPower = ar2133GetChannelMaxMinPower;
558*572ff6f6SMatthew Dillon 	priv->base.getNfAdjust		= ar2133GetNfAdjust;
559*572ff6f6SMatthew Dillon 
560*572ff6f6SMatthew Dillon 	bankData = (uint32_t *) &priv[1];
561*572ff6f6SMatthew Dillon 	priv->Bank0Data = bankData, bankData += AH5416(ah)->ah_ini_bank0.rows;
562*572ff6f6SMatthew Dillon 	priv->Bank1Data = bankData, bankData += AH5416(ah)->ah_ini_bank1.rows;
563*572ff6f6SMatthew Dillon 	priv->Bank2Data = bankData, bankData += AH5416(ah)->ah_ini_bank2.rows;
564*572ff6f6SMatthew Dillon 	priv->Bank3Data = bankData, bankData += AH5416(ah)->ah_ini_bank3.rows;
565*572ff6f6SMatthew Dillon 	priv->Bank6Data = bankData, bankData += AH5416(ah)->ah_ini_bank6.rows;
566*572ff6f6SMatthew Dillon 	priv->Bank7Data = bankData, bankData += AH5416(ah)->ah_ini_bank7.rows;
567*572ff6f6SMatthew Dillon 
568*572ff6f6SMatthew Dillon 	ahp->ah_pcdacTable = priv->pcdacTable;
569*572ff6f6SMatthew Dillon 	ahp->ah_pcdacTableSize = sizeof(priv->pcdacTable);
570*572ff6f6SMatthew Dillon 	ahp->ah_rfHal = &priv->base;
571*572ff6f6SMatthew Dillon 	/*
572*572ff6f6SMatthew Dillon 	 * Set noise floor adjust method; we arrange a
573*572ff6f6SMatthew Dillon 	 * direct call instead of thunking.
574*572ff6f6SMatthew Dillon 	 */
575*572ff6f6SMatthew Dillon 	AH_PRIVATE(ah)->ah_getNfAdjust = priv->base.getNfAdjust;
576*572ff6f6SMatthew Dillon 	AH_PRIVATE(ah)->ah_getNoiseFloor = ar2133GetNoiseFloor;
577*572ff6f6SMatthew Dillon 
578*572ff6f6SMatthew Dillon 	return AH_TRUE;
579*572ff6f6SMatthew Dillon }
580*572ff6f6SMatthew Dillon 
581*572ff6f6SMatthew Dillon static HAL_BOOL
ar2133Probe(struct ath_hal * ah)582*572ff6f6SMatthew Dillon ar2133Probe(struct ath_hal *ah)
583*572ff6f6SMatthew Dillon {
584*572ff6f6SMatthew Dillon 	return (AR_SREV_OWL(ah) || AR_SREV_HOWL(ah) || AR_SREV_SOWL(ah));
585*572ff6f6SMatthew Dillon }
586*572ff6f6SMatthew Dillon 
587*572ff6f6SMatthew Dillon AH_RF(RF2133, ar2133Probe, ar2133RfAttach);
588