18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2008-2011 Atheros Communications Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifndef PHY_H
188c2ecf20Sopenharmony_ci#define PHY_H
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define CHANSEL_DIV		15
218c2ecf20Sopenharmony_ci#define CHANSEL_2G(_freq)	(((_freq) * 0x10000) / CHANSEL_DIV)
228c2ecf20Sopenharmony_ci#define CHANSEL_5G(_freq)	(((_freq) * 0x8000) / CHANSEL_DIV)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define AR_PHY_BASE     0x9800
258c2ecf20Sopenharmony_ci#define AR_PHY(_n)      (AR_PHY_BASE + ((_n)<<2))
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define AR_PHY_TX_PWRCTRL_TX_GAIN_TAB_MAX   0x0007E000
288c2ecf20Sopenharmony_ci#define AR_PHY_TX_PWRCTRL_TX_GAIN_TAB_MAX_S 13
298c2ecf20Sopenharmony_ci#define AR_PHY_TX_GAIN_CLC       0x0000001E
308c2ecf20Sopenharmony_ci#define AR_PHY_TX_GAIN_CLC_S     1
318c2ecf20Sopenharmony_ci#define AR_PHY_TX_GAIN           0x0007F000
328c2ecf20Sopenharmony_ci#define AR_PHY_TX_GAIN_S         12
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define AR_PHY_CLC_TBL1      0xa35c
358c2ecf20Sopenharmony_ci#define AR_PHY_CLC_I0        0x07ff0000
368c2ecf20Sopenharmony_ci#define AR_PHY_CLC_I0_S      16
378c2ecf20Sopenharmony_ci#define AR_PHY_CLC_Q0        0x0000ffd0
388c2ecf20Sopenharmony_ci#define AR_PHY_CLC_Q0_S      5
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define ANTSWAP_AB 0x0001
418c2ecf20Sopenharmony_ci#define REDUCE_CHAIN_0 0x00000050
428c2ecf20Sopenharmony_ci#define REDUCE_CHAIN_1 0x00000051
438c2ecf20Sopenharmony_ci#define AR_PHY_CHIP_ID 0x9818
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define	AR_PHY_TIMING11_SPUR_FREQ_SD		0x3FF00000
468c2ecf20Sopenharmony_ci#define	AR_PHY_TIMING11_SPUR_FREQ_SD_S		20
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define AR_PHY_PLL_CONTROL 0x16180
498c2ecf20Sopenharmony_ci#define AR_PHY_PLL_MODE 0x16184
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_cienum ath9k_ant_div_comb_lna_conf {
528c2ecf20Sopenharmony_ci	ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2,
538c2ecf20Sopenharmony_ci	ATH_ANT_DIV_COMB_LNA2,
548c2ecf20Sopenharmony_ci	ATH_ANT_DIV_COMB_LNA1,
558c2ecf20Sopenharmony_ci	ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2,
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#endif
59