xref: /dflybsd-src/sys/dev/netif/ath/ath_hal/ar5211/ar5211phy.h (revision 572ff6f6e8b95055988f178b6ba12ce77bb5b3c2)
1*572ff6f6SMatthew Dillon /*
2*572ff6f6SMatthew Dillon  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3*572ff6f6SMatthew Dillon  * Copyright (c) 2002-2006 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_AR5211PHY_H
20*572ff6f6SMatthew Dillon #define _DEV_ATH_AR5211PHY_H
21*572ff6f6SMatthew Dillon 
22*572ff6f6SMatthew Dillon /*
23*572ff6f6SMatthew Dillon  * Definitions for the PHY on the Atheros AR5211/5311 chipset.
24*572ff6f6SMatthew Dillon  */
25*572ff6f6SMatthew Dillon 
26*572ff6f6SMatthew Dillon /* PHY registers */
27*572ff6f6SMatthew Dillon #define	AR_PHY_BASE	0x9800	/* PHY registers base address */
28*572ff6f6SMatthew Dillon #define	AR_PHY(_n)	(AR_PHY_BASE + ((_n)<<2))
29*572ff6f6SMatthew Dillon 
30*572ff6f6SMatthew Dillon #define	AR_PHY_TURBO	0x9804	/* PHY frame control register */
31*572ff6f6SMatthew Dillon #define	AR_PHY_FC_TURBO_MODE	0x00000001	/* Set turbo mode bits */
32*572ff6f6SMatthew Dillon #define	AR_PHY_FC_TURBO_SHORT	0x00000002	/* Set short symbols to turbo mode setting */
33*572ff6f6SMatthew Dillon 
34*572ff6f6SMatthew Dillon #define	AR_PHY_CHIP_ID	0x9818	/* PHY chip revision ID */
35*572ff6f6SMatthew Dillon 
36*572ff6f6SMatthew Dillon #define	AR_PHY_ACTIVE	0x981C	/* PHY activation register */
37*572ff6f6SMatthew Dillon #define	AR_PHY_ACTIVE_EN	0x00000001	/* Activate PHY chips */
38*572ff6f6SMatthew Dillon #define	AR_PHY_ACTIVE_DIS	0x00000000	/* Deactivate PHY chips */
39*572ff6f6SMatthew Dillon 
40*572ff6f6SMatthew Dillon #define	AR_PHY_AGC_CONTROL	0x9860	/* PHY chip calibration and noise floor setting */
41*572ff6f6SMatthew Dillon #define	AR_PHY_AGC_CONTROL_CAL	0x00000001	/* Perform PHY chip internal calibration */
42*572ff6f6SMatthew Dillon #define	AR_PHY_AGC_CONTROL_NF	0x00000002	/* Perform PHY chip noise-floor calculation */
43*572ff6f6SMatthew Dillon 
44*572ff6f6SMatthew Dillon #define	AR_PHY_PLL_CTL	0x987c	/* PLL control register */
45*572ff6f6SMatthew Dillon #define	AR_PHY_PLL_CTL_44	0x19	/* 44 MHz for 11b channels and FPGA */
46*572ff6f6SMatthew Dillon #define	AR_PHY_PLL_CTL_40	0x18	/* 40 MHz */
47*572ff6f6SMatthew Dillon #define	AR_PHY_PLL_CTL_20	0x13	/* 20 MHz half rate 11a for emulation */
48*572ff6f6SMatthew Dillon 
49*572ff6f6SMatthew Dillon 
50*572ff6f6SMatthew Dillon #define	AR_PHY_RX_DELAY	0x9914	/* PHY analog_power_on_time, in 100ns increments */
51*572ff6f6SMatthew Dillon #define	AR_PHY_RX_DELAY_M	0x00003FFF	/* Mask for delay from active assertion (wake up) */
52*572ff6f6SMatthew Dillon 				/* to enable_receiver */
53*572ff6f6SMatthew Dillon 
54*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4	0x9920	/* PHY */
55*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF_M	0x0000001F	/* Mask for kcos_theta-1 for q correction */
56*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF_M	0x000007E0	/* Mask for sin_theta for i correction */
57*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF_S	5         	/* Shift for sin_theta for i correction */
58*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_IQCORR_ENABLE	0x00000800	/* enable IQ correction */
59*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX_M	0x0000F000	/* Mask for max number of samples (logarithmic) */
60*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX_S	12        	/* Shift for max number of samples */
61*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_DO_IQCAL	0x00010000	/* perform IQ calibration */
62*572ff6f6SMatthew Dillon 
63*572ff6f6SMatthew Dillon #define	AR_PHY_PAPD_PROBE	0x9930
64*572ff6f6SMatthew Dillon #define	AR_PHY_PAPD_PROBE_POWERTX	0x00007E00
65*572ff6f6SMatthew Dillon #define	AR_PHY_PAPD_PROBE_POWERTX_S	9
66*572ff6f6SMatthew Dillon #define	AR_PHY_PAPD_PROBE_NEXT_TX	0x00008000	/* command to take next reading */
67*572ff6f6SMatthew Dillon #define	AR_PHY_PAPD_PROBE_GAINF	0xFE000000
68*572ff6f6SMatthew Dillon #define	AR_PHY_PAPD_PROBE_GAINF_S	25
69*572ff6f6SMatthew Dillon 
70*572ff6f6SMatthew Dillon #define	AR_PHY_POWER_TX_RATE1		0x9934
71*572ff6f6SMatthew Dillon #define	AR_PHY_POWER_TX_RATE2		0x9938
72*572ff6f6SMatthew Dillon #define	AR_PHY_POWER_TX_RATE_MAX	0x993c
73*572ff6f6SMatthew Dillon 
74*572ff6f6SMatthew Dillon #define	AR_PHY_FRAME_CTL	0x9944
75*572ff6f6SMatthew Dillon #define	AR_PHY_FRAME_CTL_TX_CLIP	0x00000038
76*572ff6f6SMatthew Dillon #define	AR_PHY_FRAME_CTL_TX_CLIP_S	3
77*572ff6f6SMatthew Dillon #define AR_PHY_FRAME_CTL_ERR_SERV	0x20000000
78*572ff6f6SMatthew Dillon #define AR_PHY_FRAME_CTL_ERR_SERV_S	29
79*572ff6f6SMatthew Dillon 
80*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_0	0x9954	/* PHY radar detection settings */
81*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_0_ENA	0x00000001	/* Enable radar detection */
82*572ff6f6SMatthew Dillon 
83*572ff6f6SMatthew Dillon #define	AR_PHY_IQCAL_RES_PWR_MEAS_I	0x9c10	/*PHY IQ calibration results - power measurement for I */
84*572ff6f6SMatthew Dillon #define	AR_PHY_IQCAL_RES_PWR_MEAS_Q	0x9c14	/*PHY IQ calibration results - power measurement for Q */
85*572ff6f6SMatthew Dillon #define	AR_PHY_IQCAL_RES_IQ_CORR_MEAS	0x9c18	/*PHY IQ calibration results - IQ correlation measurement */
86*572ff6f6SMatthew Dillon #define	AR_PHY_CURRENT_RSSI	0x9c1c	/* rssi of current frame being received */
87*572ff6f6SMatthew Dillon 
88*572ff6f6SMatthew Dillon #define	AR5211_PHY_MODE	0xA200	/* Mode register */
89*572ff6f6SMatthew Dillon #define	AR5211_PHY_MODE_OFDM	0x0	/* bit 0 = 0 for OFDM */
90*572ff6f6SMatthew Dillon #define	AR5211_PHY_MODE_CCK	0x1	/* bit 0 = 1 for CCK */
91*572ff6f6SMatthew Dillon #define	AR5211_PHY_MODE_RF5GHZ	0x0	/* bit 1 = 0 for 5 GHz */
92*572ff6f6SMatthew Dillon #define	AR5211_PHY_MODE_RF2GHZ	0x2	/* bit 1 = 1 for 2.4 GHz */
93*572ff6f6SMatthew Dillon 
94*572ff6f6SMatthew Dillon #endif /* _DEV_ATH_AR5211PHY_H */
95