xref: /dflybsd-src/sys/dev/netif/ath/ath_hal/ar5312/ar5312reg.h (revision 572ff6f6e8b95055988f178b6ba12ce77bb5b3c2)
1*572ff6f6SMatthew Dillon /*
2*572ff6f6SMatthew Dillon  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3*572ff6f6SMatthew Dillon  * Copyright (c) 2002-2008 Atheros Communications, Inc.
4*572ff6f6SMatthew Dillon  *
5*572ff6f6SMatthew Dillon  * Permission to use, copy, modify, and/or distribute this software for any
6*572ff6f6SMatthew Dillon  * purpose with or without fee is hereby granted, provided that the above
7*572ff6f6SMatthew Dillon  * copyright notice and this permission notice appear in all copies.
8*572ff6f6SMatthew Dillon  *
9*572ff6f6SMatthew Dillon  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*572ff6f6SMatthew Dillon  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*572ff6f6SMatthew Dillon  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*572ff6f6SMatthew Dillon  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*572ff6f6SMatthew Dillon  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*572ff6f6SMatthew Dillon  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*572ff6f6SMatthew Dillon  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*572ff6f6SMatthew Dillon  *
17*572ff6f6SMatthew Dillon  * $FreeBSD$
18*572ff6f6SMatthew Dillon  */
19*572ff6f6SMatthew Dillon #ifndef _DEV_ATH_AR5312REG_H_
20*572ff6f6SMatthew Dillon #define _DEV_ATH_AR5312REG_H_
21*572ff6f6SMatthew Dillon 
22*572ff6f6SMatthew Dillon #include "ar5212/ar5212reg.h"
23*572ff6f6SMatthew Dillon /*
24*572ff6f6SMatthew Dillon  * Definitions for the Atheros 5312 chipset.
25*572ff6f6SMatthew Dillon  */
26*572ff6f6SMatthew Dillon 
27*572ff6f6SMatthew Dillon /* Register base addresses for modules which are not wmac modules */
28*572ff6f6SMatthew Dillon /* 531X has a fixed memory map */
29*572ff6f6SMatthew Dillon 
30*572ff6f6SMatthew Dillon 
31*572ff6f6SMatthew Dillon #define REG_WRITE(_reg,_val)		*((volatile uint32_t *)(_reg)) = (_val);
32*572ff6f6SMatthew Dillon #define REG_READ(_reg)		*((volatile uint32_t *)(_reg))
33*572ff6f6SMatthew Dillon /*
34*572ff6f6SMatthew Dillon  * PCI-MAC Configuration registers (AR2315+)
35*572ff6f6SMatthew Dillon  */
36*572ff6f6SMatthew Dillon #define AR5315_RSTIMER_BASE 0xb1000000  /* Address for reset/timer registers */
37*572ff6f6SMatthew Dillon #define AR5315_GPIO_BASE    0xb1000000  /* Address for GPIO registers */
38*572ff6f6SMatthew Dillon #define AR5315_WLAN0            0xb0000000
39*572ff6f6SMatthew Dillon 
40*572ff6f6SMatthew Dillon #define AR5315_RESET   0x0004      /* Offset of reset control register */
41*572ff6f6SMatthew Dillon #define AR5315_SREV    0x0014      /* Offset of reset control register */
42*572ff6f6SMatthew Dillon #define AR5315_ENDIAN_CTL  0x000c  /* offset of the endian control register */
43*572ff6f6SMatthew Dillon #define AR5315_CONFIG_WLAN     0x00000002      /* WLAN byteswap */
44*572ff6f6SMatthew Dillon 
45*572ff6f6SMatthew Dillon #define AR5315_REV_MAJ                     0x00f0
46*572ff6f6SMatthew Dillon #define AR5315_REV_MIN                     0x000f
47*572ff6f6SMatthew Dillon 
48*572ff6f6SMatthew Dillon #define AR5315_GPIODIR      0x0098      /* GPIO direction register */
49*572ff6f6SMatthew Dillon #define AR5315_GPIODO       0x0090      /* GPIO data output access reg */
50*572ff6f6SMatthew Dillon #define AR5315_GPIODI       0x0088      /* GPIO data input access reg*/
51*572ff6f6SMatthew Dillon #define AR5315_GPIOINT      0x00a0      /* GPIO interrupt control */
52*572ff6f6SMatthew Dillon 
53*572ff6f6SMatthew Dillon #define AR5315_GPIODIR_M(x) (1 << (x))  /* mask for i/o */
54*572ff6f6SMatthew Dillon #define AR5315_GPIODIR_O(x) (1 << (x))  /* output */
55*572ff6f6SMatthew Dillon #define AR5315_GPIODIR_I(x) 0           /* input */
56*572ff6f6SMatthew Dillon 
57*572ff6f6SMatthew Dillon #define AR5315_GPIOINT_S    0
58*572ff6f6SMatthew Dillon #define AR5315_GPIOINT_M    0x3F
59*572ff6f6SMatthew Dillon #define AR5315_GPIOINTLVL_S 6
60*572ff6f6SMatthew Dillon #define AR5315_GPIOINTLVL_M (3 << AR5315_GPIOINTLVL_S)
61*572ff6f6SMatthew Dillon 
62*572ff6f6SMatthew Dillon #define AR5315_WREV         (-0xefbfe0)      /* Revision ID register offset */
63*572ff6f6SMatthew Dillon #define AR5315_WREV_S       0           /* Shift for WMAC revision info */
64*572ff6f6SMatthew Dillon #define AR5315_WREV_ID      0x000000FF  /* Mask for WMAC revision info */
65*572ff6f6SMatthew Dillon #define AR5315_WREV_ID_S    4           /* Shift for WMAC Rev ID */
66*572ff6f6SMatthew Dillon #define AR5315_WREV_REVISION 0x0000000F /* Mask for WMAN Revsion version */
67*572ff6f6SMatthew Dillon 
68*572ff6f6SMatthew Dillon #define AR5315_RC_BB0_CRES   0x00000002  /* Cold reset to WMAC0 & WBB0 */
69*572ff6f6SMatthew Dillon #define AR5315_RC_BB1_CRES   0x00000200  /* Cold reset to WMAC1 & WBB1n */
70*572ff6f6SMatthew Dillon #define AR5315_RC_WMAC0_RES  0x00000001  /* Warm reset to WMAC 0 */
71*572ff6f6SMatthew Dillon #define AR5315_RC_WBB0_RES  0x00000002  /* Warm reset to WBB0 */
72*572ff6f6SMatthew Dillon #define AR5315_RC_WMAC1_RES  0x00020000  /* Warm reset to WMAC1 */
73*572ff6f6SMatthew Dillon #define AR5315_RC_WBB1_RES   0x00040000  /* Warm reset to WBB */
74*572ff6f6SMatthew Dillon 
75*572ff6f6SMatthew Dillon /*
76*572ff6f6SMatthew Dillon  * PCI-MAC Configuration registers (AR5312)
77*572ff6f6SMatthew Dillon  */
78*572ff6f6SMatthew Dillon #define AR5312_RSTIMER_BASE 0xbc003000  /* Address for reset/timer registers */
79*572ff6f6SMatthew Dillon #define AR5312_GPIO_BASE    0xbc002000  /* Address for GPIO registers */
80*572ff6f6SMatthew Dillon #define AR5312_WLAN0            0xb8000000
81*572ff6f6SMatthew Dillon #define AR5312_WLAN1            0xb8500000
82*572ff6f6SMatthew Dillon 
83*572ff6f6SMatthew Dillon #define AR5312_RESET	0x0020      /* Offset of reset control register */
84*572ff6f6SMatthew Dillon #define	AR5312_PCICFG	0x00B0	    /* MAC/PCI configuration reg (LEDs) */
85*572ff6f6SMatthew Dillon 
86*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDMODE  0x0000001c	/* LED Mode mask */
87*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDMODE_S  2	/* LED Mode shift */
88*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDMOD0  0	/* Blnk prop to Tx and filtered Rx */
89*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDMOD1  1	/* Blnk prop to all Tx and Rx */
90*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDMOD2  2	/* DEBG flash */
91*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDMOD3  3	/* BLNK Randomly */
92*572ff6f6SMatthew Dillon 
93*572ff6f6SMatthew Dillon #define	AR5312_PCICFG_LEDSEL   0x000000e0 /* LED Throughput select */
94*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDSEL_S 5
95*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDSEL0  0	/* See blink rate table on p. 143 */
96*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDSEL1  1	/* of AR5212 data sheet */
97*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDSEL2  2
98*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDSEL3  3
99*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDSEL4  4
100*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDSEL5  5
101*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDSEL6  6
102*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDSEL7  7
103*572ff6f6SMatthew Dillon 
104*572ff6f6SMatthew Dillon #define AR5312_PCICFG_LEDSBR   0x00000100 /* Slow blink rate if no
105*572ff6f6SMatthew Dillon 			   		     activity. 0 = blink @ lowest
106*572ff6f6SMatthew Dillon 					     rate */
107*572ff6f6SMatthew Dillon 
108*572ff6f6SMatthew Dillon #undef AR_GPIOCR
109*572ff6f6SMatthew Dillon #undef AR_GPIODO                    /* Undefine the 5212 defs */
110*572ff6f6SMatthew Dillon #undef AR_GPIODI
111*572ff6f6SMatthew Dillon 
112*572ff6f6SMatthew Dillon #define AR5312_GPIOCR       0x0008      /* GPIO Control register */
113*572ff6f6SMatthew Dillon #define AR5312_GPIODO       0x0000      /* GPIO data output access reg */
114*572ff6f6SMatthew Dillon #define AR5312_GPIODI       0x0004      /* GPIO data input access reg*/
115*572ff6f6SMatthew Dillon /* NB: AR5312 uses AR5212 defines for GPIOCR definitions */
116*572ff6f6SMatthew Dillon 
117*572ff6f6SMatthew Dillon #define AR5312_WREV         0x0090      /* Revision ID register offset */
118*572ff6f6SMatthew Dillon #define AR5312_WREV_S       8           /* Shift for WMAC revision info */
119*572ff6f6SMatthew Dillon #define AR5312_WREV_ID      0x000000FF  /* Mask for WMAC revision info */
120*572ff6f6SMatthew Dillon #define AR5312_WREV_ID_S    4           /* Shift for WMAC Rev ID */
121*572ff6f6SMatthew Dillon #define AR5312_WREV_REVISION 0x0000000F /* Mask for WMAN Revsion version */
122*572ff6f6SMatthew Dillon 
123*572ff6f6SMatthew Dillon #define AR5312_RC_BB0_CRES   0x00000004  /* Cold reset to WMAC0 & WBB0 */
124*572ff6f6SMatthew Dillon #define AR5312_RC_BB1_CRES   0x00000200  /* Cold reset to WMAC1 & WBB1n */
125*572ff6f6SMatthew Dillon #define AR5312_RC_WMAC0_RES  0x00002000  /* Warm reset to WMAC 0 */
126*572ff6f6SMatthew Dillon #define AR5312_RC_WBB0_RES  0x00004000  /* Warm reset to WBB0 */
127*572ff6f6SMatthew Dillon #define AR5312_RC_WMAC1_RES  0x00020000  /* Warm reset to WMAC1 */
128*572ff6f6SMatthew Dillon #define AR5312_RC_WBB1_RES   0x00040000  /* Warm reset to WBB */
129*572ff6f6SMatthew Dillon 
130*572ff6f6SMatthew Dillon 
131*572ff6f6SMatthew Dillon #define AR_RAD2112_SREV_MAJOR   0x40    /* 2112 Major Rev */
132*572ff6f6SMatthew Dillon 
133*572ff6f6SMatthew Dillon enum AR5312PowerMode {
134*572ff6f6SMatthew Dillon     AR5312_POWER_MODE_FORCE_SLEEP  = 0,
135*572ff6f6SMatthew Dillon     AR5312_POWER_MODE_FORCE_WAKE   = 1,
136*572ff6f6SMatthew Dillon     AR5312_POWER_MODE_NORMAL       = 2,
137*572ff6f6SMatthew Dillon };
138*572ff6f6SMatthew Dillon 
139*572ff6f6SMatthew Dillon #endif /* _DEV_AR5312REG_H_ */
140