phy_int.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143
  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. #ifndef _BRCM_PHY_INT_H_
  17. #define _BRCM_PHY_INT_H_
  18. #include <types.h>
  19. #include <brcmu_utils.h>
  20. #include <brcmu_wifi.h>
  21. #define PHY_VERSION { 1, 82, 8, 0 }
  22. #define LCNXN_BASEREV 16
  23. struct phy_shim_info;
  24. struct brcms_phy_srom_fem {
  25. /* TSSI positive slope, 1: positive, 0: negative */
  26. u8 tssipos;
  27. /* Ext PA gain-type: full-gain: 0, pa-lite: 1, no_pa: 2 */
  28. u8 extpagain;
  29. /* support 32 combinations of different Pdet dynamic ranges */
  30. u8 pdetrange;
  31. /* TR switch isolation */
  32. u8 triso;
  33. /* antswctrl lookup table configuration: 32 possible choices */
  34. u8 antswctrllut;
  35. };
  36. #define ISNPHY(pi) PHYTYPE_IS((pi)->pubpi.phy_type, PHY_TYPE_N)
  37. #define ISLCNPHY(pi) PHYTYPE_IS((pi)->pubpi.phy_type, PHY_TYPE_LCN)
  38. #define PHY_GET_RFATTN(rfgain) ((rfgain) & 0x0f)
  39. #define PHY_GET_PADMIX(rfgain) (((rfgain) & 0x10) >> 4)
  40. #define PHY_GET_RFGAINID(rfattn, padmix, width) ((rfattn) + ((padmix)*(width)))
  41. #define PHY_SAT(x, n) ((x) > ((1<<((n)-1))-1) ? ((1<<((n)-1))-1) : \
  42. ((x) < -(1<<((n)-1)) ? -(1<<((n)-1)) : (x)))
  43. #define PHY_SHIFT_ROUND(x, n) ((x) >= 0 ? ((x)+(1<<((n)-1)))>>(n) : (x)>>(n))
  44. #define PHY_HW_ROUND(x, s) ((x >> s) + ((x >> (s-1)) & (s != 0)))
  45. #define CH_5G_GROUP 3
  46. #define A_LOW_CHANS 0
  47. #define A_MID_CHANS 1
  48. #define A_HIGH_CHANS 2
  49. #define CH_2G_GROUP 1
  50. #define G_ALL_CHANS 0
  51. #define FIRST_REF5_CHANNUM 149
  52. #define LAST_REF5_CHANNUM 165
  53. #define FIRST_5G_CHAN 14
  54. #define LAST_5G_CHAN 50
  55. #define FIRST_MID_5G_CHAN 14
  56. #define LAST_MID_5G_CHAN 35
  57. #define FIRST_HIGH_5G_CHAN 36
  58. #define LAST_HIGH_5G_CHAN 41
  59. #define FIRST_LOW_5G_CHAN 42
  60. #define LAST_LOW_5G_CHAN 50
  61. #define BASE_LOW_5G_CHAN 4900
  62. #define BASE_MID_5G_CHAN 5100
  63. #define BASE_HIGH_5G_CHAN 5500
  64. #define CHAN5G_FREQ(chan) (5000 + chan*5)
  65. #define CHAN2G_FREQ(chan) (2407 + chan*5)
  66. #define TXP_FIRST_CCK 0
  67. #define TXP_LAST_CCK 3
  68. #define TXP_FIRST_OFDM 4
  69. #define TXP_LAST_OFDM 11
  70. #define TXP_FIRST_OFDM_20_CDD 12
  71. #define TXP_LAST_OFDM_20_CDD 19
  72. #define TXP_FIRST_MCS_20_SISO 20
  73. #define TXP_LAST_MCS_20_SISO 27
  74. #define TXP_FIRST_MCS_20_CDD 28
  75. #define TXP_LAST_MCS_20_CDD 35
  76. #define TXP_FIRST_MCS_20_STBC 36
  77. #define TXP_LAST_MCS_20_STBC 43
  78. #define TXP_FIRST_MCS_20_SDM 44
  79. #define TXP_LAST_MCS_20_SDM 51
  80. #define TXP_FIRST_OFDM_40_SISO 52
  81. #define TXP_LAST_OFDM_40_SISO 59
  82. #define TXP_FIRST_OFDM_40_CDD 60
  83. #define TXP_LAST_OFDM_40_CDD 67
  84. #define TXP_FIRST_MCS_40_SISO 68
  85. #define TXP_LAST_MCS_40_SISO 75
  86. #define TXP_FIRST_MCS_40_CDD 76
  87. #define TXP_LAST_MCS_40_CDD 83
  88. #define TXP_FIRST_MCS_40_STBC 84
  89. #define TXP_LAST_MCS_40_STBC 91
  90. #define TXP_FIRST_MCS_40_SDM 92
  91. #define TXP_LAST_MCS_40_SDM 99
  92. #define TXP_MCS_32 100
  93. #define TXP_NUM_RATES 101
  94. #define ADJ_PWR_TBL_LEN 84
  95. #define TXP_FIRST_SISO_MCS_20 20
  96. #define TXP_LAST_SISO_MCS_20 27
  97. #define PHY_CORE_NUM_1 1
  98. #define PHY_CORE_NUM_2 2
  99. #define PHY_CORE_NUM_3 3
  100. #define PHY_CORE_NUM_4 4
  101. #define PHY_CORE_MAX PHY_CORE_NUM_4
  102. #define PHY_CORE_0 0
  103. #define PHY_CORE_1 1
  104. #define PHY_CORE_2 2
  105. #define PHY_CORE_3 3
  106. #define MA_WINDOW_SZ 8
  107. #define PHY_NOISE_SAMPLE_MON 1
  108. #define PHY_NOISE_SAMPLE_EXTERNAL 2
  109. #define PHY_NOISE_WINDOW_SZ 16
  110. #define PHY_NOISE_GLITCH_INIT_MA 10
  111. #define PHY_NOISE_GLITCH_INIT_MA_BADPlCP 10
  112. #define PHY_NOISE_STATE_MON 0x1
  113. #define PHY_NOISE_STATE_EXTERNAL 0x2
  114. #define PHY_NOISE_SAMPLE_LOG_NUM_NPHY 10
  115. #define PHY_NOISE_SAMPLE_LOG_NUM_UCODE 9
  116. #define PHY_NOISE_OFFSETFACT_4322 (-103)
  117. #define PHY_NOISE_MA_WINDOW_SZ 2
  118. #define PHY_RSSI_TABLE_SIZE 64
  119. #define RSSI_ANT_MERGE_MAX 0
  120. #define RSSI_ANT_MERGE_MIN 1
  121. #define RSSI_ANT_MERGE_AVG 2
  122. #define PHY_TSSI_TABLE_SIZE 64
  123. #define APHY_TSSI_TABLE_SIZE 256
  124. #define TX_GAIN_TABLE_LENGTH 64
  125. #define DEFAULT_11A_TXP_IDX 24
  126. #define NUM_TSSI_FRAMES 4
  127. #define NULL_TSSI 0x7f
  128. #define NULL_TSSI_W 0x7f7f
  129. #define PHY_PAPD_EPS_TBL_SIZE_LCNPHY 64
  130. #define LCNPHY_PERICAL_TEMPBASED_TXPWRCTRL 9
  131. #define PHY_TXPWR_MIN 10
  132. #define PHY_TXPWR_MIN_NPHY 8
  133. #define RADIOPWR_OVERRIDE_DEF (-1)
  134. #define PWRTBL_NUM_COEFF 3
  135. #define SPURAVOID_DISABLE 0
  136. #define SPURAVOID_AUTO 1
  137. #define SPURAVOID_FORCEON 2
  138. #define SPURAVOID_FORCEON2 3
  139. #define PHY_SW_TIMER_FAST 15
  140. #define PHY_SW_TIMER_SLOW 60
  141. #define PHY_SW_TIMER_GLACIAL 120
  142. #define PHY_PERICAL_AUTO 0
  143. #define PHY_PERICAL_FULL 1
  144. #define PHY_PERICAL_PARTIAL 2
  145. #define PHY_PERICAL_NODELAY 0
  146. #define PHY_PERICAL_INIT_DELAY 5
  147. #define PHY_PERICAL_ASSOC_DELAY 5
  148. #define PHY_PERICAL_WDOG_DELAY 5
  149. #define MPHASE_TXCAL_NUMCMDS 2
  150. #define PHY_PERICAL_MPHASE_PENDING(pi) \
  151. (pi->mphase_cal_phase_id > MPHASE_CAL_STATE_IDLE)
  152. enum {
  153. MPHASE_CAL_STATE_IDLE = 0,
  154. MPHASE_CAL_STATE_INIT = 1,
  155. MPHASE_CAL_STATE_TXPHASE0,
  156. MPHASE_CAL_STATE_TXPHASE1,
  157. MPHASE_CAL_STATE_TXPHASE2,
  158. MPHASE_CAL_STATE_TXPHASE3,
  159. MPHASE_CAL_STATE_TXPHASE4,
  160. MPHASE_CAL_STATE_TXPHASE5,
  161. MPHASE_CAL_STATE_PAPDCAL,
  162. MPHASE_CAL_STATE_RXCAL,
  163. MPHASE_CAL_STATE_RSSICAL,
  164. MPHASE_CAL_STATE_IDLETSSI
  165. };
  166. enum phy_cal_mode {
  167. CAL_FULL,
  168. CAL_RECAL,
  169. CAL_CURRECAL,
  170. CAL_DIGCAL,
  171. CAL_GCTRL,
  172. CAL_SOFT,
  173. CAL_DIGLO
  174. };
  175. #define RDR_NTIERS 1
  176. #define RDR_TIER_SIZE 64
  177. #define RDR_LIST_SIZE (512/3)
  178. #define RDR_EPOCH_SIZE 40
  179. #define RDR_NANTENNAS 2
  180. #define RDR_NTIER_SIZE RDR_LIST_SIZE
  181. #define RDR_LP_BUFFER_SIZE 64
  182. #define LP_LEN_HIS_SIZE 10
  183. #define STATIC_NUM_RF 32
  184. #define STATIC_NUM_BB 9
  185. #define BB_MULT_MASK 0x0000ffff
  186. #define BB_MULT_VALID_MASK 0x80000000
  187. #define CORDIC_AG 39797
  188. #define CORDIC_NI 18
  189. #define FIXED(X) ((s32)((X) << 16))
  190. #define FLOAT(X) \
  191. (((X) >= 0) ? ((((X) >> 15) + 1) >> 1) : -((((-(X)) >> 15) + 1) >> 1))
  192. #define PHY_CHAIN_TX_DISABLE_TEMP 115
  193. #define PHY_HYSTERESIS_DELTATEMP 5
  194. #define SCAN_INPROG_PHY(pi) \
  195. (mboolisset(pi->measure_hold, PHY_HOLD_FOR_SCAN))
  196. #define PLT_INPROG_PHY(pi) (mboolisset(pi->measure_hold, PHY_HOLD_FOR_PLT))
  197. #define ASSOC_INPROG_PHY(pi) \
  198. (mboolisset(pi->measure_hold, PHY_HOLD_FOR_ASSOC))
  199. #define SCAN_RM_IN_PROGRESS(pi) \
  200. (mboolisset(pi->measure_hold, PHY_HOLD_FOR_SCAN | PHY_HOLD_FOR_RM))
  201. #define PHY_MUTED(pi) \
  202. (mboolisset(pi->measure_hold, PHY_HOLD_FOR_MUTE))
  203. #define PUB_NOT_ASSOC(pi) \
  204. (mboolisset(pi->measure_hold, PHY_HOLD_FOR_NOT_ASSOC))
  205. struct phy_table_info {
  206. uint table;
  207. int q;
  208. uint max;
  209. };
  210. struct phytbl_info {
  211. const void *tbl_ptr;
  212. u32 tbl_len;
  213. u32 tbl_id;
  214. u32 tbl_offset;
  215. u32 tbl_width;
  216. };
  217. struct interference_info {
  218. u8 curr_home_channel;
  219. u16 crsminpwrthld_40_stored;
  220. u16 crsminpwrthld_20L_stored;
  221. u16 crsminpwrthld_20U_stored;
  222. u16 init_gain_code_core1_stored;
  223. u16 init_gain_code_core2_stored;
  224. u16 init_gain_codeb_core1_stored;
  225. u16 init_gain_codeb_core2_stored;
  226. u16 init_gain_table_stored[4];
  227. u16 clip1_hi_gain_code_core1_stored;
  228. u16 clip1_hi_gain_code_core2_stored;
  229. u16 clip1_hi_gain_codeb_core1_stored;
  230. u16 clip1_hi_gain_codeb_core2_stored;
  231. u16 nb_clip_thresh_core1_stored;
  232. u16 nb_clip_thresh_core2_stored;
  233. u16 init_ofdmlna2gainchange_stored[4];
  234. u16 init_ccklna2gainchange_stored[4];
  235. u16 clip1_lo_gain_code_core1_stored;
  236. u16 clip1_lo_gain_code_core2_stored;
  237. u16 clip1_lo_gain_codeb_core1_stored;
  238. u16 clip1_lo_gain_codeb_core2_stored;
  239. u16 w1_clip_thresh_core1_stored;
  240. u16 w1_clip_thresh_core2_stored;
  241. u16 radio_2056_core1_rssi_gain_stored;
  242. u16 radio_2056_core2_rssi_gain_stored;
  243. u16 energy_drop_timeout_len_stored;
  244. u16 ed_crs40_assertthld0_stored;
  245. u16 ed_crs40_assertthld1_stored;
  246. u16 ed_crs40_deassertthld0_stored;
  247. u16 ed_crs40_deassertthld1_stored;
  248. u16 ed_crs20L_assertthld0_stored;
  249. u16 ed_crs20L_assertthld1_stored;
  250. u16 ed_crs20L_deassertthld0_stored;
  251. u16 ed_crs20L_deassertthld1_stored;
  252. u16 ed_crs20U_assertthld0_stored;
  253. u16 ed_crs20U_assertthld1_stored;
  254. u16 ed_crs20U_deassertthld0_stored;
  255. u16 ed_crs20U_deassertthld1_stored;
  256. u16 badplcp_ma;
  257. u16 badplcp_ma_previous;
  258. u16 badplcp_ma_total;
  259. u16 badplcp_ma_list[MA_WINDOW_SZ];
  260. int badplcp_ma_index;
  261. s16 pre_badplcp_cnt;
  262. s16 bphy_pre_badplcp_cnt;
  263. u16 init_gain_core1;
  264. u16 init_gain_core2;
  265. u16 init_gainb_core1;
  266. u16 init_gainb_core2;
  267. u16 init_gain_rfseq[4];
  268. u16 crsminpwr0;
  269. u16 crsminpwrl0;
  270. u16 crsminpwru0;
  271. s16 crsminpwr_index;
  272. u16 radio_2057_core1_rssi_wb1a_gc_stored;
  273. u16 radio_2057_core2_rssi_wb1a_gc_stored;
  274. u16 radio_2057_core1_rssi_wb1g_gc_stored;
  275. u16 radio_2057_core2_rssi_wb1g_gc_stored;
  276. u16 radio_2057_core1_rssi_wb2_gc_stored;
  277. u16 radio_2057_core2_rssi_wb2_gc_stored;
  278. u16 radio_2057_core1_rssi_nb_gc_stored;
  279. u16 radio_2057_core2_rssi_nb_gc_stored;
  280. };
  281. struct aci_save_gphy {
  282. u16 rc_cal_ovr;
  283. u16 phycrsth1;
  284. u16 phycrsth2;
  285. u16 init_n1p1_gain;
  286. u16 p1_p2_gain;
  287. u16 n1_n2_gain;
  288. u16 n1_p1_gain;
  289. u16 div_search_gain;
  290. u16 div_p1_p2_gain;
  291. u16 div_search_gn_change;
  292. u16 table_7_2;
  293. u16 table_7_3;
  294. u16 cckshbits_gnref;
  295. u16 clip_thresh;
  296. u16 clip2_thresh;
  297. u16 clip3_thresh;
  298. u16 clip_p2_thresh;
  299. u16 clip_pwdn_thresh;
  300. u16 clip_n1p1_thresh;
  301. u16 clip_n1_pwdn_thresh;
  302. u16 bbconfig;
  303. u16 cthr_sthr_shdin;
  304. u16 energy;
  305. u16 clip_p1_p2_thresh;
  306. u16 threshold;
  307. u16 reg15;
  308. u16 reg16;
  309. u16 reg17;
  310. u16 div_srch_idx;
  311. u16 div_srch_p1_p2;
  312. u16 div_srch_gn_back;
  313. u16 ant_dwell;
  314. u16 ant_wr_settle;
  315. };
  316. struct lo_complex_abgphy_info {
  317. s8 i;
  318. s8 q;
  319. };
  320. struct nphy_iq_comp {
  321. s16 a0;
  322. s16 b0;
  323. s16 a1;
  324. s16 b1;
  325. };
  326. struct nphy_txpwrindex {
  327. s8 index;
  328. s8 index_internal;
  329. s8 index_internal_save;
  330. u16 AfectrlOverride;
  331. u16 AfeCtrlDacGain;
  332. u16 rad_gain;
  333. u8 bbmult;
  334. u16 iqcomp_a;
  335. u16 iqcomp_b;
  336. u16 locomp;
  337. };
  338. struct txiqcal_cache {
  339. u16 txcal_coeffs_2G[8];
  340. u16 txcal_radio_regs_2G[8];
  341. struct nphy_iq_comp rxcal_coeffs_2G;
  342. u16 txcal_coeffs_5G[8];
  343. u16 txcal_radio_regs_5G[8];
  344. struct nphy_iq_comp rxcal_coeffs_5G;
  345. };
  346. struct nphy_pwrctrl {
  347. s8 max_pwr_2g;
  348. s8 idle_targ_2g;
  349. s16 pwrdet_2g_a1;
  350. s16 pwrdet_2g_b0;
  351. s16 pwrdet_2g_b1;
  352. s8 max_pwr_5gm;
  353. s8 idle_targ_5gm;
  354. s8 max_pwr_5gh;
  355. s8 max_pwr_5gl;
  356. s16 pwrdet_5gm_a1;
  357. s16 pwrdet_5gm_b0;
  358. s16 pwrdet_5gm_b1;
  359. s16 pwrdet_5gl_a1;
  360. s16 pwrdet_5gl_b0;
  361. s16 pwrdet_5gl_b1;
  362. s16 pwrdet_5gh_a1;
  363. s16 pwrdet_5gh_b0;
  364. s16 pwrdet_5gh_b1;
  365. s8 idle_targ_5gl;
  366. s8 idle_targ_5gh;
  367. s8 idle_tssi_2g;
  368. s8 idle_tssi_5g;
  369. s8 idle_tssi;
  370. s16 a1;
  371. s16 b0;
  372. s16 b1;
  373. };
  374. struct nphy_txgains {
  375. u16 txlpf[2];
  376. u16 txgm[2];
  377. u16 pga[2];
  378. u16 pad[2];
  379. u16 ipa[2];
  380. };
  381. #define PHY_NOISEVAR_BUFSIZE 10
  382. struct nphy_noisevar_buf {
  383. int bufcount;
  384. int tone_id[PHY_NOISEVAR_BUFSIZE];
  385. u32 noise_vars[PHY_NOISEVAR_BUFSIZE];
  386. u32 min_noise_vars[PHY_NOISEVAR_BUFSIZE];
  387. };
  388. struct rssical_cache {
  389. u16 rssical_radio_regs_2G[2];
  390. u16 rssical_phyregs_2G[12];
  391. u16 rssical_radio_regs_5G[2];
  392. u16 rssical_phyregs_5G[12];
  393. };
  394. struct lcnphy_cal_results {
  395. u16 txiqlocal_a;
  396. u16 txiqlocal_b;
  397. u16 txiqlocal_didq;
  398. u8 txiqlocal_ei0;
  399. u8 txiqlocal_eq0;
  400. u8 txiqlocal_fi0;
  401. u8 txiqlocal_fq0;
  402. u16 txiqlocal_bestcoeffs[11];
  403. u16 txiqlocal_bestcoeffs_valid;
  404. u32 papd_eps_tbl[PHY_PAPD_EPS_TBL_SIZE_LCNPHY];
  405. u16 analog_gain_ref;
  406. u16 lut_begin;
  407. u16 lut_end;
  408. u16 lut_step;
  409. u16 rxcompdbm;
  410. u16 papdctrl;
  411. u16 sslpnCalibClkEnCtrl;
  412. u16 rxiqcal_coeff_a0;
  413. u16 rxiqcal_coeff_b0;
  414. };
  415. struct shared_phy {
  416. struct brcms_phy *phy_head;
  417. uint unit;
  418. struct phy_shim_info *physhim;
  419. uint corerev;
  420. u32 machwcap;
  421. bool up;
  422. bool clk;
  423. uint now;
  424. u16 vid;
  425. u16 did;
  426. uint chip;
  427. uint chiprev;
  428. uint chippkg;
  429. uint sromrev;
  430. uint boardtype;
  431. uint boardrev;
  432. u32 boardflags;
  433. u32 boardflags2;
  434. uint fast_timer;
  435. uint slow_timer;
  436. uint glacial_timer;
  437. u8 rx_antdiv;
  438. s8 phy_noise_window[MA_WINDOW_SZ];
  439. uint phy_noise_index;
  440. u8 hw_phytxchain;
  441. u8 hw_phyrxchain;
  442. u8 phytxchain;
  443. u8 phyrxchain;
  444. u8 rssi_mode;
  445. bool _rifs_phy;
  446. };
  447. struct brcms_phy_pub {
  448. uint phy_type;
  449. uint phy_rev;
  450. u8 phy_corenum;
  451. u16 radioid;
  452. u8 radiorev;
  453. u8 radiover;
  454. uint coreflags;
  455. uint ana_rev;
  456. bool abgphy_encore;
  457. };
  458. struct phy_func_ptr {
  459. void (*init)(struct brcms_phy *);
  460. void (*calinit)(struct brcms_phy *);
  461. void (*chanset)(struct brcms_phy *, u16 chanspec);
  462. void (*txpwrrecalc)(struct brcms_phy *);
  463. int (*longtrn)(struct brcms_phy *, int);
  464. void (*txiqccget)(struct brcms_phy *, u16 *, u16 *);
  465. void (*txiqccset)(struct brcms_phy *, u16, u16);
  466. u16 (*txloccget)(struct brcms_phy *);
  467. void (*radioloftget)(struct brcms_phy *, u8 *, u8 *, u8 *, u8 *);
  468. void (*carrsuppr)(struct brcms_phy *);
  469. s32 (*rxsigpwr)(struct brcms_phy *, s32);
  470. void (*detach)(struct brcms_phy *);
  471. };
  472. struct brcms_phy {
  473. struct brcms_phy_pub pubpi_ro;
  474. struct shared_phy *sh;
  475. struct phy_func_ptr pi_fptr;
  476. union {
  477. struct brcms_phy_lcnphy *pi_lcnphy;
  478. } u;
  479. bool user_txpwr_at_rfport;
  480. struct bcma_device *d11core;
  481. struct brcms_phy *next;
  482. struct brcms_phy_pub pubpi;
  483. bool do_initcal;
  484. bool phytest_on;
  485. bool ofdm_rateset_war;
  486. bool bf_preempt_4306;
  487. u16 radio_chanspec;
  488. u8 antsel_type;
  489. u16 bw;
  490. u8 txpwr_percent;
  491. bool phy_init_por;
  492. bool init_in_progress;
  493. bool initialized;
  494. bool sbtml_gm;
  495. uint refcnt;
  496. bool watchdog_override;
  497. u8 phynoise_state;
  498. uint phynoise_now;
  499. int phynoise_chan_watchdog;
  500. bool phynoise_polling;
  501. bool disable_percal;
  502. u32 measure_hold;
  503. s16 txpa_2g[PWRTBL_NUM_COEFF];
  504. s16 txpa_2g_low_temp[PWRTBL_NUM_COEFF];
  505. s16 txpa_2g_high_temp[PWRTBL_NUM_COEFF];
  506. s16 txpa_5g_low[PWRTBL_NUM_COEFF];
  507. s16 txpa_5g_mid[PWRTBL_NUM_COEFF];
  508. s16 txpa_5g_hi[PWRTBL_NUM_COEFF];
  509. u8 tx_srom_max_2g;
  510. u8 tx_srom_max_5g_low;
  511. u8 tx_srom_max_5g_mid;
  512. u8 tx_srom_max_5g_hi;
  513. u8 tx_srom_max_rate_2g[TXP_NUM_RATES];
  514. u8 tx_srom_max_rate_5g_low[TXP_NUM_RATES];
  515. u8 tx_srom_max_rate_5g_mid[TXP_NUM_RATES];
  516. u8 tx_srom_max_rate_5g_hi[TXP_NUM_RATES];
  517. u8 tx_user_target[TXP_NUM_RATES];
  518. s8 tx_power_offset[TXP_NUM_RATES];
  519. u8 tx_power_target[TXP_NUM_RATES];
  520. struct brcms_phy_srom_fem srom_fem2g;
  521. struct brcms_phy_srom_fem srom_fem5g;
  522. u8 tx_power_max;
  523. u8 tx_power_max_rate_ind;
  524. bool hwpwrctrl;
  525. u8 nphy_txpwrctrl;
  526. s8 nphy_txrx_chain;
  527. bool phy_5g_pwrgain;
  528. u16 phy_wreg;
  529. u16 phy_wreg_limit;
  530. s8 n_preamble_override;
  531. u8 antswitch;
  532. u8 aa2g, aa5g;
  533. s8 idle_tssi[CH_5G_GROUP];
  534. s8 target_idle_tssi;
  535. s8 txpwr_est_Pout;
  536. u8 tx_power_min;
  537. u8 txpwr_limit[TXP_NUM_RATES];
  538. u8 txpwr_env_limit[TXP_NUM_RATES];
  539. u8 adj_pwr_tbl_nphy[ADJ_PWR_TBL_LEN];
  540. bool channel_14_wide_filter;
  541. bool txpwroverride;
  542. bool txpwridx_override_aphy;
  543. s16 radiopwr_override;
  544. u16 hwpwr_txcur;
  545. u8 saved_txpwr_idx;
  546. bool edcrs_threshold_lock;
  547. u32 tr_R_gain_val;
  548. u32 tr_T_gain_val;
  549. s16 ofdm_analog_filt_bw_override;
  550. s16 cck_analog_filt_bw_override;
  551. s16 ofdm_rccal_override;
  552. s16 cck_rccal_override;
  553. u16 extlna_type;
  554. uint interference_mode_crs_time;
  555. u16 crsglitch_prev;
  556. bool interference_mode_crs;
  557. u32 phy_tx_tone_freq;
  558. uint phy_lastcal;
  559. bool phy_forcecal;
  560. bool phy_fixed_noise;
  561. u32 xtalfreq;
  562. u8 pdiv;
  563. s8 carrier_suppr_disable;
  564. bool phy_bphy_evm;
  565. bool phy_bphy_rfcs;
  566. s8 phy_scraminit;
  567. u8 phy_gpiosel;
  568. s16 phy_txcore_disable_temp;
  569. s16 phy_txcore_enable_temp;
  570. s8 phy_tempsense_offset;
  571. bool phy_txcore_heatedup;
  572. u16 radiopwr;
  573. u16 bb_atten;
  574. u16 txctl1;
  575. u16 mintxbias;
  576. u16 mintxmag;
  577. struct lo_complex_abgphy_info gphy_locomp_iq
  578. [STATIC_NUM_RF][STATIC_NUM_BB];
  579. s8 stats_11b_txpower[STATIC_NUM_RF][STATIC_NUM_BB];
  580. u16 gain_table[TX_GAIN_TABLE_LENGTH];
  581. bool loopback_gain;
  582. s16 max_lpback_gain_hdB;
  583. s16 trsw_rx_gain_hdB;
  584. u8 power_vec[8];
  585. u16 rc_cal;
  586. int nrssi_table_delta;
  587. int nrssi_slope_scale;
  588. int nrssi_slope_offset;
  589. int min_rssi;
  590. int max_rssi;
  591. s8 txpwridx;
  592. u8 min_txpower;
  593. u8 a_band_high_disable;
  594. u16 tx_vos;
  595. u16 global_tx_bb_dc_bias_loft;
  596. int rf_max;
  597. int bb_max;
  598. int rf_list_size;
  599. int bb_list_size;
  600. u16 *rf_attn_list;
  601. u16 *bb_attn_list;
  602. u16 padmix_mask;
  603. u16 padmix_reg;
  604. u16 *txmag_list;
  605. uint txmag_len;
  606. bool txmag_enable;
  607. s8 *a_tssi_to_dbm;
  608. s8 *m_tssi_to_dbm;
  609. s8 *l_tssi_to_dbm;
  610. s8 *h_tssi_to_dbm;
  611. u8 *hwtxpwr;
  612. u16 freqtrack_saved_regs[2];
  613. int cur_interference_mode;
  614. bool hwpwrctrl_capable;
  615. bool temppwrctrl_capable;
  616. uint phycal_nslope;
  617. uint phycal_noffset;
  618. uint phycal_mlo;
  619. uint phycal_txpower;
  620. u8 phy_aa2g;
  621. bool nphy_tableloaded;
  622. s8 nphy_rssisel;
  623. u32 nphy_bb_mult_save;
  624. u16 nphy_txiqlocal_bestc[11];
  625. bool nphy_txiqlocal_coeffsvalid;
  626. struct nphy_txpwrindex nphy_txpwrindex[PHY_CORE_NUM_2];
  627. struct nphy_pwrctrl nphy_pwrctrl_info[PHY_CORE_NUM_2];
  628. u16 cck2gpo;
  629. u32 ofdm2gpo;
  630. u32 ofdm5gpo;
  631. u32 ofdm5glpo;
  632. u32 ofdm5ghpo;
  633. u8 bw402gpo;
  634. u8 bw405gpo;
  635. u8 bw405glpo;
  636. u8 bw405ghpo;
  637. u8 cdd2gpo;
  638. u8 cdd5gpo;
  639. u8 cdd5glpo;
  640. u8 cdd5ghpo;
  641. u8 stbc2gpo;
  642. u8 stbc5gpo;
  643. u8 stbc5glpo;
  644. u8 stbc5ghpo;
  645. u8 bwdup2gpo;
  646. u8 bwdup5gpo;
  647. u8 bwdup5glpo;
  648. u8 bwdup5ghpo;
  649. u16 mcs2gpo[8];
  650. u16 mcs5gpo[8];
  651. u16 mcs5glpo[8];
  652. u16 mcs5ghpo[8];
  653. u32 nphy_rxcalparams;
  654. u8 phy_spuravoid;
  655. bool phy_isspuravoid;
  656. u8 phy_pabias;
  657. u8 nphy_papd_skip;
  658. u8 nphy_tssi_slope;
  659. s16 nphy_noise_win[PHY_CORE_MAX][PHY_NOISE_WINDOW_SZ];
  660. u8 nphy_noise_index;
  661. bool nphy_gain_boost;
  662. bool nphy_elna_gain_config;
  663. u16 old_bphy_test;
  664. u16 old_bphy_testcontrol;
  665. bool phyhang_avoid;
  666. bool rssical_nphy;
  667. u8 nphy_perical;
  668. uint nphy_perical_last;
  669. u8 cal_type_override;
  670. u8 mphase_cal_phase_id;
  671. u8 mphase_txcal_cmdidx;
  672. u8 mphase_txcal_numcmds;
  673. u16 mphase_txcal_bestcoeffs[11];
  674. u16 nphy_txiqlocal_chanspec;
  675. u16 nphy_iqcal_chanspec_2G;
  676. u16 nphy_iqcal_chanspec_5G;
  677. u16 nphy_rssical_chanspec_2G;
  678. u16 nphy_rssical_chanspec_5G;
  679. struct wlapi_timer *phycal_timer;
  680. bool use_int_tx_iqlo_cal_nphy;
  681. bool internal_tx_iqlo_cal_tapoff_intpa_nphy;
  682. s16 nphy_lastcal_temp;
  683. struct txiqcal_cache calibration_cache;
  684. struct rssical_cache rssical_cache;
  685. u8 nphy_txpwr_idx[2];
  686. u8 nphy_papd_cal_type;
  687. uint nphy_papd_last_cal;
  688. u16 nphy_papd_tx_gain_at_last_cal[2];
  689. u8 nphy_papd_cal_gain_index[2];
  690. s16 nphy_papd_epsilon_offset[2];
  691. bool nphy_papd_recal_enable;
  692. u32 nphy_papd_recal_counter;
  693. bool nphy_force_papd_cal;
  694. bool nphy_papdcomp;
  695. bool ipa2g_on;
  696. bool ipa5g_on;
  697. u16 classifier_state;
  698. u16 clip_state[2];
  699. uint nphy_deaf_count;
  700. u8 rxiq_samps;
  701. u8 rxiq_antsel;
  702. u16 rfctrlIntc1_save;
  703. u16 rfctrlIntc2_save;
  704. bool first_cal_after_assoc;
  705. u16 tx_rx_cal_radio_saveregs[22];
  706. u16 tx_rx_cal_phy_saveregs[15];
  707. u8 nphy_cal_orig_pwr_idx[2];
  708. u8 nphy_txcal_pwr_idx[2];
  709. u8 nphy_rxcal_pwr_idx[2];
  710. u16 nphy_cal_orig_tx_gain[2];
  711. struct nphy_txgains nphy_cal_target_gain;
  712. u16 nphy_txcal_bbmult;
  713. u16 nphy_gmval;
  714. u16 nphy_saved_bbconf;
  715. bool nphy_gband_spurwar_en;
  716. bool nphy_gband_spurwar2_en;
  717. bool nphy_aband_spurwar_en;
  718. u16 nphy_rccal_value;
  719. u16 nphy_crsminpwr[3];
  720. struct nphy_noisevar_buf nphy_saved_noisevars;
  721. bool nphy_anarxlpf_adjusted;
  722. bool nphy_crsminpwr_adjusted;
  723. bool nphy_noisevars_adjusted;
  724. bool nphy_rxcal_active;
  725. u16 radar_percal_mask;
  726. bool dfs_lp_buffer_nphy;
  727. u16 nphy_fineclockgatecontrol;
  728. s8 rx2tx_biasentry;
  729. u16 crsminpwr0;
  730. u16 crsminpwrl0;
  731. u16 crsminpwru0;
  732. s16 noise_crsminpwr_index;
  733. u16 init_gain_core1;
  734. u16 init_gain_core2;
  735. u16 init_gainb_core1;
  736. u16 init_gainb_core2;
  737. u8 aci_noise_curr_channel;
  738. u16 init_gain_rfseq[4];
  739. bool radio_is_on;
  740. bool nphy_sample_play_lpf_bw_ctl_ovr;
  741. u16 tbl_data_hi;
  742. u16 tbl_data_lo;
  743. u16 tbl_addr;
  744. uint tbl_save_id;
  745. uint tbl_save_offset;
  746. u8 txpwrctrl;
  747. s8 txpwrindex[PHY_CORE_MAX];
  748. u8 phycal_tempdelta;
  749. u32 mcs20_po;
  750. u32 mcs40_po;
  751. struct wiphy *wiphy;
  752. };
  753. struct cs32 {
  754. s32 q;
  755. s32 i;
  756. };
  757. struct radio_regs {
  758. u16 address;
  759. u32 init_a;
  760. u32 init_g;
  761. u8 do_init_a;
  762. u8 do_init_g;
  763. };
  764. struct radio_20xx_regs {
  765. u16 address;
  766. u8 init;
  767. u8 do_init;
  768. };
  769. struct lcnphy_radio_regs {
  770. u16 address;
  771. u8 init_a;
  772. u8 init_g;
  773. u8 do_init_a;
  774. u8 do_init_g;
  775. };
  776. u16 read_phy_reg(struct brcms_phy *pi, u16 addr);
  777. void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val);
  778. void and_phy_reg(struct brcms_phy *pi, u16 addr, u16 val);
  779. void or_phy_reg(struct brcms_phy *pi, u16 addr, u16 val);
  780. void mod_phy_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val);
  781. u16 read_radio_reg(struct brcms_phy *pi, u16 addr);
  782. void or_radio_reg(struct brcms_phy *pi, u16 addr, u16 val);
  783. void and_radio_reg(struct brcms_phy *pi, u16 addr, u16 val);
  784. void mod_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val);
  785. void xor_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask);
  786. void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val);
  787. void wlc_phyreg_enter(struct brcms_phy_pub *pih);
  788. void wlc_phyreg_exit(struct brcms_phy_pub *pih);
  789. void wlc_radioreg_enter(struct brcms_phy_pub *pih);
  790. void wlc_radioreg_exit(struct brcms_phy_pub *pih);
  791. void wlc_phy_read_table(struct brcms_phy *pi,
  792. const struct phytbl_info *ptbl_info,
  793. u16 tblAddr, u16 tblDataHi, u16 tblDatalo);
  794. void wlc_phy_write_table(struct brcms_phy *pi,
  795. const struct phytbl_info *ptbl_info,
  796. u16 tblAddr, u16 tblDataHi, u16 tblDatalo);
  797. void wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, uint tbl_offset,
  798. u16 tblAddr, u16 tblDataHi, u16 tblDataLo);
  799. void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val);
  800. void write_phy_channel_reg(struct brcms_phy *pi, uint val);
  801. void wlc_phy_txpower_update_shm(struct brcms_phy *pi);
  802. u8 wlc_phy_nbits(s32 value);
  803. void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_dB, u8 core);
  804. uint wlc_phy_init_radio_regs_allbands(struct brcms_phy *pi,
  805. struct radio_20xx_regs *radioregs);
  806. uint wlc_phy_init_radio_regs(struct brcms_phy *pi,
  807. const struct radio_regs *radioregs,
  808. u16 core_offset);
  809. void wlc_phy_txpower_ipa_upd(struct brcms_phy *pi);
  810. void wlc_phy_do_dummy_tx(struct brcms_phy *pi, bool ofdm, bool pa_on);
  811. void wlc_phy_papd_decode_epsilon(u32 epsilon, s32 *eps_real, s32 *eps_imag);
  812. void wlc_phy_cal_perical_mphase_reset(struct brcms_phy *pi);
  813. void wlc_phy_cal_perical_mphase_restart(struct brcms_phy *pi);
  814. bool wlc_phy_attach_nphy(struct brcms_phy *pi);
  815. bool wlc_phy_attach_lcnphy(struct brcms_phy *pi);
  816. void wlc_phy_detach_lcnphy(struct brcms_phy *pi);
  817. void wlc_phy_init_nphy(struct brcms_phy *pi);
  818. void wlc_phy_init_lcnphy(struct brcms_phy *pi);
  819. void wlc_phy_cal_init_nphy(struct brcms_phy *pi);
  820. void wlc_phy_cal_init_lcnphy(struct brcms_phy *pi);
  821. void wlc_phy_chanspec_set_nphy(struct brcms_phy *pi, u16 chanspec);
  822. void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec);
  823. void wlc_phy_chanspec_set_fixup_lcnphy(struct brcms_phy *pi, u16 chanspec);
  824. int wlc_phy_channel2freq(uint channel);
  825. int wlc_phy_chanspec_freq2bandrange_lpssn(uint);
  826. int wlc_phy_chanspec_bandrange_get(struct brcms_phy *, u16 chanspec);
  827. void wlc_lcnphy_set_tx_pwr_ctrl(struct brcms_phy *pi, u16 mode);
  828. s8 wlc_lcnphy_get_current_tx_pwr_idx(struct brcms_phy *pi);
  829. void wlc_phy_txpower_recalc_target_nphy(struct brcms_phy *pi);
  830. void wlc_lcnphy_txpower_recalc_target(struct brcms_phy *pi);
  831. void wlc_phy_txpower_recalc_target_lcnphy(struct brcms_phy *pi);
  832. void wlc_lcnphy_set_tx_pwr_by_index(struct brcms_phy *pi, int index);
  833. void wlc_lcnphy_tx_pu(struct brcms_phy *pi, bool bEnable);
  834. void wlc_lcnphy_stop_tx_tone(struct brcms_phy *pi);
  835. void wlc_lcnphy_start_tx_tone(struct brcms_phy *pi, s32 f_kHz, u16 max_val,
  836. bool iqcalmode);
  837. void wlc_phy_txpower_sromlimit_get_nphy(struct brcms_phy *pi, uint chan,
  838. u8 *max_pwr, u8 rate_id);
  839. void wlc_phy_ofdm_to_mcs_powers_nphy(u8 *power, u8 rate_mcs_start,
  840. u8 rate_mcs_end, u8 rate_ofdm_start);
  841. void wlc_phy_mcs_to_ofdm_powers_nphy(u8 *power, u8 rate_ofdm_start,
  842. u8 rate_ofdm_end, u8 rate_mcs_start);
  843. u16 wlc_lcnphy_tempsense(struct brcms_phy *pi, bool mode);
  844. s16 wlc_lcnphy_tempsense_new(struct brcms_phy *pi, bool mode);
  845. s8 wlc_lcnphy_tempsense_degree(struct brcms_phy *pi, bool mode);
  846. s8 wlc_lcnphy_vbatsense(struct brcms_phy *pi, bool mode);
  847. void wlc_phy_carrier_suppress_lcnphy(struct brcms_phy *pi);
  848. void wlc_lcnphy_crsuprs(struct brcms_phy *pi, int channel);
  849. void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode);
  850. void wlc_2064_vco_cal(struct brcms_phy *pi);
  851. void wlc_phy_txpower_recalc_target(struct brcms_phy *pi);
  852. #define LCNPHY_TBL_ID_PAPDCOMPDELTATBL 0x18
  853. #define LCNPHY_TX_POWER_TABLE_SIZE 128
  854. #define LCNPHY_MAX_TX_POWER_INDEX (LCNPHY_TX_POWER_TABLE_SIZE - 1)
  855. #define LCNPHY_TBL_ID_TXPWRCTL 0x07
  856. #define LCNPHY_TX_PWR_CTRL_OFF 0
  857. #define LCNPHY_TX_PWR_CTRL_SW (0x1 << 15)
  858. #define LCNPHY_TX_PWR_CTRL_HW ((0x1 << 15) | \
  859. (0x1 << 14) | \
  860. (0x1 << 13))
  861. #define LCNPHY_TX_PWR_CTRL_TEMPBASED 0xE001
  862. void wlc_lcnphy_write_table(struct brcms_phy *pi,
  863. const struct phytbl_info *pti);
  864. void wlc_lcnphy_read_table(struct brcms_phy *pi, struct phytbl_info *pti);
  865. void wlc_lcnphy_set_tx_iqcc(struct brcms_phy *pi, u16 a, u16 b);
  866. void wlc_lcnphy_set_tx_locc(struct brcms_phy *pi, u16 didq);
  867. void wlc_lcnphy_get_tx_iqcc(struct brcms_phy *pi, u16 *a, u16 *b);
  868. u16 wlc_lcnphy_get_tx_locc(struct brcms_phy *pi);
  869. void wlc_lcnphy_get_radio_loft(struct brcms_phy *pi, u8 *ei0, u8 *eq0, u8 *fi0,
  870. u8 *fq0);
  871. void wlc_lcnphy_calib_modes(struct brcms_phy *pi, uint mode);
  872. void wlc_lcnphy_deaf_mode(struct brcms_phy *pi, bool mode);
  873. bool wlc_phy_tpc_isenabled_lcnphy(struct brcms_phy *pi);
  874. void wlc_lcnphy_tx_pwr_update_npt(struct brcms_phy *pi);
  875. s32 wlc_lcnphy_tssi2dbm(s32 tssi, s32 a1, s32 b0, s32 b1);
  876. void wlc_lcnphy_get_tssi(struct brcms_phy *pi, s8 *ofdm_pwr, s8 *cck_pwr);
  877. void wlc_lcnphy_tx_power_adjustment(struct brcms_phy_pub *ppi);
  878. s32 wlc_lcnphy_rx_signal_power(struct brcms_phy *pi, s32 gain_index);
  879. #define NPHY_MAX_HPVGA1_INDEX 10
  880. #define NPHY_DEF_HPVGA1_INDEXLIMIT 7
  881. struct phy_iq_est {
  882. s32 iq_prod;
  883. u32 i_pwr;
  884. u32 q_pwr;
  885. };
  886. void wlc_phy_stay_in_carriersearch_nphy(struct brcms_phy *pi, bool enable);
  887. void wlc_nphy_deaf_mode(struct brcms_phy *pi, bool mode);
  888. #define wlc_phy_write_table_nphy(pi, pti) \
  889. wlc_phy_write_table(pi, pti, 0x72, 0x74, 0x73)
  890. #define wlc_phy_read_table_nphy(pi, pti) \
  891. wlc_phy_read_table(pi, pti, 0x72, 0x74, 0x73)
  892. #define wlc_nphy_table_addr(pi, id, off) \
  893. wlc_phy_table_addr((pi), (id), (off), 0x72, 0x74, 0x73)
  894. #define wlc_nphy_table_data_write(pi, w, v) \
  895. wlc_phy_table_data_write((pi), (w), (v))
  896. void wlc_phy_table_read_nphy(struct brcms_phy *pi, u32, u32 l, u32 o, u32 w,
  897. void *d);
  898. void wlc_phy_table_write_nphy(struct brcms_phy *pi, u32, u32, u32, u32,
  899. const void *);
  900. #define PHY_IPA(pi) \
  901. ((pi->ipa2g_on && CHSPEC_IS2G(pi->radio_chanspec)) || \
  902. (pi->ipa5g_on && CHSPEC_IS5G(pi->radio_chanspec)))
  903. #define BRCMS_PHY_WAR_PR51571(pi) \
  904. if (NREV_LT((pi)->pubpi.phy_rev, 3)) \
  905. (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol))
  906. void wlc_phy_cal_perical_nphy_run(struct brcms_phy *pi, u8 caltype);
  907. void wlc_phy_aci_reset_nphy(struct brcms_phy *pi);
  908. void wlc_phy_pa_override_nphy(struct brcms_phy *pi, bool en);
  909. u8 wlc_phy_get_chan_freq_range_nphy(struct brcms_phy *pi, uint chan);
  910. void wlc_phy_switch_radio_nphy(struct brcms_phy *pi, bool on);
  911. void wlc_phy_stf_chain_upd_nphy(struct brcms_phy *pi);
  912. void wlc_phy_force_rfseq_nphy(struct brcms_phy *pi, u8 cmd);
  913. s16 wlc_phy_tempsense_nphy(struct brcms_phy *pi);
  914. u16 wlc_phy_classifier_nphy(struct brcms_phy *pi, u16 mask, u16 val);
  915. void wlc_phy_rx_iq_est_nphy(struct brcms_phy *pi, struct phy_iq_est *est,
  916. u16 num_samps, u8 wait_time, u8 wait_for_crs);
  917. void wlc_phy_rx_iq_coeffs_nphy(struct brcms_phy *pi, u8 write,
  918. struct nphy_iq_comp *comp);
  919. void wlc_phy_aci_and_noise_reduction_nphy(struct brcms_phy *pi);
  920. void wlc_phy_rxcore_setstate_nphy(struct brcms_phy_pub *pih, u8 rxcore_bitmask);
  921. u8 wlc_phy_rxcore_getstate_nphy(struct brcms_phy_pub *pih);
  922. void wlc_phy_txpwrctrl_enable_nphy(struct brcms_phy *pi, u8 ctrl_type);
  923. void wlc_phy_txpwr_fixpower_nphy(struct brcms_phy *pi);
  924. void wlc_phy_txpwr_apply_nphy(struct brcms_phy *pi);
  925. void wlc_phy_txpwr_papd_cal_nphy(struct brcms_phy *pi);
  926. u16 wlc_phy_txpwr_idx_get_nphy(struct brcms_phy *pi);
  927. struct nphy_txgains wlc_phy_get_tx_gain_nphy(struct brcms_phy *pi);
  928. int wlc_phy_cal_txiqlo_nphy(struct brcms_phy *pi,
  929. struct nphy_txgains target_gain, bool full, bool m);
  930. int wlc_phy_cal_rxiq_nphy(struct brcms_phy *pi, struct nphy_txgains target_gain,
  931. u8 type, bool d);
  932. void wlc_phy_txpwr_index_nphy(struct brcms_phy *pi, u8 core_mask,
  933. s8 txpwrindex, bool res);
  934. void wlc_phy_rssisel_nphy(struct brcms_phy *pi, u8 core, u8 rssi_type);
  935. int wlc_phy_poll_rssi_nphy(struct brcms_phy *pi, u8 rssi_type,
  936. s32 *rssi_buf, u8 nsamps);
  937. void wlc_phy_rssi_cal_nphy(struct brcms_phy *pi);
  938. int wlc_phy_aci_scan_nphy(struct brcms_phy *pi);
  939. void wlc_phy_cal_txgainctrl_nphy(struct brcms_phy *pi, s32 dBm_targetpower,
  940. bool debug);
  941. int wlc_phy_tx_tone_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val, u8 mode,
  942. u8, bool);
  943. void wlc_phy_stopplayback_nphy(struct brcms_phy *pi);
  944. void wlc_phy_est_tonepwr_nphy(struct brcms_phy *pi, s32 *qdBm_pwrbuf,
  945. u8 num_samps);
  946. void wlc_phy_radio205x_vcocal_nphy(struct brcms_phy *pi);
  947. int wlc_phy_rssi_compute_nphy(struct brcms_phy *pi, struct d11rxhdr *rxh);
  948. #define NPHY_TESTPATTERN_BPHY_EVM 0
  949. #define NPHY_TESTPATTERN_BPHY_RFCS 1
  950. void wlc_phy_nphy_tkip_rifs_war(struct brcms_phy *pi, u8 rifs);
  951. void wlc_phy_get_pwrdet_offsets(struct brcms_phy *pi, s8 *cckoffset,
  952. s8 *ofdmoffset);
  953. s8 wlc_phy_upd_rssi_offset(struct brcms_phy *pi, s8 rssi, u16 chanspec);
  954. bool wlc_phy_n_txpower_ipa_ison(struct brcms_phy *pih);
  955. #endif /* _BRCM_PHY_INT_H_ */