xref: /dflybsd-src/sys/dev/netif/ath/ath_hal/ar5416/ar5416reg.h (revision dc24979338a9c26cf9963899768e21a9c95d30f2)
1572ff6f6SMatthew Dillon /*
2572ff6f6SMatthew Dillon  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3572ff6f6SMatthew Dillon  * Copyright (c) 2002-2008 Atheros Communications, Inc.
4572ff6f6SMatthew Dillon  *
5572ff6f6SMatthew Dillon  * Permission to use, copy, modify, and/or distribute this software for any
6572ff6f6SMatthew Dillon  * purpose with or without fee is hereby granted, provided that the above
7572ff6f6SMatthew Dillon  * copyright notice and this permission notice appear in all copies.
8572ff6f6SMatthew Dillon  *
9572ff6f6SMatthew Dillon  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10572ff6f6SMatthew Dillon  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11572ff6f6SMatthew Dillon  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12572ff6f6SMatthew Dillon  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13572ff6f6SMatthew Dillon  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14572ff6f6SMatthew Dillon  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15572ff6f6SMatthew Dillon  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16572ff6f6SMatthew Dillon  *
17572ff6f6SMatthew Dillon  * $FreeBSD$
18572ff6f6SMatthew Dillon  */
19572ff6f6SMatthew Dillon #ifndef _DEV_ATH_AR5416REG_H
20572ff6f6SMatthew Dillon #define	_DEV_ATH_AR5416REG_H
21572ff6f6SMatthew Dillon 
22*dc249793SMatthew Dillon #include <dev/netif/ath/ath_hal/ar5212/ar5212reg.h>
23572ff6f6SMatthew Dillon 
24572ff6f6SMatthew Dillon /*
25572ff6f6SMatthew Dillon  * Register added starting with the AR5416
26572ff6f6SMatthew Dillon  */
27572ff6f6SMatthew Dillon #define	AR_MIRT			0x0020	/* interrupt rate threshold */
28572ff6f6SMatthew Dillon #define	AR_TIMT			0x0028	/* Tx Interrupt mitigation threshold */
29572ff6f6SMatthew Dillon #define	AR_RIMT			0x002C	/* Rx Interrupt mitigation threshold */
30572ff6f6SMatthew Dillon #define	AR_GTXTO		0x0064	/* global transmit timeout */
31572ff6f6SMatthew Dillon #define	AR_GTTM			0x0068	/* global transmit timeout mode */
32572ff6f6SMatthew Dillon #define	AR_CST			0x006C	/* carrier sense timeout */
33572ff6f6SMatthew Dillon #define	AR_MAC_LED		0x1f04	/* LED control */
34572ff6f6SMatthew Dillon #define	AR_WA			0x4004	/* PCIE work-arounds */
35572ff6f6SMatthew Dillon #define	AR_PCIE_PM_CTRL		0x4014
36572ff6f6SMatthew Dillon #define	AR_AHB_MODE		0x4024	/* AHB mode for dma */
37572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_CAUSE_CLR	0x4028	/* clear interrupt */
38572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_CAUSE	0x4028	/* check pending interrupts */
39572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_ENABLE	0x402c	/* enable interrupts */
40572ff6f6SMatthew Dillon #define	AR_INTR_ASYNC_MASK	0x4030	/* asynchronous interrupt mask */
41572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_MASK	0x4034	/* synchronous interrupt mask */
42572ff6f6SMatthew Dillon #define	AR_INTR_ASYNC_CAUSE	0x4038	/* check pending interrupts */
43572ff6f6SMatthew Dillon #define	AR_INTR_ASYNC_CAUSE_CLR	0x4038	/* clear pending interrupts */
44572ff6f6SMatthew Dillon #define	AR_INTR_ASYNC_ENABLE	0x403c	/* enable interrupts */
45572ff6f6SMatthew Dillon #define	AR5416_PCIE_SERDES	0x4040
46572ff6f6SMatthew Dillon #define	AR5416_PCIE_SERDES2	0x4044
47572ff6f6SMatthew Dillon #define	AR_GPIO_IN_OUT		0x4048	/* GPIO input/output register */
48572ff6f6SMatthew Dillon #define	AR_GPIO_OE_OUT		0x404c	/* GPIO output enable register */
49572ff6f6SMatthew Dillon #define	AR_GPIO_INTR_POL	0x4050	/* GPIO interrupt polarity */
50572ff6f6SMatthew Dillon 
51572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL	0x4054	/* GPIO input enable and value */
52572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF     0x00000004
53572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_S       2
54572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF    0x00000008
55572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_S      3
56572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_DEF       0x00000010
57572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_S         4
58572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_RFSILENT_DEF        0x00000080
59572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_RFSILENT_DEF_S      7
60572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB      0x00000400
61572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB_S    10
62572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_BB     0x00000800
63572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_BB_S   11
64572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB        0x00001000
65572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB_S      12
66572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_RFSILENT_BB         0x00008000
67572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_EN_VAL_RFSILENT_BB_S       15
68572ff6f6SMatthew Dillon #define	AR_GPIO_RTC_RESET_OVERRIDE_ENABLE        0x00010000
69572ff6f6SMatthew Dillon #define	AR_GPIO_JTAG_DISABLE                     0x00020000
70572ff6f6SMatthew Dillon 
71572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX1	0x4058
72572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX1_BT_PRIORITY           0x00000f00
73572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX1_BT_PRIORITY_S         8
74572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX1_BT_FREQUENCY          0x0000f000
75572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX1_BT_FREQUENCY_S        12
76572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX1_BT_ACTIVE             0x000f0000
77572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX1_BT_ACTIVE_S           16
78572ff6f6SMatthew Dillon 
79572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX2	0x405c
80572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX2_CLK25                 0x0000000f
81572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX2_CLK25_S               0
82572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX2_RFSILENT              0x000000f0
83572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX2_RFSILENT_S            4
84572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX2_RTC_RESET             0x00000f00
85572ff6f6SMatthew Dillon #define	AR_GPIO_INPUT_MUX2_RTC_RESET_S           8
86572ff6f6SMatthew Dillon 
87572ff6f6SMatthew Dillon #define	AR_GPIO_OUTPUT_MUX1	0x4060
88572ff6f6SMatthew Dillon #define	AR_GPIO_OUTPUT_MUX2	0x4064
89572ff6f6SMatthew Dillon #define	AR_GPIO_OUTPUT_MUX3	0x4068
90572ff6f6SMatthew Dillon 
91572ff6f6SMatthew Dillon #define	AR_GPIO_OUTPUT_MUX_AS_OUTPUT             0
92572ff6f6SMatthew Dillon #define	AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
93572ff6f6SMatthew Dillon #define	AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED     2
94572ff6f6SMatthew Dillon #define	AR_GPIO_OUTPUT_MUX_AS_TX_FRAME           3
95572ff6f6SMatthew Dillon #define	AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL  4
96572ff6f6SMatthew Dillon #define	AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED    5
97572ff6f6SMatthew Dillon #define	AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED      6
98572ff6f6SMatthew Dillon 
99572ff6f6SMatthew Dillon #define	AR_EEPROM_STATUS_DATA	0x407c
100572ff6f6SMatthew Dillon #define	AR_OBS			0x4080
101572ff6f6SMatthew Dillon #define	AR_GPIO_PDPU		0x4088
102572ff6f6SMatthew Dillon 
103572ff6f6SMatthew Dillon #ifdef	AH_SUPPORT_AR9130
104572ff6f6SMatthew Dillon #define	AR_RTC_BASE		0x20000
105572ff6f6SMatthew Dillon #else
106572ff6f6SMatthew Dillon #define	AR_RTC_BASE		0x7000
107572ff6f6SMatthew Dillon #endif	/* AH_SUPPORT_AR9130 */
108572ff6f6SMatthew Dillon 
109572ff6f6SMatthew Dillon #define	AR_RTC_RC		AR_RTC_BASE + 0x00	/* reset control */
110572ff6f6SMatthew Dillon #define	AR_RTC_PLL_CONTROL	AR_RTC_BASE + 0x14
111572ff6f6SMatthew Dillon #define	AR_RTC_RESET		AR_RTC_BASE + 0x40	/* RTC reset register */
112572ff6f6SMatthew Dillon #define	AR_RTC_STATUS		AR_RTC_BASE + 0x44	/* system sleep status */
113572ff6f6SMatthew Dillon #define	AR_RTC_SLEEP_CLK	AR_RTC_BASE + 0x48
114572ff6f6SMatthew Dillon #define	AR_RTC_FORCE_WAKE	AR_RTC_BASE + 0x4c	/* control MAC force wake */
115572ff6f6SMatthew Dillon #define	AR_RTC_INTR_CAUSE	AR_RTC_BASE + 0x50	/* RTC interrupt cause/clear */
116572ff6f6SMatthew Dillon #define	AR_RTC_INTR_ENABLE	AR_RTC_BASE + 0x54	/* RTC interrupt enable */
117572ff6f6SMatthew Dillon #define	AR_RTC_INTR_MASK	AR_RTC_BASE + 0x58	/* RTC interrupt mask */
118572ff6f6SMatthew Dillon 
119572ff6f6SMatthew Dillon #ifdef	AH_SUPPORT_AR9130
120572ff6f6SMatthew Dillon /* RTC_DERIVED_* - only for AR9130 */
121572ff6f6SMatthew Dillon #define	AR_RTC_DERIVED_CLK		(AR_RTC_BASE + 0x0038)
122572ff6f6SMatthew Dillon #define	AR_RTC_DERIVED_CLK_PERIOD	0x0000fffe
123572ff6f6SMatthew Dillon #define	AR_RTC_DERIVED_CLK_PERIOD_S	1
124572ff6f6SMatthew Dillon #endif	/* AH_SUPPORT_AR9130 */
125572ff6f6SMatthew Dillon 
126572ff6f6SMatthew Dillon /* AR_USEC: 0x801c */
127572ff6f6SMatthew Dillon #define	AR5416_USEC_TX_LAT	0x007FC000	/* tx latency to start of SIGNAL (usec) */
128572ff6f6SMatthew Dillon #define	AR5416_USEC_TX_LAT_S	14		/* tx latency to start of SIGNAL (usec) */
129572ff6f6SMatthew Dillon #define	AR5416_USEC_RX_LAT	0x1F800000	/* rx latency to start of SIGNAL (usec) */
130572ff6f6SMatthew Dillon #define	AR5416_USEC_RX_LAT_S	23		/* rx latency to start of SIGNAL (usec) */
131572ff6f6SMatthew Dillon 
132572ff6f6SMatthew Dillon #define	AR_RESET_TSF		0x8020
133572ff6f6SMatthew Dillon 
134572ff6f6SMatthew Dillon /*
135572ff6f6SMatthew Dillon  * AR_SLEEP1 / AR_SLEEP2 are in the same place as in
136572ff6f6SMatthew Dillon  * AR5212, however the fields have changed.
137572ff6f6SMatthew Dillon  */
138572ff6f6SMatthew Dillon #define	AR5416_SLEEP1		0x80d4
139572ff6f6SMatthew Dillon #define	AR5416_SLEEP2		0x80d8
140572ff6f6SMatthew Dillon #define	AR_RXFIFO_CFG		0x8114
141572ff6f6SMatthew Dillon #define	AR_PHY_ERR_1		0x812c
142572ff6f6SMatthew Dillon #define	AR_PHY_ERR_MASK_1	0x8130	/* mask for AR_PHY_ERR_1 */
143572ff6f6SMatthew Dillon #define	AR_PHY_ERR_2		0x8134
144572ff6f6SMatthew Dillon #define	AR_PHY_ERR_MASK_2	0x8138	/* mask for AR_PHY_ERR_2 */
145572ff6f6SMatthew Dillon #define	AR_TSFOOR_THRESHOLD	0x813c
146572ff6f6SMatthew Dillon #define	AR_PHY_ERR_3		0x8168
147572ff6f6SMatthew Dillon #define	AR_PHY_ERR_MASK_3	0x816c	/* mask for AR_PHY_ERR_3 */
148572ff6f6SMatthew Dillon #define	AR_BT_COEX_WEIGHT2	0x81c4
149572ff6f6SMatthew Dillon #define	AR_TXOP_X		0x81ec	/* txop for legacy non-qos */
150572ff6f6SMatthew Dillon #define	AR_TXOP_0_3		0x81f0	/* txop for various tid's */
151572ff6f6SMatthew Dillon #define	AR_TXOP_4_7		0x81f4
152572ff6f6SMatthew Dillon #define	AR_TXOP_8_11		0x81f8
153572ff6f6SMatthew Dillon #define	AR_TXOP_12_15		0x81fc
154572ff6f6SMatthew Dillon /* generic timers based on tsf - all uS */
155572ff6f6SMatthew Dillon #define	AR_NEXT_TBTT		0x8200
156572ff6f6SMatthew Dillon #define	AR_NEXT_DBA		0x8204
157572ff6f6SMatthew Dillon #define	AR_NEXT_SWBA		0x8208
158572ff6f6SMatthew Dillon #define	AR_NEXT_CFP		0x8208
159572ff6f6SMatthew Dillon #define	AR_NEXT_HCF		0x820C
160572ff6f6SMatthew Dillon #define	AR_NEXT_TIM		0x8210
161572ff6f6SMatthew Dillon #define	AR_NEXT_DTIM		0x8214
162572ff6f6SMatthew Dillon #define	AR_NEXT_QUIET		0x8218
163572ff6f6SMatthew Dillon #define	AR_NEXT_NDP		0x821C
164572ff6f6SMatthew Dillon #define	AR5416_BEACON_PERIOD	0x8220
165572ff6f6SMatthew Dillon #define	AR_DBA_PERIOD		0x8224
166572ff6f6SMatthew Dillon #define	AR_SWBA_PERIOD		0x8228
167572ff6f6SMatthew Dillon #define	AR_HCF_PERIOD		0x822C
168572ff6f6SMatthew Dillon #define	AR_TIM_PERIOD		0x8230
169572ff6f6SMatthew Dillon #define	AR_DTIM_PERIOD		0x8234
170572ff6f6SMatthew Dillon #define	AR_QUIET_PERIOD		0x8238
171572ff6f6SMatthew Dillon #define	AR_NDP_PERIOD		0x823C
172572ff6f6SMatthew Dillon #define	AR_TIMER_MODE		0x8240
173572ff6f6SMatthew Dillon #define	AR_SLP32_MODE		0x8244
174572ff6f6SMatthew Dillon #define	AR_SLP32_WAKE		0x8248
175572ff6f6SMatthew Dillon #define	AR_SLP32_INC		0x824c
176572ff6f6SMatthew Dillon #define	AR_SLP_CNT		0x8250	/* 32kHz cycles with mac asleep */
177572ff6f6SMatthew Dillon #define	AR_SLP_CYCLE_CNT	0x8254	/* absolute number of 32kHz cycles */
178572ff6f6SMatthew Dillon #define	AR_SLP_MIB_CTRL		0x8258
179572ff6f6SMatthew Dillon #define	AR_2040_MODE		0x8318
180572ff6f6SMatthew Dillon #define	AR_EXTRCCNT		0x8328	/* extension channel rx clear count */
181572ff6f6SMatthew Dillon #define	AR_SELFGEN_MASK		0x832c	/* rx and cal chain masks */
182572ff6f6SMatthew Dillon #define	AR_PHY_ERR_MASK_REG	0x8338
183572ff6f6SMatthew Dillon #define	AR_PCU_TXBUF_CTRL	0x8340
184572ff6f6SMatthew Dillon #define	AR_PCU_MISC_MODE2	0x8344
185572ff6f6SMatthew Dillon 
186572ff6f6SMatthew Dillon /* DMA & PCI Registers in PCI space (usable during sleep)*/
187572ff6f6SMatthew Dillon #define	AR_RC_AHB		0x00000001	/* AHB reset */
188572ff6f6SMatthew Dillon #define	AR_RC_APB		0x00000002	/* APB reset */
189572ff6f6SMatthew Dillon #define	AR_RC_HOSTIF		0x00000100	/* host interface reset */
190572ff6f6SMatthew Dillon 
191572ff6f6SMatthew Dillon #define	AR_MIRT_VAL		0x0000ffff	/* in uS */
192572ff6f6SMatthew Dillon #define	AR_MIRT_VAL_S		16
193572ff6f6SMatthew Dillon 
194572ff6f6SMatthew Dillon #define	AR_TIMT_LAST		0x0000ffff	/* Last packet threshold */
195572ff6f6SMatthew Dillon #define	AR_TIMT_LAST_S		0
196572ff6f6SMatthew Dillon #define	AR_TIMT_FIRST		0xffff0000	/* First packet threshold */
197572ff6f6SMatthew Dillon #define	AR_TIMT_FIRST_S		16
198572ff6f6SMatthew Dillon 
199572ff6f6SMatthew Dillon #define	AR_RIMT_LAST		0x0000ffff	/* Last packet threshold */
200572ff6f6SMatthew Dillon #define	AR_RIMT_LAST_S		0
201572ff6f6SMatthew Dillon #define	AR_RIMT_FIRST		0xffff0000	/* First packet threshold */
202572ff6f6SMatthew Dillon #define	AR_RIMT_FIRST_S		16
203572ff6f6SMatthew Dillon 
204572ff6f6SMatthew Dillon #define	AR_GTXTO_TIMEOUT_COUNTER    0x0000FFFF  // Mask for timeout counter (in TUs)
205572ff6f6SMatthew Dillon #define	AR_GTXTO_TIMEOUT_LIMIT      0xFFFF0000  // Mask for timeout limit (in  TUs)
206572ff6f6SMatthew Dillon #define	AR_GTXTO_TIMEOUT_LIMIT_S    16      // Shift for timeout limit
207572ff6f6SMatthew Dillon 
208572ff6f6SMatthew Dillon #define	AR_GTTM_USEC          0x00000001 // usec strobe
209572ff6f6SMatthew Dillon #define	AR_GTTM_IGNORE_IDLE   0x00000002 // ignore channel idle
210572ff6f6SMatthew Dillon #define	AR_GTTM_RESET_IDLE    0x00000004 // reset counter on channel idle low
211572ff6f6SMatthew Dillon #define	AR_GTTM_CST_USEC      0x00000008 // CST usec strobe
212572ff6f6SMatthew Dillon 
213572ff6f6SMatthew Dillon #define	AR_CST_TIMEOUT_COUNTER    0x0000FFFF  // Mask for timeout counter (in TUs)
214572ff6f6SMatthew Dillon #define	AR_CST_TIMEOUT_LIMIT      0xFFFF0000  // Mask for timeout limit (in  TUs)
215572ff6f6SMatthew Dillon #define	AR_CST_TIMEOUT_LIMIT_S    16      // Shift for timeout limit
216572ff6f6SMatthew Dillon 
217572ff6f6SMatthew Dillon /* MAC tx DMA size config  */
218572ff6f6SMatthew Dillon #define	AR_TXCFG_DMASZ_MASK	0x00000003
219572ff6f6SMatthew Dillon #define	AR_TXCFG_DMASZ_4B	0
220572ff6f6SMatthew Dillon #define	AR_TXCFG_DMASZ_8B	1
221572ff6f6SMatthew Dillon #define	AR_TXCFG_DMASZ_16B	2
222572ff6f6SMatthew Dillon #define	AR_TXCFG_DMASZ_32B	3
223572ff6f6SMatthew Dillon #define	AR_TXCFG_DMASZ_64B	4
224572ff6f6SMatthew Dillon #define	AR_TXCFG_DMASZ_128B	5
225572ff6f6SMatthew Dillon #define	AR_TXCFG_DMASZ_256B	6
226572ff6f6SMatthew Dillon #define	AR_TXCFG_DMASZ_512B	7
227572ff6f6SMatthew Dillon #define	AR_TXCFG_ATIM_TXPOLICY	0x00000800
228572ff6f6SMatthew Dillon 
229572ff6f6SMatthew Dillon /* MAC rx DMA size config  */
230572ff6f6SMatthew Dillon #define	AR_RXCFG_DMASZ_MASK	0x00000007
231572ff6f6SMatthew Dillon #define	AR_RXCFG_DMASZ_4B	0
232572ff6f6SMatthew Dillon #define	AR_RXCFG_DMASZ_8B	1
233572ff6f6SMatthew Dillon #define	AR_RXCFG_DMASZ_16B	2
234572ff6f6SMatthew Dillon #define	AR_RXCFG_DMASZ_32B	3
235572ff6f6SMatthew Dillon #define	AR_RXCFG_DMASZ_64B	4
236572ff6f6SMatthew Dillon #define	AR_RXCFG_DMASZ_128B	5
237572ff6f6SMatthew Dillon #define	AR_RXCFG_DMASZ_256B	6
238572ff6f6SMatthew Dillon #define	AR_RXCFG_DMASZ_512B	7
239572ff6f6SMatthew Dillon 
240572ff6f6SMatthew Dillon /* MAC Led registers */
241572ff6f6SMatthew Dillon #define	AR_CFG_SCLK_RATE_IND	0x00000003 /* sleep clock indication */
242572ff6f6SMatthew Dillon #define	AR_CFG_SCLK_RATE_IND_S	0
243572ff6f6SMatthew Dillon #define	AR_CFG_SCLK_32MHZ	0x00000000 /* Sleep clock rate */
244572ff6f6SMatthew Dillon #define	AR_CFG_SCLK_4MHZ	0x00000001 /* Sleep clock rate */
245572ff6f6SMatthew Dillon #define	AR_CFG_SCLK_1MHZ	0x00000002 /* Sleep clock rate */
246572ff6f6SMatthew Dillon #define	AR_CFG_SCLK_32KHZ	0x00000003 /* Sleep clock rate */
247572ff6f6SMatthew Dillon #define	AR_MAC_LED_BLINK_SLOW	0x00000008	/* LED slowest blink rate mode */
248572ff6f6SMatthew Dillon #define	AR_MAC_LED_BLINK_THRESH_SEL 0x00000070	/* LED blink threshold select */
249572ff6f6SMatthew Dillon #define	AR_MAC_LED_MODE		0x00000380	/* LED mode select */
250572ff6f6SMatthew Dillon #define	AR_MAC_LED_MODE_S	7
251572ff6f6SMatthew Dillon #define	AR_MAC_LED_MODE_PROP	0	/* Blink prop to filtered tx/rx */
252572ff6f6SMatthew Dillon #define	AR_MAC_LED_MODE_RPROP	1	/* Blink prop to unfiltered tx/rx */
253572ff6f6SMatthew Dillon #define	AR_MAC_LED_MODE_SPLIT	2	/* Blink power for tx/net for rx */
254572ff6f6SMatthew Dillon #define	AR_MAC_LED_MODE_RAND	3	/* Blink randomly */
255572ff6f6SMatthew Dillon #define	AR_MAC_LED_MODE_POWON	5	/* Power LED on (s/w control) */
256572ff6f6SMatthew Dillon #define	AR_MAC_LED_MODE_NETON	6	/* Network LED on (s/w control) */
257572ff6f6SMatthew Dillon #define	AR_MAC_LED_ASSOC	0x00000c00
258572ff6f6SMatthew Dillon #define	AR_MAC_LED_ASSOC_NONE	0x0	/* STA is not associated or trying */
259572ff6f6SMatthew Dillon #define	AR_MAC_LED_ASSOC_ACTIVE	0x1	/* STA is associated */
260572ff6f6SMatthew Dillon #define	AR_MAC_LED_ASSOC_PEND	0x2	/* STA is trying to associate */
261572ff6f6SMatthew Dillon #define	AR_MAC_LED_ASSOC_S	10
262572ff6f6SMatthew Dillon 
263572ff6f6SMatthew Dillon #define	AR_WA_BIT6		0x00000040
264572ff6f6SMatthew Dillon #define	AR_WA_BIT7		0x00000080
265572ff6f6SMatthew Dillon #define	AR_WA_D3_L1_DISABLE	0x00004000	/* */
266572ff6f6SMatthew Dillon #define	AR_WA_UNTIE_RESET_EN	0x00008000	/* ena PCI reset to POR */
267572ff6f6SMatthew Dillon #define	AR_WA_RESET_EN		0x00040000	/* ena AR_WA_UNTIE_RESET_EN */
268572ff6f6SMatthew Dillon #define	AR_WA_ANALOG_SHIFT	0x00100000
269572ff6f6SMatthew Dillon #define	AR_WA_POR_SHORT		0x00200000	/* PCIE phy reset control */
270572ff6f6SMatthew Dillon #define	AR_WA_BIT22		0x00400000
271572ff6f6SMatthew Dillon #define	AR_WA_BIT23		0x00800000
272572ff6f6SMatthew Dillon 
273572ff6f6SMatthew Dillon #define	AR_WA_DEFAULT		0x0000073f
274572ff6f6SMatthew Dillon #define	AR9280_WA_DEFAULT	0x0040073b	/* disable bit 2, see commit */
275572ff6f6SMatthew Dillon #define	AR9285_WA_DEFAULT	0x004a05cb
276572ff6f6SMatthew Dillon 
277572ff6f6SMatthew Dillon #define	AR_PCIE_PM_CTRL_ENA	0x00080000
278572ff6f6SMatthew Dillon 
279572ff6f6SMatthew Dillon #define	AR_AHB_EXACT_WR_EN	0x00000000	/* write exact bytes */
280572ff6f6SMatthew Dillon #define	AR_AHB_BUF_WR_EN	0x00000001	/* buffer write up to cacheline*/
281572ff6f6SMatthew Dillon #define	AR_AHB_EXACT_RD_EN	0x00000000	/* read exact bytes */
282572ff6f6SMatthew Dillon #define	AR_AHB_CACHELINE_RD_EN	0x00000002	/* read up to end of cacheline */
283572ff6f6SMatthew Dillon #define	AR_AHB_PREFETCH_RD_EN	0x00000004	/* prefetch up to page boundary*/
284572ff6f6SMatthew Dillon #define	AR_AHB_PAGE_SIZE_1K	0x00000000	/* set page-size as 1k */
285572ff6f6SMatthew Dillon #define	AR_AHB_PAGE_SIZE_2K	0x00000008	/* set page-size as 2k */
286572ff6f6SMatthew Dillon #define	AR_AHB_PAGE_SIZE_4K	0x00000010	/* set page-size as 4k */
287572ff6f6SMatthew Dillon /* Kiwi */
288572ff6f6SMatthew Dillon #define	AR_AHB_CUSTOM_BURST_EN	0x000000C0      /* set Custom Burst Mode */
289572ff6f6SMatthew Dillon #define	AR_AHB_CUSTOM_BURST_EN_S		6	/* set Custom Burst Mode */
290572ff6f6SMatthew Dillon #define	AR_AHB_CUSTOM_BURST_ASYNC_FIFO_VAL	3	/* set both bits in Async FIFO mode */
291572ff6f6SMatthew Dillon 
292572ff6f6SMatthew Dillon /* MAC PCU Registers */
293572ff6f6SMatthew Dillon #define	AR_STA_ID1_PRESERVE_SEQNUM	0x20000000 /* Don't replace seq num */
294572ff6f6SMatthew Dillon 
295572ff6f6SMatthew Dillon /* Extended PCU DIAG_SW control fields */
296572ff6f6SMatthew Dillon #define	AR_DIAG_DUAL_CHAIN_INFO	0x01000000	/* dual chain channel info */
297572ff6f6SMatthew Dillon #define	AR_DIAG_RX_ABORT	0x02000000	/* abort rx */
298572ff6f6SMatthew Dillon #define	AR_DIAG_SATURATE_CCNT	0x04000000	/* sat. cycle cnts (no shift) */
299572ff6f6SMatthew Dillon #define	AR_DIAG_OBS_PT_SEL2	0x08000000	/* observation point sel */
300572ff6f6SMatthew Dillon #define	AR_DIAG_RXCLEAR_CTL_LOW	0x10000000	/* force rx_clear(ctl) low/busy */
301572ff6f6SMatthew Dillon #define	AR_DIAG_RXCLEAR_EXT_LOW	0x20000000	/* force rx_clear(ext) low/busy */
302572ff6f6SMatthew Dillon 
303572ff6f6SMatthew Dillon #define	AR_TXOP_X_VAL	0x000000FF
304572ff6f6SMatthew Dillon 
305572ff6f6SMatthew Dillon #define	AR_RESET_TSF_ONCE	0x01000000	/* reset tsf once; self-clears*/
306572ff6f6SMatthew Dillon 
307572ff6f6SMatthew Dillon /* Interrupts */
308572ff6f6SMatthew Dillon #define	AR_ISR_TXMINTR		0x00080000	/* Maximum interrupt tx rate */
309572ff6f6SMatthew Dillon #define	AR_ISR_RXMINTR		0x01000000	/* Maximum interrupt rx rate */
310572ff6f6SMatthew Dillon #define	AR_ISR_GENTMR		0x10000000	/* OR of generic timer bits in S5 */
311572ff6f6SMatthew Dillon #define	AR_ISR_TXINTM		0x40000000	/* Tx int after mitigation */
312572ff6f6SMatthew Dillon #define	AR_ISR_RXINTM		0x80000000	/* Rx int after mitigation */
313572ff6f6SMatthew Dillon 
314572ff6f6SMatthew Dillon #define	AR_ISR_S2_CST		0x00400000	/* Carrier sense timeout */
315572ff6f6SMatthew Dillon #define	AR_ISR_S2_GTT		0x00800000	/* Global transmit timeout */
316572ff6f6SMatthew Dillon #define	AR_ISR_S2_TSFOOR	0x40000000	/* RX TSF out of range */
317572ff6f6SMatthew Dillon 
318572ff6f6SMatthew Dillon #define	AR_ISR_S5		0x0098
319572ff6f6SMatthew Dillon #define	AR_ISR_S5_S		0x00d8
320572ff6f6SMatthew Dillon #define	AR_ISR_S5_GENTIMER7	0x00000080 // Mask for timer 7 trigger
321572ff6f6SMatthew Dillon #define	AR_ISR_S5_TIM_TIMER	0x00000010 // TIM Timer ISR
322572ff6f6SMatthew Dillon #define	AR_ISR_S5_DTIM_TIMER	0x00000020 // DTIM Timer ISR
323572ff6f6SMatthew Dillon #define	AR_ISR_S5_GENTIMER_TRIG	0x0000FF80 // ISR for generic timer trigger 7-15
324572ff6f6SMatthew Dillon #define	AR_ISR_S5_GENTIMER_TRIG_S	0
325572ff6f6SMatthew Dillon #define	AR_ISR_S5_GENTIMER_THRESH	0xFF800000 // ISR for generic timer threshold 7-15
326572ff6f6SMatthew Dillon #define	AR_ISR_S5_GENTIMER_THRESH_S	16
327572ff6f6SMatthew Dillon 
328572ff6f6SMatthew Dillon #define	AR_INTR_SPURIOUS	0xffffffff
329572ff6f6SMatthew Dillon #define	AR_INTR_RTC_IRQ		0x00000001	/* rtc in shutdown state */
330572ff6f6SMatthew Dillon #define	AR_INTR_MAC_IRQ		0x00000002	/* pending mac interrupt */
331572ff6f6SMatthew Dillon #define	AR_INTR_EEP_PROT_ACCESS	0x00000004	/* eeprom protected access */
332572ff6f6SMatthew Dillon #define	AR_INTR_MAC_AWAKE	0x00020000	/* mac is awake */
333572ff6f6SMatthew Dillon #define	AR_INTR_MAC_ASLEEP	0x00040000	/* mac is asleep */
334572ff6f6SMatthew Dillon 
335572ff6f6SMatthew Dillon /* Interrupt Mask Registers */
336572ff6f6SMatthew Dillon #define	AR_IMR_TXMINTR		0x00080000	/* Maximum interrupt tx rate */
337572ff6f6SMatthew Dillon #define	AR_IMR_RXMINTR		0x01000000	/* Maximum interrupt rx rate */
338572ff6f6SMatthew Dillon #define	AR_IMR_TXINTM		0x40000000	/* Tx int after mitigation */
339572ff6f6SMatthew Dillon #define	AR_IMR_RXINTM		0x80000000	/* Rx int after mitigation */
340572ff6f6SMatthew Dillon 
341572ff6f6SMatthew Dillon #define	AR_IMR_S2_CST		0x00400000	/* Carrier sense timeout */
342572ff6f6SMatthew Dillon #define	AR_IMR_S2_GTT		0x00800000	/* Global transmit timeout */
343572ff6f6SMatthew Dillon 
344572ff6f6SMatthew Dillon /* synchronous interrupt signals */
345572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_RTC_IRQ		0x00000001
346572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_MAC_IRQ		0x00000002
347572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_EEPROM_ILLEGAL_ACCESS	0x00000004
348572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_APB_TIMEOUT	0x00000008
349572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_PCI_MODE_CONFLICT	0x00000010
350572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_HOST1_FATAL	0x00000020
351572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_HOST1_PERR		0x00000040
352572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_TRCV_FIFO_PERR	0x00000080
353572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_RADM_CPL_EP	0x00000100
354572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_RADM_CPL_DLLP_ABORT	0x00000200
355572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_RADM_CPL_TLP_ABORT	0x00000400
356572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_RADM_CPL_ECRC_ERR	0x00000800
357572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_RADM_CPL_TIMEOUT	0x00001000
358572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_LOCAL_TIMEOUT	0x00002000
359572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_PM_ACCESS		0x00004000
360572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_MAC_AWAKE		0x00008000
361572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_MAC_ASLEEP		0x00010000
362572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_MAC_SLEEP_ACCESS	0x00020000
363572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_ALL		0x0003FFFF
364572ff6f6SMatthew Dillon 
365572ff6f6SMatthew Dillon /* default synchronous interrupt signals enabled */
366572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_DEFAULT \
367572ff6f6SMatthew Dillon 	(AR_INTR_SYNC_HOST1_FATAL | AR_INTR_SYNC_HOST1_PERR | \
368572ff6f6SMatthew Dillon 	 AR_INTR_SYNC_RADM_CPL_EP | AR_INTR_SYNC_RADM_CPL_DLLP_ABORT | \
369572ff6f6SMatthew Dillon 	 AR_INTR_SYNC_RADM_CPL_TLP_ABORT | AR_INTR_SYNC_RADM_CPL_ECRC_ERR | \
370572ff6f6SMatthew Dillon 	 AR_INTR_SYNC_RADM_CPL_TIMEOUT | AR_INTR_SYNC_LOCAL_TIMEOUT | \
371572ff6f6SMatthew Dillon 	 AR_INTR_SYNC_MAC_SLEEP_ACCESS)
372572ff6f6SMatthew Dillon 
373572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_MASK_GPIO		0xFFFC0000
374572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_MASK_GPIO_S	18
375572ff6f6SMatthew Dillon 
376572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_ENABLE_GPIO	0xFFFC0000
377572ff6f6SMatthew Dillon #define	AR_INTR_SYNC_ENABLE_GPIO_S	18
378572ff6f6SMatthew Dillon 
379572ff6f6SMatthew Dillon #define	AR_INTR_ASYNC_MASK_GPIO		0xFFFC0000	/* async int mask */
380572ff6f6SMatthew Dillon #define	AR_INTR_ASYNC_MASK_GPIO_S	18
381572ff6f6SMatthew Dillon 
382572ff6f6SMatthew Dillon #define	AR_INTR_ASYNC_CAUSE_GPIO	0xFFFC0000	/* GPIO interrupts */
383572ff6f6SMatthew Dillon #define	AR_INTR_ASYNC_USED	(AR_INTR_MAC_IRQ | AR_INTR_ASYNC_CAUSE_GPIO)
384572ff6f6SMatthew Dillon 
385572ff6f6SMatthew Dillon #define	AR_INTR_ASYNC_ENABLE_GPIO	0xFFFC0000	/* enable interrupts */
386572ff6f6SMatthew Dillon #define	AR_INTR_ASYNC_ENABLE_GPIO_S	18
387572ff6f6SMatthew Dillon 
388572ff6f6SMatthew Dillon /* RTC registers */
389572ff6f6SMatthew Dillon #define	AR_RTC_RC_M		0x00000003
390572ff6f6SMatthew Dillon #define	AR_RTC_RC_MAC_WARM	0x00000001
391572ff6f6SMatthew Dillon #define	AR_RTC_RC_MAC_COLD	0x00000002
392572ff6f6SMatthew Dillon #ifdef	AH_SUPPORT_AR9130
393572ff6f6SMatthew Dillon #define AR_RTC_RC_COLD_RESET    0x00000004
394572ff6f6SMatthew Dillon #define AR_RTC_RC_WARM_RESET    0x00000008
395572ff6f6SMatthew Dillon #endif	/* AH_SUPPORT_AR9130 */
396572ff6f6SMatthew Dillon #define	AR_RTC_PLL_DIV		0x0000001f
397572ff6f6SMatthew Dillon #define	AR_RTC_PLL_DIV_S	0
398572ff6f6SMatthew Dillon #define	AR_RTC_PLL_DIV2		0x00000020
399572ff6f6SMatthew Dillon #define	AR_RTC_PLL_REFDIV_5	0x000000c0
400572ff6f6SMatthew Dillon 
401572ff6f6SMatthew Dillon #define	AR_RTC_SOWL_PLL_DIV		0x000003ff
402572ff6f6SMatthew Dillon #define	AR_RTC_SOWL_PLL_DIV_S		0
403572ff6f6SMatthew Dillon #define	AR_RTC_SOWL_PLL_REFDIV		0x00003C00
404572ff6f6SMatthew Dillon #define	AR_RTC_SOWL_PLL_REFDIV_S	10
405572ff6f6SMatthew Dillon #define	AR_RTC_SOWL_PLL_CLKSEL		0x0000C000
406572ff6f6SMatthew Dillon #define	AR_RTC_SOWL_PLL_CLKSEL_S	14
407572ff6f6SMatthew Dillon 
408572ff6f6SMatthew Dillon #define	AR_RTC_RESET_EN		0x00000001	/* Reset RTC bit */
409572ff6f6SMatthew Dillon 
410572ff6f6SMatthew Dillon #define	AR_RTC_PM_STATUS_M	0x0000000f	/* Pwr Mgmt Status */
411572ff6f6SMatthew Dillon #ifdef	AH_SUPPORT_AR9130
412572ff6f6SMatthew Dillon #define	AR_RTC_STATUS_M		0x0000000f	/* RTC Status */
413572ff6f6SMatthew Dillon #else
414572ff6f6SMatthew Dillon #define	AR_RTC_STATUS_M		0x0000003f	/* RTC Status */
415572ff6f6SMatthew Dillon #endif	/* AH_SUPPORT_AR9130 */
416572ff6f6SMatthew Dillon #define	AR_RTC_STATUS_SHUTDOWN	0x00000001
417572ff6f6SMatthew Dillon #define	AR_RTC_STATUS_ON	0x00000002
418572ff6f6SMatthew Dillon #define	AR_RTC_STATUS_SLEEP	0x00000004
419572ff6f6SMatthew Dillon #define	AR_RTC_STATUS_WAKEUP	0x00000008
420572ff6f6SMatthew Dillon #define	AR_RTC_STATUS_COLDRESET	0x00000010	/* Not currently used */
421572ff6f6SMatthew Dillon #define	AR_RTC_STATUS_PLLCHANGE	0x00000020	/* Not currently used */
422572ff6f6SMatthew Dillon 
423572ff6f6SMatthew Dillon #define	AR_RTC_SLEEP_DERIVED_CLK	0x2
424572ff6f6SMatthew Dillon 
425572ff6f6SMatthew Dillon #define	AR_RTC_FORCE_WAKE_EN	0x00000001	/* enable force wake */
426572ff6f6SMatthew Dillon #define	AR_RTC_FORCE_WAKE_ON_INT 0x00000002	/* auto-wake on MAC interrupt */
427572ff6f6SMatthew Dillon 
428572ff6f6SMatthew Dillon #define	AR_RTC_PLL_CLKSEL	0x00000300
429572ff6f6SMatthew Dillon #define	AR_RTC_PLL_CLKSEL_S	8
430572ff6f6SMatthew Dillon 
431572ff6f6SMatthew Dillon /* AR9280: rf long shift registers */
432572ff6f6SMatthew Dillon #define	AR_AN_RF2G1_CH0         0x7810
433572ff6f6SMatthew Dillon #define	AR_AN_RF5G1_CH0         0x7818
434572ff6f6SMatthew Dillon #define	AR_AN_RF2G1_CH1         0x7834
435572ff6f6SMatthew Dillon #define	AR_AN_RF5G1_CH1         0x783C
436572ff6f6SMatthew Dillon #define	AR_AN_TOP2		0x7894
437572ff6f6SMatthew Dillon #define	AR_AN_SYNTH9            0x7868
438572ff6f6SMatthew Dillon 
439572ff6f6SMatthew Dillon #define	AR_AN_RF2G1_CH0_OB      0x03800000
440572ff6f6SMatthew Dillon #define	AR_AN_RF2G1_CH0_OB_S    23
441572ff6f6SMatthew Dillon #define	AR_AN_RF2G1_CH0_DB      0x1C000000
442572ff6f6SMatthew Dillon #define	AR_AN_RF2G1_CH0_DB_S    26
443572ff6f6SMatthew Dillon 
444572ff6f6SMatthew Dillon #define	AR_AN_RF5G1_CH0_OB5     0x00070000
445572ff6f6SMatthew Dillon #define	AR_AN_RF5G1_CH0_OB5_S   16
446572ff6f6SMatthew Dillon #define	AR_AN_RF5G1_CH0_DB5     0x00380000
447572ff6f6SMatthew Dillon #define	AR_AN_RF5G1_CH0_DB5_S   19
448572ff6f6SMatthew Dillon 
449572ff6f6SMatthew Dillon #define	AR_AN_RF2G1_CH1_OB      0x03800000
450572ff6f6SMatthew Dillon #define	AR_AN_RF2G1_CH1_OB_S    23
451572ff6f6SMatthew Dillon #define	AR_AN_RF2G1_CH1_DB      0x1C000000
452572ff6f6SMatthew Dillon #define	AR_AN_RF2G1_CH1_DB_S    26
453572ff6f6SMatthew Dillon 
454572ff6f6SMatthew Dillon #define	AR_AN_RF5G1_CH1_OB5     0x00070000
455572ff6f6SMatthew Dillon #define	AR_AN_RF5G1_CH1_OB5_S   16
456572ff6f6SMatthew Dillon #define	AR_AN_RF5G1_CH1_DB5     0x00380000
457572ff6f6SMatthew Dillon #define	AR_AN_RF5G1_CH1_DB5_S   19
458572ff6f6SMatthew Dillon 
459572ff6f6SMatthew Dillon #define AR_AN_TOP1                  0x7890
460572ff6f6SMatthew Dillon #define AR_AN_TOP1_DACIPMODE        0x00040000
461572ff6f6SMatthew Dillon #define AR_AN_TOP1_DACIPMODE_S      18
462572ff6f6SMatthew Dillon 
463572ff6f6SMatthew Dillon #define	AR_AN_TOP2_XPABIAS_LVL      0xC0000000
464572ff6f6SMatthew Dillon #define	AR_AN_TOP2_XPABIAS_LVL_S    30
465572ff6f6SMatthew Dillon #define	AR_AN_TOP2_LOCALBIAS        0x00200000
466572ff6f6SMatthew Dillon #define	AR_AN_TOP2_LOCALBIAS_S      21
467572ff6f6SMatthew Dillon #define	AR_AN_TOP2_PWDCLKIND        0x00400000
468572ff6f6SMatthew Dillon #define	AR_AN_TOP2_PWDCLKIND_S      22
469572ff6f6SMatthew Dillon 
470572ff6f6SMatthew Dillon #define	AR_AN_SYNTH9_REFDIVA    0xf8000000
471572ff6f6SMatthew Dillon #define	AR_AN_SYNTH9_REFDIVA_S  27
472572ff6f6SMatthew Dillon 
473572ff6f6SMatthew Dillon #define	AR9271_AN_RF2G6_OFFS	0x07f00000
474572ff6f6SMatthew Dillon #define	AR9271_AN_RF2G6_OFFS_S	20
475572ff6f6SMatthew Dillon 
476572ff6f6SMatthew Dillon /* Sleep control */
477572ff6f6SMatthew Dillon #define	AR5416_SLEEP1_ASSUME_DTIM	0x00080000
478572ff6f6SMatthew Dillon #define	AR5416_SLEEP1_CAB_TIMEOUT	0xFFE00000	/* Cab timeout (TU) */
479d98a0bcfSMatthew Dillon #define	AR5416_SLEEP1_CAB_TIMEOUT_S	21
480572ff6f6SMatthew Dillon 
481572ff6f6SMatthew Dillon #define	AR5416_SLEEP2_BEACON_TIMEOUT	0xFFE00000	/* Beacon timeout (TU)*/
482d98a0bcfSMatthew Dillon #define	AR5416_SLEEP2_BEACON_TIMEOUT_S	21
483572ff6f6SMatthew Dillon 
484572ff6f6SMatthew Dillon /* Sleep Registers */
485572ff6f6SMatthew Dillon #define	AR_SLP32_HALFCLK_LATENCY      0x000FFFFF	/* rising <-> falling edge */
486572ff6f6SMatthew Dillon #define	AR_SLP32_ENA		0x00100000
487572ff6f6SMatthew Dillon #define	AR_SLP32_TSF_WRITE_STATUS      0x00200000	/* tsf update in progress */
488572ff6f6SMatthew Dillon 
489572ff6f6SMatthew Dillon #define	AR_SLP32_WAKE_XTL_TIME	0x0000FFFF	/* time to wake crystal */
490572ff6f6SMatthew Dillon 
491572ff6f6SMatthew Dillon #define	AR_SLP32_TST_INC	0x000FFFFF
492572ff6f6SMatthew Dillon 
493572ff6f6SMatthew Dillon #define	AR_SLP_MIB_CLEAR	0x00000001	/* clear pending */
494572ff6f6SMatthew Dillon #define	AR_SLP_MIB_PENDING	0x00000002	/* clear counters */
495572ff6f6SMatthew Dillon 
496572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_TBTT		0x00000001
497572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_DBA		0x00000002
498572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_SWBA		0x00000004
499572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_HCF		0x00000008
500572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_TIM		0x00000010
501572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_DTIM		0x00000020
502572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_QUIET		0x00000040
503572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_NDP		0x00000080
504572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_OVERFLOW_INDEX	0x00000700
505572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_OVERFLOW_INDEX_S	8
506572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_THRESH		0xFFFFF000
507572ff6f6SMatthew Dillon #define	AR_TIMER_MODE_THRESH_S		12
508572ff6f6SMatthew Dillon 
509572ff6f6SMatthew Dillon /* PCU Misc modes */
510572ff6f6SMatthew Dillon #define	AR_PCU_FORCE_BSSID_MATCH	0x00000001 /* force bssid to match */
511572ff6f6SMatthew Dillon #define	AR_PCU_MIC_NEW_LOC_ENA		0x00000004 /* tx/rx mic keys together */
512572ff6f6SMatthew Dillon #define	AR_PCU_TX_ADD_TSF		0x00000008 /* add tx_tsf + int_tsf */
513572ff6f6SMatthew Dillon #define	AR_PCU_CCK_SIFS_MODE		0x00000010 /* assume 11b sifs */
514572ff6f6SMatthew Dillon #define	AR_PCU_RX_ANT_UPDT		0x00000800 /* KC_RX_ANT_UPDATE */
515572ff6f6SMatthew Dillon #define	AR_PCU_TXOP_TBTT_LIMIT_ENA	0x00001000 /* enforce txop / tbtt */
516572ff6f6SMatthew Dillon #define	AR_PCU_MISS_BCN_IN_SLEEP	0x00004000 /* count bmiss's when sleeping */
517572ff6f6SMatthew Dillon #define	AR_PCU_BUG_12306_FIX_ENA	0x00020000 /* use rx_clear to count sifs */
518572ff6f6SMatthew Dillon #define	AR_PCU_FORCE_QUIET_COLL		0x00040000 /* kill xmit for channel change */
519572ff6f6SMatthew Dillon #define	AR_PCU_BT_ANT_PREVENT_RX	0x00100000
520572ff6f6SMatthew Dillon #define	AR_PCU_BT_ANT_PREVENT_RX_S	20
521572ff6f6SMatthew Dillon #define	AR_PCU_TBTT_PROTECT		0x00200000 /* no xmit up to tbtt+20 uS */
522572ff6f6SMatthew Dillon #define	AR_PCU_CLEAR_VMF		0x01000000 /* clear vmf mode (fast cc)*/
523572ff6f6SMatthew Dillon #define	AR_PCU_CLEAR_BA_VALID		0x04000000 /* clear ba state */
524572ff6f6SMatthew Dillon #define	AR_PCU_SEL_EVM			0x08000000 /* select EVM data or PLCP header */
525572ff6f6SMatthew Dillon 
526572ff6f6SMatthew Dillon #define	AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE		0x00000002
527572ff6f6SMatthew Dillon #define	AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT	0x00000004
528572ff6f6SMatthew Dillon /*
529572ff6f6SMatthew Dillon  * This bit enables the Multicast search based on both MAC Address and Key ID.
530572ff6f6SMatthew Dillon  * If bit is 0, then Multicast search is based on MAC address only.
531572ff6f6SMatthew Dillon  * For Merlin and above only.
532572ff6f6SMatthew Dillon  */
533572ff6f6SMatthew Dillon #define	AR_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE	0x00000040
534572ff6f6SMatthew Dillon #define	AR_PCU_MISC_MODE2_ENABLE_AGGWEP	0x00020000	/* Kiwi or later? */
535572ff6f6SMatthew Dillon #define	AR_PCU_MISC_MODE2_HWWAR1	0x00100000
536572ff6f6SMatthew Dillon #define	AR_PCU_MISC_MODE2_HWWAR2	0x02000000
537572ff6f6SMatthew Dillon 
538572ff6f6SMatthew Dillon /* For Kiwi */
539572ff6f6SMatthew Dillon #define	AR_MAC_PCU_ASYNC_FIFO_REG3		0x8358
540572ff6f6SMatthew Dillon #define	AR_MAC_PCU_ASYNC_FIFO_REG3_DATAPATH_SEL	0x00000400
541572ff6f6SMatthew Dillon #define	AR_MAC_PCU_ASYNC_FIFO_REG3_SOFT_RESET	0x80000000
542572ff6f6SMatthew Dillon 
543572ff6f6SMatthew Dillon /* TSF2. For Kiwi only */
544572ff6f6SMatthew Dillon #define	AR_TSF2_L32			0x8390
545572ff6f6SMatthew Dillon #define	AR_TSF2_U32			0x8394
546572ff6f6SMatthew Dillon 
547572ff6f6SMatthew Dillon /* MAC Direct Connect Control. For Kiwi only */
548572ff6f6SMatthew Dillon #define	AR_DIRECT_CONNECT		0x83A0
549572ff6f6SMatthew Dillon #define	AR_DC_AP_STA_EN			0x00000001
550572ff6f6SMatthew Dillon 
551572ff6f6SMatthew Dillon /* GPIO Interrupt */
552572ff6f6SMatthew Dillon #define	AR_INTR_GPIO		0x3FF00000	/* gpio interrupted */
553572ff6f6SMatthew Dillon #define	AR_INTR_GPIO_S		20
554572ff6f6SMatthew Dillon 
555572ff6f6SMatthew Dillon #define	AR_GPIO_OUT_CTRL	0x000003FF	/* 0 = out, 1 = in */
556572ff6f6SMatthew Dillon #define	AR_GPIO_OUT_VAL		0x000FFC00
557572ff6f6SMatthew Dillon #define	AR_GPIO_OUT_VAL_S	10
558572ff6f6SMatthew Dillon #define	AR_GPIO_INTR_CTRL	0x3FF00000
559572ff6f6SMatthew Dillon #define	AR_GPIO_INTR_CTRL_S	20
560572ff6f6SMatthew Dillon 
561572ff6f6SMatthew Dillon #define	AR_GPIO_IN_VAL		0x0FFFC000	/* pre-9280 */
562572ff6f6SMatthew Dillon #define	AR_GPIO_IN_VAL_S	14
563572ff6f6SMatthew Dillon #define	AR928X_GPIO_IN_VAL	0x000FFC00
564572ff6f6SMatthew Dillon #define	AR928X_GPIO_IN_VAL_S	10
565572ff6f6SMatthew Dillon #define	AR9285_GPIO_IN_VAL	0x00FFF000
566572ff6f6SMatthew Dillon #define	AR9285_GPIO_IN_VAL_S	12
567572ff6f6SMatthew Dillon #define	AR9287_GPIO_IN_VAL	0x003FF800
568572ff6f6SMatthew Dillon #define	AR9287_GPIO_IN_VAL_S	11
569572ff6f6SMatthew Dillon 
570572ff6f6SMatthew Dillon #define	AR_GPIO_OE_OUT_DRV	0x3	/* 2 bit mask shifted by 2*bitpos */
571572ff6f6SMatthew Dillon #define	AR_GPIO_OE_OUT_DRV_NO	0x0	/* tristate */
572572ff6f6SMatthew Dillon #define	AR_GPIO_OE_OUT_DRV_LOW	0x1	/* drive if low */
573572ff6f6SMatthew Dillon #define	AR_GPIO_OE_OUT_DRV_HI	0x2	/* drive if high */
574572ff6f6SMatthew Dillon #define	AR_GPIO_OE_OUT_DRV_ALL	0x3	/* drive always */
575572ff6f6SMatthew Dillon 
576572ff6f6SMatthew Dillon #define	AR_GPIO_INTR_POL_VAL	0x1FFF
577572ff6f6SMatthew Dillon #define	AR_GPIO_INTR_POL_VAL_S	0
578572ff6f6SMatthew Dillon 
579572ff6f6SMatthew Dillon #define	AR_GPIO_JTAG_DISABLE	0x00020000
580572ff6f6SMatthew Dillon 
581572ff6f6SMatthew Dillon #define	AR_2040_JOINED_RX_CLEAR	0x00000001	/* use ctl + ext rx_clear for cca */
582572ff6f6SMatthew Dillon 
583572ff6f6SMatthew Dillon #define	AR_PCU_TXBUF_CTRL_SIZE_MASK	0x7FF
584572ff6f6SMatthew Dillon #define	AR_PCU_TXBUF_CTRL_USABLE_SIZE	0x700
585572ff6f6SMatthew Dillon #define	AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE 0x380
586572ff6f6SMatthew Dillon 
587572ff6f6SMatthew Dillon /* IFS, SIFS, slot, etc for Async FIFO mode (Kiwi) */
588572ff6f6SMatthew Dillon #define	AR_D_GBL_IFS_SIFS_ASYNC_FIFO_DUR	0x000003AB
589572ff6f6SMatthew Dillon #define	AR_TIME_OUT_ACK_CTS_ASYNC_FIFO_DUR	0x16001D56
590572ff6f6SMatthew Dillon #define	AR_USEC_ASYNC_FIFO_DUR			0x12e00074
591572ff6f6SMatthew Dillon #define	AR_D_GBL_IFS_SLOT_ASYNC_FIFO_DUR	0x00000420
592572ff6f6SMatthew Dillon #define	AR_D_GBL_IFS_EIFS_ASYNC_FIFO_DUR	0x0000A5EB
593572ff6f6SMatthew Dillon 
594572ff6f6SMatthew Dillon /* Used by Kiwi Async FIFO */
595572ff6f6SMatthew Dillon #define	AR_MAC_PCU_LOGIC_ANALYZER		0x8264
596572ff6f6SMatthew Dillon #define	AR_MAC_PCU_LOGIC_ANALYZER_DISBUG20768	0x20000000
597572ff6f6SMatthew Dillon 
598572ff6f6SMatthew Dillon /* Eeprom defines */
599572ff6f6SMatthew Dillon #define	AR_EEPROM_STATUS_DATA_VAL           0x0000ffff
600572ff6f6SMatthew Dillon #define	AR_EEPROM_STATUS_DATA_VAL_S         0
601572ff6f6SMatthew Dillon #define	AR_EEPROM_STATUS_DATA_BUSY          0x00010000
602572ff6f6SMatthew Dillon #define	AR_EEPROM_STATUS_DATA_BUSY_ACCESS   0x00020000
603572ff6f6SMatthew Dillon #define	AR_EEPROM_STATUS_DATA_PROT_ACCESS   0x00040000
604572ff6f6SMatthew Dillon #define	AR_EEPROM_STATUS_DATA_ABSENT_ACCESS 0x00080000
605572ff6f6SMatthew Dillon 
606572ff6f6SMatthew Dillon /* K2 (9271) */
607572ff6f6SMatthew Dillon #define	AR9271_CLOCK_CONTROL		0x50040
608572ff6f6SMatthew Dillon #define	AR9271_CLOCK_SELECTION_22	0x0
609572ff6f6SMatthew Dillon #define	AR9271_CLOCK_SELECTION_88	0x1
610572ff6f6SMatthew Dillon #define	AR9271_CLOCK_SELECTION_44	0x2
611572ff6f6SMatthew Dillon #define	AR9271_CLOCK_SELECTION_117	0x4
612572ff6f6SMatthew Dillon #define	AR9271_CLOCK_SELECTION_OSC_40	0x6
613572ff6f6SMatthew Dillon #define	AR9271_CLOCK_SELECTION_RTC	0x7
614572ff6f6SMatthew Dillon #define	AR9271_SPI_SEL			0x100
615572ff6f6SMatthew Dillon #define	AR9271_UART_SEL			0x200
616572ff6f6SMatthew Dillon 
617572ff6f6SMatthew Dillon #define	AR9271_RESET_POWER_DOWN_CONTROL	0x50044
618572ff6f6SMatthew Dillon #define	AR9271_RADIO_RF_RST		0x20
619572ff6f6SMatthew Dillon #define	AR9271_GATE_MAC_CTL		0x4000
620572ff6f6SMatthew Dillon #define	AR9271_MAIN_PLL_PWD_CTL		0x40000
621572ff6f6SMatthew Dillon 
622572ff6f6SMatthew Dillon #define	AR9271_CLKMISC			0x4090
623572ff6f6SMatthew Dillon #define	AR9271_OSC_to_10M_EN		0x00000001
624572ff6f6SMatthew Dillon 
625572ff6f6SMatthew Dillon /*
626572ff6f6SMatthew Dillon  * AR5212 defines the MAC revision mask as 0xF, but both ath9k and
627572ff6f6SMatthew Dillon  * the Atheros HAL define it as 0x7.
628572ff6f6SMatthew Dillon  *
629572ff6f6SMatthew Dillon  * What this means however is AR5416 silicon revisions have
630572ff6f6SMatthew Dillon  * changed. The below macros are for what is contained in the
631572ff6f6SMatthew Dillon  * lower four bits; if the lower three bits are taken into account
632572ff6f6SMatthew Dillon  * the revisions become 1.0 => 0x0, 2.0 => 0x1, 2.2 => 0x2.
633572ff6f6SMatthew Dillon  */
634572ff6f6SMatthew Dillon 
635572ff6f6SMatthew Dillon /* These are the legacy revisions, with a four bit AR_SREV_REVISION mask */
636572ff6f6SMatthew Dillon #define	AR_SREV_REVISION_OWL_10		0x08
637572ff6f6SMatthew Dillon #define	AR_SREV_REVISION_OWL_20		0x09
638572ff6f6SMatthew Dillon #define	AR_SREV_REVISION_OWL_22		0x0a
639572ff6f6SMatthew Dillon 
640572ff6f6SMatthew Dillon #define	AR_RAD5133_SREV_MAJOR		0xc0	/* Fowl: 2+5G/3x3 */
641572ff6f6SMatthew Dillon #define	AR_RAD2133_SREV_MAJOR		0xd0	/* Fowl: 2G/3x3   */
642572ff6f6SMatthew Dillon #define	AR_RAD5122_SREV_MAJOR		0xe0	/* Fowl: 5G/2x2   */
643572ff6f6SMatthew Dillon #define	AR_RAD2122_SREV_MAJOR		0xf0	/* Fowl: 2+5G/2x2 */
644572ff6f6SMatthew Dillon 
645572ff6f6SMatthew Dillon /* Test macro for owl 1.0 */
646572ff6f6SMatthew Dillon #define	IS_5416V1(_ah)	(AR_SREV_OWL((_ah)) && AH_PRIVATE((_ah))->ah_macRev == AR_SREV_REVISION_OWL_10)
647572ff6f6SMatthew Dillon #define	IS_5416V2(_ah)	(AR_SREV_OWL((_ah)) && AH_PRIVATE((_ah))->ah_macRev >= AR_SREV_REVISION_OWL_20)
648572ff6f6SMatthew Dillon #define	IS_5416V2_2(_ah)	(AR_SREV_OWL((_ah)) && AH_PRIVATE((_ah))->ah_macRev == AR_SREV_REVISION_OWL_22)
649572ff6f6SMatthew Dillon 
650572ff6f6SMatthew Dillon /* Misc; compatibility with Atheros HAL */
651572ff6f6SMatthew Dillon #define	AR_SREV_5416_V20_OR_LATER(_ah)	(AR_SREV_HOWL((_ah)) || AR_SREV_OWL_20_OR_LATER(_ah))
652572ff6f6SMatthew Dillon #define	AR_SREV_5416_V22_OR_LATER(_ah)	(AR_SREV_HOWL((_ah)) || AR_SREV_OWL_22_OR_LATER(_ah))
653572ff6f6SMatthew Dillon 
654572ff6f6SMatthew Dillon /* Expanded Mac Silicon Rev (16 bits starting with Sowl) */
655572ff6f6SMatthew Dillon #define	AR_XSREV_ID		0xFFFFFFFF	/* Chip ID */
656572ff6f6SMatthew Dillon #define	AR_XSREV_ID_S		0
657572ff6f6SMatthew Dillon #define	AR_XSREV_VERSION	0xFFFC0000	/* Chip version */
658572ff6f6SMatthew Dillon #define	AR_XSREV_VERSION_S	18
659572ff6f6SMatthew Dillon #define	AR_XSREV_TYPE		0x0003F000	/* Chip type */
660572ff6f6SMatthew Dillon #define	AR_XSREV_TYPE_S		12
661572ff6f6SMatthew Dillon #define	AR_XSREV_TYPE_CHAIN	0x00001000	/* Chain Mode (1:3 chains,
662572ff6f6SMatthew Dillon 						 * 0:2 chains) */
663572ff6f6SMatthew Dillon #define	AR_XSREV_TYPE_HOST_MODE 0x00002000	/* Host Mode (1:PCI, 0:PCIe) */
664572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION	0x00000F00
665572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_S	8
666572ff6f6SMatthew Dillon 
667572ff6f6SMatthew Dillon #define	AR_XSREV_VERSION_OWL_PCI	0x0D
668572ff6f6SMatthew Dillon #define	AR_XSREV_VERSION_OWL_PCIE	0x0C
669572ff6f6SMatthew Dillon 
670572ff6f6SMatthew Dillon 
671572ff6f6SMatthew Dillon /*
672572ff6f6SMatthew Dillon  * These are from ath9k/Atheros and assume an AR_SREV version mask
673572ff6f6SMatthew Dillon  * of 0x07, rather than 0x0F which is being used in the FreeBSD HAL.
674572ff6f6SMatthew Dillon  * Thus, don't use these values as they're incorrect here; use
675572ff6f6SMatthew Dillon  * AR_SREV_REVISION_OWL_{10,20,22}.
676572ff6f6SMatthew Dillon  */
677572ff6f6SMatthew Dillon #if 0
678572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_OWL_10	0	/* Owl 1.0 */
679572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_OWL_20	1	/* Owl 2.0/2.1 */
680572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_OWL_22	2	/* Owl 2.2 */
681572ff6f6SMatthew Dillon #endif
682572ff6f6SMatthew Dillon 
683572ff6f6SMatthew Dillon #define	AR_XSREV_VERSION_HOWL		0x14	/* Howl (AR9130) */
684572ff6f6SMatthew Dillon #define	AR_XSREV_VERSION_SOWL		0x40	/* Sowl (AR9160) */
685572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_SOWL_10	0	/* Sowl 1.0 */
686572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_SOWL_11	1	/* Sowl 1.1 */
687572ff6f6SMatthew Dillon #define	AR_XSREV_VERSION_MERLIN		0x80	/* Merlin Version */
688572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_MERLIN_10	0	/* Merlin 1.0 */
689572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_MERLIN_20	1	/* Merlin 2.0 */
690572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_MERLIN_21	2	/* Merlin 2.1 */
691572ff6f6SMatthew Dillon #define	AR_XSREV_VERSION_KITE		0xC0	/* Kite Version */
692572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_KITE_10	0	/* Kite 1.0 */
693572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_KITE_11	1	/* Kite 1.1 */
694572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_KITE_12	2	/* Kite 1.2 */
695572ff6f6SMatthew Dillon #define	AR_XSREV_VERSION_KIWI		0x180	/* Kiwi (AR9287) */
696572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_KIWI_10	0	/* Kiwi 1.0 */
697572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_KIWI_11	1	/* Kiwi 1.1 */
698572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_KIWI_12	2	/* Kiwi 1.2 */
699572ff6f6SMatthew Dillon #define	AR_XSREV_REVISION_KIWI_13	3	/* Kiwi 1.3 */
700572ff6f6SMatthew Dillon 
701572ff6f6SMatthew Dillon /* Owl (AR5416) */
702572ff6f6SMatthew Dillon #define	AR_SREV_OWL(_ah) \
703572ff6f6SMatthew Dillon 	((AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_OWL_PCI) || \
704572ff6f6SMatthew Dillon 	 (AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_OWL_PCIE))
705572ff6f6SMatthew Dillon 
706572ff6f6SMatthew Dillon #define	AR_SREV_OWL_20_OR_LATER(_ah) \
707572ff6f6SMatthew Dillon 	((AR_SREV_OWL(_ah) &&						\
708572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev >= AR_SREV_REVISION_OWL_20) ||	\
709572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_HOWL)
710572ff6f6SMatthew Dillon 
711572ff6f6SMatthew Dillon #define	AR_SREV_OWL_22_OR_LATER(_ah) \
712572ff6f6SMatthew Dillon 	((AR_SREV_OWL(_ah) &&						\
713572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev >= AR_SREV_REVISION_OWL_22) ||	\
714572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_HOWL)
715572ff6f6SMatthew Dillon 
716572ff6f6SMatthew Dillon /* Howl (AR9130) */
717572ff6f6SMatthew Dillon 
718572ff6f6SMatthew Dillon #define AR_SREV_HOWL(_ah) \
719572ff6f6SMatthew Dillon 	(AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_HOWL)
720572ff6f6SMatthew Dillon 
721572ff6f6SMatthew Dillon #define	AR_SREV_9100(_ah)	AR_SREV_HOWL(_ah)
722572ff6f6SMatthew Dillon 
723572ff6f6SMatthew Dillon /* Sowl (AR9160) */
724572ff6f6SMatthew Dillon 
725572ff6f6SMatthew Dillon #define	AR_SREV_SOWL(_ah) \
726572ff6f6SMatthew Dillon 	(AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_SOWL)
727572ff6f6SMatthew Dillon 
728572ff6f6SMatthew Dillon #define	AR_SREV_SOWL_10_OR_LATER(_ah) \
729572ff6f6SMatthew Dillon 	(AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_SOWL)
730572ff6f6SMatthew Dillon 
731572ff6f6SMatthew Dillon #define	AR_SREV_SOWL_11(_ah) \
732572ff6f6SMatthew Dillon 	(AR_SREV_SOWL(_ah) && \
733572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_SOWL_11)
734572ff6f6SMatthew Dillon 
735572ff6f6SMatthew Dillon /* Merlin (AR9280) */
736572ff6f6SMatthew Dillon 
737572ff6f6SMatthew Dillon #define	AR_SREV_MERLIN(_ah) \
738572ff6f6SMatthew Dillon 	(AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_MERLIN)
739572ff6f6SMatthew Dillon 
740572ff6f6SMatthew Dillon #define	AR_SREV_MERLIN_10_OR_LATER(_ah)	\
741572ff6f6SMatthew Dillon 	(AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_MERLIN)
742572ff6f6SMatthew Dillon 
743572ff6f6SMatthew Dillon #define	AR_SREV_MERLIN_20(_ah) \
744572ff6f6SMatthew Dillon 	(AR_SREV_MERLIN(_ah) && \
745572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_MERLIN_20)
746572ff6f6SMatthew Dillon 
747572ff6f6SMatthew Dillon #define	AR_SREV_MERLIN_20_OR_LATER(_ah) \
748572ff6f6SMatthew Dillon 	((AH_PRIVATE((_ah))->ah_macVersion > AR_XSREV_VERSION_MERLIN) ||	\
749572ff6f6SMatthew Dillon 	 (AR_SREV_MERLIN((_ah)) &&						\
750572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_MERLIN_20))
751572ff6f6SMatthew Dillon 
752572ff6f6SMatthew Dillon /* Kite (AR9285) */
753572ff6f6SMatthew Dillon 
754572ff6f6SMatthew Dillon #define	AR_SREV_KITE(_ah) \
755572ff6f6SMatthew Dillon 	(AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_KITE)
756572ff6f6SMatthew Dillon 
757572ff6f6SMatthew Dillon #define	AR_SREV_KITE_10_OR_LATER(_ah) \
758572ff6f6SMatthew Dillon 	(AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_KITE)
759572ff6f6SMatthew Dillon 
760572ff6f6SMatthew Dillon #define	AR_SREV_KITE_11(_ah) \
761572ff6f6SMatthew Dillon 	(AR_SREV_KITE(ah) && \
762572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_KITE_11)
763572ff6f6SMatthew Dillon 
764572ff6f6SMatthew Dillon #define	AR_SREV_KITE_11_OR_LATER(_ah) \
765572ff6f6SMatthew Dillon 	((AH_PRIVATE((_ah))->ah_macVersion > AR_XSREV_VERSION_KITE) ||	\
766572ff6f6SMatthew Dillon 	 (AR_SREV_KITE((_ah)) &&					\
767572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KITE_11))
768572ff6f6SMatthew Dillon 
769572ff6f6SMatthew Dillon #define	AR_SREV_KITE_12(_ah) \
770572ff6f6SMatthew Dillon 	(AR_SREV_KITE(ah) && \
771572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_KITE_12)
772572ff6f6SMatthew Dillon 
773572ff6f6SMatthew Dillon #define	AR_SREV_KITE_12_OR_LATER(_ah) \
774572ff6f6SMatthew Dillon 	((AH_PRIVATE((_ah))->ah_macVersion > AR_XSREV_VERSION_KITE) ||	\
775572ff6f6SMatthew Dillon 	 (AR_SREV_KITE((_ah)) &&					\
776572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KITE_12))
777572ff6f6SMatthew Dillon 
778572ff6f6SMatthew Dillon #define	AR_SREV_9285E_20(_ah) \
779572ff6f6SMatthew Dillon 	(AR_SREV_KITE_12_OR_LATER(_ah) && \
780572ff6f6SMatthew Dillon 	((OS_REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1))
781572ff6f6SMatthew Dillon 
782572ff6f6SMatthew Dillon #define AR_SREV_KIWI(_ah) \
783572ff6f6SMatthew Dillon 	(AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_KIWI)
784572ff6f6SMatthew Dillon 
785572ff6f6SMatthew Dillon #define AR_SREV_KIWI_10_OR_LATER(_ah) \
786572ff6f6SMatthew Dillon 	(AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_KIWI)
787572ff6f6SMatthew Dillon 
788572ff6f6SMatthew Dillon /* XXX TODO: make these handle macVersion > Kiwi */
789572ff6f6SMatthew Dillon #define AR_SREV_KIWI_11_OR_LATER(_ah) \
790572ff6f6SMatthew Dillon 	(AR_SREV_KIWI(_ah) && \
791572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KIWI_11)
792572ff6f6SMatthew Dillon 
793572ff6f6SMatthew Dillon #define AR_SREV_KIWI_11(_ah) \
794572ff6f6SMatthew Dillon 	(AR_SREV_KIWI(_ah) && \
795572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_KIWI_11)
796572ff6f6SMatthew Dillon 
797572ff6f6SMatthew Dillon #define AR_SREV_KIWI_12(_ah) \
798572ff6f6SMatthew Dillon 	(AR_SREV_KIWI(_ah) && \
799572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_KIWI_12)
800572ff6f6SMatthew Dillon 
801572ff6f6SMatthew Dillon #define	AR_SREV_KIWI_12_OR_LATER(_ah) \
802572ff6f6SMatthew Dillon 	(AR_SREV_KIWI(_ah) && \
803572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KIWI_12)
804572ff6f6SMatthew Dillon 
805572ff6f6SMatthew Dillon #define	AR_SREV_KIWI_13_OR_LATER(_ah) \
806572ff6f6SMatthew Dillon 	(AR_SREV_KIWI(_ah) && \
807572ff6f6SMatthew Dillon 	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KIWI_13)
808572ff6f6SMatthew Dillon 
809572ff6f6SMatthew Dillon 
810572ff6f6SMatthew Dillon /* Not yet implemented chips */
811572ff6f6SMatthew Dillon #define	AR_SREV_9271(_ah)	0
812572ff6f6SMatthew Dillon 
813572ff6f6SMatthew Dillon #endif /* _DEV_ATH_AR5416REG_H */
814