Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
phy_int.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef _BRCM_PHY_INT_H_
18 #define _BRCM_PHY_INT_H_
19 
20 #include <types.h>
21 #include <brcmu_utils.h>
22 #include <brcmu_wifi.h>
23 
24 #define PHY_VERSION { 1, 82, 8, 0 }
25 
26 #define LCNXN_BASEREV 16
27 
28 struct phy_shim_info;
29 
31  /* TSSI positive slope, 1: positive, 0: negative */
33  /* Ext PA gain-type: full-gain: 0, pa-lite: 1, no_pa: 2 */
35  /* support 32 combinations of different Pdet dynamic ranges */
37  /* TR switch isolation */
39  /* antswctrl lookup table configuration: 32 possible choices */
41 };
42 
43 #define ISNPHY(pi) PHYTYPE_IS((pi)->pubpi.phy_type, PHY_TYPE_N)
44 #define ISLCNPHY(pi) PHYTYPE_IS((pi)->pubpi.phy_type, PHY_TYPE_LCN)
45 
46 #define PHY_GET_RFATTN(rfgain) ((rfgain) & 0x0f)
47 #define PHY_GET_PADMIX(rfgain) (((rfgain) & 0x10) >> 4)
48 #define PHY_GET_RFGAINID(rfattn, padmix, width) ((rfattn) + ((padmix)*(width)))
49 #define PHY_SAT(x, n) ((x) > ((1<<((n)-1))-1) ? ((1<<((n)-1))-1) : \
50  ((x) < -(1<<((n)-1)) ? -(1<<((n)-1)) : (x)))
51 #define PHY_SHIFT_ROUND(x, n) ((x) >= 0 ? ((x)+(1<<((n)-1)))>>(n) : (x)>>(n))
52 #define PHY_HW_ROUND(x, s) ((x >> s) + ((x >> (s-1)) & (s != 0)))
53 
54 #define CH_5G_GROUP 3
55 #define A_LOW_CHANS 0
56 #define A_MID_CHANS 1
57 #define A_HIGH_CHANS 2
58 #define CH_2G_GROUP 1
59 #define G_ALL_CHANS 0
60 
61 #define FIRST_REF5_CHANNUM 149
62 #define LAST_REF5_CHANNUM 165
63 #define FIRST_5G_CHAN 14
64 #define LAST_5G_CHAN 50
65 #define FIRST_MID_5G_CHAN 14
66 #define LAST_MID_5G_CHAN 35
67 #define FIRST_HIGH_5G_CHAN 36
68 #define LAST_HIGH_5G_CHAN 41
69 #define FIRST_LOW_5G_CHAN 42
70 #define LAST_LOW_5G_CHAN 50
71 
72 #define BASE_LOW_5G_CHAN 4900
73 #define BASE_MID_5G_CHAN 5100
74 #define BASE_HIGH_5G_CHAN 5500
75 
76 #define CHAN5G_FREQ(chan) (5000 + chan*5)
77 #define CHAN2G_FREQ(chan) (2407 + chan*5)
78 
79 #define TXP_FIRST_CCK 0
80 #define TXP_LAST_CCK 3
81 #define TXP_FIRST_OFDM 4
82 #define TXP_LAST_OFDM 11
83 #define TXP_FIRST_OFDM_20_CDD 12
84 #define TXP_LAST_OFDM_20_CDD 19
85 #define TXP_FIRST_MCS_20_SISO 20
86 #define TXP_LAST_MCS_20_SISO 27
87 #define TXP_FIRST_MCS_20_CDD 28
88 #define TXP_LAST_MCS_20_CDD 35
89 #define TXP_FIRST_MCS_20_STBC 36
90 #define TXP_LAST_MCS_20_STBC 43
91 #define TXP_FIRST_MCS_20_SDM 44
92 #define TXP_LAST_MCS_20_SDM 51
93 #define TXP_FIRST_OFDM_40_SISO 52
94 #define TXP_LAST_OFDM_40_SISO 59
95 #define TXP_FIRST_OFDM_40_CDD 60
96 #define TXP_LAST_OFDM_40_CDD 67
97 #define TXP_FIRST_MCS_40_SISO 68
98 #define TXP_LAST_MCS_40_SISO 75
99 #define TXP_FIRST_MCS_40_CDD 76
100 #define TXP_LAST_MCS_40_CDD 83
101 #define TXP_FIRST_MCS_40_STBC 84
102 #define TXP_LAST_MCS_40_STBC 91
103 #define TXP_FIRST_MCS_40_SDM 92
104 #define TXP_LAST_MCS_40_SDM 99
105 #define TXP_MCS_32 100
106 #define TXP_NUM_RATES 101
107 #define ADJ_PWR_TBL_LEN 84
108 
109 #define TXP_FIRST_SISO_MCS_20 20
110 #define TXP_LAST_SISO_MCS_20 27
111 
112 #define PHY_CORE_NUM_1 1
113 #define PHY_CORE_NUM_2 2
114 #define PHY_CORE_NUM_3 3
115 #define PHY_CORE_NUM_4 4
116 #define PHY_CORE_MAX PHY_CORE_NUM_4
117 #define PHY_CORE_0 0
118 #define PHY_CORE_1 1
119 #define PHY_CORE_2 2
120 #define PHY_CORE_3 3
121 
122 #define MA_WINDOW_SZ 8
123 
124 #define PHY_NOISE_SAMPLE_MON 1
125 #define PHY_NOISE_SAMPLE_EXTERNAL 2
126 #define PHY_NOISE_WINDOW_SZ 16
127 #define PHY_NOISE_GLITCH_INIT_MA 10
128 #define PHY_NOISE_GLITCH_INIT_MA_BADPlCP 10
129 #define PHY_NOISE_STATE_MON 0x1
130 #define PHY_NOISE_STATE_EXTERNAL 0x2
131 #define PHY_NOISE_SAMPLE_LOG_NUM_NPHY 10
132 #define PHY_NOISE_SAMPLE_LOG_NUM_UCODE 9
133 
134 #define PHY_NOISE_OFFSETFACT_4322 (-103)
135 #define PHY_NOISE_MA_WINDOW_SZ 2
136 
137 #define PHY_RSSI_TABLE_SIZE 64
138 #define RSSI_ANT_MERGE_MAX 0
139 #define RSSI_ANT_MERGE_MIN 1
140 #define RSSI_ANT_MERGE_AVG 2
141 
142 #define PHY_TSSI_TABLE_SIZE 64
143 #define APHY_TSSI_TABLE_SIZE 256
144 #define TX_GAIN_TABLE_LENGTH 64
145 #define DEFAULT_11A_TXP_IDX 24
146 #define NUM_TSSI_FRAMES 4
147 #define NULL_TSSI 0x7f
148 #define NULL_TSSI_W 0x7f7f
149 
150 #define PHY_PAPD_EPS_TBL_SIZE_LCNPHY 64
151 
152 #define LCNPHY_PERICAL_TEMPBASED_TXPWRCTRL 9
153 
154 #define PHY_TXPWR_MIN 10
155 #define PHY_TXPWR_MIN_NPHY 8
156 #define RADIOPWR_OVERRIDE_DEF (-1)
157 
158 #define PWRTBL_NUM_COEFF 3
159 
160 #define SPURAVOID_DISABLE 0
161 #define SPURAVOID_AUTO 1
162 #define SPURAVOID_FORCEON 2
163 #define SPURAVOID_FORCEON2 3
164 
165 #define PHY_SW_TIMER_FAST 15
166 #define PHY_SW_TIMER_SLOW 60
167 #define PHY_SW_TIMER_GLACIAL 120
168 
169 #define PHY_PERICAL_AUTO 0
170 #define PHY_PERICAL_FULL 1
171 #define PHY_PERICAL_PARTIAL 2
172 
173 #define PHY_PERICAL_NODELAY 0
174 #define PHY_PERICAL_INIT_DELAY 5
175 #define PHY_PERICAL_ASSOC_DELAY 5
176 #define PHY_PERICAL_WDOG_DELAY 5
177 
178 #define MPHASE_TXCAL_NUMCMDS 2
179 
180 #define PHY_PERICAL_MPHASE_PENDING(pi) \
181  (pi->mphase_cal_phase_id > MPHASE_CAL_STATE_IDLE)
182 
183 enum {
196 };
197 
206 };
207 
208 #define RDR_NTIERS 1
209 #define RDR_TIER_SIZE 64
210 #define RDR_LIST_SIZE (512/3)
211 #define RDR_EPOCH_SIZE 40
212 #define RDR_NANTENNAS 2
213 #define RDR_NTIER_SIZE RDR_LIST_SIZE
214 #define RDR_LP_BUFFER_SIZE 64
215 #define LP_LEN_HIS_SIZE 10
216 
217 #define STATIC_NUM_RF 32
218 #define STATIC_NUM_BB 9
219 
220 #define BB_MULT_MASK 0x0000ffff
221 #define BB_MULT_VALID_MASK 0x80000000
222 
223 #define CORDIC_AG 39797
224 #define CORDIC_NI 18
225 #define FIXED(X) ((s32)((X) << 16))
226 
227 #define FLOAT(X) \
228  (((X) >= 0) ? ((((X) >> 15) + 1) >> 1) : -((((-(X)) >> 15) + 1) >> 1))
229 
230 #define PHY_CHAIN_TX_DISABLE_TEMP 115
231 #define PHY_HYSTERESIS_DELTATEMP 5
232 
233 #define SCAN_INPROG_PHY(pi) \
234  (mboolisset(pi->measure_hold, PHY_HOLD_FOR_SCAN))
235 
236 #define PLT_INPROG_PHY(pi) (mboolisset(pi->measure_hold, PHY_HOLD_FOR_PLT))
237 
238 #define ASSOC_INPROG_PHY(pi) \
239  (mboolisset(pi->measure_hold, PHY_HOLD_FOR_ASSOC))
240 
241 #define SCAN_RM_IN_PROGRESS(pi) \
242  (mboolisset(pi->measure_hold, PHY_HOLD_FOR_SCAN | PHY_HOLD_FOR_RM))
243 
244 #define PHY_MUTED(pi) \
245  (mboolisset(pi->measure_hold, PHY_HOLD_FOR_MUTE))
246 
247 #define PUB_NOT_ASSOC(pi) \
248  (mboolisset(pi->measure_hold, PHY_HOLD_FOR_NOT_ASSOC))
249 
252  int q;
254 };
255 
256 struct phytbl_info {
257  const void *tbl_ptr;
262 };
263 
274 
292 
305 
313 
319 
323 
325 
334 };
335 
370 };
371 
373  s8 i;
374  s8 q;
375 };
376 
377 struct nphy_iq_comp {
382 };
383 
395 };
396 
398 
402 
406 };
407 
408 struct nphy_pwrctrl {
435 };
436 
437 struct nphy_txgains {
438  u16 txlpf[2];
439  u16 txgm[2];
440  u16 pga[2];
441  u16 pad[2];
442  u16 ipa[2];
443 };
444 
445 #define PHY_NOISEVAR_BUFSIZE 10
446 
448  int bufcount;
452 };
453 
457 
460 };
461 
463 
471 
474 
483 
486 };
487 
488 struct shared_phy {
491  struct si_pub *sih;
495  bool up;
496  bool clk;
519  bool _rifs_phy;
520 };
521 
529 
533 };
534 
535 struct phy_func_ptr {
536  void (*init)(struct brcms_phy *);
537  void (*calinit)(struct brcms_phy *);
538  void (*chanset)(struct brcms_phy *, u16 chanspec);
539  void (*txpwrrecalc)(struct brcms_phy *);
540  int (*longtrn)(struct brcms_phy *, int);
541  void (*txiqccget)(struct brcms_phy *, u16 *, u16 *);
542  void (*txiqccset)(struct brcms_phy *, u16, u16);
543  u16 (*txloccget)(struct brcms_phy *);
544  void (*radioloftget)(struct brcms_phy *, u8 *, u8 *, u8 *, u8 *);
545  void (*carrsuppr)(struct brcms_phy *);
546  s32 (*rxsigpwr)(struct brcms_phy *, s32);
547  void (*detach)(struct brcms_phy *);
548 };
549 
550 struct brcms_phy {
552  struct shared_phy *sh;
554 
555  union {
557  } u;
559 
561  struct brcms_phy *next;
563 
573 
576  bool sbtml_gm;
585 
592 
604 
607 
610  bool hwpwrctrl;
614 
617 
621 
629 
631 
637 
639 
642 
648 
652 
660 
665 
670 
674 
685 
690  int min_rssi;
691  int max_rssi;
692 
695 
697 
700 
701  int rf_max;
702  int bb_max;
712 
718 
723 
728 
730 
764 
767 
771 
774 
779 
781 
795  struct wlapi_timer *phycal_timer;
799 
802 
813  bool ipa2g_on;
814  bool ipa5g_on;
815 
821 
827 
835 
837 
847 
851 
853 
855 
866 
868 
870 
874 
877 
880 
884  struct wiphy *wiphy;
885 };
886 
887 struct cs32 {
890 };
891 
892 struct radio_regs {
898 };
899 
904 };
905 
912 };
913 
914 extern u16 read_phy_reg(struct brcms_phy *pi, u16 addr);
915 extern void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val);
916 extern void and_phy_reg(struct brcms_phy *pi, u16 addr, u16 val);
917 extern void or_phy_reg(struct brcms_phy *pi, u16 addr, u16 val);
918 extern void mod_phy_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val);
919 
920 extern u16 read_radio_reg(struct brcms_phy *pi, u16 addr);
921 extern void or_radio_reg(struct brcms_phy *pi, u16 addr, u16 val);
922 extern void and_radio_reg(struct brcms_phy *pi, u16 addr, u16 val);
923 extern void mod_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask,
924  u16 val);
925 extern void xor_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask);
926 
927 extern void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val);
928 
929 extern void wlc_phyreg_enter(struct brcms_phy_pub *pih);
930 extern void wlc_phyreg_exit(struct brcms_phy_pub *pih);
931 extern void wlc_radioreg_enter(struct brcms_phy_pub *pih);
932 extern void wlc_radioreg_exit(struct brcms_phy_pub *pih);
933 
934 extern void wlc_phy_read_table(struct brcms_phy *pi,
935  const struct phytbl_info *ptbl_info,
936  u16 tblAddr, u16 tblDataHi,
937  u16 tblDatalo);
938 extern void wlc_phy_write_table(struct brcms_phy *pi,
939  const struct phytbl_info *ptbl_info,
940  u16 tblAddr, u16 tblDataHi, u16 tblDatalo);
941 extern void wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id,
942  uint tbl_offset, u16 tblAddr, u16 tblDataHi,
943  u16 tblDataLo);
944 extern void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val);
945 
946 extern void write_phy_channel_reg(struct brcms_phy *pi, uint val);
947 extern void wlc_phy_txpower_update_shm(struct brcms_phy *pi);
948 
949 extern u8 wlc_phy_nbits(s32 value);
950 extern void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_dB, u8 core);
951 
953  struct radio_20xx_regs *radioregs);
954 extern uint wlc_phy_init_radio_regs(struct brcms_phy *pi,
955  const struct radio_regs *radioregs,
956  u16 core_offset);
957 
958 extern void wlc_phy_txpower_ipa_upd(struct brcms_phy *pi);
959 
960 extern void wlc_phy_do_dummy_tx(struct brcms_phy *pi, bool ofdm, bool pa_on);
961 extern void wlc_phy_papd_decode_epsilon(u32 epsilon, s32 *eps_real,
962  s32 *eps_imag);
963 
964 extern void wlc_phy_cal_perical_mphase_reset(struct brcms_phy *pi);
965 extern void wlc_phy_cal_perical_mphase_restart(struct brcms_phy *pi);
966 
967 extern bool wlc_phy_attach_nphy(struct brcms_phy *pi);
968 extern bool wlc_phy_attach_lcnphy(struct brcms_phy *pi);
969 
970 extern void wlc_phy_detach_lcnphy(struct brcms_phy *pi);
971 
972 extern void wlc_phy_init_nphy(struct brcms_phy *pi);
973 extern void wlc_phy_init_lcnphy(struct brcms_phy *pi);
974 
975 extern void wlc_phy_cal_init_nphy(struct brcms_phy *pi);
976 extern void wlc_phy_cal_init_lcnphy(struct brcms_phy *pi);
977 
978 extern void wlc_phy_chanspec_set_nphy(struct brcms_phy *pi,
979  u16 chanspec);
980 extern void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi,
981  u16 chanspec);
982 extern void wlc_phy_chanspec_set_fixup_lcnphy(struct brcms_phy *pi,
983  u16 chanspec);
984 extern int wlc_phy_channel2freq(uint channel);
986 extern int wlc_phy_chanspec_bandrange_get(struct brcms_phy *, u16 chanspec);
987 
988 extern void wlc_lcnphy_set_tx_pwr_ctrl(struct brcms_phy *pi, u16 mode);
990 
991 extern void wlc_phy_txpower_recalc_target_nphy(struct brcms_phy *pi);
992 extern void wlc_lcnphy_txpower_recalc_target(struct brcms_phy *pi);
993 extern void wlc_phy_txpower_recalc_target_lcnphy(struct brcms_phy *pi);
994 
995 extern void wlc_lcnphy_set_tx_pwr_by_index(struct brcms_phy *pi, int index);
996 extern void wlc_lcnphy_tx_pu(struct brcms_phy *pi, bool bEnable);
997 extern void wlc_lcnphy_stop_tx_tone(struct brcms_phy *pi);
998 extern void wlc_lcnphy_start_tx_tone(struct brcms_phy *pi, s32 f_kHz,
999  u16 max_val, bool iqcalmode);
1000 
1001 extern void wlc_phy_txpower_sromlimit_get_nphy(struct brcms_phy *pi, uint chan,
1002  u8 *max_pwr, u8 rate_id);
1003 extern void wlc_phy_ofdm_to_mcs_powers_nphy(u8 *power, u8 rate_mcs_start,
1004  u8 rate_mcs_end,
1005  u8 rate_ofdm_start);
1006 extern void wlc_phy_mcs_to_ofdm_powers_nphy(u8 *power,
1007  u8 rate_ofdm_start,
1008  u8 rate_ofdm_end,
1009  u8 rate_mcs_start);
1010 
1011 extern u16 wlc_lcnphy_tempsense(struct brcms_phy *pi, bool mode);
1012 extern s16 wlc_lcnphy_tempsense_new(struct brcms_phy *pi, bool mode);
1013 extern s8 wlc_lcnphy_tempsense_degree(struct brcms_phy *pi, bool mode);
1014 extern s8 wlc_lcnphy_vbatsense(struct brcms_phy *pi, bool mode);
1015 extern void wlc_phy_carrier_suppress_lcnphy(struct brcms_phy *pi);
1016 extern void wlc_lcnphy_crsuprs(struct brcms_phy *pi, int channel);
1017 extern void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode);
1018 extern void wlc_2064_vco_cal(struct brcms_phy *pi);
1019 
1020 extern void wlc_phy_txpower_recalc_target(struct brcms_phy *pi);
1021 
1022 #define LCNPHY_TBL_ID_PAPDCOMPDELTATBL 0x18
1023 #define LCNPHY_TX_POWER_TABLE_SIZE 128
1024 #define LCNPHY_MAX_TX_POWER_INDEX (LCNPHY_TX_POWER_TABLE_SIZE - 1)
1025 #define LCNPHY_TBL_ID_TXPWRCTL 0x07
1026 #define LCNPHY_TX_PWR_CTRL_OFF 0
1027 #define LCNPHY_TX_PWR_CTRL_SW (0x1 << 15)
1028 #define LCNPHY_TX_PWR_CTRL_HW ((0x1 << 15) | \
1029  (0x1 << 14) | \
1030  (0x1 << 13))
1031 
1032 #define LCNPHY_TX_PWR_CTRL_TEMPBASED 0xE001
1033 
1034 extern void wlc_lcnphy_write_table(struct brcms_phy *pi,
1035  const struct phytbl_info *pti);
1036 extern void wlc_lcnphy_read_table(struct brcms_phy *pi,
1037  struct phytbl_info *pti);
1038 extern void wlc_lcnphy_set_tx_iqcc(struct brcms_phy *pi, u16 a, u16 b);
1039 extern void wlc_lcnphy_set_tx_locc(struct brcms_phy *pi, u16 didq);
1040 extern void wlc_lcnphy_get_tx_iqcc(struct brcms_phy *pi, u16 *a, u16 *b);
1041 extern u16 wlc_lcnphy_get_tx_locc(struct brcms_phy *pi);
1042 extern void wlc_lcnphy_get_radio_loft(struct brcms_phy *pi, u8 *ei0,
1043  u8 *eq0, u8 *fi0, u8 *fq0);
1044 extern void wlc_lcnphy_calib_modes(struct brcms_phy *pi, uint mode);
1045 extern void wlc_lcnphy_deaf_mode(struct brcms_phy *pi, bool mode);
1046 extern bool wlc_phy_tpc_isenabled_lcnphy(struct brcms_phy *pi);
1047 extern void wlc_lcnphy_tx_pwr_update_npt(struct brcms_phy *pi);
1048 extern s32 wlc_lcnphy_tssi2dbm(s32 tssi, s32 a1, s32 b0, s32 b1);
1049 extern void wlc_lcnphy_get_tssi(struct brcms_phy *pi, s8 *ofdm_pwr,
1050  s8 *cck_pwr);
1051 extern void wlc_lcnphy_tx_power_adjustment(struct brcms_phy_pub *ppi);
1052 
1053 extern s32 wlc_lcnphy_rx_signal_power(struct brcms_phy *pi, s32 gain_index);
1054 
1055 #define NPHY_MAX_HPVGA1_INDEX 10
1056 #define NPHY_DEF_HPVGA1_INDEXLIMIT 7
1057 
1058 struct phy_iq_est {
1062 };
1063 
1064 extern void wlc_phy_stay_in_carriersearch_nphy(struct brcms_phy *pi,
1065  bool enable);
1066 extern void wlc_nphy_deaf_mode(struct brcms_phy *pi, bool mode);
1067 
1068 #define wlc_phy_write_table_nphy(pi, pti) \
1069  wlc_phy_write_table(pi, pti, 0x72, 0x74, 0x73)
1070 
1071 #define wlc_phy_read_table_nphy(pi, pti) \
1072  wlc_phy_read_table(pi, pti, 0x72, 0x74, 0x73)
1073 
1074 #define wlc_nphy_table_addr(pi, id, off) \
1075  wlc_phy_table_addr((pi), (id), (off), 0x72, 0x74, 0x73)
1076 
1077 #define wlc_nphy_table_data_write(pi, w, v) \
1078  wlc_phy_table_data_write((pi), (w), (v))
1079 
1080 extern void wlc_phy_table_read_nphy(struct brcms_phy *pi, u32, u32 l, u32 o,
1081  u32 w, void *d);
1082 extern void wlc_phy_table_write_nphy(struct brcms_phy *pi, u32, u32, u32,
1083  u32, const void *);
1084 
1085 #define PHY_IPA(pi) \
1086  ((pi->ipa2g_on && CHSPEC_IS2G(pi->radio_chanspec)) || \
1087  (pi->ipa5g_on && CHSPEC_IS5G(pi->radio_chanspec)))
1088 
1089 #define BRCMS_PHY_WAR_PR51571(pi) \
1090  if (NREV_LT((pi)->pubpi.phy_rev, 3)) \
1091  (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol))
1092 
1093 extern void wlc_phy_cal_perical_nphy_run(struct brcms_phy *pi, u8 caltype);
1094 extern void wlc_phy_aci_reset_nphy(struct brcms_phy *pi);
1095 extern void wlc_phy_pa_override_nphy(struct brcms_phy *pi, bool en);
1096 
1098 extern void wlc_phy_switch_radio_nphy(struct brcms_phy *pi, bool on);
1099 
1100 extern void wlc_phy_stf_chain_upd_nphy(struct brcms_phy *pi);
1101 
1102 extern void wlc_phy_force_rfseq_nphy(struct brcms_phy *pi, u8 cmd);
1103 extern s16 wlc_phy_tempsense_nphy(struct brcms_phy *pi);
1104 
1105 extern u16 wlc_phy_classifier_nphy(struct brcms_phy *pi, u16 mask, u16 val);
1106 
1107 extern void wlc_phy_rx_iq_est_nphy(struct brcms_phy *pi, struct phy_iq_est *est,
1108  u16 num_samps, u8 wait_time,
1109  u8 wait_for_crs);
1110 
1111 extern void wlc_phy_rx_iq_coeffs_nphy(struct brcms_phy *pi, u8 write,
1112  struct nphy_iq_comp *comp);
1113 extern void wlc_phy_aci_and_noise_reduction_nphy(struct brcms_phy *pi);
1114 
1115 extern void wlc_phy_rxcore_setstate_nphy(struct brcms_phy_pub *pih,
1116  u8 rxcore_bitmask);
1117 extern u8 wlc_phy_rxcore_getstate_nphy(struct brcms_phy_pub *pih);
1118 
1119 extern void wlc_phy_txpwrctrl_enable_nphy(struct brcms_phy *pi, u8 ctrl_type);
1120 extern void wlc_phy_txpwr_fixpower_nphy(struct brcms_phy *pi);
1121 extern void wlc_phy_txpwr_apply_nphy(struct brcms_phy *pi);
1122 extern void wlc_phy_txpwr_papd_cal_nphy(struct brcms_phy *pi);
1123 extern u16 wlc_phy_txpwr_idx_get_nphy(struct brcms_phy *pi);
1124 
1126 extern int wlc_phy_cal_txiqlo_nphy(struct brcms_phy *pi,
1127  struct nphy_txgains target_gain,
1128  bool full, bool m);
1129 extern int wlc_phy_cal_rxiq_nphy(struct brcms_phy *pi,
1130  struct nphy_txgains target_gain,
1131  u8 type, bool d);
1132 extern void wlc_phy_txpwr_index_nphy(struct brcms_phy *pi, u8 core_mask,
1133  s8 txpwrindex, bool res);
1134 extern void wlc_phy_rssisel_nphy(struct brcms_phy *pi, u8 core, u8 rssi_type);
1135 extern int wlc_phy_poll_rssi_nphy(struct brcms_phy *pi, u8 rssi_type,
1136  s32 *rssi_buf, u8 nsamps);
1137 extern void wlc_phy_rssi_cal_nphy(struct brcms_phy *pi);
1138 extern int wlc_phy_aci_scan_nphy(struct brcms_phy *pi);
1139 extern void wlc_phy_cal_txgainctrl_nphy(struct brcms_phy *pi,
1140  s32 dBm_targetpower, bool debug);
1141 extern int wlc_phy_tx_tone_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val,
1142  u8 mode, u8, bool);
1143 extern void wlc_phy_stopplayback_nphy(struct brcms_phy *pi);
1144 extern void wlc_phy_est_tonepwr_nphy(struct brcms_phy *pi, s32 *qdBm_pwrbuf,
1145  u8 num_samps);
1146 extern void wlc_phy_radio205x_vcocal_nphy(struct brcms_phy *pi);
1147 
1148 extern int wlc_phy_rssi_compute_nphy(struct brcms_phy *pi,
1149  struct d11rxhdr *rxh);
1150 
1151 #define NPHY_TESTPATTERN_BPHY_EVM 0
1152 #define NPHY_TESTPATTERN_BPHY_RFCS 1
1153 
1154 extern void wlc_phy_nphy_tkip_rifs_war(struct brcms_phy *pi, u8 rifs);
1155 
1156 void wlc_phy_get_pwrdet_offsets(struct brcms_phy *pi, s8 *cckoffset,
1157  s8 *ofdmoffset);
1158 extern s8 wlc_phy_upd_rssi_offset(struct brcms_phy *pi, s8 rssi,
1159  u16 chanspec);
1160 
1161 extern bool wlc_phy_n_txpower_ipa_ison(struct brcms_phy *pih);
1162 #endif /* _BRCM_PHY_INT_H_ */