xref: /freebsd/sys/dev/ath/ath_hal/ar5212/ar5212.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
16e778a7eSPedro F. Giffuni /*-
26e778a7eSPedro F. Giffuni  * SPDX-License-Identifier: ISC
36e778a7eSPedro F. Giffuni  *
459efa8b5SSam Leffler  * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
514779705SSam Leffler  * Copyright (c) 2002-2008 Atheros Communications, Inc.
614779705SSam Leffler  *
714779705SSam Leffler  * Permission to use, copy, modify, and/or distribute this software for any
814779705SSam Leffler  * purpose with or without fee is hereby granted, provided that the above
914779705SSam Leffler  * copyright notice and this permission notice appear in all copies.
1014779705SSam Leffler  *
1114779705SSam Leffler  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1214779705SSam Leffler  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1314779705SSam Leffler  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1414779705SSam Leffler  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1514779705SSam Leffler  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1614779705SSam Leffler  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1714779705SSam Leffler  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1814779705SSam Leffler  */
1914779705SSam Leffler #ifndef _ATH_AR5212_H_
2014779705SSam Leffler #define _ATH_AR5212_H_
2114779705SSam Leffler 
2214779705SSam Leffler #include "ah_eeprom.h"
2314779705SSam Leffler 
2414779705SSam Leffler #define	AR5212_MAGIC	0x19541014
2514779705SSam Leffler 
2614779705SSam Leffler /* DCU Transmit Filter macros */
2714779705SSam Leffler #define CALC_MMR(dcu, idx) \
2814779705SSam Leffler 	( (4 * dcu) + (idx < 32 ? 0 : (idx < 64 ? 1 : (idx < 96 ? 2 : 3))) )
2914779705SSam Leffler #define TXBLK_FROM_MMR(mmr) \
3014779705SSam Leffler 	(AR_D_TXBLK_BASE + ((mmr & 0x1f) << 6) + ((mmr & 0x20) >> 3))
3114779705SSam Leffler #define CALC_TXBLK_ADDR(dcu, idx)	(TXBLK_FROM_MMR(CALC_MMR(dcu, idx)))
3214779705SSam Leffler #define CALC_TXBLK_VALUE(idx)		(1 << (idx & 0x1f))
3314779705SSam Leffler 
3414779705SSam Leffler /* MAC register values */
3514779705SSam Leffler 
3614779705SSam Leffler #define INIT_INTERRUPT_MASK \
3714779705SSam Leffler 	( AR_IMR_TXERR  | AR_IMR_TXOK | AR_IMR_RXORN | \
3814779705SSam Leffler 	  AR_IMR_RXERR  | AR_IMR_RXOK | AR_IMR_TXURN | \
3914779705SSam Leffler 	  AR_IMR_HIUERR )
4014779705SSam Leffler #define INIT_BEACON_CONTROL \
4114779705SSam Leffler 	((INIT_RESET_TSF << 24)  | (INIT_BEACON_EN << 23) | \
4214779705SSam Leffler 	  (INIT_TIM_OFFSET << 16) | INIT_BEACON_PERIOD)
4314779705SSam Leffler 
4414779705SSam Leffler #define INIT_CONFIG_STATUS	0x00000000
4514779705SSam Leffler #define INIT_RSSI_THR		0x00000781	/* Missed beacon counter initialized to 0x7 (max is 0xff) */
4614779705SSam Leffler #define INIT_IQCAL_LOG_COUNT_MAX	0xF
4714779705SSam Leffler #define INIT_BCON_CNTRL_REG	0x00000000
4814779705SSam Leffler 
4914779705SSam Leffler #define INIT_USEC		40
5014779705SSam Leffler #define HALF_RATE_USEC		19 /* ((40 / 2) - 1 ) */
5114779705SSam Leffler #define QUARTER_RATE_USEC	9  /* ((40 / 4) - 1 ) */
5214779705SSam Leffler 
5314779705SSam Leffler #define RX_NON_FULL_RATE_LATENCY	63
5414779705SSam Leffler #define TX_HALF_RATE_LATENCY		108
5514779705SSam Leffler #define TX_QUARTER_RATE_LATENCY		216
5614779705SSam Leffler 
5714779705SSam Leffler #define IFS_SLOT_FULL_RATE	0x168 /* 9 us half, 40 MHz core clock (9*40) */
5814779705SSam Leffler #define IFS_SLOT_HALF_RATE	0x104 /* 13 us half, 20 MHz core clock (13*20) */
5914779705SSam Leffler #define IFS_SLOT_QUARTER_RATE	0xD2 /* 21 us quarter, 10 MHz core clock (21*10) */
6014779705SSam Leffler #define IFS_EIFS_FULL_RATE	0xE60 /* (74 + (2 * 9)) * 40MHz core clock */
6114779705SSam Leffler #define IFS_EIFS_HALF_RATE	0xDAC /* (149 + (2 * 13)) * 20MHz core clock */
6214779705SSam Leffler #define IFS_EIFS_QUARTER_RATE	0xD48 /* (298 + (2 * 21)) * 10MHz core clock */
6314779705SSam Leffler 
6414779705SSam Leffler #define ACK_CTS_TIMEOUT_11A	0x3E8 /* ACK timeout in 11a core clocks */
6514779705SSam Leffler 
6614779705SSam Leffler /* Tx frame start to tx data start delay */
6714779705SSam Leffler #define TX_FRAME_D_START_HALF_RATE 	0xc
6814779705SSam Leffler #define TX_FRAME_D_START_QUARTER_RATE 	0xd
6914779705SSam Leffler 
7014779705SSam Leffler /*
7114779705SSam Leffler  * Various fifo fill before Tx start, in 64-byte units
7214779705SSam Leffler  * i.e. put the frame in the air while still DMAing
7314779705SSam Leffler  */
7414779705SSam Leffler #define MIN_TX_FIFO_THRESHOLD	0x1
7514779705SSam Leffler #define MAX_TX_FIFO_THRESHOLD	((IEEE80211_MAX_LEN / 64) + 1)
7614779705SSam Leffler #define INIT_TX_FIFO_THRESHOLD	MIN_TX_FIFO_THRESHOLD
7714779705SSam Leffler 
7814779705SSam Leffler #define	HAL_DECOMP_MASK_SIZE	128	/* 1 byte per key */
7914779705SSam Leffler 
8014779705SSam Leffler /*
8114779705SSam Leffler  * Gain support.
8214779705SSam Leffler  */
8314779705SSam Leffler #define	NUM_CORNER_FIX_BITS		4
8414779705SSam Leffler #define	NUM_CORNER_FIX_BITS_5112	7
8514779705SSam Leffler #define	DYN_ADJ_UP_MARGIN		15
8614779705SSam Leffler #define	DYN_ADJ_LO_MARGIN		20
8714779705SSam Leffler #define	PHY_PROBE_CCK_CORRECTION	5
8814779705SSam Leffler #define	CCK_OFDM_GAIN_DELTA		15
8914779705SSam Leffler 
9014779705SSam Leffler enum GAIN_PARAMS {
9114779705SSam Leffler 	GP_TXCLIP,
9214779705SSam Leffler 	GP_PD90,
9314779705SSam Leffler 	GP_PD84,
9414779705SSam Leffler 	GP_GSEL,
9514779705SSam Leffler };
9614779705SSam Leffler 
9714779705SSam Leffler enum GAIN_PARAMS_5112 {
9814779705SSam Leffler 	GP_MIXGAIN_OVR,
9914779705SSam Leffler 	GP_PWD_138,
10014779705SSam Leffler 	GP_PWD_137,
10114779705SSam Leffler 	GP_PWD_136,
10214779705SSam Leffler 	GP_PWD_132,
10314779705SSam Leffler 	GP_PWD_131,
10414779705SSam Leffler 	GP_PWD_130,
10514779705SSam Leffler };
10614779705SSam Leffler 
10714779705SSam Leffler typedef struct _gainOptStep {
10814779705SSam Leffler 	int16_t	paramVal[NUM_CORNER_FIX_BITS_5112];
10914779705SSam Leffler 	int32_t	stepGain;
11014779705SSam Leffler 	int8_t	stepName[16];
11114779705SSam Leffler } GAIN_OPTIMIZATION_STEP;
11214779705SSam Leffler 
11314779705SSam Leffler typedef struct {
11414779705SSam Leffler 	uint32_t	numStepsInLadder;
11514779705SSam Leffler 	uint32_t	defaultStepNum;
11614779705SSam Leffler 	GAIN_OPTIMIZATION_STEP optStep[10];
11714779705SSam Leffler } GAIN_OPTIMIZATION_LADDER;
11814779705SSam Leffler 
11914779705SSam Leffler typedef struct {
12014779705SSam Leffler 	uint32_t	currStepNum;
12114779705SSam Leffler 	uint32_t	currGain;
12214779705SSam Leffler 	uint32_t	targetGain;
12314779705SSam Leffler 	uint32_t	loTrig;
12414779705SSam Leffler 	uint32_t	hiTrig;
12514779705SSam Leffler 	uint32_t	active;
12614779705SSam Leffler 	const GAIN_OPTIMIZATION_STEP *currStep;
12714779705SSam Leffler } GAIN_VALUES;
12814779705SSam Leffler 
12914779705SSam Leffler /* RF HAL structures */
13014779705SSam Leffler typedef struct RfHalFuncs {
13114779705SSam Leffler 	void	  *priv;		/* private state */
13214779705SSam Leffler 
13314779705SSam Leffler 	void	  (*rfDetach)(struct ath_hal *ah);
13414779705SSam Leffler 	void	  (*writeRegs)(struct ath_hal *,
13514779705SSam Leffler 		      u_int modeIndex, u_int freqIndex, int regWrites);
13614779705SSam Leffler 	uint32_t *(*getRfBank)(struct ath_hal *ah, int bank);
13759efa8b5SSam Leffler 	HAL_BOOL  (*setChannel)(struct ath_hal *,
13859efa8b5SSam Leffler 		      const struct ieee80211_channel *);
13914779705SSam Leffler 	HAL_BOOL  (*setRfRegs)(struct ath_hal *,
14059efa8b5SSam Leffler 		      const struct ieee80211_channel *, uint16_t modesIndex,
14114779705SSam Leffler 		      uint16_t *rfXpdGain);
14214779705SSam Leffler 	HAL_BOOL  (*setPowerTable)(struct ath_hal *ah,
14314779705SSam Leffler 		      int16_t *minPower, int16_t *maxPower,
14459efa8b5SSam Leffler 		      const struct ieee80211_channel *, uint16_t *rfXpdGain);
14559efa8b5SSam Leffler 	HAL_BOOL  (*getChannelMaxMinPower)(struct ath_hal *ah,
14629658c96SDimitry Andric 		      const struct ieee80211_channel *,
14714779705SSam Leffler 		      int16_t *maxPow, int16_t *minPow);
14814779705SSam Leffler 	int16_t	  (*getNfAdjust)(struct ath_hal *, const HAL_CHANNEL_INTERNAL*);
14914779705SSam Leffler } RF_HAL_FUNCS;
15014779705SSam Leffler 
15114779705SSam Leffler struct ar5212AniParams {
15214779705SSam Leffler 	int		maxNoiseImmunityLevel;	/* [0..4] */
15314779705SSam Leffler 	int		totalSizeDesired[5];
15414779705SSam Leffler 	int		coarseHigh[5];
15514779705SSam Leffler 	int		coarseLow[5];
15614779705SSam Leffler 	int		firpwr[5];
15714779705SSam Leffler 
15814779705SSam Leffler 	int		maxSpurImmunityLevel;	/* [0..7] */
15914779705SSam Leffler 	int		cycPwrThr1[8];
16014779705SSam Leffler 
16114779705SSam Leffler 	int		maxFirstepLevel;	/* [0..2] */
16214779705SSam Leffler 	int		firstep[3];
16314779705SSam Leffler 
16414779705SSam Leffler 	uint32_t	ofdmTrigHigh;
16514779705SSam Leffler 	uint32_t	ofdmTrigLow;
16614779705SSam Leffler 	uint32_t	cckTrigHigh;
16714779705SSam Leffler 	uint32_t	cckTrigLow;
16814779705SSam Leffler 	int32_t		rssiThrLow;
16914779705SSam Leffler 	uint32_t	rssiThrHigh;
17014779705SSam Leffler 
17114779705SSam Leffler 	int		period;			/* update listen period */
17214779705SSam Leffler 
17314779705SSam Leffler 	/* NB: intentionally ordered so data exported to user space is first */
17414779705SSam Leffler 	uint32_t	ofdmPhyErrBase;	/* Base value for ofdm err counter */
17514779705SSam Leffler 	uint32_t	cckPhyErrBase;	/* Base value for cck err counters */
17614779705SSam Leffler };
17714779705SSam Leffler 
17814779705SSam Leffler /*
17914779705SSam Leffler  * Per-channel ANI state private to the driver.
18014779705SSam Leffler  */
18114779705SSam Leffler struct ar5212AniState {
18214779705SSam Leffler 	uint8_t		noiseImmunityLevel;
18314779705SSam Leffler 	uint8_t		spurImmunityLevel;
18414779705SSam Leffler 	uint8_t		firstepLevel;
18514779705SSam Leffler 	uint8_t		ofdmWeakSigDetectOff;
18614779705SSam Leffler 	uint8_t		cckWeakSigThreshold;
18714779705SSam Leffler 	uint32_t	listenTime;
18814779705SSam Leffler 
18914779705SSam Leffler 	/* NB: intentionally ordered so data exported to user space is first */
19014779705SSam Leffler 	uint32_t	txFrameCount;	/* Last txFrameCount */
19114779705SSam Leffler 	uint32_t	rxFrameCount;	/* Last rx Frame count */
19214779705SSam Leffler 	uint32_t	cycleCount;	/* Last cycleCount
19314779705SSam Leffler 					   (to detect wrap-around) */
19414779705SSam Leffler 	uint32_t	ofdmPhyErrCount;/* OFDM err count since last reset */
19514779705SSam Leffler 	uint32_t	cckPhyErrCount;	/* CCK err count since last reset */
19614779705SSam Leffler 
19714779705SSam Leffler 	const struct ar5212AniParams *params;
19814779705SSam Leffler };
19914779705SSam Leffler 
20014779705SSam Leffler #define	HAL_ANI_ENA		0x00000001	/* ANI operation enabled */
20114779705SSam Leffler #define	HAL_RSSI_ANI_ENA	0x00000002	/* rssi-based processing ena'd*/
20214779705SSam Leffler 
203a9e86008SAdrian Chadd #if 0
20414779705SSam Leffler struct ar5212Stats {
20514779705SSam Leffler 	uint32_t	ast_ani_niup;	/* ANI increased noise immunity */
20614779705SSam Leffler 	uint32_t	ast_ani_nidown;	/* ANI decreased noise immunity */
20714779705SSam Leffler 	uint32_t	ast_ani_spurup;	/* ANI increased spur immunity */
20814779705SSam Leffler 	uint32_t	ast_ani_spurdown;/* ANI descreased spur immunity */
20914779705SSam Leffler 	uint32_t	ast_ani_ofdmon;	/* ANI OFDM weak signal detect on */
21014779705SSam Leffler 	uint32_t	ast_ani_ofdmoff;/* ANI OFDM weak signal detect off */
21114779705SSam Leffler 	uint32_t	ast_ani_cckhigh;/* ANI CCK weak signal threshold high */
21214779705SSam Leffler 	uint32_t	ast_ani_ccklow;	/* ANI CCK weak signal threshold low */
21314779705SSam Leffler 	uint32_t	ast_ani_stepup;	/* ANI increased first step level */
21414779705SSam Leffler 	uint32_t	ast_ani_stepdown;/* ANI decreased first step level */
21514779705SSam Leffler 	uint32_t	ast_ani_ofdmerrs;/* ANI cumulative ofdm phy err count */
21614779705SSam Leffler 	uint32_t	ast_ani_cckerrs;/* ANI cumulative cck phy err count */
21714779705SSam Leffler 	uint32_t	ast_ani_reset;	/* ANI parameters zero'd for non-STA */
21814779705SSam Leffler 	uint32_t	ast_ani_lzero;	/* ANI listen time forced to zero */
21914779705SSam Leffler 	uint32_t	ast_ani_lneg;	/* ANI listen time calculated < 0 */
22014779705SSam Leffler 	HAL_MIB_STATS	ast_mibstats;	/* MIB counter stats */
22114779705SSam Leffler 	HAL_NODE_STATS	ast_nodestats;	/* Latest rssi stats from driver */
22214779705SSam Leffler };
223a9e86008SAdrian Chadd #endif
22414779705SSam Leffler 
22514779705SSam Leffler /*
22614779705SSam Leffler  * NF Cal history buffer
22714779705SSam Leffler  */
22814779705SSam Leffler #define	AR5212_CCA_MAX_GOOD_VALUE	-95
22914779705SSam Leffler #define	AR5212_CCA_MAX_HIGH_VALUE	-62
23014779705SSam Leffler #define	AR5212_CCA_MIN_BAD_VALUE	-125
23114779705SSam Leffler 
23214779705SSam Leffler #define	AR512_NF_CAL_HIST_MAX		5
23314779705SSam Leffler 
23414779705SSam Leffler struct ar5212NfCalHist {
23514779705SSam Leffler 	int16_t		nfCalBuffer[AR512_NF_CAL_HIST_MAX];
23614779705SSam Leffler 	int16_t		privNF;
23714779705SSam Leffler 	uint8_t		currIndex;
23814779705SSam Leffler 	uint8_t		first_run;
23914779705SSam Leffler 	uint8_t		invalidNFcount;
24014779705SSam Leffler };
24114779705SSam Leffler 
24214779705SSam Leffler struct ath_hal_5212 {
24314779705SSam Leffler 	struct ath_hal_private	ah_priv;	/* base class */
24414779705SSam Leffler 
24514779705SSam Leffler 	/*
24614779705SSam Leffler 	 * Per-chip common Initialization data.
24714779705SSam Leffler 	 * NB: RF backends have their own ini data.
24814779705SSam Leffler 	 */
24914779705SSam Leffler 	HAL_INI_ARRAY	ah_ini_modes;
25014779705SSam Leffler 	HAL_INI_ARRAY	ah_ini_common;
25114779705SSam Leffler 
25214779705SSam Leffler 	GAIN_VALUES	ah_gainValues;
25314779705SSam Leffler 
25414779705SSam Leffler 	uint8_t		ah_macaddr[IEEE80211_ADDR_LEN];
25514779705SSam Leffler 	uint8_t		ah_bssid[IEEE80211_ADDR_LEN];
25614779705SSam Leffler 	uint8_t		ah_bssidmask[IEEE80211_ADDR_LEN];
2570047ff70SAdrian Chadd 	uint16_t	ah_assocId;
25814779705SSam Leffler 
25914779705SSam Leffler 	/*
26014779705SSam Leffler 	 * Runtime state.
26114779705SSam Leffler 	 */
26214779705SSam Leffler 	uint32_t	ah_maskReg;		/* copy of AR_IMR */
263a9e86008SAdrian Chadd 	HAL_ANI_STATS	ah_stats;		/* various statistics */
26414779705SSam Leffler 	RF_HAL_FUNCS	*ah_rfHal;
26514779705SSam Leffler 	uint32_t	ah_txDescMask;		/* mask for TXDESC */
26614779705SSam Leffler 	uint32_t	ah_txOkInterruptMask;
26714779705SSam Leffler 	uint32_t	ah_txErrInterruptMask;
26814779705SSam Leffler 	uint32_t	ah_txDescInterruptMask;
26914779705SSam Leffler 	uint32_t	ah_txEolInterruptMask;
27014779705SSam Leffler 	uint32_t	ah_txUrnInterruptMask;
27114779705SSam Leffler 	HAL_TX_QUEUE_INFO ah_txq[HAL_NUM_TX_QUEUES];
27214779705SSam Leffler 	uint32_t	ah_intrTxqs;		/* tx q interrupt state */
27314779705SSam Leffler 						/* decomp mask array */
27414779705SSam Leffler 	uint8_t		ah_decompMask[HAL_DECOMP_MASK_SIZE];
27514779705SSam Leffler 	HAL_ANT_SETTING ah_antControl;		/* antenna setting */
27614779705SSam Leffler 	HAL_BOOL	ah_diversity;		/* fast diversity setting */
27714779705SSam Leffler 	enum {
27814779705SSam Leffler 		IQ_CAL_INACTIVE,
27914779705SSam Leffler 		IQ_CAL_RUNNING,
28014779705SSam Leffler 		IQ_CAL_DONE
28114779705SSam Leffler 	} ah_bIQCalibration;			/* IQ calibrate state */
28214779705SSam Leffler 	HAL_RFGAIN	ah_rfgainState;		/* RF gain calibrartion state */
28314779705SSam Leffler 	uint32_t	ah_tx6PowerInHalfDbm;	/* power output for 6Mb tx */
28414779705SSam Leffler 	uint32_t	ah_staId1Defaults;	/* STA_ID1 default settings */
28514779705SSam Leffler 	uint32_t	ah_miscMode;		/* MISC_MODE settings */
28614779705SSam Leffler 	uint32_t	ah_rssiThr;		/* RSSI_THR settings */
28714779705SSam Leffler 	HAL_BOOL	ah_cwCalRequire;	/* for ap51 */
28814779705SSam Leffler 	HAL_BOOL	ah_tpcEnabled;		/* per-packet tpc enabled */
28914779705SSam Leffler 	HAL_BOOL	ah_phyPowerOn;		/* PHY power state */
29014779705SSam Leffler 	HAL_BOOL	ah_isHb63;		/* cached HB63 check */
29114779705SSam Leffler 	uint32_t	ah_macTPC;		/* tpc register */
29214779705SSam Leffler 	uint32_t	ah_beaconInterval;	/* XXX */
29314779705SSam Leffler 	enum {
29414779705SSam Leffler 		AUTO_32KHZ,		/* use it if 32kHz crystal present */
29514779705SSam Leffler 		USE_32KHZ,		/* do it regardless */
29614779705SSam Leffler 		DONT_USE_32KHZ,		/* don't use it regardless */
29714779705SSam Leffler 	} ah_enable32kHzClock;			/* whether to sleep at 32kHz */
29814779705SSam Leffler 	uint32_t	ah_ofdmTxPower;
29914779705SSam Leffler 	int16_t		ah_txPowerIndexOffset;
30014779705SSam Leffler 	/*
30114779705SSam Leffler 	 * Noise floor cal histogram support.
30214779705SSam Leffler 	 */
30314779705SSam Leffler 	struct ar5212NfCalHist ah_nfCalHist;
30414779705SSam Leffler 
30514779705SSam Leffler 	u_int		ah_slottime;		/* user-specified slot time */
30614779705SSam Leffler 	u_int		ah_acktimeout;		/* user-specified ack timeout */
30714779705SSam Leffler 	u_int		ah_ctstimeout;		/* user-specified cts timeout */
30814779705SSam Leffler 	u_int		ah_sifstime;		/* user-specified sifs time */
30914779705SSam Leffler 	/*
31014779705SSam Leffler 	 * RF Silent handling; setup according to the EEPROM.
31114779705SSam Leffler 	 */
31214779705SSam Leffler 	uint32_t	ah_gpioSelect;		/* GPIO pin to use */
31314779705SSam Leffler 	uint32_t	ah_polarity;		/* polarity to disable RF */
31414779705SSam Leffler 	uint32_t	ah_gpioBit;		/* after init, prev value */
31514779705SSam Leffler 	/*
31614779705SSam Leffler 	 * ANI support.
31714779705SSam Leffler 	 */
31814779705SSam Leffler 	uint32_t	ah_procPhyErr;		/* Process Phy errs */
31914779705SSam Leffler 	HAL_BOOL	ah_hasHwPhyCounters;	/* Hardware has phy counters */
32014779705SSam Leffler 	struct ar5212AniParams ah_aniParams24;	/* 2.4GHz parameters */
32114779705SSam Leffler 	struct ar5212AniParams ah_aniParams5;	/* 5GHz parameters */
32214779705SSam Leffler 	struct ar5212AniState	*ah_curani;	/* cached last reference */
32359efa8b5SSam Leffler 	struct ar5212AniState	ah_ani[AH_MAXCHAN]; /* per-channel state */
32414779705SSam Leffler 
3259f456336SAdrian Chadd 	/* AR5416 uses some of the AR5212 ANI code; these are the ANI methods */
3269f456336SAdrian Chadd 	HAL_BOOL	(*ah_aniControl) (struct ath_hal *, HAL_ANI_CMD cmd, int param);
3279f456336SAdrian Chadd 
32814779705SSam Leffler 	/*
32914779705SSam Leffler 	 * Transmit power state.  Note these are maintained
33014779705SSam Leffler 	 * here so they can be retrieved by diagnostic tools.
33114779705SSam Leffler 	 */
33214779705SSam Leffler 	uint16_t	*ah_pcdacTable;
33314779705SSam Leffler 	u_int		ah_pcdacTableSize;
334064e40d0SAdrian Chadd 	uint16_t	ah_ratesArray[37];
335256796dbSRui Paulo 
336256796dbSRui Paulo 	uint8_t		ah_txTrigLev;		/* current Tx trigger level */
337256796dbSRui Paulo 	uint8_t		ah_maxTxTrigLev;	/* max tx trigger level */
3380a2cefc6SAdrian Chadd 
3390a2cefc6SAdrian Chadd 	/*
3400a2cefc6SAdrian Chadd 	 * Channel Tx, Rx, Rx Clear State
3410a2cefc6SAdrian Chadd 	 */
3420a2cefc6SAdrian Chadd 	uint32_t	ah_cycleCount;
3430a2cefc6SAdrian Chadd 	uint32_t	ah_ctlBusy;
3440a2cefc6SAdrian Chadd 	uint32_t	ah_rxBusy;
3450a2cefc6SAdrian Chadd 	uint32_t	ah_txBusy;
3460a2cefc6SAdrian Chadd 	uint32_t	ah_rx_chainmask;
3470a2cefc6SAdrian Chadd 	uint32_t	ah_tx_chainmask;
34803ab0935SAdrian Chadd 
34903ab0935SAdrian Chadd 	/* Used to return ANI statistics to the diagnostic API */
35003ab0935SAdrian Chadd 	HAL_ANI_STATS	ext_ani_stats;
35114779705SSam Leffler };
35214779705SSam Leffler #define	AH5212(_ah)	((struct ath_hal_5212 *)(_ah))
35314779705SSam Leffler 
35414779705SSam Leffler /*
35514779705SSam Leffler  * IS_XXXX macros test the MAC version
35614779705SSam Leffler  * IS_RADXXX macros test the radio/RF version (matching both 2G-only and 2/5G)
35714779705SSam Leffler  *
35814779705SSam Leffler  * Some single chip radios have equivalent radio/RF (e.g. 5112)
35914779705SSam Leffler  * for those use IS_RADXXX_ANY macros.
36014779705SSam Leffler  */
36114779705SSam Leffler #define IS_2317(ah) \
36214779705SSam Leffler 	((AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV1) || \
36314779705SSam Leffler 	 (AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV2))
36414779705SSam Leffler #define	IS_2316(ah) \
36514779705SSam Leffler 	(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_2415)
36614779705SSam Leffler #define	IS_2413(ah) \
36714779705SSam Leffler 	(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_2413 || IS_2316(ah))
36814779705SSam Leffler #define IS_5424(ah) \
36914779705SSam Leffler 	(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_5424 || \
37014779705SSam Leffler 	(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_5413 && \
37114779705SSam Leffler 	  AH_PRIVATE(ah)->ah_macRev <= AR_SREV_D2PLUS_MS))
37214779705SSam Leffler #define IS_5413(ah) \
37314779705SSam Leffler 	(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_5413 || IS_5424(ah))
37414779705SSam Leffler #define IS_2425(ah) \
37514779705SSam Leffler 	(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_2425)
37614779705SSam Leffler #define IS_2417(ah) \
37714779705SSam Leffler 	((AH_PRIVATE(ah)->ah_macVersion) == AR_SREV_2417)
37814779705SSam Leffler #define IS_HB63(ah)		(AH5212(ah)->ah_isHb63 == AH_TRUE)
37914779705SSam Leffler 
38014779705SSam Leffler #define	AH_RADIO_MAJOR(ah) \
38114779705SSam Leffler 	(AH_PRIVATE(ah)->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR)
38214779705SSam Leffler #define	AH_RADIO_MINOR(ah) \
38314779705SSam Leffler 	(AH_PRIVATE(ah)->ah_analog5GhzRev & AR_RADIO_SREV_MINOR)
38414779705SSam Leffler #define	IS_RAD5111(ah) \
38514779705SSam Leffler 	(AH_RADIO_MAJOR(ah) == AR_RAD5111_SREV_MAJOR || \
38614779705SSam Leffler 	 AH_RADIO_MAJOR(ah) == AR_RAD2111_SREV_MAJOR)
38714779705SSam Leffler #define	IS_RAD5112(ah) \
38814779705SSam Leffler 	(AH_RADIO_MAJOR(ah) == AR_RAD5112_SREV_MAJOR || \
38914779705SSam Leffler 	 AH_RADIO_MAJOR(ah) == AR_RAD2112_SREV_MAJOR)
39014779705SSam Leffler /* NB: does not include 5413 as Atheros' IS_5112 macro does */
39114779705SSam Leffler #define	IS_RAD5112_ANY(ah) \
39214779705SSam Leffler 	(AR_RAD5112_SREV_MAJOR <= AH_RADIO_MAJOR(ah) && \
39314779705SSam Leffler 	 AH_RADIO_MAJOR(ah) <= AR_RAD2413_SREV_MAJOR)
39414779705SSam Leffler #define	IS_RAD5112_REV1(ah) \
39514779705SSam Leffler 	(IS_RAD5112(ah) && \
39614779705SSam Leffler 	 AH_RADIO_MINOR(ah) < (AR_RAD5112_SREV_2_0 & AR_RADIO_SREV_MINOR))
39714779705SSam Leffler #define IS_RADX112_REV2(ah) \
39814779705SSam Leffler 	(AH_PRIVATE(ah)->ah_analog5GhzRev == AR_RAD5112_SREV_2_0 || \
39914779705SSam Leffler 	 AH_PRIVATE(ah)->ah_analog5GhzRev == AR_RAD2112_SREV_2_0 || \
40014779705SSam Leffler 	 AH_PRIVATE(ah)->ah_analog5GhzRev == AR_RAD2112_SREV_2_1 || \
40114779705SSam Leffler 	 AH_PRIVATE(ah)->ah_analog5GhzRev == AR_RAD5112_SREV_2_1)
40214779705SSam Leffler 
40314779705SSam Leffler #define	ar5212RfDetach(ah) do {				\
40414779705SSam Leffler 	if (AH5212(ah)->ah_rfHal != AH_NULL)		\
40514779705SSam Leffler 		AH5212(ah)->ah_rfHal->rfDetach(ah);	\
40614779705SSam Leffler } while (0)
40714779705SSam Leffler #define	ar5212GetRfBank(ah, b) \
40814779705SSam Leffler 	AH5212(ah)->ah_rfHal->getRfBank(ah, b)
40914779705SSam Leffler 
41014779705SSam Leffler /*
41114779705SSam Leffler  * Hack macros for Nala/San: 11b is handled
41214779705SSam Leffler  * using 11g; flip the channel flags to accomplish this.
41314779705SSam Leffler  */
41414779705SSam Leffler #define SAVE_CCK(_ah, _chan, _flag) do {			\
41514779705SSam Leffler 	if ((IS_2425(_ah) || IS_2417(_ah)) &&			\
41659efa8b5SSam Leffler 	    (((_chan)->ic_flags) & IEEE80211_CHAN_CCK)) {	\
41759efa8b5SSam Leffler 		(_chan)->ic_flags &= ~IEEE80211_CHAN_CCK;	\
41859efa8b5SSam Leffler 		(_chan)->ic_flags |= IEEE80211_CHAN_DYN;	\
41914779705SSam Leffler 		(_flag) = AH_TRUE;				\
4208216b39eSSam Leffler 	} else							\
4218216b39eSSam Leffler 		(_flag) = AH_FALSE;				\
42214779705SSam Leffler } while (0)
42314779705SSam Leffler #define RESTORE_CCK(_ah, _chan, _flag) do {                     \
4248216b39eSSam Leffler 	if ((_flag) && (IS_2425(_ah) || IS_2417(_ah))) {	\
42559efa8b5SSam Leffler 		(_chan)->ic_flags &= ~IEEE80211_CHAN_DYN;	\
42659efa8b5SSam Leffler 		(_chan)->ic_flags |= IEEE80211_CHAN_CCK;	\
42714779705SSam Leffler 	}							\
42814779705SSam Leffler } while (0)
42914779705SSam Leffler 
43014779705SSam Leffler struct ath_hal;
43114779705SSam Leffler 
43214779705SSam Leffler extern	uint32_t ar5212GetRadioRev(struct ath_hal *ah);
43314779705SSam Leffler extern	void ar5212InitState(struct ath_hal_5212 *, uint16_t devid, HAL_SOFTC,
43414779705SSam Leffler 		HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status);
43514779705SSam Leffler extern	void ar5212Detach(struct ath_hal *ah);
43614779705SSam Leffler extern  HAL_BOOL ar5212ChipTest(struct ath_hal *ah);
43714779705SSam Leffler extern  HAL_BOOL ar5212GetChannelEdges(struct ath_hal *ah,
43814779705SSam Leffler                 uint16_t flags, uint16_t *low, uint16_t *high);
43914779705SSam Leffler extern	HAL_BOOL ar5212FillCapabilityInfo(struct ath_hal *ah);
44014779705SSam Leffler 
44114779705SSam Leffler extern	void ar5212SetBeaconTimers(struct ath_hal *ah,
44214779705SSam Leffler 		const HAL_BEACON_TIMERS *);
44314779705SSam Leffler extern	void ar5212BeaconInit(struct ath_hal *ah,
44414779705SSam Leffler 		uint32_t next_beacon, uint32_t beacon_period);
44514779705SSam Leffler extern	void ar5212ResetStaBeaconTimers(struct ath_hal *ah);
44614779705SSam Leffler extern	void ar5212SetStaBeaconTimers(struct ath_hal *ah,
44714779705SSam Leffler 		const HAL_BEACON_STATE *);
448fc4de9b7SAdrian Chadd extern	uint64_t ar5212GetNextTBTT(struct ath_hal *);
44914779705SSam Leffler 
45014779705SSam Leffler extern	HAL_BOOL ar5212IsInterruptPending(struct ath_hal *ah);
45114779705SSam Leffler extern	HAL_BOOL ar5212GetPendingInterrupts(struct ath_hal *ah, HAL_INT *);
45214779705SSam Leffler extern	HAL_INT ar5212GetInterrupts(struct ath_hal *ah);
45314779705SSam Leffler extern	HAL_INT ar5212SetInterrupts(struct ath_hal *ah, HAL_INT ints);
45414779705SSam Leffler 
45514779705SSam Leffler extern	uint32_t ar5212GetKeyCacheSize(struct ath_hal *);
45614779705SSam Leffler extern	HAL_BOOL ar5212IsKeyCacheEntryValid(struct ath_hal *, uint16_t entry);
45714779705SSam Leffler extern	HAL_BOOL ar5212ResetKeyCacheEntry(struct ath_hal *ah, uint16_t entry);
45814779705SSam Leffler extern	HAL_BOOL ar5212SetKeyCacheEntryMac(struct ath_hal *,
45914779705SSam Leffler 			uint16_t entry, const uint8_t *mac);
46014779705SSam Leffler extern	HAL_BOOL ar5212SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry,
46114779705SSam Leffler                        const HAL_KEYVAL *k, const uint8_t *mac, int xorKey);
46214779705SSam Leffler 
46314779705SSam Leffler extern	void ar5212GetMacAddress(struct ath_hal *ah, uint8_t *mac);
46414779705SSam Leffler extern	HAL_BOOL ar5212SetMacAddress(struct ath_hal *ah, const uint8_t *);
46514779705SSam Leffler extern	void ar5212GetBssIdMask(struct ath_hal *ah, uint8_t *mac);
46614779705SSam Leffler extern	HAL_BOOL ar5212SetBssIdMask(struct ath_hal *, const uint8_t *);
46714779705SSam Leffler extern	HAL_BOOL ar5212EepromRead(struct ath_hal *, u_int off, uint16_t *data);
46814779705SSam Leffler extern	HAL_BOOL ar5212EepromWrite(struct ath_hal *, u_int off, uint16_t data);
46914779705SSam Leffler extern	HAL_BOOL ar5212SetRegulatoryDomain(struct ath_hal *ah,
47014779705SSam Leffler 		uint16_t regDomain, HAL_STATUS *stats);
47114779705SSam Leffler extern	u_int ar5212GetWirelessModes(struct ath_hal *ah);
47214779705SSam Leffler extern	void ar5212EnableRfKill(struct ath_hal *);
473869ff02eSSam Leffler extern	HAL_BOOL ar5212GpioCfgOutput(struct ath_hal *, uint32_t gpio,
474869ff02eSSam Leffler 		HAL_GPIO_MUX_TYPE);
47514779705SSam Leffler extern	HAL_BOOL ar5212GpioCfgInput(struct ath_hal *, uint32_t gpio);
47614779705SSam Leffler extern	HAL_BOOL ar5212GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val);
47714779705SSam Leffler extern	uint32_t ar5212GpioGet(struct ath_hal *ah, uint32_t gpio);
47814779705SSam Leffler extern	void ar5212GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel);
47914779705SSam Leffler extern	void ar5212SetLedState(struct ath_hal *ah, HAL_LED_STATE state);
48014779705SSam Leffler extern	void ar5212WriteAssocid(struct ath_hal *ah, const uint8_t *bssid,
48114779705SSam Leffler 		uint16_t assocId);
48214779705SSam Leffler extern	uint32_t ar5212GetTsf32(struct ath_hal *ah);
48314779705SSam Leffler extern	uint64_t ar5212GetTsf64(struct ath_hal *ah);
484beb4faf3SAdrian Chadd extern	void ar5212SetTsf64(struct ath_hal *ah, uint64_t tsf64);
48514779705SSam Leffler extern	void ar5212ResetTsf(struct ath_hal *ah);
48614779705SSam Leffler extern	void ar5212SetBasicRate(struct ath_hal *ah, HAL_RATE_SET *pSet);
48714779705SSam Leffler extern	uint32_t ar5212GetRandomSeed(struct ath_hal *ah);
48814779705SSam Leffler extern	HAL_BOOL ar5212DetectCardPresent(struct ath_hal *ah);
48914779705SSam Leffler extern	void ar5212EnableMibCounters(struct ath_hal *);
49014779705SSam Leffler extern	void ar5212DisableMibCounters(struct ath_hal *);
49114779705SSam Leffler extern	void ar5212UpdateMibCounters(struct ath_hal *ah, HAL_MIB_STATS* stats);
49214779705SSam Leffler extern	HAL_BOOL ar5212IsJapanChannelSpreadSupported(struct ath_hal *ah);
49314779705SSam Leffler extern	uint32_t ar5212GetCurRssi(struct ath_hal *ah);
49414779705SSam Leffler extern	u_int ar5212GetDefAntenna(struct ath_hal *ah);
49514779705SSam Leffler extern	void ar5212SetDefAntenna(struct ath_hal *ah, u_int antenna);
49614779705SSam Leffler extern	HAL_ANT_SETTING ar5212GetAntennaSwitch(struct ath_hal *);
49714779705SSam Leffler extern	HAL_BOOL ar5212SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING);
49814779705SSam Leffler extern	HAL_BOOL ar5212IsSleepAfterBeaconBroken(struct ath_hal *ah);
49914779705SSam Leffler extern	HAL_BOOL ar5212SetSifsTime(struct ath_hal *, u_int);
50014779705SSam Leffler extern	u_int ar5212GetSifsTime(struct ath_hal *);
50114779705SSam Leffler extern	HAL_BOOL ar5212SetSlotTime(struct ath_hal *, u_int);
50214779705SSam Leffler extern	u_int ar5212GetSlotTime(struct ath_hal *);
50314779705SSam Leffler extern	HAL_BOOL ar5212SetAckTimeout(struct ath_hal *, u_int);
50414779705SSam Leffler extern	u_int ar5212GetAckTimeout(struct ath_hal *);
50514779705SSam Leffler extern	HAL_BOOL ar5212SetAckCTSRate(struct ath_hal *, u_int);
50614779705SSam Leffler extern	u_int ar5212GetAckCTSRate(struct ath_hal *);
50714779705SSam Leffler extern	HAL_BOOL ar5212SetCTSTimeout(struct ath_hal *, u_int);
50814779705SSam Leffler extern	u_int ar5212GetCTSTimeout(struct ath_hal *);
50914779705SSam Leffler extern  HAL_BOOL ar5212SetDecompMask(struct ath_hal *, uint16_t, int);
51014779705SSam Leffler void 	ar5212SetCoverageClass(struct ath_hal *, uint8_t, int);
51114779705SSam Leffler extern	void ar5212SetPCUConfig(struct ath_hal *);
51214779705SSam Leffler extern	HAL_BOOL ar5212Use32KHzclock(struct ath_hal *ah, HAL_OPMODE opmode);
51314779705SSam Leffler extern	void ar5212SetupClock(struct ath_hal *ah, HAL_OPMODE opmode);
51414779705SSam Leffler extern	void ar5212RestoreClock(struct ath_hal *ah, HAL_OPMODE opmode);
51514779705SSam Leffler extern	int16_t ar5212GetNfAdjust(struct ath_hal *,
51614779705SSam Leffler 		const HAL_CHANNEL_INTERNAL *);
51714779705SSam Leffler extern	void ar5212SetCompRegs(struct ath_hal *ah);
51814779705SSam Leffler extern	HAL_STATUS ar5212GetCapability(struct ath_hal *, HAL_CAPABILITY_TYPE,
51914779705SSam Leffler 		uint32_t, uint32_t *);
52014779705SSam Leffler extern	HAL_BOOL ar5212SetCapability(struct ath_hal *, HAL_CAPABILITY_TYPE,
52114779705SSam Leffler 		uint32_t, uint32_t, HAL_STATUS *);
52214779705SSam Leffler extern	HAL_BOOL ar5212GetDiagState(struct ath_hal *ah, int request,
52314779705SSam Leffler 		const void *args, uint32_t argsize,
52414779705SSam Leffler 		void **result, uint32_t *resultsize);
52504d172dbSAdrian Chadd extern	HAL_STATUS ar5212SetQuiet(struct ath_hal *ah, uint32_t period,
52604d172dbSAdrian Chadd 		uint32_t duration, uint32_t nextStart, HAL_QUIET_FLAG flag);
527352f07f6SAdrian Chadd extern	HAL_BOOL ar5212GetMibCycleCounts(struct ath_hal *,
528352f07f6SAdrian Chadd 		HAL_SURVEY_SAMPLE *);
529d2a72d67SAdrian Chadd extern	void ar5212SetChainMasks(struct ath_hal *, uint32_t, uint32_t);
530bed90bf8SAdrian Chadd extern	u_int ar5212GetNav(struct ath_hal *);
531bed90bf8SAdrian Chadd extern	void ar5212SetNav(struct ath_hal *, u_int);
53214779705SSam Leffler 
53314779705SSam Leffler extern	HAL_BOOL ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode,
53414779705SSam Leffler 		int setChip);
53514779705SSam Leffler extern	HAL_POWER_MODE ar5212GetPowerMode(struct ath_hal *ah);
53614779705SSam Leffler extern	HAL_BOOL ar5212GetPowerStatus(struct ath_hal *ah);
53714779705SSam Leffler 
538d60a0680SAdrian Chadd extern	uint32_t ar5212GetRxDP(struct ath_hal *ath, HAL_RX_QUEUE);
539d60a0680SAdrian Chadd extern	void ar5212SetRxDP(struct ath_hal *ah, uint32_t rxdp, HAL_RX_QUEUE);
54014779705SSam Leffler extern	void ar5212EnableReceive(struct ath_hal *ah);
54114779705SSam Leffler extern	HAL_BOOL ar5212StopDmaReceive(struct ath_hal *ah);
542a8083b9cSAdrian Chadd extern	void ar5212StartPcuReceive(struct ath_hal *ah, HAL_BOOL);
54314779705SSam Leffler extern	void ar5212StopPcuReceive(struct ath_hal *ah);
54414779705SSam Leffler extern	void ar5212SetMulticastFilter(struct ath_hal *ah,
54514779705SSam Leffler 		uint32_t filter0, uint32_t filter1);
54614779705SSam Leffler extern	HAL_BOOL ar5212ClrMulticastFilterIndex(struct ath_hal *, uint32_t ix);
54714779705SSam Leffler extern	HAL_BOOL ar5212SetMulticastFilterIndex(struct ath_hal *, uint32_t ix);
54814779705SSam Leffler extern	uint32_t ar5212GetRxFilter(struct ath_hal *ah);
54914779705SSam Leffler extern	void ar5212SetRxFilter(struct ath_hal *ah, uint32_t bits);
55014779705SSam Leffler extern	HAL_BOOL ar5212SetupRxDesc(struct ath_hal *,
55114779705SSam Leffler 		struct ath_desc *, uint32_t size, u_int flags);
55214779705SSam Leffler extern	HAL_STATUS ar5212ProcRxDesc(struct ath_hal *ah, struct ath_desc *,
55314779705SSam Leffler 		uint32_t, struct ath_desc *, uint64_t,
55414779705SSam Leffler 		struct ath_rx_status *);
55514779705SSam Leffler 
55614779705SSam Leffler extern	HAL_BOOL ar5212Reset(struct ath_hal *ah, HAL_OPMODE opmode,
55759efa8b5SSam Leffler 		struct ieee80211_channel *chan, HAL_BOOL bChannelChange,
558f50e4ebfSAdrian Chadd 		HAL_RESET_TYPE, HAL_STATUS *status);
55959efa8b5SSam Leffler extern	HAL_BOOL ar5212SetChannel(struct ath_hal *,
56059efa8b5SSam Leffler 		const struct ieee80211_channel *);
56114779705SSam Leffler extern	void ar5212SetOperatingMode(struct ath_hal *ah, int opmode);
56214779705SSam Leffler extern	HAL_BOOL ar5212PhyDisable(struct ath_hal *ah);
56314779705SSam Leffler extern	HAL_BOOL ar5212Disable(struct ath_hal *ah);
56459efa8b5SSam Leffler extern	HAL_BOOL ar5212ChipReset(struct ath_hal *ah,
56559efa8b5SSam Leffler 		const struct ieee80211_channel *);
56659efa8b5SSam Leffler extern	HAL_BOOL ar5212PerCalibration(struct ath_hal *ah,
56759efa8b5SSam Leffler 		struct ieee80211_channel *chan, HAL_BOOL *isIQdone);
56859efa8b5SSam Leffler extern	HAL_BOOL ar5212PerCalibrationN(struct ath_hal *ah,
56959efa8b5SSam Leffler 		struct ieee80211_channel *chan, u_int chainMask,
57059efa8b5SSam Leffler 		HAL_BOOL longCal, HAL_BOOL *isCalDone);
57159efa8b5SSam Leffler extern	HAL_BOOL ar5212ResetCalValid(struct ath_hal *ah,
57259efa8b5SSam Leffler 		const struct ieee80211_channel *);
57314779705SSam Leffler extern	int16_t ar5212GetNoiseFloor(struct ath_hal *ah);
57414779705SSam Leffler extern	void ar5212InitNfCalHistBuffer(struct ath_hal *);
575*c1ebd4c9SJohn Baldwin extern	int16_t ar5212GetNfHistMid(const int16_t calData[AR512_NF_CAL_HIST_MAX]);
57659efa8b5SSam Leffler extern	void ar5212SetSpurMitigation(struct ath_hal *,
57759efa8b5SSam Leffler 		 const struct ieee80211_channel *);
57814779705SSam Leffler extern	HAL_BOOL ar5212SetAntennaSwitchInternal(struct ath_hal *ah,
57959efa8b5SSam Leffler 		HAL_ANT_SETTING settings, const struct ieee80211_channel *);
58014779705SSam Leffler extern	HAL_BOOL ar5212SetTxPowerLimit(struct ath_hal *ah, uint32_t limit);
58114779705SSam Leffler extern	HAL_BOOL ar5212GetChipPowerLimits(struct ath_hal *ah,
58259efa8b5SSam Leffler 		struct ieee80211_channel *chan);
58314779705SSam Leffler extern	void ar5212InitializeGainValues(struct ath_hal *);
58414779705SSam Leffler extern	HAL_RFGAIN ar5212GetRfgain(struct ath_hal *ah);
58514779705SSam Leffler extern	void ar5212RequestRfgain(struct ath_hal *);
58614779705SSam Leffler 
58714779705SSam Leffler extern	HAL_BOOL ar5212UpdateTxTrigLevel(struct ath_hal *,
58814779705SSam Leffler 		HAL_BOOL IncTrigLevel);
58914779705SSam Leffler extern  HAL_BOOL ar5212SetTxQueueProps(struct ath_hal *ah, int q,
59014779705SSam Leffler 		const HAL_TXQ_INFO *qInfo);
59114779705SSam Leffler extern	HAL_BOOL ar5212GetTxQueueProps(struct ath_hal *ah, int q,
59214779705SSam Leffler 		HAL_TXQ_INFO *qInfo);
59314779705SSam Leffler extern	int ar5212SetupTxQueue(struct ath_hal *ah, HAL_TX_QUEUE type,
59414779705SSam Leffler 		const HAL_TXQ_INFO *qInfo);
59514779705SSam Leffler extern	HAL_BOOL ar5212ReleaseTxQueue(struct ath_hal *ah, u_int q);
59614779705SSam Leffler extern	HAL_BOOL ar5212ResetTxQueue(struct ath_hal *ah, u_int q);
59714779705SSam Leffler extern	uint32_t ar5212GetTxDP(struct ath_hal *ah, u_int q);
59814779705SSam Leffler extern	HAL_BOOL ar5212SetTxDP(struct ath_hal *ah, u_int q, uint32_t txdp);
59914779705SSam Leffler extern	HAL_BOOL ar5212StartTxDma(struct ath_hal *ah, u_int q);
60014779705SSam Leffler extern	uint32_t ar5212NumTxPending(struct ath_hal *ah, u_int q);
60114779705SSam Leffler extern	HAL_BOOL ar5212StopTxDma(struct ath_hal *ah, u_int q);
60214779705SSam Leffler extern	HAL_BOOL ar5212SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds,
60314779705SSam Leffler 		u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int txPower,
60414779705SSam Leffler 		u_int txRate0, u_int txTries0,
60514779705SSam Leffler 		u_int keyIx, u_int antMode, u_int flags,
60614779705SSam Leffler 		u_int rtsctsRate, u_int rtsctsDuration,
60714779705SSam Leffler 		u_int compicvLen, u_int compivLen, u_int comp);
60814779705SSam Leffler extern	HAL_BOOL ar5212SetupXTxDesc(struct ath_hal *, struct ath_desc *,
60914779705SSam Leffler 		u_int txRate1, u_int txRetries1,
61014779705SSam Leffler 		u_int txRate2, u_int txRetries2,
61114779705SSam Leffler 		u_int txRate3, u_int txRetries3);
61214779705SSam Leffler extern	HAL_BOOL ar5212FillTxDesc(struct ath_hal *ah, struct ath_desc *ds,
61346634305SAdrian Chadd 		HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList,
61446634305SAdrian Chadd 		u_int descId, u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg,
61514779705SSam Leffler 		const struct ath_desc *ds0);
61614779705SSam Leffler extern	HAL_STATUS ar5212ProcTxDesc(struct ath_hal *ah,
61714779705SSam Leffler 		struct ath_desc *, struct ath_tx_status *);
61814779705SSam Leffler extern  void ar5212GetTxIntrQueue(struct ath_hal *ah, uint32_t *);
61914779705SSam Leffler extern  void ar5212IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *);
6209ea46744SAdrian Chadd extern	HAL_BOOL ar5212GetTxCompletionRates(struct ath_hal *ah,
6219ea46744SAdrian Chadd 		const struct ath_desc *ds0, int *rates, int *tries);
622ad3e6dcdSAdrian Chadd extern	void ar5212SetTxDescLink(struct ath_hal *ah, void *ds,
623ad3e6dcdSAdrian Chadd 		uint32_t link);
624ad3e6dcdSAdrian Chadd extern	void ar5212GetTxDescLink(struct ath_hal *ah, void *ds,
625ad3e6dcdSAdrian Chadd 		uint32_t *link);
626ad3e6dcdSAdrian Chadd extern	void ar5212GetTxDescLinkPtr(struct ath_hal *ah, void *ds,
627ad3e6dcdSAdrian Chadd 		uint32_t **linkptr);
62814779705SSam Leffler 
62914779705SSam Leffler extern	const HAL_RATE_TABLE *ar5212GetRateTable(struct ath_hal *, u_int mode);
63014779705SSam Leffler 
63114779705SSam Leffler extern	void ar5212AniAttach(struct ath_hal *, const struct ar5212AniParams *,
63214779705SSam Leffler 		const struct ar5212AniParams *, HAL_BOOL ena);
63314779705SSam Leffler extern	void ar5212AniDetach(struct ath_hal *);
63414779705SSam Leffler extern	struct ar5212AniState *ar5212AniGetCurrentState(struct ath_hal *);
635a9e86008SAdrian Chadd extern	HAL_ANI_STATS *ar5212AniGetCurrentStats(struct ath_hal *);
63614779705SSam Leffler extern	HAL_BOOL ar5212AniControl(struct ath_hal *, HAL_ANI_CMD cmd, int param);
63714779705SSam Leffler extern	HAL_BOOL ar5212AniSetParams(struct ath_hal *,
63814779705SSam Leffler 		const struct ar5212AniParams *, const struct ar5212AniParams *);
63914779705SSam Leffler struct ath_rx_status;
64014779705SSam Leffler extern	void ar5212AniPhyErrReport(struct ath_hal *ah,
64114779705SSam Leffler 		const struct ath_rx_status *rs);
64214779705SSam Leffler extern	void ar5212ProcessMibIntr(struct ath_hal *, const HAL_NODE_STATS *);
643a108ab63SAdrian Chadd extern	void ar5212RxMonitor(struct ath_hal *, const HAL_NODE_STATS *,
64459efa8b5SSam Leffler 			     const struct ieee80211_channel *);
645a108ab63SAdrian Chadd extern	void ar5212AniPoll(struct ath_hal *, const struct ieee80211_channel *);
64659efa8b5SSam Leffler extern	void ar5212AniReset(struct ath_hal *, const struct ieee80211_channel *,
64714779705SSam Leffler 		HAL_OPMODE, int);
64885b035b3SAdrian Chadd 
64985b035b3SAdrian Chadd extern	HAL_BOOL ar5212IsNFCalInProgress(struct ath_hal *ah);
65085b035b3SAdrian Chadd extern	HAL_BOOL ar5212WaitNFCalComplete(struct ath_hal *ah, int i);
6512cb5233bSAdrian Chadd extern	void ar5212EnableDfs(struct ath_hal *ah, HAL_PHYERR_PARAM *pe);
65247152caeSAdrian Chadd extern	HAL_BOOL ar5212GetDfsDefaultThresh(struct ath_hal *ah,
65347152caeSAdrian Chadd 	    HAL_PHYERR_PARAM *pe);
6542cb5233bSAdrian Chadd extern	void ar5212GetDfsThresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe);
6553d423111SAdrian Chadd extern	HAL_BOOL ar5212ProcessRadarEvent(struct ath_hal *ah,
6563d423111SAdrian Chadd 	    struct ath_rx_status *rxs, uint64_t fulltsf, const char *buf,
6573d423111SAdrian Chadd 	    HAL_DFS_EVENT *event);
65860829c48SAdrian Chadd extern	HAL_BOOL ar5212IsFastClockEnabled(struct ath_hal *ah);
6597f925de1SAdrian Chadd extern	uint32_t ar5212Get11nExtBusy(struct ath_hal *ah);
66085b035b3SAdrian Chadd 
66114779705SSam Leffler #endif	/* _ATH_AR5212_H_ */
662