Lines Matching refs:pi

36 #define READ_RADIO_REG2(pi, radio_type, jspace, core, reg_name)	\  argument
37 read_radio_reg(pi, radio_type##_##jspace##_##reg_name | \
42 #define WRITE_RADIO_REG2(pi, radio_type, jspace, core, reg_name, value) \ argument
43 write_radio_reg(pi, radio_type##_##jspace##_##reg_name | \
48 #define WRITE_RADIO_SYN(pi, radio_type, reg_name, value) \ argument
49 write_radio_reg(pi, radio_type##_##SYN##_##reg_name, value)
51 #define READ_RADIO_REG3(pi, radio_type, jspace, core, reg_name) \ argument
52 read_radio_reg(pi, ((core == PHY_CORE_0) ? \
56 #define WRITE_RADIO_REG3(pi, radio_type, jspace, core, reg_name, value) \ argument
57 write_radio_reg(pi, ((core == PHY_CORE_0) ? \
62 #define READ_RADIO_REG4(pi, radio_type, jspace, core, reg_name) \ argument
63 read_radio_reg(pi, ((core == PHY_CORE_0) ? \
67 #define WRITE_RADIO_REG4(pi, radio_type, jspace, core, reg_name, value) \ argument
68 write_radio_reg(pi, ((core == PHY_CORE_0) ? \
108 #define NPHY_IS_SROM_REINTERPRET NREV_GE(pi->pubpi.phy_rev, 5)
267 #define wlc_phy_get_papd_nphy(pi) \ argument
268 (read_phy_reg((pi), 0x1e7) & \
14124 struct brcms_phy *pi = container_of(pih, struct brcms_phy, pubpi_ro); in wlc_phy_bist_check_phy() local
14127 if (NREV_GE(pi->pubpi.phy_rev, 16)) in wlc_phy_bist_check_phy()
14130 phybist0 = read_phy_reg(pi, 0x0e); in wlc_phy_bist_check_phy()
14131 phybist1 = read_phy_reg(pi, 0x0f); in wlc_phy_bist_check_phy()
14132 phybist2 = read_phy_reg(pi, 0xea); in wlc_phy_bist_check_phy()
14133 phybist3 = read_phy_reg(pi, 0xeb); in wlc_phy_bist_check_phy()
14134 phybist4 = read_phy_reg(pi, 0x156); in wlc_phy_bist_check_phy()
14143 static void wlc_phy_bphy_init_nphy(struct brcms_phy *pi) in wlc_phy_bphy_init_nphy() argument
14150 write_phy_reg(pi, addr, val); in wlc_phy_bphy_init_nphy()
14157 write_phy_reg(pi, NPHY_TO_BPHY_OFF + BPHY_STEP, 0x668); in wlc_phy_bphy_init_nphy()
14161 wlc_phy_table_write_nphy(struct brcms_phy *pi, u32 id, u32 len, u32 offset, in wlc_phy_table_write_nphy() argument
14171 wlc_phy_write_table_nphy(pi, &tbl); in wlc_phy_table_write_nphy()
14175 wlc_phy_table_read_nphy(struct brcms_phy *pi, u32 id, u32 len, u32 offset, in wlc_phy_table_read_nphy() argument
14185 wlc_phy_read_table_nphy(pi, &tbl); in wlc_phy_table_read_nphy()
14189 wlc_phy_static_table_download_nphy(struct brcms_phy *pi) in wlc_phy_static_table_download_nphy() argument
14193 if (NREV_GE(pi->pubpi.phy_rev, 16)) { in wlc_phy_static_table_download_nphy()
14195 wlc_phy_write_table_nphy(pi, in wlc_phy_static_table_download_nphy()
14197 } else if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_static_table_download_nphy()
14199 wlc_phy_write_table_nphy(pi, in wlc_phy_static_table_download_nphy()
14201 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_static_table_download_nphy()
14203 wlc_phy_write_table_nphy(pi, in wlc_phy_static_table_download_nphy()
14207 wlc_phy_write_table_nphy(pi, in wlc_phy_static_table_download_nphy()
14212 static void wlc_phy_tbl_init_nphy(struct brcms_phy *pi) in wlc_phy_tbl_init_nphy() argument
14217 if (pi->phy_init_por) in wlc_phy_tbl_init_nphy()
14218 wlc_phy_static_table_download_nphy(pi); in wlc_phy_tbl_init_nphy()
14220 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_tbl_init_nphy()
14222 antswctrllut = CHSPEC_IS2G(pi->radio_chanspec) ? in wlc_phy_tbl_init_nphy()
14223 pi->srom_fem2g.antswctrllut : pi->srom_fem5g. in wlc_phy_tbl_init_nphy()
14233 if (pi->aa2g == 7) in wlc_phy_tbl_init_nphy()
14235 pi, in wlc_phy_tbl_init_nphy()
14241 pi, in wlc_phy_tbl_init_nphy()
14247 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_tbl_init_nphy()
14250 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_tbl_init_nphy()
14258 pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_tbl_init_nphy()
14262 pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_tbl_init_nphy()
14266 pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_tbl_init_nphy()
14271 pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_tbl_init_nphy()
14275 pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_tbl_init_nphy()
14279 pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_tbl_init_nphy()
14288 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_tbl_init_nphy()
14293 CHSPEC_IS2G(pi->radio_chanspec) ? in wlc_phy_tbl_init_nphy()
14294 pi->srom_fem2g.antswctrllut : in wlc_phy_tbl_init_nphy()
14295 pi->srom_fem5g.antswctrllut; in wlc_phy_tbl_init_nphy()
14299 pi, in wlc_phy_tbl_init_nphy()
14305 pi, in wlc_phy_tbl_init_nphy()
14311 pi, in wlc_phy_tbl_init_nphy()
14317 pi, in wlc_phy_tbl_init_nphy()
14326 pi, in wlc_phy_tbl_init_nphy()
14332 wlc_phy_write_table_nphy(pi, in wlc_phy_tbl_init_nphy()
14339 wlc_phy_write_txmacreg_nphy(struct brcms_phy *pi, u16 holdoff, u16 delay) in wlc_phy_write_txmacreg_nphy() argument
14341 write_phy_reg(pi, 0x77, holdoff); in wlc_phy_write_txmacreg_nphy()
14342 write_phy_reg(pi, 0xb4, delay); in wlc_phy_write_txmacreg_nphy()
14345 void wlc_phy_nphy_tkip_rifs_war(struct brcms_phy *pi, u8 rifs) in wlc_phy_nphy_tkip_rifs_war() argument
14359 wlc_phy_write_txmacreg_nphy(pi, holdoff, delay); in wlc_phy_nphy_tkip_rifs_war()
14361 if (pi->sh && (pi->sh->_rifs_phy != rifs)) in wlc_phy_nphy_tkip_rifs_war()
14362 pi->sh->_rifs_phy = rifs; in wlc_phy_nphy_tkip_rifs_war()
14365 static void wlc_phy_txpwrctrl_config_nphy(struct brcms_phy *pi) in wlc_phy_txpwrctrl_config_nphy() argument
14368 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwrctrl_config_nphy()
14369 pi->nphy_txpwrctrl = PHY_TPC_HW_ON; in wlc_phy_txpwrctrl_config_nphy()
14370 pi->phy_5g_pwrgain = true; in wlc_phy_txpwrctrl_config_nphy()
14374 pi->nphy_txpwrctrl = PHY_TPC_HW_OFF; in wlc_phy_txpwrctrl_config_nphy()
14375 pi->phy_5g_pwrgain = false; in wlc_phy_txpwrctrl_config_nphy()
14377 if ((pi->sh->boardflags2 & BFL2_TXPWRCTRL_EN) && in wlc_phy_txpwrctrl_config_nphy()
14378 NREV_GE(pi->pubpi.phy_rev, 2) && (pi->sh->sromrev >= 4)) in wlc_phy_txpwrctrl_config_nphy()
14379 pi->nphy_txpwrctrl = PHY_TPC_HW_ON; in wlc_phy_txpwrctrl_config_nphy()
14380 else if ((pi->sh->sromrev >= 4) in wlc_phy_txpwrctrl_config_nphy()
14381 && (pi->sh->boardflags2 & BFL2_5G_PWRGAIN)) in wlc_phy_txpwrctrl_config_nphy()
14382 pi->phy_5g_pwrgain = true; in wlc_phy_txpwrctrl_config_nphy()
14385 static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi) in wlc_phy_txpwr_srom_read_ppr_nphy() argument
14389 struct ssb_sprom *sprom = &pi->d11core->bus->sprom; in wlc_phy_txpwr_srom_read_ppr_nphy()
14391 if (pi->sh->sromrev >= 9) in wlc_phy_txpwr_srom_read_ppr_nphy()
14395 pi->bw402gpo = bw40po & 0xf; in wlc_phy_txpwr_srom_read_ppr_nphy()
14396 pi->bw405gpo = (bw40po & 0xf0) >> 4; in wlc_phy_txpwr_srom_read_ppr_nphy()
14397 pi->bw405glpo = (bw40po & 0xf00) >> 8; in wlc_phy_txpwr_srom_read_ppr_nphy()
14398 pi->bw405ghpo = (bw40po & 0xf000) >> 12; in wlc_phy_txpwr_srom_read_ppr_nphy()
14401 pi->cdd2gpo = cddpo & 0xf; in wlc_phy_txpwr_srom_read_ppr_nphy()
14402 pi->cdd5gpo = (cddpo & 0xf0) >> 4; in wlc_phy_txpwr_srom_read_ppr_nphy()
14403 pi->cdd5glpo = (cddpo & 0xf00) >> 8; in wlc_phy_txpwr_srom_read_ppr_nphy()
14404 pi->cdd5ghpo = (cddpo & 0xf000) >> 12; in wlc_phy_txpwr_srom_read_ppr_nphy()
14407 pi->stbc2gpo = stbcpo & 0xf; in wlc_phy_txpwr_srom_read_ppr_nphy()
14408 pi->stbc5gpo = (stbcpo & 0xf0) >> 4; in wlc_phy_txpwr_srom_read_ppr_nphy()
14409 pi->stbc5glpo = (stbcpo & 0xf00) >> 8; in wlc_phy_txpwr_srom_read_ppr_nphy()
14410 pi->stbc5ghpo = (stbcpo & 0xf000) >> 12; in wlc_phy_txpwr_srom_read_ppr_nphy()
14413 pi->bwdup2gpo = bwduppo & 0xf; in wlc_phy_txpwr_srom_read_ppr_nphy()
14414 pi->bwdup5gpo = (bwduppo & 0xf0) >> 4; in wlc_phy_txpwr_srom_read_ppr_nphy()
14415 pi->bwdup5glpo = (bwduppo & 0xf00) >> 8; in wlc_phy_txpwr_srom_read_ppr_nphy()
14416 pi->bwdup5ghpo = (bwduppo & 0xf000) >> 12; in wlc_phy_txpwr_srom_read_ppr_nphy()
14422 pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_2g = in wlc_phy_txpwr_srom_read_ppr_nphy()
14424 pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_2g = in wlc_phy_txpwr_srom_read_ppr_nphy()
14426 pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_a1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14428 pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_a1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14430 pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b0 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14432 pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b0 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14434 pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14436 pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14438 pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_2g = in wlc_phy_txpwr_srom_read_ppr_nphy()
14440 pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_2g = in wlc_phy_txpwr_srom_read_ppr_nphy()
14443 pi->cck2gpo = sprom->cck2gpo; in wlc_phy_txpwr_srom_read_ppr_nphy()
14445 pi->ofdm2gpo = sprom->ofdm2gpo; in wlc_phy_txpwr_srom_read_ppr_nphy()
14447 pi->mcs2gpo[0] = sprom->mcs2gpo[0]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14448 pi->mcs2gpo[1] = sprom->mcs2gpo[1]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14449 pi->mcs2gpo[2] = sprom->mcs2gpo[2]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14450 pi->mcs2gpo[3] = sprom->mcs2gpo[3]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14451 pi->mcs2gpo[4] = sprom->mcs2gpo[4]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14452 pi->mcs2gpo[5] = sprom->mcs2gpo[5]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14453 pi->mcs2gpo[6] = sprom->mcs2gpo[6]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14454 pi->mcs2gpo[7] = sprom->mcs2gpo[7]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14458 pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_5gm = in wlc_phy_txpwr_srom_read_ppr_nphy()
14460 pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_5gm = in wlc_phy_txpwr_srom_read_ppr_nphy()
14462 pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_a1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14464 pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_a1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14466 pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b0 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14468 pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b0 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14470 pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14472 pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14474 pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_5gm = in wlc_phy_txpwr_srom_read_ppr_nphy()
14476 pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_5gm = in wlc_phy_txpwr_srom_read_ppr_nphy()
14479 pi->ofdm5gpo = sprom->ofdm5gpo; in wlc_phy_txpwr_srom_read_ppr_nphy()
14481 pi->mcs5gpo[0] = sprom->mcs5gpo[0]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14482 pi->mcs5gpo[1] = sprom->mcs5gpo[1]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14483 pi->mcs5gpo[2] = sprom->mcs5gpo[2]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14484 pi->mcs5gpo[3] = sprom->mcs5gpo[3]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14485 pi->mcs5gpo[4] = sprom->mcs5gpo[4]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14486 pi->mcs5gpo[5] = sprom->mcs5gpo[5]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14487 pi->mcs5gpo[6] = sprom->mcs5gpo[6]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14488 pi->mcs5gpo[7] = sprom->mcs5gpo[7]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14492 pi->nphy_pwrctrl_info[0].max_pwr_5gl = in wlc_phy_txpwr_srom_read_ppr_nphy()
14494 pi->nphy_pwrctrl_info[1].max_pwr_5gl = in wlc_phy_txpwr_srom_read_ppr_nphy()
14496 pi->nphy_pwrctrl_info[0].pwrdet_5gl_a1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14498 pi->nphy_pwrctrl_info[1].pwrdet_5gl_a1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14500 pi->nphy_pwrctrl_info[0].pwrdet_5gl_b0 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14502 pi->nphy_pwrctrl_info[1].pwrdet_5gl_b0 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14504 pi->nphy_pwrctrl_info[0].pwrdet_5gl_b1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14506 pi->nphy_pwrctrl_info[1].pwrdet_5gl_b1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14508 pi->nphy_pwrctrl_info[0].idle_targ_5gl = 0; in wlc_phy_txpwr_srom_read_ppr_nphy()
14509 pi->nphy_pwrctrl_info[1].idle_targ_5gl = 0; in wlc_phy_txpwr_srom_read_ppr_nphy()
14511 pi->ofdm5glpo = sprom->ofdm5glpo; in wlc_phy_txpwr_srom_read_ppr_nphy()
14513 pi->mcs5glpo[0] = sprom->mcs5glpo[0]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14514 pi->mcs5glpo[1] = sprom->mcs5glpo[1]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14515 pi->mcs5glpo[2] = sprom->mcs5glpo[2]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14516 pi->mcs5glpo[3] = sprom->mcs5glpo[3]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14517 pi->mcs5glpo[4] = sprom->mcs5glpo[4]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14518 pi->mcs5glpo[5] = sprom->mcs5glpo[5]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14519 pi->mcs5glpo[6] = sprom->mcs5glpo[6]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14520 pi->mcs5glpo[7] = sprom->mcs5glpo[7]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14524 pi->nphy_pwrctrl_info[0].max_pwr_5gh = in wlc_phy_txpwr_srom_read_ppr_nphy()
14526 pi->nphy_pwrctrl_info[1].max_pwr_5gh = in wlc_phy_txpwr_srom_read_ppr_nphy()
14528 pi->nphy_pwrctrl_info[0].pwrdet_5gh_a1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14530 pi->nphy_pwrctrl_info[1].pwrdet_5gh_a1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14532 pi->nphy_pwrctrl_info[0].pwrdet_5gh_b0 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14534 pi->nphy_pwrctrl_info[1].pwrdet_5gh_b0 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14536 pi->nphy_pwrctrl_info[0].pwrdet_5gh_b1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14538 pi->nphy_pwrctrl_info[1].pwrdet_5gh_b1 = in wlc_phy_txpwr_srom_read_ppr_nphy()
14540 pi->nphy_pwrctrl_info[0].idle_targ_5gh = 0; in wlc_phy_txpwr_srom_read_ppr_nphy()
14541 pi->nphy_pwrctrl_info[1].idle_targ_5gh = 0; in wlc_phy_txpwr_srom_read_ppr_nphy()
14543 pi->ofdm5ghpo = sprom->ofdm5ghpo; in wlc_phy_txpwr_srom_read_ppr_nphy()
14545 pi->mcs5ghpo[0] = sprom->mcs5ghpo[0]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14546 pi->mcs5ghpo[1] = sprom->mcs5ghpo[1]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14547 pi->mcs5ghpo[2] = sprom->mcs5ghpo[2]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14548 pi->mcs5ghpo[3] = sprom->mcs5ghpo[3]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14549 pi->mcs5ghpo[4] = sprom->mcs5ghpo[4]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14550 pi->mcs5ghpo[5] = sprom->mcs5ghpo[5]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14551 pi->mcs5ghpo[6] = sprom->mcs5ghpo[6]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14552 pi->mcs5ghpo[7] = sprom->mcs5ghpo[7]; in wlc_phy_txpwr_srom_read_ppr_nphy()
14557 wlc_phy_txpwr_apply_nphy(pi); in wlc_phy_txpwr_srom_read_ppr_nphy()
14560 static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi) in wlc_phy_txpwr_srom_read_nphy() argument
14562 struct ssb_sprom *sprom = &pi->d11core->bus->sprom; in wlc_phy_txpwr_srom_read_nphy()
14564 pi->antswitch = sprom->antswitch; in wlc_phy_txpwr_srom_read_nphy()
14565 pi->aa2g = sprom->ant_available_bg; in wlc_phy_txpwr_srom_read_nphy()
14566 pi->aa5g = sprom->ant_available_a; in wlc_phy_txpwr_srom_read_nphy()
14568 pi->srom_fem2g.tssipos = sprom->fem.ghz2.tssipos; in wlc_phy_txpwr_srom_read_nphy()
14569 pi->srom_fem2g.extpagain = sprom->fem.ghz2.extpa_gain; in wlc_phy_txpwr_srom_read_nphy()
14570 pi->srom_fem2g.pdetrange = sprom->fem.ghz2.pdet_range; in wlc_phy_txpwr_srom_read_nphy()
14571 pi->srom_fem2g.triso = sprom->fem.ghz2.tr_iso; in wlc_phy_txpwr_srom_read_nphy()
14572 pi->srom_fem2g.antswctrllut = sprom->fem.ghz2.antswlut; in wlc_phy_txpwr_srom_read_nphy()
14574 pi->srom_fem5g.tssipos = sprom->fem.ghz5.tssipos; in wlc_phy_txpwr_srom_read_nphy()
14575 pi->srom_fem5g.extpagain = sprom->fem.ghz5.extpa_gain; in wlc_phy_txpwr_srom_read_nphy()
14576 pi->srom_fem5g.pdetrange = sprom->fem.ghz5.pdet_range; in wlc_phy_txpwr_srom_read_nphy()
14577 pi->srom_fem5g.triso = sprom->fem.ghz5.tr_iso; in wlc_phy_txpwr_srom_read_nphy()
14579 pi->srom_fem5g.antswctrllut = sprom->fem.ghz5.antswlut; in wlc_phy_txpwr_srom_read_nphy()
14581 pi->srom_fem5g.antswctrllut = sprom->fem.ghz2.antswlut; in wlc_phy_txpwr_srom_read_nphy()
14583 wlc_phy_txpower_ipa_upd(pi); in wlc_phy_txpwr_srom_read_nphy()
14585 pi->phy_txcore_disable_temp = sprom->tempthresh; in wlc_phy_txpwr_srom_read_nphy()
14586 if (pi->phy_txcore_disable_temp == 0) in wlc_phy_txpwr_srom_read_nphy()
14587 pi->phy_txcore_disable_temp = PHY_CHAIN_TX_DISABLE_TEMP; in wlc_phy_txpwr_srom_read_nphy()
14589 pi->phy_tempsense_offset = sprom->tempoffset; in wlc_phy_txpwr_srom_read_nphy()
14590 if (pi->phy_tempsense_offset != 0) { in wlc_phy_txpwr_srom_read_nphy()
14591 if (pi->phy_tempsense_offset > in wlc_phy_txpwr_srom_read_nphy()
14593 pi->phy_tempsense_offset = NPHY_SROM_MAXTEMPOFFSET; in wlc_phy_txpwr_srom_read_nphy()
14594 else if (pi->phy_tempsense_offset < (NPHY_SROM_TEMPSHIFT + in wlc_phy_txpwr_srom_read_nphy()
14596 pi->phy_tempsense_offset = NPHY_SROM_MINTEMPOFFSET; in wlc_phy_txpwr_srom_read_nphy()
14598 pi->phy_tempsense_offset -= NPHY_SROM_TEMPSHIFT; in wlc_phy_txpwr_srom_read_nphy()
14601 pi->phy_txcore_enable_temp = in wlc_phy_txpwr_srom_read_nphy()
14602 pi->phy_txcore_disable_temp - PHY_HYSTERESIS_DELTATEMP; in wlc_phy_txpwr_srom_read_nphy()
14604 pi->phycal_tempdelta = sprom->phycal_tempdelta; in wlc_phy_txpwr_srom_read_nphy()
14605 if (pi->phycal_tempdelta > NPHY_CAL_MAXTEMPDELTA) in wlc_phy_txpwr_srom_read_nphy()
14606 pi->phycal_tempdelta = 0; in wlc_phy_txpwr_srom_read_nphy()
14608 wlc_phy_txpwr_srom_read_ppr_nphy(pi); in wlc_phy_txpwr_srom_read_nphy()
14613 bool wlc_phy_attach_nphy(struct brcms_phy *pi) in wlc_phy_attach_nphy() argument
14617 if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 6)) in wlc_phy_attach_nphy()
14618 pi->phyhang_avoid = true; in wlc_phy_attach_nphy()
14620 if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 7)) { in wlc_phy_attach_nphy()
14621 pi->nphy_gband_spurwar_en = true; in wlc_phy_attach_nphy()
14622 if (pi->sh->boardflags2 & BFL2_SPUR_WAR) in wlc_phy_attach_nphy()
14623 pi->nphy_aband_spurwar_en = true; in wlc_phy_attach_nphy()
14625 if (NREV_GE(pi->pubpi.phy_rev, 6) && NREV_LT(pi->pubpi.phy_rev, 7)) { in wlc_phy_attach_nphy()
14626 if (pi->sh->boardflags2 & BFL2_2G_SPUR_WAR) in wlc_phy_attach_nphy()
14627 pi->nphy_gband_spurwar2_en = true; in wlc_phy_attach_nphy()
14630 pi->n_preamble_override = AUTO; in wlc_phy_attach_nphy()
14631 if (NREV_IS(pi->pubpi.phy_rev, 3) || NREV_IS(pi->pubpi.phy_rev, 4)) in wlc_phy_attach_nphy()
14632 pi->n_preamble_override = BRCMS_N_PREAMBLE_MIXEDMODE; in wlc_phy_attach_nphy()
14634 pi->nphy_txrx_chain = AUTO; in wlc_phy_attach_nphy()
14635 pi->phy_scraminit = AUTO; in wlc_phy_attach_nphy()
14637 pi->nphy_rxcalparams = 0x010100B5; in wlc_phy_attach_nphy()
14639 pi->nphy_perical = PHY_PERICAL_MPHASE; in wlc_phy_attach_nphy()
14640 pi->mphase_cal_phase_id = MPHASE_CAL_STATE_IDLE; in wlc_phy_attach_nphy()
14641 pi->mphase_txcal_numcmds = MPHASE_TXCAL_NUMCMDS; in wlc_phy_attach_nphy()
14643 pi->nphy_gain_boost = true; in wlc_phy_attach_nphy()
14644 pi->nphy_elna_gain_config = false; in wlc_phy_attach_nphy()
14645 pi->radio_is_on = false; in wlc_phy_attach_nphy()
14647 for (i = 0; i < pi->pubpi.phy_corenum; i++) in wlc_phy_attach_nphy()
14648 pi->nphy_txpwrindex[i].index = AUTO; in wlc_phy_attach_nphy()
14650 wlc_phy_txpwrctrl_config_nphy(pi); in wlc_phy_attach_nphy()
14651 if (pi->nphy_txpwrctrl == PHY_TPC_HW_ON) in wlc_phy_attach_nphy()
14652 pi->hwpwrctrl_capable = true; in wlc_phy_attach_nphy()
14654 pi->pi_fptr.init = wlc_phy_init_nphy; in wlc_phy_attach_nphy()
14655 pi->pi_fptr.calinit = wlc_phy_cal_init_nphy; in wlc_phy_attach_nphy()
14656 pi->pi_fptr.chanset = wlc_phy_chanspec_set_nphy; in wlc_phy_attach_nphy()
14657 pi->pi_fptr.txpwrrecalc = wlc_phy_txpower_recalc_target_nphy; in wlc_phy_attach_nphy()
14659 if (!wlc_phy_txpwr_srom_read_nphy(pi)) in wlc_phy_attach_nphy()
14665 static s32 get_rf_pwr_offset(struct brcms_phy *pi, s16 pga_gn, s16 pad_gn) in get_rf_pwr_offset() argument
14669 if (CHSPEC_IS2G(pi->radio_chanspec)) { in get_rf_pwr_offset()
14670 if ((pi->pubpi.radiorev == 3) || in get_rf_pwr_offset()
14671 (pi->pubpi.radiorev == 4) || in get_rf_pwr_offset()
14672 (pi->pubpi.radiorev == 6)) in get_rf_pwr_offset()
14676 else if (pi->pubpi.radiorev == 5) in get_rf_pwr_offset()
14680 else if ((pi->pubpi.radiorev == 7) in get_rf_pwr_offset()
14681 || (pi->pubpi.radiorev == in get_rf_pwr_offset()
14687 if ((pi->pubpi.radiorev == 3) || in get_rf_pwr_offset()
14688 (pi->pubpi.radiorev == 4) || in get_rf_pwr_offset()
14689 (pi->pubpi.radiorev == 6)) in get_rf_pwr_offset()
14693 else if ((pi->pubpi.radiorev == 7) in get_rf_pwr_offset()
14694 || (pi->pubpi.radiorev == in get_rf_pwr_offset()
14703 static void wlc_phy_update_mimoconfig_nphy(struct brcms_phy *pi, s32 preamble) in wlc_phy_update_mimoconfig_nphy() argument
14711 val = read_phy_reg(pi, 0xed); in wlc_phy_update_mimoconfig_nphy()
14718 write_phy_reg(pi, 0xed, val); in wlc_phy_update_mimoconfig_nphy()
14721 static void wlc_phy_ipa_set_tx_digi_filts_nphy(struct brcms_phy *pi) in wlc_phy_ipa_set_tx_digi_filts_nphy() argument
14728 write_phy_reg(pi, addr_offset[type] + j, in wlc_phy_ipa_set_tx_digi_filts_nphy()
14732 if (pi->bw == WL_CHANSPEC_BW_40) { in wlc_phy_ipa_set_tx_digi_filts_nphy()
14734 write_phy_reg(pi, 0x186 + j, in wlc_phy_ipa_set_tx_digi_filts_nphy()
14737 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_ipa_set_tx_digi_filts_nphy()
14739 write_phy_reg(pi, 0x186 + j, in wlc_phy_ipa_set_tx_digi_filts_nphy()
14743 if (CHSPEC_CHANNEL(pi->radio_chanspec) == 14) { in wlc_phy_ipa_set_tx_digi_filts_nphy()
14745 write_phy_reg(pi, 0x2c5 + j, in wlc_phy_ipa_set_tx_digi_filts_nphy()
14751 static void wlc_phy_ipa_restore_tx_digi_filts_nphy(struct brcms_phy *pi) in wlc_phy_ipa_restore_tx_digi_filts_nphy() argument
14755 if (pi->bw == WL_CHANSPEC_BW_40) { in wlc_phy_ipa_restore_tx_digi_filts_nphy()
14757 write_phy_reg(pi, 0x195 + j, in wlc_phy_ipa_restore_tx_digi_filts_nphy()
14761 write_phy_reg(pi, 0x186 + j, in wlc_phy_ipa_restore_tx_digi_filts_nphy()
14767 wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, u8 *events, u8 *dlys, in wlc_phy_set_rfseq_nphy() argument
14773 NREV_GE(pi->pubpi.phy_rev, in wlc_phy_set_rfseq_nphy()
14777 if (pi->phyhang_avoid) in wlc_phy_set_rfseq_nphy()
14778 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_set_rfseq_nphy()
14781 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, len, t1_offset, 8, in wlc_phy_set_rfseq_nphy()
14784 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, len, t2_offset, 8, in wlc_phy_set_rfseq_nphy()
14788 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, in wlc_phy_set_rfseq_nphy()
14790 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, in wlc_phy_set_rfseq_nphy()
14794 if (pi->phyhang_avoid) in wlc_phy_set_rfseq_nphy()
14795 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_set_rfseq_nphy()
14798 static u16 wlc_phy_read_lpf_bw_ctl_nphy(struct brcms_phy *pi, u16 offset) in wlc_phy_read_lpf_bw_ctl_nphy() argument
14804 if (CHSPEC_IS40(pi->radio_chanspec)) in wlc_phy_read_lpf_bw_ctl_nphy()
14811 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, in wlc_phy_read_lpf_bw_ctl_nphy()
14821 wlc_phy_rfctrl_override_nphy_rev7(struct brcms_phy *pi, u16 field, u16 value, in wlc_phy_rfctrl_override_nphy_rev7() argument
14828 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rfctrl_override_nphy_rev7()
15072 and_phy_reg(pi, en_addr, ~en_mask); in wlc_phy_rfctrl_override_nphy_rev7()
15073 and_phy_reg(pi, val_addr, ~val_mask); in wlc_phy_rfctrl_override_nphy_rev7()
15078 or_phy_reg(pi, en_addr, en_mask); in wlc_phy_rfctrl_override_nphy_rev7()
15081 mod_phy_reg(pi, val_addr, in wlc_phy_rfctrl_override_nphy_rev7()
15091 static void wlc_phy_adjust_lnagaintbl_nphy(struct brcms_phy *pi) in wlc_phy_adjust_lnagaintbl_nphy() argument
15100 if (pi->phyhang_avoid) in wlc_phy_adjust_lnagaintbl_nphy()
15101 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_adjust_lnagaintbl_nphy()
15103 if (pi->nphy_gain_boost) { in wlc_phy_adjust_lnagaintbl_nphy()
15104 if ((CHSPEC_IS2G(pi->radio_chanspec))) { in wlc_phy_adjust_lnagaintbl_nphy()
15110 curr_channel = CHSPEC_CHANNEL(pi->radio_chanspec); in wlc_phy_adjust_lnagaintbl_nphy()
15128 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_adjust_lnagaintbl_nphy()
15129 if (pi->nphy_elna_gain_config) { in wlc_phy_adjust_lnagaintbl_nphy()
15141 wlc_phy_table_write_nphy(pi, core, 4, 8, 16, regval); in wlc_phy_adjust_lnagaintbl_nphy()
15147 mod_phy_reg(pi, 0x1e, (0xff << 0), (minmax_gain[0] << 0)); in wlc_phy_adjust_lnagaintbl_nphy()
15148 mod_phy_reg(pi, 0x34, (0xff << 0), (minmax_gain[1] << 0)); in wlc_phy_adjust_lnagaintbl_nphy()
15150 if (pi->phyhang_avoid) in wlc_phy_adjust_lnagaintbl_nphy()
15151 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_adjust_lnagaintbl_nphy()
15155 wlc_phy_war_force_trsw_to_R_cliplo_nphy(struct brcms_phy *pi, u8 core) in wlc_phy_war_force_trsw_to_R_cliplo_nphy() argument
15158 write_phy_reg(pi, 0x38, 0x4); in wlc_phy_war_force_trsw_to_R_cliplo_nphy()
15159 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_war_force_trsw_to_R_cliplo_nphy()
15160 write_phy_reg(pi, 0x37, 0x0060); in wlc_phy_war_force_trsw_to_R_cliplo_nphy()
15162 write_phy_reg(pi, 0x37, 0x1080); in wlc_phy_war_force_trsw_to_R_cliplo_nphy()
15164 write_phy_reg(pi, 0x2ae, 0x4); in wlc_phy_war_force_trsw_to_R_cliplo_nphy()
15165 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_war_force_trsw_to_R_cliplo_nphy()
15166 write_phy_reg(pi, 0x2ad, 0x0060); in wlc_phy_war_force_trsw_to_R_cliplo_nphy()
15168 write_phy_reg(pi, 0x2ad, 0x1080); in wlc_phy_war_force_trsw_to_R_cliplo_nphy()
15172 static void wlc_phy_war_txchain_upd_nphy(struct brcms_phy *pi, u8 txchain) in wlc_phy_war_txchain_upd_nphy() argument
15179 wlc_phy_war_force_trsw_to_R_cliplo_nphy(pi, PHY_CORE_0); in wlc_phy_war_txchain_upd_nphy()
15182 wlc_phy_war_force_trsw_to_R_cliplo_nphy(pi, PHY_CORE_1); in wlc_phy_war_txchain_upd_nphy()
15185 static void wlc_phy_workarounds_nphy_gainctrl_2057_rev5(struct brcms_phy *pi) in wlc_phy_workarounds_nphy_gainctrl_2057_rev5() argument
15193 mod_phy_reg(pi, 0x1c, (0x1 << 13), (1 << 13)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15194 mod_phy_reg(pi, 0x32, (0x1 << 13), (1 << 13)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15196 mod_phy_reg(pi, 0x289, (0xff << 0), (0x46 << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15198 mod_phy_reg(pi, 0x283, (0xff << 0), (0x3c << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15199 mod_phy_reg(pi, 0x280, (0xff << 0), (0x3c << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15201 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 0x8, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15203 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 0x8, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15206 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 0x10, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15208 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 0x10, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15211 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 10, 0x20, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15213 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 10, 0x20, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15216 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS1, 10, 0x20, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15218 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS2, 10, 0x20, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15221 write_phy_reg(pi, 0x37, 0x74); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15222 write_phy_reg(pi, 0x2ad, 0x74); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15223 write_phy_reg(pi, 0x38, 0x18); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15224 write_phy_reg(pi, 0x2ae, 0x18); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15226 write_phy_reg(pi, 0x2b, 0xe8); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15227 write_phy_reg(pi, 0x41, 0xe8); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15229 if (CHSPEC_IS20(pi->radio_chanspec)) { in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15231 mod_phy_reg(pi, 0x300, (0x3f << 0), (0x12 << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15232 mod_phy_reg(pi, 0x301, (0x3f << 0), (0x12 << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15235 mod_phy_reg(pi, 0x300, (0x3f << 0), (0x10 << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15236 mod_phy_reg(pi, 0x301, (0x3f << 0), (0x10 << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev5()
15240 static void wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi) in wlc_phy_workarounds_nphy_gainctrl_2057_rev6() argument
15267 mod_phy_reg(pi, 0x1c, (0x1 << 13), (1 << 13)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15268 mod_phy_reg(pi, 0x32, (0x1 << 13), (1 << 13)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15270 currband = read_phy_reg(pi, 0x09) & NPHY_BandControl_currentBand; in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15275 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 8, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15277 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 8, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15280 mod_phy_reg(pi, 0x283, (0xff << 0), (0x40 << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15282 if (CHSPEC_IS40(pi->radio_chanspec)) { in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15283 mod_phy_reg(pi, 0x280, (0xff << 0), (0x3e << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15284 mod_phy_reg(pi, 0x283, (0xff << 0), (0x3e << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15287 mod_phy_reg(pi, 0x289, (0xff << 0), (0x46 << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15289 if (CHSPEC_IS20(pi->radio_chanspec)) { in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15290 mod_phy_reg(pi, 0x300, (0x3f << 0), (13 << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15291 mod_phy_reg(pi, 0x301, (0x3f << 0), (13 << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15305 freq = CHAN5G_FREQ(CHSPEC_CHANNEL(pi->radio_chanspec)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15306 if (CHSPEC_IS20(pi->radio_chanspec)) { in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15380 write_phy_reg(pi, 0x20, init_gaincode); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15381 write_phy_reg(pi, 0x2a7, init_gaincode); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15383 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15384 pi->pubpi.phy_corenum, 0x106, 16, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15387 write_phy_reg(pi, 0x22, clip1hi_gaincode); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15388 write_phy_reg(pi, 0x2a9, clip1hi_gaincode); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15390 write_phy_reg(pi, 0x36, clip1md_gaincode_B); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15391 write_phy_reg(pi, 0x2ac, clip1md_gaincode_B); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15393 write_phy_reg(pi, 0x37, clip1lo_gaincode); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15394 write_phy_reg(pi, 0x2ad, clip1lo_gaincode); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15395 write_phy_reg(pi, 0x38, clip1lo_gaincode_B); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15396 write_phy_reg(pi, 0x2ae, clip1lo_gaincode_B); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15398 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 10, 0x20, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15400 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 10, 0x20, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15403 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS1, 10, 0x20, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15405 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS2, 10, 0x20, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15408 mod_phy_reg(pi, 0x283, (0xff << 0), (crsminu_th << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15411 write_phy_reg(pi, 0x2b, nbclip_th); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15412 write_phy_reg(pi, 0x41, nbclip_th); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15415 mod_phy_reg(pi, 0x300, (0x3f << 0), (w1clip_th << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15416 mod_phy_reg(pi, 0x301, (0x3f << 0), (w1clip_th << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15418 mod_phy_reg(pi, 0x2e4, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15421 mod_phy_reg(pi, 0x2e4, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15424 if (CHSPEC_IS20(pi->radio_chanspec)) { in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15426 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 8, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15428 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 8, 8, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15431 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 0x10, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15433 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 0x10, in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15436 write_phy_reg(pi, 0x24, clip1md_gaincode); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15437 write_phy_reg(pi, 0x2ab, clip1md_gaincode); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15439 mod_phy_reg(pi, 0x280, (0xff << 0), (crsminl_th << 0)); in wlc_phy_workarounds_nphy_gainctrl_2057_rev6()
15444 static void wlc_phy_workarounds_nphy_gainctrl(struct brcms_phy *pi) in wlc_phy_workarounds_nphy_gainctrl() argument
15599 triso = (CHSPEC_IS5G(pi->radio_chanspec)) ? pi->srom_fem5g.triso : in wlc_phy_workarounds_nphy_gainctrl()
15600 pi->srom_fem2g.triso; in wlc_phy_workarounds_nphy_gainctrl()
15602 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_workarounds_nphy_gainctrl()
15603 if (pi->pubpi.radiorev == 5) { in wlc_phy_workarounds_nphy_gainctrl()
15604 wlc_phy_workarounds_nphy_gainctrl_2057_rev5(pi); in wlc_phy_workarounds_nphy_gainctrl()
15605 } else if (pi->pubpi.radiorev == 7) { in wlc_phy_workarounds_nphy_gainctrl()
15606 wlc_phy_workarounds_nphy_gainctrl_2057_rev6(pi); in wlc_phy_workarounds_nphy_gainctrl()
15608 mod_phy_reg(pi, 0x283, (0xff << 0), (0x44 << 0)); in wlc_phy_workarounds_nphy_gainctrl()
15609 mod_phy_reg(pi, 0x280, (0xff << 0), (0x44 << 0)); in wlc_phy_workarounds_nphy_gainctrl()
15611 } else if ((pi->pubpi.radiorev == 3) in wlc_phy_workarounds_nphy_gainctrl()
15612 || (pi->pubpi.radiorev == 8)) { in wlc_phy_workarounds_nphy_gainctrl()
15613 wlc_phy_workarounds_nphy_gainctrl_2057_rev6(pi); in wlc_phy_workarounds_nphy_gainctrl()
15615 if (pi->pubpi.radiorev == 8) { in wlc_phy_workarounds_nphy_gainctrl()
15616 mod_phy_reg(pi, 0x283, in wlc_phy_workarounds_nphy_gainctrl()
15618 mod_phy_reg(pi, 0x280, in wlc_phy_workarounds_nphy_gainctrl()
15622 wlc_phy_workarounds_nphy_gainctrl_2057_rev6(pi); in wlc_phy_workarounds_nphy_gainctrl()
15624 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_workarounds_nphy_gainctrl()
15626 mod_phy_reg(pi, 0xa0, (0x1 << 6), (1 << 6)); in wlc_phy_workarounds_nphy_gainctrl()
15628 mod_phy_reg(pi, 0x1c, (0x1 << 13), (1 << 13)); in wlc_phy_workarounds_nphy_gainctrl()
15629 mod_phy_reg(pi, 0x32, (0x1 << 13), (1 << 13)); in wlc_phy_workarounds_nphy_gainctrl()
15632 read_phy_reg(pi, 0x09) & NPHY_BandControl_currentBand; in wlc_phy_workarounds_nphy_gainctrl()
15634 if (NREV_GE(pi->pubpi.phy_rev, 6)) { in wlc_phy_workarounds_nphy_gainctrl()
15635 if (pi->pubpi.radiorev == 11) { in wlc_phy_workarounds_nphy_gainctrl()
15655 if (pi->sh->boardflags & BFL_EXTLNA) { in wlc_phy_workarounds_nphy_gainctrl()
15720 } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { in wlc_phy_workarounds_nphy_gainctrl()
15723 if (pi->sh->boardflags & BFL_EXTLNA) { in wlc_phy_workarounds_nphy_gainctrl()
15779 } else if (NREV_IS(pi->pubpi.phy_rev, 4)) { in wlc_phy_workarounds_nphy_gainctrl()
15810 if (NREV_GE(pi->pubpi.phy_rev, 6)) { in wlc_phy_workarounds_nphy_gainctrl()
15822 if ((pi->pubpi.radiorev == 11) && in wlc_phy_workarounds_nphy_gainctrl()
15823 (CHSPEC_IS40(pi->radio_chanspec) == 0)) in wlc_phy_workarounds_nphy_gainctrl()
15830 } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { in wlc_phy_workarounds_nphy_gainctrl()
15845 } else if (NREV_IS(pi->pubpi.phy_rev, 4)) { in wlc_phy_workarounds_nphy_gainctrl()
15850 if (pi->sh->boardflags & BFL_EXTLNA_5GHz) { in wlc_phy_workarounds_nphy_gainctrl()
15887 write_radio_reg(pi, in wlc_phy_workarounds_nphy_gainctrl()
15890 write_radio_reg(pi, in wlc_phy_workarounds_nphy_gainctrl()
15894 write_radio_reg(pi, (RADIO_2056_RX_LNAG2_IDAC | RADIO_2056_RX0), in wlc_phy_workarounds_nphy_gainctrl()
15896 write_radio_reg(pi, (RADIO_2056_RX_LNAG2_IDAC | RADIO_2056_RX1), in wlc_phy_workarounds_nphy_gainctrl()
15899 write_radio_reg(pi, (RADIO_2056_RX_RSSI_POLE | RADIO_2056_RX0), in wlc_phy_workarounds_nphy_gainctrl()
15901 write_radio_reg(pi, (RADIO_2056_RX_RSSI_POLE | RADIO_2056_RX1), in wlc_phy_workarounds_nphy_gainctrl()
15904 write_radio_reg(pi, (RADIO_2056_RX_RSSI_GAIN | RADIO_2056_RX0), in wlc_phy_workarounds_nphy_gainctrl()
15906 write_radio_reg(pi, (RADIO_2056_RX_RSSI_GAIN | RADIO_2056_RX1), in wlc_phy_workarounds_nphy_gainctrl()
15909 write_radio_reg(pi, in wlc_phy_workarounds_nphy_gainctrl()
15912 write_radio_reg(pi, in wlc_phy_workarounds_nphy_gainctrl()
15916 write_radio_reg(pi, (RADIO_2056_RX_LNAA2_IDAC | RADIO_2056_RX0), in wlc_phy_workarounds_nphy_gainctrl()
15918 write_radio_reg(pi, (RADIO_2056_RX_LNAA2_IDAC | RADIO_2056_RX1), in wlc_phy_workarounds_nphy_gainctrl()
15921 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 8, in wlc_phy_workarounds_nphy_gainctrl()
15923 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 8, in wlc_phy_workarounds_nphy_gainctrl()
15926 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 0x10, in wlc_phy_workarounds_nphy_gainctrl()
15928 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 0x10, in wlc_phy_workarounds_nphy_gainctrl()
15931 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 10, 0x20, in wlc_phy_workarounds_nphy_gainctrl()
15933 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 10, 0x20, in wlc_phy_workarounds_nphy_gainctrl()
15936 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS1, 10, 0x20, in wlc_phy_workarounds_nphy_gainctrl()
15938 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS2, 10, 0x20, in wlc_phy_workarounds_nphy_gainctrl()
15941 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 6, 0x40, in wlc_phy_workarounds_nphy_gainctrl()
15943 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 6, 0x40, in wlc_phy_workarounds_nphy_gainctrl()
15945 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS1, 6, 0x40, in wlc_phy_workarounds_nphy_gainctrl()
15947 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS2, 6, 0x40, in wlc_phy_workarounds_nphy_gainctrl()
15950 write_phy_reg(pi, 0x20, init_gaincode); in wlc_phy_workarounds_nphy_gainctrl()
15951 write_phy_reg(pi, 0x2a7, init_gaincode); in wlc_phy_workarounds_nphy_gainctrl()
15953 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_workarounds_nphy_gainctrl()
15954 pi->pubpi.phy_corenum, 0x106, 16, in wlc_phy_workarounds_nphy_gainctrl()
15957 write_phy_reg(pi, 0x22, clip1hi_gaincode); in wlc_phy_workarounds_nphy_gainctrl()
15958 write_phy_reg(pi, 0x2a9, clip1hi_gaincode); in wlc_phy_workarounds_nphy_gainctrl()
15960 write_phy_reg(pi, 0x24, clip1md_gaincode); in wlc_phy_workarounds_nphy_gainctrl()
15961 write_phy_reg(pi, 0x2ab, clip1md_gaincode); in wlc_phy_workarounds_nphy_gainctrl()
15963 write_phy_reg(pi, 0x37, clip1lo_gaincode); in wlc_phy_workarounds_nphy_gainctrl()
15964 write_phy_reg(pi, 0x2ad, clip1lo_gaincode); in wlc_phy_workarounds_nphy_gainctrl()
15966 mod_phy_reg(pi, 0x27d, (0xff << 0), (crsmin_th << 0)); in wlc_phy_workarounds_nphy_gainctrl()
15967 mod_phy_reg(pi, 0x280, (0xff << 0), (crsminl_th << 0)); in wlc_phy_workarounds_nphy_gainctrl()
15968 mod_phy_reg(pi, 0x283, (0xff << 0), (crsminu_th << 0)); in wlc_phy_workarounds_nphy_gainctrl()
15970 write_phy_reg(pi, 0x2b, nbclip_th); in wlc_phy_workarounds_nphy_gainctrl()
15971 write_phy_reg(pi, 0x41, nbclip_th); in wlc_phy_workarounds_nphy_gainctrl()
15973 mod_phy_reg(pi, 0x27, (0x3f << 0), (w1clip_th << 0)); in wlc_phy_workarounds_nphy_gainctrl()
15974 mod_phy_reg(pi, 0x3d, (0x3f << 0), (w1clip_th << 0)); in wlc_phy_workarounds_nphy_gainctrl()
15976 write_phy_reg(pi, 0x150, 0x809c); in wlc_phy_workarounds_nphy_gainctrl()
15980 mod_phy_reg(pi, 0x1c, (0x1 << 13), (1 << 13)); in wlc_phy_workarounds_nphy_gainctrl()
15981 mod_phy_reg(pi, 0x32, (0x1 << 13), (1 << 13)); in wlc_phy_workarounds_nphy_gainctrl()
15983 write_phy_reg(pi, 0x2b, 0x84); in wlc_phy_workarounds_nphy_gainctrl()
15984 write_phy_reg(pi, 0x41, 0x84); in wlc_phy_workarounds_nphy_gainctrl()
15986 if (CHSPEC_IS20(pi->radio_chanspec)) { in wlc_phy_workarounds_nphy_gainctrl()
15987 write_phy_reg(pi, 0x6b, 0x2b); in wlc_phy_workarounds_nphy_gainctrl()
15988 write_phy_reg(pi, 0x6c, 0x2b); in wlc_phy_workarounds_nphy_gainctrl()
15989 write_phy_reg(pi, 0x6d, 0x9); in wlc_phy_workarounds_nphy_gainctrl()
15990 write_phy_reg(pi, 0x6e, 0x9); in wlc_phy_workarounds_nphy_gainctrl()
15994 mod_phy_reg(pi, 0x27, (0x3f << 0), (w1th << 0)); in wlc_phy_workarounds_nphy_gainctrl()
15995 mod_phy_reg(pi, 0x3d, (0x3f << 0), (w1th << 0)); in wlc_phy_workarounds_nphy_gainctrl()
15997 if (CHSPEC_IS20(pi->radio_chanspec)) { in wlc_phy_workarounds_nphy_gainctrl()
15998 mod_phy_reg(pi, 0x1c, (0x1f << 0), (0x1 << 0)); in wlc_phy_workarounds_nphy_gainctrl()
15999 mod_phy_reg(pi, 0x32, (0x1f << 0), (0x1 << 0)); in wlc_phy_workarounds_nphy_gainctrl()
16001 mod_phy_reg(pi, 0x1d, (0x1f << 0), (0x1 << 0)); in wlc_phy_workarounds_nphy_gainctrl()
16002 mod_phy_reg(pi, 0x33, (0x1f << 0), (0x1 << 0)); in wlc_phy_workarounds_nphy_gainctrl()
16005 write_phy_reg(pi, 0x150, 0x809c); in wlc_phy_workarounds_nphy_gainctrl()
16007 if (pi->nphy_gain_boost) in wlc_phy_workarounds_nphy_gainctrl()
16008 if ((CHSPEC_IS2G(pi->radio_chanspec)) && in wlc_phy_workarounds_nphy_gainctrl()
16009 (CHSPEC_IS40(pi->radio_chanspec))) in wlc_phy_workarounds_nphy_gainctrl()
16013 else if (CHSPEC_IS40(pi->radio_chanspec)) in wlc_phy_workarounds_nphy_gainctrl()
16018 mod_phy_reg(pi, 0x20, (0x1f << 7), (hpf_code << 7)); in wlc_phy_workarounds_nphy_gainctrl()
16019 mod_phy_reg(pi, 0x36, (0x1f << 7), (hpf_code << 7)); in wlc_phy_workarounds_nphy_gainctrl()
16023 wlc_phy_table_write_nphy(pi, 7, 4, 0x106, 16, regval); in wlc_phy_workarounds_nphy_gainctrl()
16025 wlc_phy_adjust_lnagaintbl_nphy(pi); in wlc_phy_workarounds_nphy_gainctrl()
16027 if (pi->nphy_elna_gain_config) { in wlc_phy_workarounds_nphy_gainctrl()
16032 wlc_phy_table_write_nphy(pi, 2, 4, 8, 16, regval); in wlc_phy_workarounds_nphy_gainctrl()
16033 wlc_phy_table_write_nphy(pi, 3, 4, 8, 16, regval); in wlc_phy_workarounds_nphy_gainctrl()
16037 wlc_phy_table_write_nphy(pi, 7, 4, 0x106, 16, regval); in wlc_phy_workarounds_nphy_gainctrl()
16040 if (NREV_IS(pi->pubpi.phy_rev, 2)) { in wlc_phy_workarounds_nphy_gainctrl()
16043 wlc_phy_table_write_nphy(pi, 0, 21, 32, 16, regval); in wlc_phy_workarounds_nphy_gainctrl()
16044 wlc_phy_table_write_nphy(pi, 1, 21, 32, 16, regval); in wlc_phy_workarounds_nphy_gainctrl()
16048 wlc_phy_table_write_nphy(pi, 2, 21, 32, 16, regval); in wlc_phy_workarounds_nphy_gainctrl()
16049 wlc_phy_table_write_nphy(pi, 3, 21, 32, 16, regval); in wlc_phy_workarounds_nphy_gainctrl()
16052 wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_UPDATEGAINU, in wlc_phy_workarounds_nphy_gainctrl()
16058 mod_phy_reg(pi, 0x153, (0xff << 8), (90 << 8)); in wlc_phy_workarounds_nphy_gainctrl()
16060 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_workarounds_nphy_gainctrl()
16061 mod_phy_reg(pi, in wlc_phy_workarounds_nphy_gainctrl()
16067 static void wlc_phy_workarounds_nphy(struct brcms_phy *pi) in wlc_phy_workarounds_nphy() argument
16177 if (CHSPEC_IS5G(pi->radio_chanspec)) in wlc_phy_workarounds_nphy()
16178 wlc_phy_classifier_nphy(pi, NPHY_ClassifierCtrl_cck_en, 0); in wlc_phy_workarounds_nphy()
16180 wlc_phy_classifier_nphy(pi, NPHY_ClassifierCtrl_cck_en, 1); in wlc_phy_workarounds_nphy()
16182 if (pi->phyhang_avoid) in wlc_phy_workarounds_nphy()
16183 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_workarounds_nphy()
16185 or_phy_reg(pi, 0xb1, NPHY_IQFlip_ADC1 | NPHY_IQFlip_ADC2); in wlc_phy_workarounds_nphy()
16187 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_workarounds_nphy()
16189 if (NREV_IS(pi->pubpi.phy_rev, 7)) { in wlc_phy_workarounds_nphy()
16190 mod_phy_reg(pi, 0x221, (0x1 << 4), (1 << 4)); in wlc_phy_workarounds_nphy()
16192 mod_phy_reg(pi, 0x160, (0x7f << 0), (32 << 0)); in wlc_phy_workarounds_nphy()
16193 mod_phy_reg(pi, 0x160, (0x7f << 8), (39 << 8)); in wlc_phy_workarounds_nphy()
16194 mod_phy_reg(pi, 0x161, (0x7f << 0), (46 << 0)); in wlc_phy_workarounds_nphy()
16195 mod_phy_reg(pi, 0x161, (0x7f << 8), (51 << 8)); in wlc_phy_workarounds_nphy()
16196 mod_phy_reg(pi, 0x162, (0x7f << 0), (55 << 0)); in wlc_phy_workarounds_nphy()
16197 mod_phy_reg(pi, 0x162, (0x7f << 8), (58 << 8)); in wlc_phy_workarounds_nphy()
16198 mod_phy_reg(pi, 0x163, (0x7f << 0), (60 << 0)); in wlc_phy_workarounds_nphy()
16199 mod_phy_reg(pi, 0x163, (0x7f << 8), (62 << 8)); in wlc_phy_workarounds_nphy()
16200 mod_phy_reg(pi, 0x164, (0x7f << 0), (62 << 0)); in wlc_phy_workarounds_nphy()
16201 mod_phy_reg(pi, 0x164, (0x7f << 8), (63 << 8)); in wlc_phy_workarounds_nphy()
16202 mod_phy_reg(pi, 0x165, (0x7f << 0), (63 << 0)); in wlc_phy_workarounds_nphy()
16203 mod_phy_reg(pi, 0x165, (0x7f << 8), (64 << 8)); in wlc_phy_workarounds_nphy()
16204 mod_phy_reg(pi, 0x166, (0x7f << 0), (64 << 0)); in wlc_phy_workarounds_nphy()
16205 mod_phy_reg(pi, 0x166, (0x7f << 8), (64 << 8)); in wlc_phy_workarounds_nphy()
16206 mod_phy_reg(pi, 0x167, (0x7f << 0), (64 << 0)); in wlc_phy_workarounds_nphy()
16207 mod_phy_reg(pi, 0x167, (0x7f << 8), (64 << 8)); in wlc_phy_workarounds_nphy()
16210 if (NREV_LE(pi->pubpi.phy_rev, 8)) { in wlc_phy_workarounds_nphy()
16211 write_phy_reg(pi, 0x23f, 0x1b0); in wlc_phy_workarounds_nphy()
16212 write_phy_reg(pi, 0x240, 0x1b0); in wlc_phy_workarounds_nphy()
16215 if (NREV_GE(pi->pubpi.phy_rev, 8)) in wlc_phy_workarounds_nphy()
16216 mod_phy_reg(pi, 0xbd, (0xff << 0), (114 << 0)); in wlc_phy_workarounds_nphy()
16218 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x00, 16, in wlc_phy_workarounds_nphy()
16220 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x10, 16, in wlc_phy_workarounds_nphy()
16223 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, in wlc_phy_workarounds_nphy()
16226 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, in wlc_phy_workarounds_nphy()
16229 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_workarounds_nphy()
16232 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x16e, 16, in wlc_phy_workarounds_nphy()
16235 if (PHY_IPA(pi)) in wlc_phy_workarounds_nphy()
16236 wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX, in wlc_phy_workarounds_nphy()
16241 mod_phy_reg(pi, 0x299, (0x3 << 14), (0x1 << 14)); in wlc_phy_workarounds_nphy()
16242 mod_phy_reg(pi, 0x29d, (0x3 << 14), (0x1 << 14)); in wlc_phy_workarounds_nphy()
16244 tx_lpf_bw_ofdm_20mhz = wlc_phy_read_lpf_bw_ctl_nphy(pi, 0x154); in wlc_phy_workarounds_nphy()
16245 tx_lpf_bw_ofdm_40mhz = wlc_phy_read_lpf_bw_ctl_nphy(pi, 0x159); in wlc_phy_workarounds_nphy()
16246 tx_lpf_bw_11b = wlc_phy_read_lpf_bw_ctl_nphy(pi, 0x152); in wlc_phy_workarounds_nphy()
16248 if (PHY_IPA(pi)) { in wlc_phy_workarounds_nphy()
16250 if (((pi->pubpi.radiorev == 5) in wlc_phy_workarounds_nphy()
16251 && (CHSPEC_IS40(pi->radio_chanspec) == 1)) in wlc_phy_workarounds_nphy()
16252 || (pi->pubpi.radiorev == 7) in wlc_phy_workarounds_nphy()
16253 || (pi->pubpi.radiorev == 8)) { in wlc_phy_workarounds_nphy()
16257 pi, in wlc_phy_workarounds_nphy()
16261 pi, in wlc_phy_workarounds_nphy()
16267 if ((pi->pubpi.radiorev == 5) && in wlc_phy_workarounds_nphy()
16268 (CHSPEC_IS40(pi->radio_chanspec) == 1)) { in wlc_phy_workarounds_nphy()
16277 } else if ((pi->pubpi.radiorev == 7) in wlc_phy_workarounds_nphy()
16278 || (pi->pubpi.radiorev == 8)) { in wlc_phy_workarounds_nphy()
16283 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_workarounds_nphy()
16301 if (pi->pubpi.radiorev == 5) { in wlc_phy_workarounds_nphy()
16308 pi, in wlc_phy_workarounds_nphy()
16312 pi, in wlc_phy_workarounds_nphy()
16344 pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_workarounds_nphy()
16350 pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_workarounds_nphy()
16356 pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_workarounds_nphy()
16362 pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_workarounds_nphy()
16368 pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_workarounds_nphy()
16374 pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_workarounds_nphy()
16380 pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_workarounds_nphy()
16386 pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_workarounds_nphy()
16394 pi, (0x1 << 4), in wlc_phy_workarounds_nphy()
16399 write_phy_reg(pi, 0x32f, 0x3); in wlc_phy_workarounds_nphy()
16401 if ((pi->pubpi.radiorev == 4) || (pi->pubpi.radiorev == 6)) in wlc_phy_workarounds_nphy()
16403 pi, (0x1 << 2), in wlc_phy_workarounds_nphy()
16407 if ((pi->pubpi.radiorev == 3) || (pi->pubpi.radiorev == 4) || in wlc_phy_workarounds_nphy()
16408 (pi->pubpi.radiorev == 6)) { in wlc_phy_workarounds_nphy()
16409 if ((pi->sh->sromrev >= 8) in wlc_phy_workarounds_nphy()
16410 && (pi->sh->boardflags2 & BFL2_IPALVLSHIFT_3P3)) in wlc_phy_workarounds_nphy()
16414 write_radio_reg(pi, RADIO_2057_GPAIO_CONFIG, in wlc_phy_workarounds_nphy()
16416 write_radio_reg(pi, RADIO_2057_GPAIO_SEL1, in wlc_phy_workarounds_nphy()
16418 write_radio_reg(pi, RADIO_2057_GPAIO_SEL0, 0x0); in wlc_phy_workarounds_nphy()
16419 or_radio_reg(pi, in wlc_phy_workarounds_nphy()
16422 or_radio_reg(pi, in wlc_phy_workarounds_nphy()
16440 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_workarounds_nphy()
16442 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, in wlc_phy_workarounds_nphy()
16445 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, in wlc_phy_workarounds_nphy()
16448 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, in wlc_phy_workarounds_nphy()
16456 if (PHY_IPA(pi)) { in wlc_phy_workarounds_nphy()
16457 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_workarounds_nphy()
16458 if ((pi->pubpi.radiorev == 3) in wlc_phy_workarounds_nphy()
16459 || (pi->pubpi.radiorev == 4) in wlc_phy_workarounds_nphy()
16460 || (pi->pubpi.radiorev == 6)) in wlc_phy_workarounds_nphy()
16466 pi, RADIO_2057, in wlc_phy_workarounds_nphy()
16472 if (pi->pubpi.radiorev == 5) { in wlc_phy_workarounds_nphy()
16476 WRITE_RADIO_REG4(pi, RADIO_2057, in wlc_phy_workarounds_nphy()
16480 WRITE_RADIO_REG4(pi, RADIO_2057, in wlc_phy_workarounds_nphy()
16485 pi, RADIO_2057, in wlc_phy_workarounds_nphy()
16489 WRITE_RADIO_REG4(pi, RADIO_2057, in wlc_phy_workarounds_nphy()
16494 pi, RADIO_2057, in wlc_phy_workarounds_nphy()
16500 } else if ((pi->pubpi.radiorev == 7) in wlc_phy_workarounds_nphy()
16501 || (pi->pubpi.radiorev == 8)) { in wlc_phy_workarounds_nphy()
16503 if (CHSPEC_IS40(pi->radio_chanspec) == in wlc_phy_workarounds_nphy()
16505 WRITE_RADIO_REG4(pi, RADIO_2057, in wlc_phy_workarounds_nphy()
16509 WRITE_RADIO_REG4(pi, RADIO_2057, in wlc_phy_workarounds_nphy()
16514 WRITE_RADIO_REG4(pi, RADIO_2057, in wlc_phy_workarounds_nphy()
16518 WRITE_RADIO_REG4(pi, RADIO_2057, in wlc_phy_workarounds_nphy()
16527 pi->radio_chanspec)); in wlc_phy_workarounds_nphy()
16530 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, in wlc_phy_workarounds_nphy()
16533 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, in wlc_phy_workarounds_nphy()
16540 if (pi->pubpi.radiorev != 5) { in wlc_phy_workarounds_nphy()
16542 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, in wlc_phy_workarounds_nphy()
16546 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, in wlc_phy_workarounds_nphy()
16553 if (pi->pubpi.radiorev == 4) { in wlc_phy_workarounds_nphy()
16554 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, in wlc_phy_workarounds_nphy()
16557 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, in wlc_phy_workarounds_nphy()
16562 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, coreNum, in wlc_phy_workarounds_nphy()
16564 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, coreNum, in wlc_phy_workarounds_nphy()
16566 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, coreNum, in wlc_phy_workarounds_nphy()
16570 mod_phy_reg(pi, 0xa6, (0x1 << 2), (0x1 << 2)); in wlc_phy_workarounds_nphy()
16571 mod_phy_reg(pi, 0x8f, (0x1 << 2), (0x1 << 2)); in wlc_phy_workarounds_nphy()
16572 mod_phy_reg(pi, 0xa7, (0x1 << 2), (0x1 << 2)); in wlc_phy_workarounds_nphy()
16573 mod_phy_reg(pi, 0xa5, (0x1 << 2), (0x1 << 2)); in wlc_phy_workarounds_nphy()
16575 mod_phy_reg(pi, 0xa6, (0x1 << 0), 0); in wlc_phy_workarounds_nphy()
16576 mod_phy_reg(pi, 0x8f, (0x1 << 0), (0x1 << 0)); in wlc_phy_workarounds_nphy()
16577 mod_phy_reg(pi, 0xa7, (0x1 << 0), 0); in wlc_phy_workarounds_nphy()
16578 mod_phy_reg(pi, 0xa5, (0x1 << 0), (0x1 << 0)); in wlc_phy_workarounds_nphy()
16580 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, in wlc_phy_workarounds_nphy()
16583 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, in wlc_phy_workarounds_nphy()
16587 mod_phy_reg(pi, 0xa6, (0x1 << 2), 0); in wlc_phy_workarounds_nphy()
16588 mod_phy_reg(pi, 0x8f, (0x1 << 2), 0); in wlc_phy_workarounds_nphy()
16589 mod_phy_reg(pi, 0xa7, (0x1 << 2), 0); in wlc_phy_workarounds_nphy()
16590 mod_phy_reg(pi, 0xa5, (0x1 << 2), 0); in wlc_phy_workarounds_nphy()
16593 write_phy_reg(pi, 0x6a, 0x2); in wlc_phy_workarounds_nphy()
16595 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, 256, 32, in wlc_phy_workarounds_nphy()
16598 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x138, 16, in wlc_phy_workarounds_nphy()
16601 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, 0x141, 16, in wlc_phy_workarounds_nphy()
16604 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 3, 0x133, 16, in wlc_phy_workarounds_nphy()
16607 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x146, 16, in wlc_phy_workarounds_nphy()
16610 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, 0x123, 16, in wlc_phy_workarounds_nphy()
16613 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, 0x12A, 16, in wlc_phy_workarounds_nphy()
16616 if (CHSPEC_IS40(pi->radio_chanspec) == 0) { in wlc_phy_workarounds_nphy()
16617 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, 3, in wlc_phy_workarounds_nphy()
16619 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, in wlc_phy_workarounds_nphy()
16623 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, 3, in wlc_phy_workarounds_nphy()
16627 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, in wlc_phy_workarounds_nphy()
16631 wlc_phy_workarounds_nphy_gainctrl(pi); in wlc_phy_workarounds_nphy()
16634 (CHSPEC_IS5G(pi->radio_chanspec)) ? pi->srom_fem5g. in wlc_phy_workarounds_nphy()
16635 pdetrange : pi->srom_fem2g.pdetrange; in wlc_phy_workarounds_nphy()
16639 wlc_phy_get_chan_freq_range_nphy(pi, 0); in wlc_phy_workarounds_nphy()
16660 if (pi->pubpi.radioid == BCM2057_ID) { in wlc_phy_workarounds_nphy()
16661 if ((pi->pubpi.radiorev == 5) in wlc_phy_workarounds_nphy()
16662 || (pi->pubpi.radiorev == 7) in wlc_phy_workarounds_nphy()
16663 || (pi->pubpi.radiorev == 8)) { in wlc_phy_workarounds_nphy()
16701 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, 0x08, 16, in wlc_phy_workarounds_nphy()
16703 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, 0x18, 16, in wlc_phy_workarounds_nphy()
16705 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, 0x0c, 16, in wlc_phy_workarounds_nphy()
16707 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, 0x1c, 16, in wlc_phy_workarounds_nphy()
16710 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_workarounds_nphy()
16712 write_phy_reg(pi, 0x23f, 0x1f8); in wlc_phy_workarounds_nphy()
16713 write_phy_reg(pi, 0x240, 0x1f8); in wlc_phy_workarounds_nphy()
16715 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, in wlc_phy_workarounds_nphy()
16718 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, in wlc_phy_workarounds_nphy()
16727 write_phy_reg(pi, 0x145, alpha0); in wlc_phy_workarounds_nphy()
16728 write_phy_reg(pi, 0x146, alpha1); in wlc_phy_workarounds_nphy()
16729 write_phy_reg(pi, 0x147, alpha2); in wlc_phy_workarounds_nphy()
16730 write_phy_reg(pi, 0x148, beta0); in wlc_phy_workarounds_nphy()
16731 write_phy_reg(pi, 0x149, beta1); in wlc_phy_workarounds_nphy()
16732 write_phy_reg(pi, 0x14a, beta2); in wlc_phy_workarounds_nphy()
16734 write_phy_reg(pi, 0x38, 0xC); in wlc_phy_workarounds_nphy()
16735 write_phy_reg(pi, 0x2ae, 0xC); in wlc_phy_workarounds_nphy()
16737 wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_TX2RX, in wlc_phy_workarounds_nphy()
16742 if (PHY_IPA(pi)) in wlc_phy_workarounds_nphy()
16743 wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX, in wlc_phy_workarounds_nphy()
16748 if ((pi->sh->hw_phyrxchain != 0x3) && in wlc_phy_workarounds_nphy()
16749 (pi->sh->hw_phyrxchain != pi->sh->hw_phytxchain)) { in wlc_phy_workarounds_nphy()
16751 if (PHY_IPA(pi)) { in wlc_phy_workarounds_nphy()
16759 pi, NPHY_RFSEQ_RX2TX, in wlc_phy_workarounds_nphy()
16765 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_workarounds_nphy()
16766 write_phy_reg(pi, 0x6a, 0x2); in wlc_phy_workarounds_nphy()
16768 write_phy_reg(pi, 0x6a, 0x9c40); in wlc_phy_workarounds_nphy()
16770 mod_phy_reg(pi, 0x294, (0xf << 8), (7 << 8)); in wlc_phy_workarounds_nphy()
16772 if (CHSPEC_IS40(pi->radio_chanspec) == 0) { in wlc_phy_workarounds_nphy()
16773 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, 3, in wlc_phy_workarounds_nphy()
16775 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, in wlc_phy_workarounds_nphy()
16779 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, 3, in wlc_phy_workarounds_nphy()
16783 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, in wlc_phy_workarounds_nphy()
16787 wlc_phy_workarounds_nphy_gainctrl(pi); in wlc_phy_workarounds_nphy()
16789 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x00, 16, in wlc_phy_workarounds_nphy()
16791 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x10, 16, in wlc_phy_workarounds_nphy()
16795 (CHSPEC_IS5G(pi->radio_chanspec)) ? pi->srom_fem5g. in wlc_phy_workarounds_nphy()
16796 pdetrange : pi->srom_fem2g.pdetrange; in wlc_phy_workarounds_nphy()
16799 if (NREV_GE(pi->pubpi.phy_rev, 4)) { in wlc_phy_workarounds_nphy()
16807 wlc_phy_get_chan_freq_range_nphy(pi, 0); in wlc_phy_workarounds_nphy()
16826 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16828 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16830 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16832 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16835 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16837 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16839 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16841 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16848 if (NREV_GE(pi->pubpi.phy_rev, 6)) { in wlc_phy_workarounds_nphy()
16850 wlc_phy_get_chan_freq_range_nphy(pi, 0); in wlc_phy_workarounds_nphy()
16858 } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { in wlc_phy_workarounds_nphy()
16863 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16865 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16867 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16869 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16873 wlc_phy_get_chan_freq_range_nphy(pi, 0); in wlc_phy_workarounds_nphy()
16874 if ((NREV_GE(pi->pubpi.phy_rev, 4)) in wlc_phy_workarounds_nphy()
16884 wlc_phy_table_write_nphy(pi, in wlc_phy_workarounds_nphy()
16887 wlc_phy_table_write_nphy(pi, in wlc_phy_workarounds_nphy()
16890 wlc_phy_table_write_nphy(pi, in wlc_phy_workarounds_nphy()
16893 wlc_phy_table_write_nphy(pi, in wlc_phy_workarounds_nphy()
16903 wlc_phy_get_chan_freq_range_nphy(pi, 0); in wlc_phy_workarounds_nphy()
16918 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16920 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16925 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16927 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, in wlc_phy_workarounds_nphy()
16931 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16934 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16938 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16941 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16945 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16948 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16952 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16955 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16959 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16962 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16966 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16969 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
16974 (CHSPEC_IS5G(pi->radio_chanspec)) ? pi->srom_fem5g. in wlc_phy_workarounds_nphy()
16975 triso : pi->srom_fem2g.triso; in wlc_phy_workarounds_nphy()
16977 wlc_phy_war_force_trsw_to_R_cliplo_nphy(pi, PHY_CORE_0); in wlc_phy_workarounds_nphy()
16978 wlc_phy_war_force_trsw_to_R_cliplo_nphy(pi, PHY_CORE_1); in wlc_phy_workarounds_nphy()
16981 wlc_phy_war_txchain_upd_nphy(pi, pi->sh->hw_phytxchain); in wlc_phy_workarounds_nphy()
16983 if (((pi->sh->boardflags2 & BFL2_APLL_WAR) && in wlc_phy_workarounds_nphy()
16984 (CHSPEC_IS5G(pi->radio_chanspec))) || in wlc_phy_workarounds_nphy()
16985 (((pi->sh->boardflags2 & BFL2_GPLL_WAR) || in wlc_phy_workarounds_nphy()
16986 (pi->sh->boardflags2 & BFL2_GPLL_WAR2)) && in wlc_phy_workarounds_nphy()
16987 (CHSPEC_IS2G(pi->radio_chanspec)))) { in wlc_phy_workarounds_nphy()
16996 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, in wlc_phy_workarounds_nphy()
16998 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, in wlc_phy_workarounds_nphy()
17000 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, in wlc_phy_workarounds_nphy()
17003 if (NREV_IS(pi->pubpi.phy_rev, 4)) { in wlc_phy_workarounds_nphy()
17004 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_workarounds_nphy()
17005 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
17008 write_radio_reg(pi, in wlc_phy_workarounds_nphy()
17014 if (!pi->edcrs_threshold_lock) { in wlc_phy_workarounds_nphy()
17015 write_phy_reg(pi, 0x224, 0x3eb); in wlc_phy_workarounds_nphy()
17016 write_phy_reg(pi, 0x225, 0x3eb); in wlc_phy_workarounds_nphy()
17017 write_phy_reg(pi, 0x226, 0x341); in wlc_phy_workarounds_nphy()
17018 write_phy_reg(pi, 0x227, 0x341); in wlc_phy_workarounds_nphy()
17019 write_phy_reg(pi, 0x228, 0x42b); in wlc_phy_workarounds_nphy()
17020 write_phy_reg(pi, 0x229, 0x42b); in wlc_phy_workarounds_nphy()
17021 write_phy_reg(pi, 0x22a, 0x381); in wlc_phy_workarounds_nphy()
17022 write_phy_reg(pi, 0x22b, 0x381); in wlc_phy_workarounds_nphy()
17023 write_phy_reg(pi, 0x22c, 0x42b); in wlc_phy_workarounds_nphy()
17024 write_phy_reg(pi, 0x22d, 0x42b); in wlc_phy_workarounds_nphy()
17025 write_phy_reg(pi, 0x22e, 0x381); in wlc_phy_workarounds_nphy()
17026 write_phy_reg(pi, 0x22f, 0x381); in wlc_phy_workarounds_nphy()
17029 if (NREV_GE(pi->pubpi.phy_rev, 6)) { in wlc_phy_workarounds_nphy()
17031 if (pi->sh->boardflags2 & BFL2_SINGLEANT_CCK) in wlc_phy_workarounds_nphy()
17032 wlapi_bmac_mhf(pi->sh->physhim, MHF4, in wlc_phy_workarounds_nphy()
17038 if (pi->sh->boardflags2 & BFL2_SKWRKFEM_BRD || in wlc_phy_workarounds_nphy()
17039 (pi->sh->boardtype == 0x8b)) { in wlc_phy_workarounds_nphy()
17046 if (CHSPEC_IS5G(pi->radio_chanspec) && pi->phy_5g_pwrgain) { in wlc_phy_workarounds_nphy()
17047 and_radio_reg(pi, RADIO_2055_CORE1_TX_RF_SPARE, 0xf7); in wlc_phy_workarounds_nphy()
17048 and_radio_reg(pi, RADIO_2055_CORE2_TX_RF_SPARE, 0xf7); in wlc_phy_workarounds_nphy()
17050 or_radio_reg(pi, RADIO_2055_CORE1_TX_RF_SPARE, 0x8); in wlc_phy_workarounds_nphy()
17051 or_radio_reg(pi, RADIO_2055_CORE2_TX_RF_SPARE, 0x8); in wlc_phy_workarounds_nphy()
17055 wlc_phy_table_write_nphy(pi, 8, 1, 0, 16, &regval); in wlc_phy_workarounds_nphy()
17056 wlc_phy_table_write_nphy(pi, 8, 1, 0x10, 16, &regval); in wlc_phy_workarounds_nphy()
17058 if (NREV_LT(pi->pubpi.phy_rev, 3)) { in wlc_phy_workarounds_nphy()
17060 wlc_phy_table_write_nphy(pi, 8, 1, 0x02, 16, &regval); in wlc_phy_workarounds_nphy()
17061 wlc_phy_table_write_nphy(pi, 8, 1, 0x12, 16, &regval); in wlc_phy_workarounds_nphy()
17064 if (NREV_LT(pi->pubpi.phy_rev, 2)) { in wlc_phy_workarounds_nphy()
17066 wlc_phy_table_write_nphy(pi, 8, 1, 0x08, 16, &regval); in wlc_phy_workarounds_nphy()
17067 wlc_phy_table_write_nphy(pi, 8, 1, 0x18, 16, &regval); in wlc_phy_workarounds_nphy()
17070 wlc_phy_table_write_nphy(pi, 8, 1, 0x07, 16, &regval); in wlc_phy_workarounds_nphy()
17071 wlc_phy_table_write_nphy(pi, 8, 1, 0x17, 16, &regval); in wlc_phy_workarounds_nphy()
17074 wlc_phy_table_write_nphy(pi, 8, 1, 0x06, 16, &regval); in wlc_phy_workarounds_nphy()
17075 wlc_phy_table_write_nphy(pi, 8, 1, 0x16, 16, &regval); in wlc_phy_workarounds_nphy()
17078 write_phy_reg(pi, 0xf8, 0x02d8); in wlc_phy_workarounds_nphy()
17079 write_phy_reg(pi, 0xf9, 0x0301); in wlc_phy_workarounds_nphy()
17080 write_phy_reg(pi, 0xfa, 0x02d8); in wlc_phy_workarounds_nphy()
17081 write_phy_reg(pi, 0xfb, 0x0301); in wlc_phy_workarounds_nphy()
17083 wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX, rfseq_rx2tx_events, in wlc_phy_workarounds_nphy()
17087 wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_TX2RX, rfseq_tx2rx_events, in wlc_phy_workarounds_nphy()
17091 wlc_phy_workarounds_nphy_gainctrl(pi); in wlc_phy_workarounds_nphy()
17093 if (NREV_LT(pi->pubpi.phy_rev, 2)) { in wlc_phy_workarounds_nphy()
17095 if (read_phy_reg(pi, 0xa0) & NPHY_MLenable) in wlc_phy_workarounds_nphy()
17096 wlapi_bmac_mhf(pi->sh->physhim, MHF3, in wlc_phy_workarounds_nphy()
17101 } else if (NREV_IS(pi->pubpi.phy_rev, 2)) { in wlc_phy_workarounds_nphy()
17102 write_phy_reg(pi, 0x1e3, 0x0); in wlc_phy_workarounds_nphy()
17103 write_phy_reg(pi, 0x1e4, 0x0); in wlc_phy_workarounds_nphy()
17106 if (NREV_LT(pi->pubpi.phy_rev, 2)) in wlc_phy_workarounds_nphy()
17107 mod_phy_reg(pi, 0x90, (0x1 << 7), 0); in wlc_phy_workarounds_nphy()
17115 write_phy_reg(pi, 0x145, alpha0); in wlc_phy_workarounds_nphy()
17116 write_phy_reg(pi, 0x146, alpha1); in wlc_phy_workarounds_nphy()
17117 write_phy_reg(pi, 0x147, alpha2); in wlc_phy_workarounds_nphy()
17118 write_phy_reg(pi, 0x148, beta0); in wlc_phy_workarounds_nphy()
17119 write_phy_reg(pi, 0x149, beta1); in wlc_phy_workarounds_nphy()
17120 write_phy_reg(pi, 0x14a, beta2); in wlc_phy_workarounds_nphy()
17122 if (NREV_LT(pi->pubpi.phy_rev, 3)) { in wlc_phy_workarounds_nphy()
17123 mod_phy_reg(pi, 0x142, (0xf << 12), 0); in wlc_phy_workarounds_nphy()
17125 write_phy_reg(pi, 0x192, 0xb5); in wlc_phy_workarounds_nphy()
17126 write_phy_reg(pi, 0x193, 0xa4); in wlc_phy_workarounds_nphy()
17127 write_phy_reg(pi, 0x194, 0x0); in wlc_phy_workarounds_nphy()
17130 if (NREV_IS(pi->pubpi.phy_rev, 2)) in wlc_phy_workarounds_nphy()
17131 mod_phy_reg(pi, 0x221, in wlc_phy_workarounds_nphy()
17136 if (pi->phyhang_avoid) in wlc_phy_workarounds_nphy()
17137 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_workarounds_nphy()
17140 static void wlc_phy_extpa_set_tx_digi_filts_nphy(struct brcms_phy *pi) in wlc_phy_extpa_set_tx_digi_filts_nphy() argument
17146 write_phy_reg(pi, addr_offset + j, in wlc_phy_extpa_set_tx_digi_filts_nphy()
17150 static void wlc_phy_clip_det_nphy(struct brcms_phy *pi, u8 write, u16 *vals) in wlc_phy_clip_det_nphy() argument
17154 vals[0] = read_phy_reg(pi, 0x2c); in wlc_phy_clip_det_nphy()
17155 vals[1] = read_phy_reg(pi, 0x42); in wlc_phy_clip_det_nphy()
17157 write_phy_reg(pi, 0x2c, vals[0]); in wlc_phy_clip_det_nphy()
17158 write_phy_reg(pi, 0x42, vals[1]); in wlc_phy_clip_det_nphy()
17162 static void wlc_phy_ipa_internal_tssi_setup_nphy(struct brcms_phy *pi) in wlc_phy_ipa_internal_tssi_setup_nphy() argument
17166 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_ipa_internal_tssi_setup_nphy()
17167 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_ipa_internal_tssi_setup_nphy()
17168 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_ipa_internal_tssi_setup_nphy()
17169 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_ipa_internal_tssi_setup_nphy()
17171 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_ipa_internal_tssi_setup_nphy()
17174 if (pi->pubpi.radiorev != 5) in wlc_phy_ipa_internal_tssi_setup_nphy()
17175 WRITE_RADIO_REG3(pi, RADIO_2057, TX, in wlc_phy_ipa_internal_tssi_setup_nphy()
17178 if (!NREV_IS(pi->pubpi.phy_rev, 7)) in wlc_phy_ipa_internal_tssi_setup_nphy()
17179 WRITE_RADIO_REG3(pi, RADIO_2057, TX, in wlc_phy_ipa_internal_tssi_setup_nphy()
17182 WRITE_RADIO_REG3(pi, RADIO_2057, TX, in wlc_phy_ipa_internal_tssi_setup_nphy()
17185 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_ipa_internal_tssi_setup_nphy()
17187 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_ipa_internal_tssi_setup_nphy()
17189 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_ipa_internal_tssi_setup_nphy()
17192 if (pi->pubpi.radiorev != 5) { in wlc_phy_ipa_internal_tssi_setup_nphy()
17193 if (!NREV_IS(pi->pubpi.phy_rev, 7)) in wlc_phy_ipa_internal_tssi_setup_nphy()
17194 WRITE_RADIO_REG3(pi, RADIO_2057, in wlc_phy_ipa_internal_tssi_setup_nphy()
17198 WRITE_RADIO_REG3(pi, RADIO_2057, in wlc_phy_ipa_internal_tssi_setup_nphy()
17203 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, IQCAL_VCM_HG, in wlc_phy_ipa_internal_tssi_setup_nphy()
17205 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, IQCAL_IDAC, in wlc_phy_ipa_internal_tssi_setup_nphy()
17207 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TSSI_VCM, in wlc_phy_ipa_internal_tssi_setup_nphy()
17209 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TSSI_MISC1, in wlc_phy_ipa_internal_tssi_setup_nphy()
17213 WRITE_RADIO_SYN(pi, RADIO_2056, RESERVED_ADDR31, in wlc_phy_ipa_internal_tssi_setup_nphy()
17214 (CHSPEC_IS2G(pi->radio_chanspec)) ? 0x128 : in wlc_phy_ipa_internal_tssi_setup_nphy()
17216 WRITE_RADIO_SYN(pi, RADIO_2056, RESERVED_ADDR30, 0x0); in wlc_phy_ipa_internal_tssi_setup_nphy()
17217 WRITE_RADIO_SYN(pi, RADIO_2056, GPIO_MASTER1, 0x29); in wlc_phy_ipa_internal_tssi_setup_nphy()
17219 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_ipa_internal_tssi_setup_nphy()
17220 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, IQCAL_VCM_HG, in wlc_phy_ipa_internal_tssi_setup_nphy()
17222 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, IQCAL_IDAC, in wlc_phy_ipa_internal_tssi_setup_nphy()
17224 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, TSSI_VCM, in wlc_phy_ipa_internal_tssi_setup_nphy()
17226 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, TX_AMP_DET, in wlc_phy_ipa_internal_tssi_setup_nphy()
17228 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, TSSI_MISC1, in wlc_phy_ipa_internal_tssi_setup_nphy()
17230 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, TSSI_MISC2, in wlc_phy_ipa_internal_tssi_setup_nphy()
17232 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, TSSI_MISC3, in wlc_phy_ipa_internal_tssi_setup_nphy()
17235 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_ipa_internal_tssi_setup_nphy()
17236 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_ipa_internal_tssi_setup_nphy()
17239 if (pi->pubpi.radiorev != 5) in wlc_phy_ipa_internal_tssi_setup_nphy()
17240 WRITE_RADIO_REG2(pi, RADIO_2056, TX, in wlc_phy_ipa_internal_tssi_setup_nphy()
17242 if (NREV_GE(pi->pubpi.phy_rev, 5)) in wlc_phy_ipa_internal_tssi_setup_nphy()
17243 WRITE_RADIO_REG2(pi, RADIO_2056, TX, in wlc_phy_ipa_internal_tssi_setup_nphy()
17246 WRITE_RADIO_REG2(pi, RADIO_2056, TX, in wlc_phy_ipa_internal_tssi_setup_nphy()
17248 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_ipa_internal_tssi_setup_nphy()
17251 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_ipa_internal_tssi_setup_nphy()
17253 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_ipa_internal_tssi_setup_nphy()
17255 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_ipa_internal_tssi_setup_nphy()
17257 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_ipa_internal_tssi_setup_nphy()
17265 wlc_phy_rfctrl_override_nphy(struct brcms_phy *pi, u16 field, u16 value, in wlc_phy_rfctrl_override_nphy() argument
17273 if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 7)) { in wlc_phy_rfctrl_override_nphy()
17378 and_phy_reg(pi, en_addr, ~en_mask); in wlc_phy_rfctrl_override_nphy()
17379 and_phy_reg(pi, val_addr, ~val_mask); in wlc_phy_rfctrl_override_nphy()
17384 or_phy_reg(pi, en_addr, en_mask); in wlc_phy_rfctrl_override_nphy()
17387 mod_phy_reg(pi, val_addr, in wlc_phy_rfctrl_override_nphy()
17397 and_phy_reg(pi, 0xec, ~field); in wlc_phy_rfctrl_override_nphy()
17400 or_phy_reg(pi, 0xec, field); in wlc_phy_rfctrl_override_nphy()
17498 mod_phy_reg(pi, addr, mask, (value << shift)); in wlc_phy_rfctrl_override_nphy()
17501 or_phy_reg(pi, 0xec, (0x1 << 0)); in wlc_phy_rfctrl_override_nphy()
17502 or_phy_reg(pi, 0x78, (0x1 << 0)); in wlc_phy_rfctrl_override_nphy()
17504 and_phy_reg(pi, 0xec, ~(0x1 << 0)); in wlc_phy_rfctrl_override_nphy()
17508 static void wlc_phy_txpwrctrl_idle_tssi_nphy(struct brcms_phy *pi) in wlc_phy_txpwrctrl_idle_tssi_nphy() argument
17513 if (SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi) || PHY_MUTED(pi)) in wlc_phy_txpwrctrl_idle_tssi_nphy()
17517 if (PHY_IPA(pi)) in wlc_phy_txpwrctrl_idle_tssi_nphy()
17518 wlc_phy_ipa_internal_tssi_setup_nphy(pi); in wlc_phy_txpwrctrl_idle_tssi_nphy()
17520 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_txpwrctrl_idle_tssi_nphy()
17521 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 12), in wlc_phy_txpwrctrl_idle_tssi_nphy()
17524 else if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_txpwrctrl_idle_tssi_nphy()
17525 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 13), 0, 3, 0); in wlc_phy_txpwrctrl_idle_tssi_nphy()
17527 wlc_phy_stopplayback_nphy(pi); in wlc_phy_txpwrctrl_idle_tssi_nphy()
17529 wlc_phy_tx_tone_nphy(pi, 4000, 0, 0, 0, false); in wlc_phy_txpwrctrl_idle_tssi_nphy()
17533 wlc_phy_poll_rssi_nphy(pi, (u8) NPHY_RSSI_SEL_TSSI_2G, rssi_buf, in wlc_phy_txpwrctrl_idle_tssi_nphy()
17535 wlc_phy_stopplayback_nphy(pi); in wlc_phy_txpwrctrl_idle_tssi_nphy()
17536 wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_OFF, 0); in wlc_phy_txpwrctrl_idle_tssi_nphy()
17538 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_txpwrctrl_idle_tssi_nphy()
17539 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 12), in wlc_phy_txpwrctrl_idle_tssi_nphy()
17542 else if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_txpwrctrl_idle_tssi_nphy()
17543 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 13), 0, 3, 1); in wlc_phy_txpwrctrl_idle_tssi_nphy()
17545 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwrctrl_idle_tssi_nphy()
17547 pi->nphy_pwrctrl_info[PHY_CORE_0].idle_tssi_2g = in wlc_phy_txpwrctrl_idle_tssi_nphy()
17549 pi->nphy_pwrctrl_info[PHY_CORE_0].idle_tssi_5g = in wlc_phy_txpwrctrl_idle_tssi_nphy()
17552 pi->nphy_pwrctrl_info[PHY_CORE_1].idle_tssi_2g = in wlc_phy_txpwrctrl_idle_tssi_nphy()
17554 pi->nphy_pwrctrl_info[PHY_CORE_1].idle_tssi_5g = in wlc_phy_txpwrctrl_idle_tssi_nphy()
17557 pi->nphy_pwrctrl_info[PHY_CORE_0].idle_tssi_2g = in wlc_phy_txpwrctrl_idle_tssi_nphy()
17560 pi->nphy_pwrctrl_info[PHY_CORE_1].idle_tssi_2g = in wlc_phy_txpwrctrl_idle_tssi_nphy()
17563 pi->nphy_pwrctrl_info[PHY_CORE_0].idle_tssi_5g = in wlc_phy_txpwrctrl_idle_tssi_nphy()
17565 pi->nphy_pwrctrl_info[PHY_CORE_1].idle_tssi_5g = in wlc_phy_txpwrctrl_idle_tssi_nphy()
17571 static void wlc_phy_txpwr_limit_to_tbl_nphy(struct brcms_phy *pi) in wlc_phy_txpwr_limit_to_tbl_nphy() argument
17576 pi->adj_pwr_tbl_nphy[idx] = pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17586 if (CHSPEC_IS40(pi->radio_chanspec) in wlc_phy_txpwr_limit_to_tbl_nphy()
17590 idx = (CHSPEC_IS40(pi->radio_chanspec)) ? in wlc_phy_txpwr_limit_to_tbl_nphy()
17598 idx = (CHSPEC_IS40(pi->radio_chanspec)) ? in wlc_phy_txpwr_limit_to_tbl_nphy()
17604 idx = (CHSPEC_IS40(pi->radio_chanspec)) ? in wlc_phy_txpwr_limit_to_tbl_nphy()
17610 idx = (CHSPEC_IS40(pi->radio_chanspec)) ? in wlc_phy_txpwr_limit_to_tbl_nphy()
17615 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17616 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17618 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17619 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17620 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17621 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17622 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17623 pi->tx_power_offset[idx++]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17625 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17626 pi->tx_power_offset[idx++]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17627 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17628 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17629 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17630 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17631 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17632 pi->tx_power_offset[idx++]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17634 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17635 pi->tx_power_offset[idx++]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17636 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17637 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17638 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17639 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17640 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17641 pi->tx_power_offset[idx++]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17643 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17644 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17645 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17646 pi->tx_power_offset[idx++]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17647 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17648 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17650 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17651 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17653 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17654 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17655 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17656 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17657 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17658 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17659 pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = in wlc_phy_txpwr_limit_to_tbl_nphy()
17660 pi->tx_power_offset[idx]; in wlc_phy_txpwr_limit_to_tbl_nphy()
17664 static void wlc_phy_txpwrctrl_pwr_setup_nphy(struct brcms_phy *pi) in wlc_phy_txpwrctrl_pwr_setup_nphy() argument
17676 if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) { in wlc_phy_txpwrctrl_pwr_setup_nphy()
17677 wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, MCTL_PHYLOCK); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17678 (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17682 if (pi->phyhang_avoid) in wlc_phy_txpwrctrl_pwr_setup_nphy()
17683 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17685 or_phy_reg(pi, 0x122, (0x1 << 0)); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17687 if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_txpwrctrl_pwr_setup_nphy()
17688 and_phy_reg(pi, 0x1e7, (u16) (~(0x1 << 15))); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17690 or_phy_reg(pi, 0x1e7, (0x1 << 15)); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17692 if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) in wlc_phy_txpwrctrl_pwr_setup_nphy()
17693 wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, 0); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17695 if (pi->sh->sromrev < 4) { in wlc_phy_txpwrctrl_pwr_setup_nphy()
17696 idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_2g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17697 idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_2g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17706 chan_freq_range = wlc_phy_get_chan_freq_range_nphy(pi, 0); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17709 idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_2g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17710 idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_2g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17711 a1[0] = pi->nphy_pwrctrl_info[0].pwrdet_2g_a1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17712 a1[1] = pi->nphy_pwrctrl_info[1].pwrdet_2g_a1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17713 b0[0] = pi->nphy_pwrctrl_info[0].pwrdet_2g_b0; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17714 b0[1] = pi->nphy_pwrctrl_info[1].pwrdet_2g_b0; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17715 b1[0] = pi->nphy_pwrctrl_info[0].pwrdet_2g_b1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17716 b1[1] = pi->nphy_pwrctrl_info[1].pwrdet_2g_b1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17719 idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_5g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17720 idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_5g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17721 a1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gl_a1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17722 a1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gl_a1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17723 b0[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gl_b0; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17724 b0[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gl_b0; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17725 b1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gl_b1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17726 b1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gl_b1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17729 idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_5g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17730 idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_5g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17731 a1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gm_a1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17732 a1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gm_a1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17733 b0[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gm_b0; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17734 b0[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gm_b0; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17735 b1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gm_b1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17736 b1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gm_b1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17739 idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_5g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17740 idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_5g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17741 a1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gh_a1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17742 a1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gh_a1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17743 b0[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gh_b0; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17744 b0[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gh_b0; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17745 b1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gh_b1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17746 b1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gh_b1; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17749 idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_2g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17750 idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_2g; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17762 target_pwr_qtrdbm[0] = (s8) pi->tx_power_max; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17763 target_pwr_qtrdbm[1] = (s8) pi->tx_power_max; in wlc_phy_txpwrctrl_pwr_setup_nphy()
17765 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwrctrl_pwr_setup_nphy()
17766 if (pi->srom_fem2g.tssipos) in wlc_phy_txpwrctrl_pwr_setup_nphy()
17767 or_phy_reg(pi, 0x1e9, (0x1 << 14)); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17769 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_txpwrctrl_pwr_setup_nphy()
17771 if (PHY_IPA(pi)) { in wlc_phy_txpwrctrl_pwr_setup_nphy()
17772 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_txpwrctrl_pwr_setup_nphy()
17773 WRITE_RADIO_REG3(pi, RADIO_2057, in wlc_phy_txpwrctrl_pwr_setup_nphy()
17778 WRITE_RADIO_REG3(pi, RADIO_2057, in wlc_phy_txpwrctrl_pwr_setup_nphy()
17785 if (PHY_IPA(pi)) { in wlc_phy_txpwrctrl_pwr_setup_nphy()
17787 write_radio_reg(pi, RADIO_2056_TX_TX_SSI_MUX | in wlc_phy_txpwrctrl_pwr_setup_nphy()
17790 (pi->radio_chanspec)) ? in wlc_phy_txpwrctrl_pwr_setup_nphy()
17792 write_radio_reg(pi, in wlc_phy_txpwrctrl_pwr_setup_nphy()
17796 (pi->radio_chanspec)) ? in wlc_phy_txpwrctrl_pwr_setup_nphy()
17800 write_radio_reg(pi, RADIO_2056_TX_TX_SSI_MUX | in wlc_phy_txpwrctrl_pwr_setup_nphy()
17802 write_radio_reg(pi, RADIO_2056_TX_TX_SSI_MUX | in wlc_phy_txpwrctrl_pwr_setup_nphy()
17808 if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) { in wlc_phy_txpwrctrl_pwr_setup_nphy()
17809 wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, MCTL_PHYLOCK); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17810 (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17814 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_txpwrctrl_pwr_setup_nphy()
17815 mod_phy_reg(pi, 0x1e7, (0x7f << 0), in wlc_phy_txpwrctrl_pwr_setup_nphy()
17818 mod_phy_reg(pi, 0x1e7, (0x7f << 0), in wlc_phy_txpwrctrl_pwr_setup_nphy()
17821 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_txpwrctrl_pwr_setup_nphy()
17822 mod_phy_reg(pi, 0x222, (0xff << 0), in wlc_phy_txpwrctrl_pwr_setup_nphy()
17824 else if (NREV_GT(pi->pubpi.phy_rev, 1)) in wlc_phy_txpwrctrl_pwr_setup_nphy()
17825 mod_phy_reg(pi, 0x222, (0xff << 0), in wlc_phy_txpwrctrl_pwr_setup_nphy()
17828 if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) in wlc_phy_txpwrctrl_pwr_setup_nphy()
17829 wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, 0); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17831 write_phy_reg(pi, 0x1e8, (0x3 << 8) | (240 << 0)); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17833 write_phy_reg(pi, 0x1e9, in wlc_phy_txpwrctrl_pwr_setup_nphy()
17836 write_phy_reg(pi, 0x1ea, in wlc_phy_txpwrctrl_pwr_setup_nphy()
17850 if (NREV_LT(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwrctrl_pwr_setup_nphy()
17860 wlc_phy_table_write_nphy(pi, tbl_id, tbl_len, tbl_offset, 32, in wlc_phy_txpwrctrl_pwr_setup_nphy()
17864 wlc_phy_txpwr_limit_to_tbl_nphy(pi); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17865 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE1TXPWRCTL, 84, 64, 8, in wlc_phy_txpwrctrl_pwr_setup_nphy()
17866 pi->adj_pwr_tbl_nphy); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17867 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE2TXPWRCTL, 84, 64, 8, in wlc_phy_txpwrctrl_pwr_setup_nphy()
17868 pi->adj_pwr_tbl_nphy); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17870 if (pi->phyhang_avoid) in wlc_phy_txpwrctrl_pwr_setup_nphy()
17871 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_txpwrctrl_pwr_setup_nphy()
17874 static u32 *wlc_phy_get_ipa_gaintbl_nphy(struct brcms_phy *pi) in wlc_phy_get_ipa_gaintbl_nphy() argument
17878 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_get_ipa_gaintbl_nphy()
17879 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_get_ipa_gaintbl_nphy()
17880 if ((pi->pubpi.radiorev == 4) in wlc_phy_get_ipa_gaintbl_nphy()
17881 || (pi->pubpi.radiorev == 6)) in wlc_phy_get_ipa_gaintbl_nphy()
17884 else if (pi->pubpi.radiorev == 3) in wlc_phy_get_ipa_gaintbl_nphy()
17887 else if (pi->pubpi.radiorev == 5) in wlc_phy_get_ipa_gaintbl_nphy()
17890 else if ((pi->pubpi.radiorev == 7) in wlc_phy_get_ipa_gaintbl_nphy()
17891 || (pi->pubpi.radiorev == 8)) in wlc_phy_get_ipa_gaintbl_nphy()
17894 } else if (NREV_IS(pi->pubpi.phy_rev, 6)) { in wlc_phy_get_ipa_gaintbl_nphy()
17896 if (pi->sh->chip == BCMA_CHIP_ID_BCM47162) in wlc_phy_get_ipa_gaintbl_nphy()
17898 } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { in wlc_phy_get_ipa_gaintbl_nphy()
17905 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_get_ipa_gaintbl_nphy()
17906 if ((pi->pubpi.radiorev == 3) || in wlc_phy_get_ipa_gaintbl_nphy()
17907 (pi->pubpi.radiorev == 4) || in wlc_phy_get_ipa_gaintbl_nphy()
17908 (pi->pubpi.radiorev == 6)) in wlc_phy_get_ipa_gaintbl_nphy()
17910 else if ((pi->pubpi.radiorev == 7) in wlc_phy_get_ipa_gaintbl_nphy()
17911 || (pi->pubpi.radiorev == 8)) in wlc_phy_get_ipa_gaintbl_nphy()
17922 static void wlc_phy_restore_rssical_nphy(struct brcms_phy *pi) in wlc_phy_restore_rssical_nphy() argument
17924 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_restore_rssical_nphy()
17925 if (pi->nphy_rssical_chanspec_2G == 0) in wlc_phy_restore_rssical_nphy()
17928 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_restore_rssical_nphy()
17929 mod_radio_reg(pi, RADIO_2057_NB_MASTER_CORE0, in wlc_phy_restore_rssical_nphy()
17931 pi->rssical_cache. in wlc_phy_restore_rssical_nphy()
17933 mod_radio_reg(pi, RADIO_2057_NB_MASTER_CORE1, in wlc_phy_restore_rssical_nphy()
17935 pi->rssical_cache. in wlc_phy_restore_rssical_nphy()
17938 mod_radio_reg(pi, in wlc_phy_restore_rssical_nphy()
17941 pi->rssical_cache. in wlc_phy_restore_rssical_nphy()
17943 mod_radio_reg(pi, in wlc_phy_restore_rssical_nphy()
17946 pi->rssical_cache. in wlc_phy_restore_rssical_nphy()
17950 write_phy_reg(pi, 0x1a6, in wlc_phy_restore_rssical_nphy()
17951 pi->rssical_cache.rssical_phyregs_2G[0]); in wlc_phy_restore_rssical_nphy()
17952 write_phy_reg(pi, 0x1ac, in wlc_phy_restore_rssical_nphy()
17953 pi->rssical_cache.rssical_phyregs_2G[1]); in wlc_phy_restore_rssical_nphy()
17954 write_phy_reg(pi, 0x1b2, in wlc_phy_restore_rssical_nphy()
17955 pi->rssical_cache.rssical_phyregs_2G[2]); in wlc_phy_restore_rssical_nphy()
17956 write_phy_reg(pi, 0x1b8, in wlc_phy_restore_rssical_nphy()
17957 pi->rssical_cache.rssical_phyregs_2G[3]); in wlc_phy_restore_rssical_nphy()
17958 write_phy_reg(pi, 0x1a4, in wlc_phy_restore_rssical_nphy()
17959 pi->rssical_cache.rssical_phyregs_2G[4]); in wlc_phy_restore_rssical_nphy()
17960 write_phy_reg(pi, 0x1aa, in wlc_phy_restore_rssical_nphy()
17961 pi->rssical_cache.rssical_phyregs_2G[5]); in wlc_phy_restore_rssical_nphy()
17962 write_phy_reg(pi, 0x1b0, in wlc_phy_restore_rssical_nphy()
17963 pi->rssical_cache.rssical_phyregs_2G[6]); in wlc_phy_restore_rssical_nphy()
17964 write_phy_reg(pi, 0x1b6, in wlc_phy_restore_rssical_nphy()
17965 pi->rssical_cache.rssical_phyregs_2G[7]); in wlc_phy_restore_rssical_nphy()
17966 write_phy_reg(pi, 0x1a5, in wlc_phy_restore_rssical_nphy()
17967 pi->rssical_cache.rssical_phyregs_2G[8]); in wlc_phy_restore_rssical_nphy()
17968 write_phy_reg(pi, 0x1ab, in wlc_phy_restore_rssical_nphy()
17969 pi->rssical_cache.rssical_phyregs_2G[9]); in wlc_phy_restore_rssical_nphy()
17970 write_phy_reg(pi, 0x1b1, in wlc_phy_restore_rssical_nphy()
17971 pi->rssical_cache.rssical_phyregs_2G[10]); in wlc_phy_restore_rssical_nphy()
17972 write_phy_reg(pi, 0x1b7, in wlc_phy_restore_rssical_nphy()
17973 pi->rssical_cache.rssical_phyregs_2G[11]); in wlc_phy_restore_rssical_nphy()
17976 if (pi->nphy_rssical_chanspec_5G == 0) in wlc_phy_restore_rssical_nphy()
17979 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_restore_rssical_nphy()
17980 mod_radio_reg(pi, RADIO_2057_NB_MASTER_CORE0, in wlc_phy_restore_rssical_nphy()
17982 pi->rssical_cache. in wlc_phy_restore_rssical_nphy()
17984 mod_radio_reg(pi, RADIO_2057_NB_MASTER_CORE1, in wlc_phy_restore_rssical_nphy()
17986 pi->rssical_cache. in wlc_phy_restore_rssical_nphy()
17989 mod_radio_reg(pi, in wlc_phy_restore_rssical_nphy()
17992 pi->rssical_cache. in wlc_phy_restore_rssical_nphy()
17994 mod_radio_reg(pi, in wlc_phy_restore_rssical_nphy()
17997 pi->rssical_cache. in wlc_phy_restore_rssical_nphy()
18001 write_phy_reg(pi, 0x1a6, in wlc_phy_restore_rssical_nphy()
18002 pi->rssical_cache.rssical_phyregs_5G[0]); in wlc_phy_restore_rssical_nphy()
18003 write_phy_reg(pi, 0x1ac, in wlc_phy_restore_rssical_nphy()
18004 pi->rssical_cache.rssical_phyregs_5G[1]); in wlc_phy_restore_rssical_nphy()
18005 write_phy_reg(pi, 0x1b2, in wlc_phy_restore_rssical_nphy()
18006 pi->rssical_cache.rssical_phyregs_5G[2]); in wlc_phy_restore_rssical_nphy()
18007 write_phy_reg(pi, 0x1b8, in wlc_phy_restore_rssical_nphy()
18008 pi->rssical_cache.rssical_phyregs_5G[3]); in wlc_phy_restore_rssical_nphy()
18009 write_phy_reg(pi, 0x1a4, in wlc_phy_restore_rssical_nphy()
18010 pi->rssical_cache.rssical_phyregs_5G[4]); in wlc_phy_restore_rssical_nphy()
18011 write_phy_reg(pi, 0x1aa, in wlc_phy_restore_rssical_nphy()
18012 pi->rssical_cache.rssical_phyregs_5G[5]); in wlc_phy_restore_rssical_nphy()
18013 write_phy_reg(pi, 0x1b0, in wlc_phy_restore_rssical_nphy()
18014 pi->rssical_cache.rssical_phyregs_5G[6]); in wlc_phy_restore_rssical_nphy()
18015 write_phy_reg(pi, 0x1b6, in wlc_phy_restore_rssical_nphy()
18016 pi->rssical_cache.rssical_phyregs_5G[7]); in wlc_phy_restore_rssical_nphy()
18017 write_phy_reg(pi, 0x1a5, in wlc_phy_restore_rssical_nphy()
18018 pi->rssical_cache.rssical_phyregs_5G[8]); in wlc_phy_restore_rssical_nphy()
18019 write_phy_reg(pi, 0x1ab, in wlc_phy_restore_rssical_nphy()
18020 pi->rssical_cache.rssical_phyregs_5G[9]); in wlc_phy_restore_rssical_nphy()
18021 write_phy_reg(pi, 0x1b1, in wlc_phy_restore_rssical_nphy()
18022 pi->rssical_cache.rssical_phyregs_5G[10]); in wlc_phy_restore_rssical_nphy()
18023 write_phy_reg(pi, 0x1b7, in wlc_phy_restore_rssical_nphy()
18024 pi->rssical_cache.rssical_phyregs_5G[11]); in wlc_phy_restore_rssical_nphy()
18028 static void wlc_phy_internal_cal_txgain_nphy(struct brcms_phy *pi) in wlc_phy_internal_cal_txgain_nphy() argument
18032 pi->nphy_txcal_pwr_idx[0] = pi->nphy_cal_orig_pwr_idx[0]; in wlc_phy_internal_cal_txgain_nphy()
18033 pi->nphy_txcal_pwr_idx[1] = pi->nphy_cal_orig_pwr_idx[0]; in wlc_phy_internal_cal_txgain_nphy()
18034 wlc_phy_txpwr_index_nphy(pi, 1, pi->nphy_cal_orig_pwr_idx[0], true); in wlc_phy_internal_cal_txgain_nphy()
18035 wlc_phy_txpwr_index_nphy(pi, 2, pi->nphy_cal_orig_pwr_idx[1], true); in wlc_phy_internal_cal_txgain_nphy()
18037 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, in wlc_phy_internal_cal_txgain_nphy()
18040 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_internal_cal_txgain_nphy()
18048 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, in wlc_phy_internal_cal_txgain_nphy()
18052 static void wlc_phy_precal_txgain_nphy(struct brcms_phy *pi) in wlc_phy_precal_txgain_nphy() argument
18058 if (pi->use_int_tx_iqlo_cal_nphy) { in wlc_phy_precal_txgain_nphy()
18059 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_precal_txgain_nphy()
18060 if ((pi->pubpi.radiorev == 3) || in wlc_phy_precal_txgain_nphy()
18061 (pi->pubpi.radiorev == 4) || in wlc_phy_precal_txgain_nphy()
18062 (pi->pubpi.radiorev == 6)) { in wlc_phy_precal_txgain_nphy()
18064 pi->nphy_txcal_pwr_idx[0] = in wlc_phy_precal_txgain_nphy()
18066 pi->nphy_txcal_pwr_idx[1] = in wlc_phy_precal_txgain_nphy()
18069 pi, 3, in wlc_phy_precal_txgain_nphy()
18074 pi->nphy_txcal_pwr_idx[0] = in wlc_phy_precal_txgain_nphy()
18076 pi->nphy_txcal_pwr_idx[1] = in wlc_phy_precal_txgain_nphy()
18079 pi, 3, in wlc_phy_precal_txgain_nphy()
18085 } else if (NREV_LT(pi->pubpi.phy_rev, 5)) { in wlc_phy_precal_txgain_nphy()
18086 wlc_phy_cal_txgainctrl_nphy(pi, 11, false); in wlc_phy_precal_txgain_nphy()
18087 if (pi->sh->hw_phytxchain != 3) { in wlc_phy_precal_txgain_nphy()
18088 pi->nphy_txcal_pwr_idx[1] = in wlc_phy_precal_txgain_nphy()
18089 pi->nphy_txcal_pwr_idx[0]; in wlc_phy_precal_txgain_nphy()
18090 wlc_phy_txpwr_index_nphy(pi, 3, in wlc_phy_precal_txgain_nphy()
18091 pi-> in wlc_phy_precal_txgain_nphy()
18097 } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { in wlc_phy_precal_txgain_nphy()
18098 if (PHY_IPA(pi)) { in wlc_phy_precal_txgain_nphy()
18099 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_precal_txgain_nphy()
18100 wlc_phy_cal_txgainctrl_nphy(pi, 12, in wlc_phy_precal_txgain_nphy()
18103 pi->nphy_txcal_pwr_idx[0] = 80; in wlc_phy_precal_txgain_nphy()
18104 pi->nphy_txcal_pwr_idx[1] = 80; in wlc_phy_precal_txgain_nphy()
18105 wlc_phy_txpwr_index_nphy(pi, 3, 80, in wlc_phy_precal_txgain_nphy()
18110 wlc_phy_internal_cal_txgain_nphy(pi); in wlc_phy_precal_txgain_nphy()
18114 } else if (NREV_IS(pi->pubpi.phy_rev, 6)) { in wlc_phy_precal_txgain_nphy()
18115 if (PHY_IPA(pi)) { in wlc_phy_precal_txgain_nphy()
18116 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_precal_txgain_nphy()
18117 wlc_phy_cal_txgainctrl_nphy(pi, 12, in wlc_phy_precal_txgain_nphy()
18120 wlc_phy_cal_txgainctrl_nphy(pi, 14, in wlc_phy_precal_txgain_nphy()
18123 wlc_phy_internal_cal_txgain_nphy(pi); in wlc_phy_precal_txgain_nphy()
18129 wlc_phy_cal_txgainctrl_nphy(pi, 10, false); in wlc_phy_precal_txgain_nphy()
18133 wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, in wlc_phy_precal_txgain_nphy()
18134 &pi->nphy_txcal_bbmult); in wlc_phy_precal_txgain_nphy()
18138 wlc_phy_rfctrlintc_override_nphy(struct brcms_phy *pi, u8 field, u16 value, in wlc_phy_rfctrlintc_override_nphy() argument
18145 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_rfctrlintc_override_nphy()
18146 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_rfctrlintc_override_nphy()
18154 if (NREV_LT(pi->pubpi.phy_rev, 7)) { in wlc_phy_rfctrlintc_override_nphy()
18158 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x91 : in wlc_phy_rfctrlintc_override_nphy()
18164 write_phy_reg(pi, (core == PHY_CORE_0) ? 0x91 : in wlc_phy_rfctrlintc_override_nphy()
18167 wlc_phy_force_rfseq_nphy(pi, in wlc_phy_rfctrlintc_override_nphy()
18171 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rfctrlintc_override_nphy()
18176 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18181 or_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18186 and_phy_reg(pi, 0x2ff, (u16) in wlc_phy_rfctrlintc_override_nphy()
18188 or_phy_reg(pi, 0x2ff, (0x1 << 13)); in wlc_phy_rfctrlintc_override_nphy()
18189 or_phy_reg(pi, 0x2ff, (0x1 << 0)); in wlc_phy_rfctrlintc_override_nphy()
18196 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18203 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18212 mod_phy_reg(pi, 0x78, mask, val); in wlc_phy_rfctrlintc_override_nphy()
18214 SPINWAIT(((read_phy_reg(pi, 0x78) & val) in wlc_phy_rfctrlintc_override_nphy()
18216 if (WARN(read_phy_reg(pi, 0x78) & val, in wlc_phy_rfctrlintc_override_nphy()
18222 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18228 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rfctrlintc_override_nphy()
18232 if (CHSPEC_IS5G(pi->radio_chanspec)) in wlc_phy_rfctrlintc_override_nphy()
18237 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18242 or_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18248 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rfctrlintc_override_nphy()
18255 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18262 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rfctrlintc_override_nphy()
18263 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rfctrlintc_override_nphy()
18267 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18273 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18281 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18287 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18295 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18301 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rfctrlintc_override_nphy()
18308 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18315 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rfctrlintc_override_nphy()
18316 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rfctrlintc_override_nphy()
18320 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18326 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18334 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18340 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18348 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18354 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rfctrlintc_override_nphy()
18361 mod_phy_reg(pi, in wlc_phy_rfctrlintc_override_nphy()
18372 wlc_phy_cal_txgainctrl_nphy(struct brcms_phy *pi, s32 dBm_targetpower, in wlc_phy_cal_txgainctrl_nphy() argument
18388 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_cal_txgainctrl_nphy()
18393 if (CHSPEC_IS40(pi->radio_chanspec)) in wlc_phy_cal_txgainctrl_nphy()
18398 wlc_phy_txpwr_index_nphy(pi, 1, pi->nphy_cal_orig_pwr_idx[0], true); in wlc_phy_cal_txgainctrl_nphy()
18399 wlc_phy_txpwr_index_nphy(pi, 2, pi->nphy_cal_orig_pwr_idx[1], true); in wlc_phy_cal_txgainctrl_nphy()
18401 if (pi->phyhang_avoid) in wlc_phy_cal_txgainctrl_nphy()
18402 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_cal_txgainctrl_nphy()
18404 phyhang_avoid_state = pi->phyhang_avoid; in wlc_phy_cal_txgainctrl_nphy()
18405 pi->phyhang_avoid = false; in wlc_phy_cal_txgainctrl_nphy()
18407 phy_saveregs[0] = read_phy_reg(pi, 0x91); in wlc_phy_cal_txgainctrl_nphy()
18408 phy_saveregs[1] = read_phy_reg(pi, 0x92); in wlc_phy_cal_txgainctrl_nphy()
18409 phy_saveregs[2] = read_phy_reg(pi, 0xe7); in wlc_phy_cal_txgainctrl_nphy()
18410 phy_saveregs[3] = read_phy_reg(pi, 0xec); in wlc_phy_cal_txgainctrl_nphy()
18411 wlc_phy_rfctrlintc_override_nphy(pi, NPHY_RfctrlIntc_override_PA, 1, in wlc_phy_cal_txgainctrl_nphy()
18416 wlc_phy_rfctrlintc_override_nphy(pi, in wlc_phy_cal_txgainctrl_nphy()
18419 wlc_phy_rfctrlintc_override_nphy(pi, in wlc_phy_cal_txgainctrl_nphy()
18423 wlc_phy_rfctrlintc_override_nphy(pi, in wlc_phy_cal_txgainctrl_nphy()
18426 wlc_phy_rfctrlintc_override_nphy(pi, in wlc_phy_cal_txgainctrl_nphy()
18431 orig_BBConfig = read_phy_reg(pi, 0x01); in wlc_phy_cal_txgainctrl_nphy()
18432 mod_phy_reg(pi, 0x01, (0x1 << 15), 0); in wlc_phy_cal_txgainctrl_nphy()
18434 wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &m0m1); in wlc_phy_cal_txgainctrl_nphy()
18436 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_cal_txgainctrl_nphy()
18437 txpwrindex = (s32) pi->nphy_cal_orig_pwr_idx[core]; in wlc_phy_cal_txgainctrl_nphy()
18441 wlc_phy_tx_tone_nphy(pi, freq_test, ampl_test, 0, 0, in wlc_phy_cal_txgainctrl_nphy()
18449 wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &curr_m0m1); in wlc_phy_cal_txgainctrl_nphy()
18450 wlc_phy_table_write_nphy(pi, 15, 1, 95, 16, &curr_m0m1); in wlc_phy_cal_txgainctrl_nphy()
18454 wlc_phy_est_tonepwr_nphy(pi, qdBm_power, in wlc_phy_cal_txgainctrl_nphy()
18457 pi->nphy_bb_mult_save = 0; in wlc_phy_cal_txgainctrl_nphy()
18458 wlc_phy_stopplayback_nphy(pi); in wlc_phy_cal_txgainctrl_nphy()
18468 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_cal_txgainctrl_nphy()
18469 if (NREV_IS(pi->pubpi.phy_rev, 4) && in wlc_phy_cal_txgainctrl_nphy()
18470 (pi->srom_fem5g.extpagain == 3)) { in wlc_phy_cal_txgainctrl_nphy()
18475 if (NREV_GE(pi->pubpi.phy_rev, 5) && in wlc_phy_cal_txgainctrl_nphy()
18476 (pi->srom_fem2g.extpagain == 3)) { in wlc_phy_cal_txgainctrl_nphy()
18482 wlc_phy_txpwr_index_nphy(pi, (1 << core), in wlc_phy_cal_txgainctrl_nphy()
18486 pi->nphy_txcal_pwr_idx[core] = (u8) txpwrindex; in wlc_phy_cal_txgainctrl_nphy()
18492 wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &dbg_m0m1); in wlc_phy_cal_txgainctrl_nphy()
18494 wlc_phy_tx_tone_nphy(pi, freq_test, ampl_test, 0, 0, in wlc_phy_cal_txgainctrl_nphy()
18497 wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &dbg_m0m1); in wlc_phy_cal_txgainctrl_nphy()
18498 wlc_phy_table_write_nphy(pi, 15, 1, 95, 16, &dbg_m0m1); in wlc_phy_cal_txgainctrl_nphy()
18502 wlc_phy_est_tonepwr_nphy(pi, qdBm_power, in wlc_phy_cal_txgainctrl_nphy()
18505 wlc_phy_table_read_nphy(pi, 7, 1, (0x110 + core), 16, in wlc_phy_cal_txgainctrl_nphy()
18509 pi->nphy_bb_mult_save = 0; in wlc_phy_cal_txgainctrl_nphy()
18510 wlc_phy_stopplayback_nphy(pi); in wlc_phy_cal_txgainctrl_nphy()
18514 wlc_phy_txpwr_index_nphy(pi, 1, pi->nphy_txcal_pwr_idx[0], true); in wlc_phy_cal_txgainctrl_nphy()
18515 wlc_phy_txpwr_index_nphy(pi, 2, pi->nphy_txcal_pwr_idx[1], true); in wlc_phy_cal_txgainctrl_nphy()
18517 wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &pi->nphy_txcal_bbmult); in wlc_phy_cal_txgainctrl_nphy()
18519 write_phy_reg(pi, 0x01, orig_BBConfig); in wlc_phy_cal_txgainctrl_nphy()
18521 write_phy_reg(pi, 0x91, phy_saveregs[0]); in wlc_phy_cal_txgainctrl_nphy()
18522 write_phy_reg(pi, 0x92, phy_saveregs[1]); in wlc_phy_cal_txgainctrl_nphy()
18523 write_phy_reg(pi, 0xe7, phy_saveregs[2]); in wlc_phy_cal_txgainctrl_nphy()
18524 write_phy_reg(pi, 0xec, phy_saveregs[3]); in wlc_phy_cal_txgainctrl_nphy()
18526 pi->phyhang_avoid = phyhang_avoid_state; in wlc_phy_cal_txgainctrl_nphy()
18528 if (pi->phyhang_avoid) in wlc_phy_cal_txgainctrl_nphy()
18529 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_cal_txgainctrl_nphy()
18532 static void wlc_phy_savecal_nphy(struct brcms_phy *pi) in wlc_phy_savecal_nphy() argument
18538 if (pi->phyhang_avoid) in wlc_phy_savecal_nphy()
18539 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_savecal_nphy()
18541 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_savecal_nphy()
18543 wlc_phy_rx_iq_coeffs_nphy(pi, 0, in wlc_phy_savecal_nphy()
18544 &pi->calibration_cache. in wlc_phy_savecal_nphy()
18547 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_savecal_nphy()
18549 pi->calibration_cache.txcal_radio_regs_2G; in wlc_phy_savecal_nphy()
18550 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_savecal_nphy()
18552 pi->calibration_cache.txcal_radio_regs_2G[0] = in wlc_phy_savecal_nphy()
18553 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18556 pi->calibration_cache.txcal_radio_regs_2G[1] = in wlc_phy_savecal_nphy()
18557 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18560 pi->calibration_cache.txcal_radio_regs_2G[2] = in wlc_phy_savecal_nphy()
18561 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18564 pi->calibration_cache.txcal_radio_regs_2G[3] = in wlc_phy_savecal_nphy()
18565 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18569 pi->calibration_cache.txcal_radio_regs_2G[4] = in wlc_phy_savecal_nphy()
18570 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18573 pi->calibration_cache.txcal_radio_regs_2G[5] = in wlc_phy_savecal_nphy()
18574 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18577 pi->calibration_cache.txcal_radio_regs_2G[6] = in wlc_phy_savecal_nphy()
18578 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18581 pi->calibration_cache.txcal_radio_regs_2G[7] = in wlc_phy_savecal_nphy()
18582 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18586 pi->calibration_cache.txcal_radio_regs_2G[0] = in wlc_phy_savecal_nphy()
18587 read_radio_reg(pi, RADIO_2055_CORE1_TX_VOS_CNCL); in wlc_phy_savecal_nphy()
18588 pi->calibration_cache.txcal_radio_regs_2G[1] = in wlc_phy_savecal_nphy()
18589 read_radio_reg(pi, RADIO_2055_CORE2_TX_VOS_CNCL); in wlc_phy_savecal_nphy()
18590 pi->calibration_cache.txcal_radio_regs_2G[2] = in wlc_phy_savecal_nphy()
18591 read_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM); in wlc_phy_savecal_nphy()
18592 pi->calibration_cache.txcal_radio_regs_2G[3] = in wlc_phy_savecal_nphy()
18593 read_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM); in wlc_phy_savecal_nphy()
18596 pi->nphy_iqcal_chanspec_2G = pi->radio_chanspec; in wlc_phy_savecal_nphy()
18597 tbl_ptr = pi->calibration_cache.txcal_coeffs_2G; in wlc_phy_savecal_nphy()
18600 wlc_phy_rx_iq_coeffs_nphy(pi, 0, in wlc_phy_savecal_nphy()
18601 &pi->calibration_cache. in wlc_phy_savecal_nphy()
18604 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_savecal_nphy()
18606 pi->calibration_cache.txcal_radio_regs_5G; in wlc_phy_savecal_nphy()
18607 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_savecal_nphy()
18609 pi->calibration_cache.txcal_radio_regs_5G[0] = in wlc_phy_savecal_nphy()
18610 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18613 pi->calibration_cache.txcal_radio_regs_5G[1] = in wlc_phy_savecal_nphy()
18614 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18617 pi->calibration_cache.txcal_radio_regs_5G[2] = in wlc_phy_savecal_nphy()
18618 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18621 pi->calibration_cache.txcal_radio_regs_5G[3] = in wlc_phy_savecal_nphy()
18622 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18626 pi->calibration_cache.txcal_radio_regs_5G[4] = in wlc_phy_savecal_nphy()
18627 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18630 pi->calibration_cache.txcal_radio_regs_5G[5] = in wlc_phy_savecal_nphy()
18631 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18634 pi->calibration_cache.txcal_radio_regs_5G[6] = in wlc_phy_savecal_nphy()
18635 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18638 pi->calibration_cache.txcal_radio_regs_5G[7] = in wlc_phy_savecal_nphy()
18639 read_radio_reg(pi, in wlc_phy_savecal_nphy()
18643 pi->calibration_cache.txcal_radio_regs_5G[0] = in wlc_phy_savecal_nphy()
18644 read_radio_reg(pi, RADIO_2055_CORE1_TX_VOS_CNCL); in wlc_phy_savecal_nphy()
18645 pi->calibration_cache.txcal_radio_regs_5G[1] = in wlc_phy_savecal_nphy()
18646 read_radio_reg(pi, RADIO_2055_CORE2_TX_VOS_CNCL); in wlc_phy_savecal_nphy()
18647 pi->calibration_cache.txcal_radio_regs_5G[2] = in wlc_phy_savecal_nphy()
18648 read_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM); in wlc_phy_savecal_nphy()
18649 pi->calibration_cache.txcal_radio_regs_5G[3] = in wlc_phy_savecal_nphy()
18650 read_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM); in wlc_phy_savecal_nphy()
18653 pi->nphy_iqcal_chanspec_5G = pi->radio_chanspec; in wlc_phy_savecal_nphy()
18654 tbl_ptr = pi->calibration_cache.txcal_coeffs_5G; in wlc_phy_savecal_nphy()
18656 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_savecal_nphy()
18660 READ_RADIO_REG3(pi, RADIO_2057, TX, coreNum, in wlc_phy_savecal_nphy()
18663 READ_RADIO_REG3(pi, RADIO_2057, TX, coreNum, in wlc_phy_savecal_nphy()
18667 READ_RADIO_REG3(pi, RADIO_2057, TX, coreNum, in wlc_phy_savecal_nphy()
18670 READ_RADIO_REG3(pi, RADIO_2057, TX, coreNum, in wlc_phy_savecal_nphy()
18675 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, 8, 80, 16, tbl_ptr); in wlc_phy_savecal_nphy()
18677 if (pi->phyhang_avoid) in wlc_phy_savecal_nphy()
18678 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_savecal_nphy()
18681 static void wlc_phy_tx_iq_war_nphy(struct brcms_phy *pi) in wlc_phy_tx_iq_war_nphy() argument
18685 wlc_phy_table_read_nphy(pi, 15, 4, 0x50, 16, &tx_comp); in wlc_phy_tx_iq_war_nphy()
18687 wlapi_bmac_write_shm(pi->sh->physhim, M_20IN40_IQ, tx_comp.a0); in wlc_phy_tx_iq_war_nphy()
18688 wlapi_bmac_write_shm(pi->sh->physhim, M_20IN40_IQ + 2, tx_comp.b0); in wlc_phy_tx_iq_war_nphy()
18689 wlapi_bmac_write_shm(pi->sh->physhim, M_20IN40_IQ + 4, tx_comp.a1); in wlc_phy_tx_iq_war_nphy()
18690 wlapi_bmac_write_shm(pi->sh->physhim, M_20IN40_IQ + 6, tx_comp.b1); in wlc_phy_tx_iq_war_nphy()
18693 static void wlc_phy_restorecal_nphy(struct brcms_phy *pi) in wlc_phy_restorecal_nphy() argument
18701 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_restorecal_nphy()
18702 if (pi->nphy_iqcal_chanspec_2G == 0) in wlc_phy_restorecal_nphy()
18705 tbl_ptr = pi->calibration_cache.txcal_coeffs_2G; in wlc_phy_restorecal_nphy()
18706 loft_comp = &pi->calibration_cache.txcal_coeffs_2G[5]; in wlc_phy_restorecal_nphy()
18708 if (pi->nphy_iqcal_chanspec_5G == 0) in wlc_phy_restorecal_nphy()
18711 tbl_ptr = pi->calibration_cache.txcal_coeffs_5G; in wlc_phy_restorecal_nphy()
18712 loft_comp = &pi->calibration_cache.txcal_coeffs_5G[5]; in wlc_phy_restorecal_nphy()
18715 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 80, 16, tbl_ptr); in wlc_phy_restorecal_nphy()
18717 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_restorecal_nphy()
18729 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 88, 16, in wlc_phy_restorecal_nphy()
18732 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 85, 16, loft_comp); in wlc_phy_restorecal_nphy()
18734 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 93, 16, loft_comp); in wlc_phy_restorecal_nphy()
18736 if (NREV_LT(pi->pubpi.phy_rev, 2)) in wlc_phy_restorecal_nphy()
18737 wlc_phy_tx_iq_war_nphy(pi); in wlc_phy_restorecal_nphy()
18739 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_restorecal_nphy()
18740 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_restorecal_nphy()
18742 pi->calibration_cache.txcal_radio_regs_2G; in wlc_phy_restorecal_nphy()
18743 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_restorecal_nphy()
18745 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18748 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18750 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18753 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18755 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18758 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18760 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18763 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18766 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18769 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18771 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18774 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18776 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18779 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18781 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18784 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18787 write_radio_reg(pi, RADIO_2055_CORE1_TX_VOS_CNCL, in wlc_phy_restorecal_nphy()
18788 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18790 write_radio_reg(pi, RADIO_2055_CORE2_TX_VOS_CNCL, in wlc_phy_restorecal_nphy()
18791 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18793 write_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM, in wlc_phy_restorecal_nphy()
18794 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18796 write_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM, in wlc_phy_restorecal_nphy()
18797 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18801 wlc_phy_rx_iq_coeffs_nphy(pi, 1, in wlc_phy_restorecal_nphy()
18802 &pi->calibration_cache. in wlc_phy_restorecal_nphy()
18805 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_restorecal_nphy()
18807 pi->calibration_cache.txcal_radio_regs_5G; in wlc_phy_restorecal_nphy()
18808 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_restorecal_nphy()
18810 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18813 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18815 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18818 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18820 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18823 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18825 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18828 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18831 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18834 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18836 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18839 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18841 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18844 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18846 write_radio_reg(pi, in wlc_phy_restorecal_nphy()
18849 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18852 write_radio_reg(pi, RADIO_2055_CORE1_TX_VOS_CNCL, in wlc_phy_restorecal_nphy()
18853 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18855 write_radio_reg(pi, RADIO_2055_CORE2_TX_VOS_CNCL, in wlc_phy_restorecal_nphy()
18856 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18858 write_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM, in wlc_phy_restorecal_nphy()
18859 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18861 write_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM, in wlc_phy_restorecal_nphy()
18862 pi->calibration_cache. in wlc_phy_restorecal_nphy()
18866 wlc_phy_rx_iq_coeffs_nphy(pi, 1, in wlc_phy_restorecal_nphy()
18867 &pi->calibration_cache. in wlc_phy_restorecal_nphy()
18871 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_restorecal_nphy()
18874 WRITE_RADIO_REG3(pi, RADIO_2057, TX, coreNum, in wlc_phy_restorecal_nphy()
18877 WRITE_RADIO_REG3(pi, RADIO_2057, TX, coreNum, in wlc_phy_restorecal_nphy()
18881 WRITE_RADIO_REG3(pi, RADIO_2057, TX, coreNum, in wlc_phy_restorecal_nphy()
18884 WRITE_RADIO_REG3(pi, RADIO_2057, TX, coreNum, in wlc_phy_restorecal_nphy()
18891 static void wlc_phy_txpwrctrl_coeff_setup_nphy(struct brcms_phy *pi) in wlc_phy_txpwrctrl_coeff_setup_nphy() argument
18901 if (pi->phyhang_avoid) in wlc_phy_txpwrctrl_coeff_setup_nphy()
18902 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_txpwrctrl_coeff_setup_nphy()
18904 wlc_phy_table_read_nphy(pi, 15, 7, 80, 16, iqloCalbuf); in wlc_phy_txpwrctrl_coeff_setup_nphy()
18919 wlc_phy_table_write_nphy(pi, tbl_id, tbl_len, tbl_offset, 32, in wlc_phy_txpwrctrl_coeff_setup_nphy()
18932 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwrctrl_coeff_setup_nphy()
18948 wlc_phy_table_write_nphy(pi, tbl_id, tbl_len, tbl_offset, 32, in wlc_phy_txpwrctrl_coeff_setup_nphy()
18952 if (NREV_LT(pi->pubpi.phy_rev, 2)) { in wlc_phy_txpwrctrl_coeff_setup_nphy()
18954 wlapi_bmac_write_shm(pi->sh->physhim, M_CURR_IDX1, 0xFFFF); in wlc_phy_txpwrctrl_coeff_setup_nphy()
18955 wlapi_bmac_write_shm(pi->sh->physhim, M_CURR_IDX2, 0xFFFF); in wlc_phy_txpwrctrl_coeff_setup_nphy()
18958 if (pi->phyhang_avoid) in wlc_phy_txpwrctrl_coeff_setup_nphy()
18959 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_txpwrctrl_coeff_setup_nphy()
18962 static void wlc_phy_txlpfbw_nphy(struct brcms_phy *pi) in wlc_phy_txlpfbw_nphy() argument
18966 if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 7)) { in wlc_phy_txlpfbw_nphy()
18967 if (CHSPEC_IS40(pi->radio_chanspec)) in wlc_phy_txlpfbw_nphy()
18972 if (PHY_IPA(pi)) { in wlc_phy_txlpfbw_nphy()
18973 if (CHSPEC_IS40(pi->radio_chanspec)) in wlc_phy_txlpfbw_nphy()
18979 write_phy_reg(pi, 0xe8, in wlc_phy_txlpfbw_nphy()
18984 if (PHY_IPA(pi)) { in wlc_phy_txlpfbw_nphy()
18986 if (CHSPEC_IS40(pi->radio_chanspec)) in wlc_phy_txlpfbw_nphy()
18991 write_phy_reg(pi, 0xe9, in wlc_phy_txlpfbw_nphy()
19000 wlc_phy_adjust_rx_analpfbw_nphy(struct brcms_phy *pi, u16 reduction_factr) in wlc_phy_adjust_rx_analpfbw_nphy() argument
19002 if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 7)) { in wlc_phy_adjust_rx_analpfbw_nphy()
19003 if ((CHSPEC_CHANNEL(pi->radio_chanspec) == 11) && in wlc_phy_adjust_rx_analpfbw_nphy()
19004 CHSPEC_IS40(pi->radio_chanspec)) { in wlc_phy_adjust_rx_analpfbw_nphy()
19005 if (!pi->nphy_anarxlpf_adjusted) { in wlc_phy_adjust_rx_analpfbw_nphy()
19006 write_radio_reg(pi, in wlc_phy_adjust_rx_analpfbw_nphy()
19009 ((pi->nphy_rccal_value + in wlc_phy_adjust_rx_analpfbw_nphy()
19012 pi->nphy_anarxlpf_adjusted = true; in wlc_phy_adjust_rx_analpfbw_nphy()
19015 if (pi->nphy_anarxlpf_adjusted) { in wlc_phy_adjust_rx_analpfbw_nphy()
19016 write_radio_reg(pi, in wlc_phy_adjust_rx_analpfbw_nphy()
19019 (pi->nphy_rccal_value | 0x80)); in wlc_phy_adjust_rx_analpfbw_nphy()
19021 pi->nphy_anarxlpf_adjusted = false; in wlc_phy_adjust_rx_analpfbw_nphy()
19028 wlc_phy_adjust_min_noisevar_nphy(struct brcms_phy *pi, int ntones, in wlc_phy_adjust_min_noisevar_nphy() argument
19035 CHSPEC_IS40(pi->radio_chanspec) ? in wlc_phy_adjust_min_noisevar_nphy()
19038 if (pi->nphy_noisevars_adjusted) { in wlc_phy_adjust_min_noisevar_nphy()
19039 for (i = 0; i < pi->nphy_saved_noisevars.bufcount; i++) { in wlc_phy_adjust_min_noisevar_nphy()
19040 tone_id = pi->nphy_saved_noisevars.tone_id[i]; in wlc_phy_adjust_min_noisevar_nphy()
19045 pi, NPHY_TBL_ID_NOISEVAR, 1, in wlc_phy_adjust_min_noisevar_nphy()
19047 &pi->nphy_saved_noisevars.min_noise_vars[i]); in wlc_phy_adjust_min_noisevar_nphy()
19050 pi->nphy_saved_noisevars.bufcount = 0; in wlc_phy_adjust_min_noisevar_nphy()
19051 pi->nphy_noisevars_adjusted = false; in wlc_phy_adjust_min_noisevar_nphy()
19055 pi->nphy_saved_noisevars.bufcount = 0; in wlc_phy_adjust_min_noisevar_nphy()
19062 pi->nphy_saved_noisevars.tone_id[i] = tone_id; in wlc_phy_adjust_min_noisevar_nphy()
19063 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, in wlc_phy_adjust_min_noisevar_nphy()
19065 &pi->nphy_saved_noisevars. in wlc_phy_adjust_min_noisevar_nphy()
19067 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, in wlc_phy_adjust_min_noisevar_nphy()
19069 pi->nphy_saved_noisevars.bufcount++; in wlc_phy_adjust_min_noisevar_nphy()
19072 pi->nphy_noisevars_adjusted = true; in wlc_phy_adjust_min_noisevar_nphy()
19076 static void wlc_phy_adjust_crsminpwr_nphy(struct brcms_phy *pi, u8 minpwr) in wlc_phy_adjust_crsminpwr_nphy() argument
19080 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_adjust_crsminpwr_nphy()
19081 if ((CHSPEC_CHANNEL(pi->radio_chanspec) == 11) && in wlc_phy_adjust_crsminpwr_nphy()
19082 CHSPEC_IS40(pi->radio_chanspec)) { in wlc_phy_adjust_crsminpwr_nphy()
19083 if (!pi->nphy_crsminpwr_adjusted) { in wlc_phy_adjust_crsminpwr_nphy()
19084 regval = read_phy_reg(pi, 0x27d); in wlc_phy_adjust_crsminpwr_nphy()
19085 pi->nphy_crsminpwr[0] = regval & 0xff; in wlc_phy_adjust_crsminpwr_nphy()
19088 write_phy_reg(pi, 0x27d, regval); in wlc_phy_adjust_crsminpwr_nphy()
19090 regval = read_phy_reg(pi, 0x280); in wlc_phy_adjust_crsminpwr_nphy()
19091 pi->nphy_crsminpwr[1] = regval & 0xff; in wlc_phy_adjust_crsminpwr_nphy()
19094 write_phy_reg(pi, 0x280, regval); in wlc_phy_adjust_crsminpwr_nphy()
19096 regval = read_phy_reg(pi, 0x283); in wlc_phy_adjust_crsminpwr_nphy()
19097 pi->nphy_crsminpwr[2] = regval & 0xff; in wlc_phy_adjust_crsminpwr_nphy()
19100 write_phy_reg(pi, 0x283, regval); in wlc_phy_adjust_crsminpwr_nphy()
19102 pi->nphy_crsminpwr_adjusted = true; in wlc_phy_adjust_crsminpwr_nphy()
19105 if (pi->nphy_crsminpwr_adjusted) { in wlc_phy_adjust_crsminpwr_nphy()
19106 regval = read_phy_reg(pi, 0x27d); in wlc_phy_adjust_crsminpwr_nphy()
19108 regval |= pi->nphy_crsminpwr[0]; in wlc_phy_adjust_crsminpwr_nphy()
19109 write_phy_reg(pi, 0x27d, regval); in wlc_phy_adjust_crsminpwr_nphy()
19111 regval = read_phy_reg(pi, 0x280); in wlc_phy_adjust_crsminpwr_nphy()
19113 regval |= pi->nphy_crsminpwr[1]; in wlc_phy_adjust_crsminpwr_nphy()
19114 write_phy_reg(pi, 0x280, regval); in wlc_phy_adjust_crsminpwr_nphy()
19116 regval = read_phy_reg(pi, 0x283); in wlc_phy_adjust_crsminpwr_nphy()
19118 regval |= pi->nphy_crsminpwr[2]; in wlc_phy_adjust_crsminpwr_nphy()
19119 write_phy_reg(pi, 0x283, regval); in wlc_phy_adjust_crsminpwr_nphy()
19121 pi->nphy_crsminpwr_adjusted = false; in wlc_phy_adjust_crsminpwr_nphy()
19127 static void wlc_phy_spurwar_nphy(struct brcms_phy *pi) in wlc_phy_spurwar_nphy() argument
19136 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_spurwar_nphy()
19137 if (pi->phyhang_avoid) in wlc_phy_spurwar_nphy()
19138 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_spurwar_nphy()
19140 cur_channel = CHSPEC_CHANNEL(pi->radio_chanspec); in wlc_phy_spurwar_nphy()
19142 if (pi->nphy_gband_spurwar_en) { in wlc_phy_spurwar_nphy()
19145 pi, in wlc_phy_spurwar_nphy()
19148 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_spurwar_nphy()
19150 && CHSPEC_IS40(pi->radio_chanspec)) in wlc_phy_spurwar_nphy()
19152 pi, 2, in wlc_phy_spurwar_nphy()
19156 wlc_phy_adjust_min_noisevar_nphy(pi, 0, in wlc_phy_spurwar_nphy()
19161 wlc_phy_adjust_crsminpwr_nphy(pi, in wlc_phy_spurwar_nphy()
19165 if ((pi->nphy_gband_spurwar2_en) in wlc_phy_spurwar_nphy()
19166 && CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_spurwar_nphy()
19168 if (CHSPEC_IS40(pi->radio_chanspec)) { in wlc_phy_spurwar_nphy()
19236 pi, in wlc_phy_spurwar_nphy()
19244 wlc_phy_adjust_min_noisevar_nphy(pi, 0, NULL, in wlc_phy_spurwar_nphy()
19249 if ((pi->nphy_aband_spurwar_en) && in wlc_phy_spurwar_nphy()
19250 (CHSPEC_IS5G(pi->radio_chanspec))) { in wlc_phy_spurwar_nphy()
19259 if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) && in wlc_phy_spurwar_nphy()
19260 (pi->sh->chippkg == BCMA_PKG_ID_BCM4717)) { in wlc_phy_spurwar_nphy()
19290 pi, 1, in wlc_phy_spurwar_nphy()
19294 wlc_phy_adjust_min_noisevar_nphy(pi, 0, NULL, in wlc_phy_spurwar_nphy()
19298 if (pi->phyhang_avoid) in wlc_phy_spurwar_nphy()
19299 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_spurwar_nphy()
19303 void wlc_phy_init_nphy(struct brcms_phy *pi) in wlc_phy_init_nphy() argument
19316 if (!(pi->measure_hold & PHY_HOLD_FOR_SCAN)) in wlc_phy_init_nphy()
19317 pi->measure_hold |= PHY_HOLD_FOR_NOT_ASSOC; in wlc_phy_init_nphy()
19319 if ((ISNPHY(pi)) && (NREV_GE(pi->pubpi.phy_rev, 5)) && in wlc_phy_init_nphy()
19320 ((pi->sh->chippkg == BCMA_PKG_ID_BCM4717) || in wlc_phy_init_nphy()
19321 (pi->sh->chippkg == BCMA_PKG_ID_BCM4718))) { in wlc_phy_init_nphy()
19322 if ((pi->sh->boardflags & BFL_EXTLNA) && in wlc_phy_init_nphy()
19323 (CHSPEC_IS2G(pi->radio_chanspec))) in wlc_phy_init_nphy()
19324 bcma_cc_set32(&pi->d11core->bus->drv_cc, in wlc_phy_init_nphy()
19328 if ((!PHY_IPA(pi)) && (pi->sh->chip == BCMA_CHIP_ID_BCM5357)) in wlc_phy_init_nphy()
19329 bcma_chipco_chipctl_maskset(&pi->d11core->bus->drv_cc, 1, in wlc_phy_init_nphy()
19332 if ((pi->nphy_gband_spurwar2_en) && CHSPEC_IS2G(pi->radio_chanspec) && in wlc_phy_init_nphy()
19333 CHSPEC_IS40(pi->radio_chanspec)) { in wlc_phy_init_nphy()
19335 d11_clk_ctl_st = bcma_read32(pi->d11core, in wlc_phy_init_nphy()
19337 bcma_mask32(pi->d11core, D11REGOFFS(clk_ctl_st), in wlc_phy_init_nphy()
19340 bcma_write32(pi->d11core, D11REGOFFS(clk_ctl_st), in wlc_phy_init_nphy()
19344 pi->use_int_tx_iqlo_cal_nphy = in wlc_phy_init_nphy()
19345 (PHY_IPA(pi) || in wlc_phy_init_nphy()
19346 (NREV_GE(pi->pubpi.phy_rev, 7) || in wlc_phy_init_nphy()
19347 (NREV_GE(pi->pubpi.phy_rev, 5) in wlc_phy_init_nphy()
19348 && pi->sh->boardflags2 & BFL2_INTERNDET_TXIQCAL))); in wlc_phy_init_nphy()
19350 pi->internal_tx_iqlo_cal_tapoff_intpa_nphy = false; in wlc_phy_init_nphy()
19352 pi->nphy_deaf_count = 0; in wlc_phy_init_nphy()
19354 wlc_phy_tbl_init_nphy(pi); in wlc_phy_init_nphy()
19356 pi->nphy_crsminpwr_adjusted = false; in wlc_phy_init_nphy()
19357 pi->nphy_noisevars_adjusted = false; in wlc_phy_init_nphy()
19359 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_init_nphy()
19360 write_phy_reg(pi, 0xe7, 0); in wlc_phy_init_nphy()
19361 write_phy_reg(pi, 0xec, 0); in wlc_phy_init_nphy()
19362 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_init_nphy()
19363 write_phy_reg(pi, 0x342, 0); in wlc_phy_init_nphy()
19364 write_phy_reg(pi, 0x343, 0); in wlc_phy_init_nphy()
19365 write_phy_reg(pi, 0x346, 0); in wlc_phy_init_nphy()
19366 write_phy_reg(pi, 0x347, 0); in wlc_phy_init_nphy()
19368 write_phy_reg(pi, 0xe5, 0); in wlc_phy_init_nphy()
19369 write_phy_reg(pi, 0xe6, 0); in wlc_phy_init_nphy()
19371 write_phy_reg(pi, 0xec, 0); in wlc_phy_init_nphy()
19374 write_phy_reg(pi, 0x91, 0); in wlc_phy_init_nphy()
19375 write_phy_reg(pi, 0x92, 0); in wlc_phy_init_nphy()
19376 if (NREV_LT(pi->pubpi.phy_rev, 6)) { in wlc_phy_init_nphy()
19377 write_phy_reg(pi, 0x93, 0); in wlc_phy_init_nphy()
19378 write_phy_reg(pi, 0x94, 0); in wlc_phy_init_nphy()
19381 and_phy_reg(pi, 0xa1, ~3); in wlc_phy_init_nphy()
19383 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_init_nphy()
19384 write_phy_reg(pi, 0x8f, 0); in wlc_phy_init_nphy()
19385 write_phy_reg(pi, 0xa5, 0); in wlc_phy_init_nphy()
19387 write_phy_reg(pi, 0xa5, 0); in wlc_phy_init_nphy()
19390 if (NREV_IS(pi->pubpi.phy_rev, 2)) in wlc_phy_init_nphy()
19391 mod_phy_reg(pi, 0xdc, 0x00ff, 0x3b); in wlc_phy_init_nphy()
19392 else if (NREV_LT(pi->pubpi.phy_rev, 2)) in wlc_phy_init_nphy()
19393 mod_phy_reg(pi, 0xdc, 0x00ff, 0x40); in wlc_phy_init_nphy()
19395 write_phy_reg(pi, 0x203, 32); in wlc_phy_init_nphy()
19396 write_phy_reg(pi, 0x201, 32); in wlc_phy_init_nphy()
19398 if (pi->sh->boardflags2 & BFL2_SKWRKFEM_BRD) in wlc_phy_init_nphy()
19399 write_phy_reg(pi, 0x20d, 160); in wlc_phy_init_nphy()
19401 write_phy_reg(pi, 0x20d, 184); in wlc_phy_init_nphy()
19403 write_phy_reg(pi, 0x13a, 200); in wlc_phy_init_nphy()
19405 write_phy_reg(pi, 0x70, 80); in wlc_phy_init_nphy()
19407 write_phy_reg(pi, 0x1ff, 48); in wlc_phy_init_nphy()
19409 if (NREV_LT(pi->pubpi.phy_rev, 8)) in wlc_phy_init_nphy()
19410 wlc_phy_update_mimoconfig_nphy(pi, pi->n_preamble_override); in wlc_phy_init_nphy()
19412 wlc_phy_stf_chain_upd_nphy(pi); in wlc_phy_init_nphy()
19414 if (NREV_LT(pi->pubpi.phy_rev, 2)) { in wlc_phy_init_nphy()
19415 write_phy_reg(pi, 0x180, 0xaa8); in wlc_phy_init_nphy()
19416 write_phy_reg(pi, 0x181, 0x9a4); in wlc_phy_init_nphy()
19419 if (PHY_IPA(pi)) { in wlc_phy_init_nphy()
19420 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_init_nphy()
19422 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : in wlc_phy_init_nphy()
19425 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x298 : in wlc_phy_init_nphy()
19427 (pi->nphy_papd_epsilon_offset[core]) << 7); in wlc_phy_init_nphy()
19431 wlc_phy_ipa_set_tx_digi_filts_nphy(pi); in wlc_phy_init_nphy()
19432 } else if (NREV_GE(pi->pubpi.phy_rev, 5)) { in wlc_phy_init_nphy()
19433 wlc_phy_extpa_set_tx_digi_filts_nphy(pi); in wlc_phy_init_nphy()
19436 wlc_phy_workarounds_nphy(pi); in wlc_phy_init_nphy()
19438 wlapi_bmac_phyclk_fgc(pi->sh->physhim, ON); in wlc_phy_init_nphy()
19440 val = read_phy_reg(pi, 0x01); in wlc_phy_init_nphy()
19441 write_phy_reg(pi, 0x01, val | BBCFG_RESETCCA); in wlc_phy_init_nphy()
19442 write_phy_reg(pi, 0x01, val & (~BBCFG_RESETCCA)); in wlc_phy_init_nphy()
19443 wlapi_bmac_phyclk_fgc(pi->sh->physhim, OFF); in wlc_phy_init_nphy()
19445 wlapi_bmac_macphyclk_set(pi->sh->physhim, ON); in wlc_phy_init_nphy()
19447 wlc_phy_pa_override_nphy(pi, OFF); in wlc_phy_init_nphy()
19448 wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX); in wlc_phy_init_nphy()
19449 wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); in wlc_phy_init_nphy()
19450 wlc_phy_pa_override_nphy(pi, ON); in wlc_phy_init_nphy()
19452 wlc_phy_classifier_nphy(pi, 0, 0); in wlc_phy_init_nphy()
19453 wlc_phy_clip_det_nphy(pi, 0, clip1_ths); in wlc_phy_init_nphy()
19455 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_init_nphy()
19456 wlc_phy_bphy_init_nphy(pi); in wlc_phy_init_nphy()
19458 tx_pwr_ctrl_state = pi->nphy_txpwrctrl; in wlc_phy_init_nphy()
19459 wlc_phy_txpwrctrl_enable_nphy(pi, PHY_TPC_HW_OFF); in wlc_phy_init_nphy()
19461 wlc_phy_txpwr_fixpower_nphy(pi); in wlc_phy_init_nphy()
19463 wlc_phy_txpwrctrl_idle_tssi_nphy(pi); in wlc_phy_init_nphy()
19465 wlc_phy_txpwrctrl_pwr_setup_nphy(pi); in wlc_phy_init_nphy()
19467 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_init_nphy()
19474 if (PHY_IPA(pi)) { in wlc_phy_init_nphy()
19475 tx_pwrctrl_tbl = wlc_phy_get_ipa_gaintbl_nphy(pi); in wlc_phy_init_nphy()
19477 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_init_nphy()
19478 if (NREV_IS(pi->pubpi.phy_rev, 3)) in wlc_phy_init_nphy()
19481 else if (NREV_IS(pi->pubpi.phy_rev, 4)) in wlc_phy_init_nphy()
19483 (pi->srom_fem5g.extpagain == in wlc_phy_init_nphy()
19491 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_init_nphy()
19492 if (pi->pubpi.radiorev == 5) in wlc_phy_init_nphy()
19495 else if (pi->pubpi.radiorev == 3) in wlc_phy_init_nphy()
19499 if (NREV_GE(pi->pubpi.phy_rev, 5) && in wlc_phy_init_nphy()
19500 (pi->srom_fem2g.extpagain == 3)) in wlc_phy_init_nphy()
19510 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE1TXPWRCTL, 128, in wlc_phy_init_nphy()
19512 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE2TXPWRCTL, 128, in wlc_phy_init_nphy()
19515 pi->nphy_gmval = (u16) ((*tx_pwrctrl_tbl >> 16) & 0x7000); in wlc_phy_init_nphy()
19517 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_init_nphy()
19522 rfpwr_offset = get_rf_pwr_offset(pi, pga_gn, in wlc_phy_init_nphy()
19525 pi, in wlc_phy_init_nphy()
19530 pi, in wlc_phy_init_nphy()
19539 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_init_nphy()
19549 pi, in wlc_phy_init_nphy()
19554 pi, in wlc_phy_init_nphy()
19563 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE1TXPWRCTL, 128, in wlc_phy_init_nphy()
19565 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE2TXPWRCTL, 128, in wlc_phy_init_nphy()
19569 if (pi->sh->phyrxchain != 0x3) in wlc_phy_init_nphy()
19570 wlc_phy_rxcore_setstate_nphy((struct brcms_phy_pub *) pi, in wlc_phy_init_nphy()
19571 pi->sh->phyrxchain); in wlc_phy_init_nphy()
19573 if (PHY_PERICAL_MPHASE_PENDING(pi)) in wlc_phy_init_nphy()
19574 wlc_phy_cal_perical_mphase_restart(pi); in wlc_phy_init_nphy()
19576 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_init_nphy()
19577 do_rssi_cal = (CHSPEC_IS2G(pi->radio_chanspec)) ? in wlc_phy_init_nphy()
19578 (pi->nphy_rssical_chanspec_2G == 0) : in wlc_phy_init_nphy()
19579 (pi->nphy_rssical_chanspec_5G == 0); in wlc_phy_init_nphy()
19582 wlc_phy_rssi_cal_nphy(pi); in wlc_phy_init_nphy()
19584 wlc_phy_restore_rssical_nphy(pi); in wlc_phy_init_nphy()
19586 wlc_phy_rssi_cal_nphy(pi); in wlc_phy_init_nphy()
19589 if (!SCAN_RM_IN_PROGRESS(pi)) in wlc_phy_init_nphy()
19590 do_nphy_cal = (CHSPEC_IS2G(pi->radio_chanspec)) ? in wlc_phy_init_nphy()
19591 (pi->nphy_iqcal_chanspec_2G == 0) : in wlc_phy_init_nphy()
19592 (pi->nphy_iqcal_chanspec_5G == 0); in wlc_phy_init_nphy()
19594 if (!pi->do_initcal) in wlc_phy_init_nphy()
19599 target_gain = wlc_phy_get_tx_gain_nphy(pi); in wlc_phy_init_nphy()
19601 if (pi->antsel_type == ANTSEL_2x3) in wlc_phy_init_nphy()
19602 wlc_phy_antsel_init((struct brcms_phy_pub *) pi, in wlc_phy_init_nphy()
19605 if (pi->nphy_perical != PHY_PERICAL_MPHASE) { in wlc_phy_init_nphy()
19606 wlc_phy_rssi_cal_nphy(pi); in wlc_phy_init_nphy()
19608 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_init_nphy()
19609 pi->nphy_cal_orig_pwr_idx[0] = in wlc_phy_init_nphy()
19610 pi->nphy_txpwrindex[PHY_CORE_0] in wlc_phy_init_nphy()
19613 pi->nphy_cal_orig_pwr_idx[1] = in wlc_phy_init_nphy()
19614 pi->nphy_txpwrindex[PHY_CORE_1] in wlc_phy_init_nphy()
19618 wlc_phy_precal_txgain_nphy(pi); in wlc_phy_init_nphy()
19620 wlc_phy_get_tx_gain_nphy(pi); in wlc_phy_init_nphy()
19624 (pi, target_gain, true, in wlc_phy_init_nphy()
19627 (pi, target_gain, 2, in wlc_phy_init_nphy()
19629 wlc_phy_savecal_nphy(pi); in wlc_phy_init_nphy()
19632 } else if (pi->mphase_cal_phase_id == in wlc_phy_init_nphy()
19634 wlc_phy_cal_perical((struct brcms_phy_pub *) pi, in wlc_phy_init_nphy()
19638 wlc_phy_restorecal_nphy(pi); in wlc_phy_init_nphy()
19641 wlc_phy_txpwrctrl_coeff_setup_nphy(pi); in wlc_phy_init_nphy()
19643 wlc_phy_txpwrctrl_enable_nphy(pi, tx_pwr_ctrl_state); in wlc_phy_init_nphy()
19645 wlc_phy_nphy_tkip_rifs_war(pi, pi->sh->_rifs_phy); in wlc_phy_init_nphy()
19647 if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LE(pi->pubpi.phy_rev, 6)) in wlc_phy_init_nphy()
19649 write_phy_reg(pi, 0x70, 50); in wlc_phy_init_nphy()
19651 wlc_phy_txlpfbw_nphy(pi); in wlc_phy_init_nphy()
19653 wlc_phy_spurwar_nphy(pi); in wlc_phy_init_nphy()
19657 static void wlc_phy_resetcca_nphy(struct brcms_phy *pi) in wlc_phy_resetcca_nphy() argument
19661 wlapi_bmac_phyclk_fgc(pi->sh->physhim, ON); in wlc_phy_resetcca_nphy()
19663 val = read_phy_reg(pi, 0x01); in wlc_phy_resetcca_nphy()
19664 write_phy_reg(pi, 0x01, val | BBCFG_RESETCCA); in wlc_phy_resetcca_nphy()
19666 write_phy_reg(pi, 0x01, val & (~BBCFG_RESETCCA)); in wlc_phy_resetcca_nphy()
19668 wlapi_bmac_phyclk_fgc(pi->sh->physhim, OFF); in wlc_phy_resetcca_nphy()
19670 wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); in wlc_phy_resetcca_nphy()
19673 void wlc_phy_pa_override_nphy(struct brcms_phy *pi, bool en) in wlc_phy_pa_override_nphy() argument
19679 pi->rfctrlIntc1_save = read_phy_reg(pi, 0x91); in wlc_phy_pa_override_nphy()
19680 pi->rfctrlIntc2_save = read_phy_reg(pi, 0x92); in wlc_phy_pa_override_nphy()
19682 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_pa_override_nphy()
19684 else if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_pa_override_nphy()
19686 CHSPEC_IS5G(pi->radio_chanspec) ? 0x600 : 0x480; in wlc_phy_pa_override_nphy()
19689 CHSPEC_IS5G(pi->radio_chanspec) ? 0x180 : 0x120; in wlc_phy_pa_override_nphy()
19691 write_phy_reg(pi, 0x91, rfctrlintc_override_val); in wlc_phy_pa_override_nphy()
19692 write_phy_reg(pi, 0x92, rfctrlintc_override_val); in wlc_phy_pa_override_nphy()
19694 write_phy_reg(pi, 0x91, pi->rfctrlIntc1_save); in wlc_phy_pa_override_nphy()
19695 write_phy_reg(pi, 0x92, pi->rfctrlIntc2_save); in wlc_phy_pa_override_nphy()
19700 void wlc_phy_stf_chain_upd_nphy(struct brcms_phy *pi) in wlc_phy_stf_chain_upd_nphy() argument
19707 if (pi->nphy_txrx_chain == BRCMS_N_TXRX_CHAIN0) { in wlc_phy_stf_chain_upd_nphy()
19711 if (NREV_LE(pi->pubpi.phy_rev, 2)) in wlc_phy_stf_chain_upd_nphy()
19712 and_phy_reg(pi, 0xa0, ~0x20); in wlc_phy_stf_chain_upd_nphy()
19713 } else if (pi->nphy_txrx_chain == BRCMS_N_TXRX_CHAIN1) { in wlc_phy_stf_chain_upd_nphy()
19717 if (NREV_LE(pi->pubpi.phy_rev, 2)) in wlc_phy_stf_chain_upd_nphy()
19718 or_phy_reg(pi, 0xa0, 0x20); in wlc_phy_stf_chain_upd_nphy()
19721 mod_phy_reg(pi, 0xa2, ((0xf << 0) | (0xf << 4)), txrx_chain); in wlc_phy_stf_chain_upd_nphy()
19724 pi->nphy_perical = PHY_PERICAL_DISABLE; in wlc_phy_stf_chain_upd_nphy()
19725 or_phy_reg(pi, 0xa1, NPHY_RfseqMode_CoreActv_override); in wlc_phy_stf_chain_upd_nphy()
19727 pi->nphy_perical = PHY_PERICAL_MPHASE; in wlc_phy_stf_chain_upd_nphy()
19728 and_phy_reg(pi, 0xa1, ~NPHY_RfseqMode_CoreActv_override); in wlc_phy_stf_chain_upd_nphy()
19737 struct brcms_phy *pi = container_of(pih, struct brcms_phy, pubpi_ro); in wlc_phy_rxcore_setstate_nphy() local
19741 pi->sh->phyrxchain = rxcore_bitmask; in wlc_phy_rxcore_setstate_nphy()
19743 if (!pi->sh->clk) in wlc_phy_rxcore_setstate_nphy()
19746 suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & in wlc_phy_rxcore_setstate_nphy()
19749 wlapi_suspend_mac_and_wait(pi->sh->physhim); in wlc_phy_rxcore_setstate_nphy()
19751 if (pi->phyhang_avoid) in wlc_phy_rxcore_setstate_nphy()
19752 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_rxcore_setstate_nphy()
19754 regval = read_phy_reg(pi, 0xa2); in wlc_phy_rxcore_setstate_nphy()
19757 write_phy_reg(pi, 0xa2, regval); in wlc_phy_rxcore_setstate_nphy()
19761 write_phy_reg(pi, 0x20e, 1); in wlc_phy_rxcore_setstate_nphy()
19763 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_rxcore_setstate_nphy()
19764 if (pi->rx2tx_biasentry == -1) { in wlc_phy_rxcore_setstate_nphy()
19765 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_rxcore_setstate_nphy()
19772 pi->rx2tx_biasentry = (u8) i; in wlc_phy_rxcore_setstate_nphy()
19776 pi, in wlc_phy_rxcore_setstate_nphy()
19790 write_phy_reg(pi, 0x20e, 30); in wlc_phy_rxcore_setstate_nphy()
19792 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_rxcore_setstate_nphy()
19793 if (pi->rx2tx_biasentry != -1) { in wlc_phy_rxcore_setstate_nphy()
19795 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_rxcore_setstate_nphy()
19796 1, pi->rx2tx_biasentry, in wlc_phy_rxcore_setstate_nphy()
19798 pi->rx2tx_biasentry = -1; in wlc_phy_rxcore_setstate_nphy()
19803 wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); in wlc_phy_rxcore_setstate_nphy()
19805 if (pi->phyhang_avoid) in wlc_phy_rxcore_setstate_nphy()
19806 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_rxcore_setstate_nphy()
19809 wlapi_enable_mac(pi->sh->physhim); in wlc_phy_rxcore_setstate_nphy()
19815 struct brcms_phy *pi = container_of(pih, struct brcms_phy, pubpi_ro); in wlc_phy_rxcore_getstate_nphy() local
19817 regval = read_phy_reg(pi, 0xa2); in wlc_phy_rxcore_getstate_nphy()
19823 bool wlc_phy_n_txpower_ipa_ison(struct brcms_phy *pi) in wlc_phy_n_txpower_ipa_ison() argument
19825 return PHY_IPA(pi); in wlc_phy_n_txpower_ipa_ison()
19828 void wlc_phy_cal_init_nphy(struct brcms_phy *pi) in wlc_phy_cal_init_nphy() argument
19832 static void wlc_phy_radio_preinit_205x(struct brcms_phy *pi) in wlc_phy_radio_preinit_205x() argument
19835 and_phy_reg(pi, 0x78, ~RFCC_CHIP0_PU); in wlc_phy_radio_preinit_205x()
19836 and_phy_reg(pi, 0x78, RFCC_OE_POR_FORCE); in wlc_phy_radio_preinit_205x()
19838 or_phy_reg(pi, 0x78, ~RFCC_OE_POR_FORCE); in wlc_phy_radio_preinit_205x()
19839 or_phy_reg(pi, 0x78, RFCC_CHIP0_PU); in wlc_phy_radio_preinit_205x()
19843 static void wlc_phy_radio_init_2057(struct brcms_phy *pi) in wlc_phy_radio_init_2057() argument
19847 if (NREV_IS(pi->pubpi.phy_rev, 7)) { in wlc_phy_radio_init_2057()
19849 } else if (NREV_IS(pi->pubpi.phy_rev, 8) in wlc_phy_radio_init_2057()
19850 || NREV_IS(pi->pubpi.phy_rev, 9)) { in wlc_phy_radio_init_2057()
19851 switch (pi->pubpi.radiorev) { in wlc_phy_radio_init_2057()
19854 if (NREV_IS(pi->pubpi.phy_rev, 8)) in wlc_phy_radio_init_2057()
19856 else if (NREV_IS(pi->pubpi.phy_rev, 9)) in wlc_phy_radio_init_2057()
19875 wlc_phy_init_radio_regs_allbands(pi, regs_2057_ptr); in wlc_phy_radio_init_2057()
19878 static u16 wlc_phy_radio205x_rcal(struct brcms_phy *pi) in wlc_phy_radio205x_rcal() argument
19883 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_radio205x_rcal()
19885 if (pi->pubpi.radiorev == 5) { in wlc_phy_radio205x_rcal()
19887 and_phy_reg(pi, 0x342, ~(0x1 << 1)); in wlc_phy_radio205x_rcal()
19891 mod_radio_reg(pi, RADIO_2057_IQTEST_SEL_PU, 0x1, 0x1); in wlc_phy_radio205x_rcal()
19892 mod_radio_reg(pi, RADIO_2057v7_IQTEST_SEL_PU2, 0x2, in wlc_phy_radio205x_rcal()
19895 mod_radio_reg(pi, RADIO_2057_RCAL_CONFIG, 0x1, 0x1); in wlc_phy_radio205x_rcal()
19899 mod_radio_reg(pi, RADIO_2057_RCAL_CONFIG, 0x3, 0x3); in wlc_phy_radio205x_rcal()
19902 rcal_reg = read_radio_reg(pi, RADIO_2057_RCAL_STATUS); in wlc_phy_radio205x_rcal()
19913 mod_radio_reg(pi, RADIO_2057_RCAL_CONFIG, 0x2, 0x0); in wlc_phy_radio205x_rcal()
19915 rcal_reg = read_radio_reg(pi, RADIO_2057_RCAL_STATUS) & 0x3e; in wlc_phy_radio205x_rcal()
19917 mod_radio_reg(pi, RADIO_2057_RCAL_CONFIG, 0x1, 0x0); in wlc_phy_radio205x_rcal()
19918 if (pi->pubpi.radiorev == 5) { in wlc_phy_radio205x_rcal()
19920 mod_radio_reg(pi, RADIO_2057_IQTEST_SEL_PU, 0x1, 0x0); in wlc_phy_radio205x_rcal()
19921 mod_radio_reg(pi, RADIO_2057v7_IQTEST_SEL_PU2, 0x2, in wlc_phy_radio205x_rcal()
19925 if ((pi->pubpi.radiorev <= 4) || (pi->pubpi.radiorev == 6)) { in wlc_phy_radio205x_rcal()
19927 mod_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, 0x3c, in wlc_phy_radio205x_rcal()
19929 mod_radio_reg(pi, RADIO_2057_BANDGAP_RCAL_TRIM, 0xf0, in wlc_phy_radio205x_rcal()
19933 } else if (NREV_IS(pi->pubpi.phy_rev, 3)) { in wlc_phy_radio205x_rcal()
19938 pi, in wlc_phy_radio205x_rcal()
19941 write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST2 | RADIO_2056_SYN, in wlc_phy_radio205x_rcal()
19945 write_radio_reg(pi, RADIO_2056_SYN_RCAL_MASTER | RADIO_2056_SYN, in wlc_phy_radio205x_rcal()
19949 write_radio_reg(pi, RADIO_2056_SYN_RCAL_MASTER | RADIO_2056_SYN, in wlc_phy_radio205x_rcal()
19954 pi, in wlc_phy_radio205x_rcal()
19967 write_radio_reg(pi, RADIO_2056_SYN_RCAL_MASTER | RADIO_2056_SYN, in wlc_phy_radio205x_rcal()
19971 read_radio_reg(pi, in wlc_phy_radio205x_rcal()
19975 write_radio_reg(pi, RADIO_2056_SYN_RCAL_MASTER | RADIO_2056_SYN, in wlc_phy_radio205x_rcal()
19978 write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST2 | RADIO_2056_SYN, in wlc_phy_radio205x_rcal()
19986 static u16 wlc_phy_radio2057_rccal(struct brcms_phy *pi) in wlc_phy_radio2057_rccal() argument
19992 chip43226_6362A0 = ((pi->pubpi.radiorev == 3) in wlc_phy_radio2057_rccal()
19993 || (pi->pubpi.radiorev == 4) in wlc_phy_radio2057_rccal()
19994 || (pi->pubpi.radiorev == 6)); in wlc_phy_radio2057_rccal()
19998 write_radio_reg(pi, RADIO_2057_RCCAL_MASTER, 0x61); in wlc_phy_radio2057_rccal()
19999 write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0xc0); in wlc_phy_radio2057_rccal()
20001 write_radio_reg(pi, RADIO_2057v7_RCCAL_MASTER, 0x61); in wlc_phy_radio2057_rccal()
20003 write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0xe9); in wlc_phy_radio2057_rccal()
20005 write_radio_reg(pi, RADIO_2057_RCCAL_X1, 0x6e); in wlc_phy_radio2057_rccal()
20006 write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x55); in wlc_phy_radio2057_rccal()
20009 rccal_valid = read_radio_reg(pi, RADIO_2057_RCCAL_DONE_OSCCAP); in wlc_phy_radio2057_rccal()
20016 write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x15); in wlc_phy_radio2057_rccal()
20020 write_radio_reg(pi, RADIO_2057_RCCAL_MASTER, 0x69); in wlc_phy_radio2057_rccal()
20021 write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0xb0); in wlc_phy_radio2057_rccal()
20023 write_radio_reg(pi, RADIO_2057v7_RCCAL_MASTER, 0x69); in wlc_phy_radio2057_rccal()
20025 write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0xd5); in wlc_phy_radio2057_rccal()
20027 write_radio_reg(pi, RADIO_2057_RCCAL_X1, 0x6e); in wlc_phy_radio2057_rccal()
20028 write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x55); in wlc_phy_radio2057_rccal()
20031 rccal_valid = read_radio_reg(pi, RADIO_2057_RCCAL_DONE_OSCCAP); in wlc_phy_radio2057_rccal()
20038 write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x15); in wlc_phy_radio2057_rccal()
20042 write_radio_reg(pi, RADIO_2057_RCCAL_MASTER, 0x73); in wlc_phy_radio2057_rccal()
20044 write_radio_reg(pi, RADIO_2057_RCCAL_X1, 0x28); in wlc_phy_radio2057_rccal()
20045 write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0xb0); in wlc_phy_radio2057_rccal()
20047 write_radio_reg(pi, RADIO_2057v7_RCCAL_MASTER, 0x73); in wlc_phy_radio2057_rccal()
20048 write_radio_reg(pi, RADIO_2057_RCCAL_X1, 0x6e); in wlc_phy_radio2057_rccal()
20049 write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0x99); in wlc_phy_radio2057_rccal()
20051 write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x55); in wlc_phy_radio2057_rccal()
20054 rccal_valid = read_radio_reg(pi, RADIO_2057_RCCAL_DONE_OSCCAP); in wlc_phy_radio2057_rccal()
20064 write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x15); in wlc_phy_radio2057_rccal()
20069 static void wlc_phy_radio_postinit_2057(struct brcms_phy *pi) in wlc_phy_radio_postinit_2057() argument
20072 mod_radio_reg(pi, RADIO_2057_XTALPUOVR_PINCTRL, 0x1, 0x1); in wlc_phy_radio_postinit_2057()
20074 mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_CAL_RESETN, 0x78, 0x78); in wlc_phy_radio_postinit_2057()
20075 mod_radio_reg(pi, RADIO_2057_XTAL_CONFIG2, 0x80, 0x80); in wlc_phy_radio_postinit_2057()
20077 mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_CAL_RESETN, 0x78, 0x0); in wlc_phy_radio_postinit_2057()
20078 mod_radio_reg(pi, RADIO_2057_XTAL_CONFIG2, 0x80, 0x0); in wlc_phy_radio_postinit_2057()
20080 if (pi->phy_init_por) { in wlc_phy_radio_postinit_2057()
20081 wlc_phy_radio205x_rcal(pi); in wlc_phy_radio_postinit_2057()
20082 wlc_phy_radio2057_rccal(pi); in wlc_phy_radio_postinit_2057()
20085 mod_radio_reg(pi, RADIO_2057_RFPLL_MASTER, 0x8, 0x0); in wlc_phy_radio_postinit_2057()
20088 static void wlc_phy_radio_init_2056(struct brcms_phy *pi) in wlc_phy_radio_init_2056() argument
20094 if (NREV_IS(pi->pubpi.phy_rev, 3)) { in wlc_phy_radio_init_2056()
20098 } else if (NREV_IS(pi->pubpi.phy_rev, 4)) { in wlc_phy_radio_init_2056()
20103 switch (pi->pubpi.radiorev) { in wlc_phy_radio_init_2056()
20140 wlc_phy_init_radio_regs(pi, regs_SYN_2056_ptr, (u16) RADIO_2056_SYN); in wlc_phy_radio_init_2056()
20142 wlc_phy_init_radio_regs(pi, regs_TX_2056_ptr, (u16) RADIO_2056_TX0); in wlc_phy_radio_init_2056()
20144 wlc_phy_init_radio_regs(pi, regs_TX_2056_ptr, (u16) RADIO_2056_TX1); in wlc_phy_radio_init_2056()
20146 wlc_phy_init_radio_regs(pi, regs_RX_2056_ptr, (u16) RADIO_2056_RX0); in wlc_phy_radio_init_2056()
20148 wlc_phy_init_radio_regs(pi, regs_RX_2056_ptr, (u16) RADIO_2056_RX1); in wlc_phy_radio_init_2056()
20151 static void wlc_phy_radio_postinit_2056(struct brcms_phy *pi) in wlc_phy_radio_postinit_2056() argument
20153 mod_radio_reg(pi, RADIO_2056_SYN_COM_CTRL, 0xb, 0xb); in wlc_phy_radio_postinit_2056()
20155 mod_radio_reg(pi, RADIO_2056_SYN_COM_PU, 0x2, 0x2); in wlc_phy_radio_postinit_2056()
20156 mod_radio_reg(pi, RADIO_2056_SYN_COM_RESET, 0x2, 0x2); in wlc_phy_radio_postinit_2056()
20158 mod_radio_reg(pi, RADIO_2056_SYN_COM_RESET, 0x2, 0x0); in wlc_phy_radio_postinit_2056()
20160 if ((pi->sh->boardflags2 & BFL2_LEGACY) in wlc_phy_radio_postinit_2056()
20161 || (pi->sh->boardflags2 & BFL2_XTALBUFOUTEN)) in wlc_phy_radio_postinit_2056()
20162 mod_radio_reg(pi, RADIO_2056_SYN_PLL_MAST2, 0xf4, 0x0); in wlc_phy_radio_postinit_2056()
20164 mod_radio_reg(pi, RADIO_2056_SYN_PLL_MAST2, 0xfc, 0x0); in wlc_phy_radio_postinit_2056()
20166 mod_radio_reg(pi, RADIO_2056_SYN_RCCAL_CTRL0, 0x1, 0x0); in wlc_phy_radio_postinit_2056()
20168 if (pi->phy_init_por) in wlc_phy_radio_postinit_2056()
20169 wlc_phy_radio205x_rcal(pi); in wlc_phy_radio_postinit_2056()
20172 static void wlc_phy_radio_preinit_2055(struct brcms_phy *pi) in wlc_phy_radio_preinit_2055() argument
20175 and_phy_reg(pi, 0x78, ~RFCC_POR_FORCE); in wlc_phy_radio_preinit_2055()
20176 or_phy_reg(pi, 0x78, RFCC_CHIP0_PU | RFCC_OE_POR_FORCE); in wlc_phy_radio_preinit_2055()
20178 or_phy_reg(pi, 0x78, RFCC_POR_FORCE); in wlc_phy_radio_preinit_2055()
20181 static void wlc_phy_radio_init_2055(struct brcms_phy *pi) in wlc_phy_radio_init_2055() argument
20183 wlc_phy_init_radio_regs(pi, regs_2055, RADIO_DEFAULT_CORE); in wlc_phy_radio_init_2055()
20186 static void wlc_phy_radio_postinit_2055(struct brcms_phy *pi) in wlc_phy_radio_postinit_2055() argument
20189 and_radio_reg(pi, RADIO_2055_MASTER_CNTRL1, in wlc_phy_radio_postinit_2055()
20192 if (((pi->sh->sromrev >= 4) in wlc_phy_radio_postinit_2055()
20193 && !(pi->sh->boardflags2 & BFL2_RXBB_INT_REG_DIS)) in wlc_phy_radio_postinit_2055()
20194 || ((pi->sh->sromrev < 4))) { in wlc_phy_radio_postinit_2055()
20195 and_radio_reg(pi, RADIO_2055_CORE1_RXBB_REGULATOR, 0x7F); in wlc_phy_radio_postinit_2055()
20196 and_radio_reg(pi, RADIO_2055_CORE2_RXBB_REGULATOR, 0x7F); in wlc_phy_radio_postinit_2055()
20199 mod_radio_reg(pi, RADIO_2055_RRCCAL_N_OPT_SEL, 0x3F, 0x2C); in wlc_phy_radio_postinit_2055()
20200 write_radio_reg(pi, RADIO_2055_CAL_MISC, 0x3C); in wlc_phy_radio_postinit_2055()
20202 and_radio_reg(pi, RADIO_2055_CAL_MISC, in wlc_phy_radio_postinit_2055()
20205 or_radio_reg(pi, RADIO_2055_CAL_LPO_CNTRL, RADIO_2055_CAL_LPO_ENABLE); in wlc_phy_radio_postinit_2055()
20207 or_radio_reg(pi, RADIO_2055_CAL_MISC, RADIO_2055_RRCAL_RST_N); in wlc_phy_radio_postinit_2055()
20211 or_radio_reg(pi, RADIO_2055_CAL_MISC, RADIO_2055_RRCAL_START); in wlc_phy_radio_postinit_2055()
20213 SPINWAIT(((read_radio_reg(pi, RADIO_2055_CAL_COUNTER_OUT2) & in wlc_phy_radio_postinit_2055()
20216 if (WARN((read_radio_reg(pi, RADIO_2055_CAL_COUNTER_OUT2) & in wlc_phy_radio_postinit_2055()
20221 and_radio_reg(pi, RADIO_2055_CAL_LPO_CNTRL, in wlc_phy_radio_postinit_2055()
20224 wlc_phy_chanspec_set((struct brcms_phy_pub *) pi, pi->radio_chanspec); in wlc_phy_radio_postinit_2055()
20226 write_radio_reg(pi, RADIO_2055_CORE1_RXBB_LPF, 9); in wlc_phy_radio_postinit_2055()
20227 write_radio_reg(pi, RADIO_2055_CORE2_RXBB_LPF, 9); in wlc_phy_radio_postinit_2055()
20229 write_radio_reg(pi, RADIO_2055_CORE1_RXBB_MIDAC_HIPAS, 0x83); in wlc_phy_radio_postinit_2055()
20230 write_radio_reg(pi, RADIO_2055_CORE2_RXBB_MIDAC_HIPAS, 0x83); in wlc_phy_radio_postinit_2055()
20232 mod_radio_reg(pi, RADIO_2055_CORE1_LNA_GAINBST, in wlc_phy_radio_postinit_2055()
20234 mod_radio_reg(pi, RADIO_2055_CORE2_LNA_GAINBST, in wlc_phy_radio_postinit_2055()
20236 if (pi->nphy_gain_boost) { in wlc_phy_radio_postinit_2055()
20237 and_radio_reg(pi, RADIO_2055_CORE1_RXRF_SPC1, in wlc_phy_radio_postinit_2055()
20239 and_radio_reg(pi, RADIO_2055_CORE2_RXRF_SPC1, in wlc_phy_radio_postinit_2055()
20242 or_radio_reg(pi, RADIO_2055_CORE1_RXRF_SPC1, in wlc_phy_radio_postinit_2055()
20244 or_radio_reg(pi, RADIO_2055_CORE2_RXRF_SPC1, in wlc_phy_radio_postinit_2055()
20251 void wlc_phy_switch_radio_nphy(struct brcms_phy *pi, bool on) in wlc_phy_switch_radio_nphy() argument
20254 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_switch_radio_nphy()
20255 if (!pi->radio_is_on) { in wlc_phy_switch_radio_nphy()
20256 wlc_phy_radio_preinit_205x(pi); in wlc_phy_switch_radio_nphy()
20257 wlc_phy_radio_init_2057(pi); in wlc_phy_switch_radio_nphy()
20258 wlc_phy_radio_postinit_2057(pi); in wlc_phy_switch_radio_nphy()
20261 wlc_phy_chanspec_set((struct brcms_phy_pub *) pi, in wlc_phy_switch_radio_nphy()
20262 pi->radio_chanspec); in wlc_phy_switch_radio_nphy()
20263 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_switch_radio_nphy()
20264 wlc_phy_radio_preinit_205x(pi); in wlc_phy_switch_radio_nphy()
20265 wlc_phy_radio_init_2056(pi); in wlc_phy_switch_radio_nphy()
20266 wlc_phy_radio_postinit_2056(pi); in wlc_phy_switch_radio_nphy()
20268 wlc_phy_chanspec_set((struct brcms_phy_pub *) pi, in wlc_phy_switch_radio_nphy()
20269 pi->radio_chanspec); in wlc_phy_switch_radio_nphy()
20271 wlc_phy_radio_preinit_2055(pi); in wlc_phy_switch_radio_nphy()
20272 wlc_phy_radio_init_2055(pi); in wlc_phy_switch_radio_nphy()
20273 wlc_phy_radio_postinit_2055(pi); in wlc_phy_switch_radio_nphy()
20276 pi->radio_is_on = true; in wlc_phy_switch_radio_nphy()
20280 if (NREV_GE(pi->pubpi.phy_rev, 3) in wlc_phy_switch_radio_nphy()
20281 && NREV_LT(pi->pubpi.phy_rev, 7)) { in wlc_phy_switch_radio_nphy()
20282 and_phy_reg(pi, 0x78, ~RFCC_CHIP0_PU); in wlc_phy_switch_radio_nphy()
20283 mod_radio_reg(pi, RADIO_2056_SYN_COM_PU, 0x2, 0x0); in wlc_phy_switch_radio_nphy()
20285 write_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20288 write_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20291 write_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20294 write_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20297 mod_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20300 write_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20304 write_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20307 write_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20310 write_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20313 write_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20316 mod_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20319 write_radio_reg(pi, in wlc_phy_switch_radio_nphy()
20323 pi->radio_is_on = false; in wlc_phy_switch_radio_nphy()
20326 if (NREV_GE(pi->pubpi.phy_rev, 8)) { in wlc_phy_switch_radio_nphy()
20327 and_phy_reg(pi, 0x78, ~RFCC_CHIP0_PU); in wlc_phy_switch_radio_nphy()
20328 pi->radio_is_on = false; in wlc_phy_switch_radio_nphy()
20335 wlc_phy_chan2freq_nphy(struct brcms_phy *pi, uint channel, int *f, in wlc_phy_chan2freq_nphy() argument
20349 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_chan2freq_nphy()
20351 if (NREV_IS(pi->pubpi.phy_rev, 7)) { in wlc_phy_chan2freq_nphy()
20356 } else if (NREV_IS(pi->pubpi.phy_rev, 8) in wlc_phy_chan2freq_nphy()
20357 || NREV_IS(pi->pubpi.phy_rev, 9)) { in wlc_phy_chan2freq_nphy()
20358 switch (pi->pubpi.radiorev) { in wlc_phy_chan2freq_nphy()
20362 if (pi->pubpi.radiover == 0x0) { in wlc_phy_chan2freq_nphy()
20369 } else if (pi->pubpi.radiover == 0x1) { in wlc_phy_chan2freq_nphy()
20396 } else if (NREV_IS(pi->pubpi.phy_rev, 16)) { in wlc_phy_chan2freq_nphy()
20405 if (pi->pubpi.radiorev == 5) { in wlc_phy_chan2freq_nphy()
20419 if (pi->pubpi.radiorev == 5) { in wlc_phy_chan2freq_nphy()
20427 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_chan2freq_nphy()
20428 if (NREV_IS(pi->pubpi.phy_rev, 3)) { in wlc_phy_chan2freq_nphy()
20431 } else if (NREV_IS(pi->pubpi.phy_rev, 4)) { in wlc_phy_chan2freq_nphy()
20434 } else if (NREV_IS(pi->pubpi.phy_rev, 5) in wlc_phy_chan2freq_nphy()
20435 || NREV_IS(pi->pubpi.phy_rev, 6)) { in wlc_phy_chan2freq_nphy()
20436 switch (pi->pubpi.radiorev) { in wlc_phy_chan2freq_nphy()
20496 u8 wlc_phy_get_chan_freq_range_nphy(struct brcms_phy *pi, uint channel) in wlc_phy_get_chan_freq_range_nphy() argument
20505 channel = CHSPEC_CHANNEL(pi->radio_chanspec); in wlc_phy_get_chan_freq_range_nphy()
20507 wlc_phy_chan2freq_nphy(pi, channel, &freq, &t0, &t1, &t2, &t3); in wlc_phy_get_chan_freq_range_nphy()
20509 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_get_chan_freq_range_nphy()
20521 wlc_phy_chanspec_radio2055_setup(struct brcms_phy *pi, in wlc_phy_chanspec_radio2055_setup() argument
20525 write_radio_reg(pi, RADIO_2055_PLL_REF, ci->RF_pll_ref); in wlc_phy_chanspec_radio2055_setup()
20526 write_radio_reg(pi, RADIO_2055_RF_PLL_MOD0, ci->RF_rf_pll_mod0); in wlc_phy_chanspec_radio2055_setup()
20527 write_radio_reg(pi, RADIO_2055_RF_PLL_MOD1, ci->RF_rf_pll_mod1); in wlc_phy_chanspec_radio2055_setup()
20528 write_radio_reg(pi, RADIO_2055_VCO_CAP_TAIL, ci->RF_vco_cap_tail); in wlc_phy_chanspec_radio2055_setup()
20530 BRCMS_PHY_WAR_PR51571(pi); in wlc_phy_chanspec_radio2055_setup()
20532 write_radio_reg(pi, RADIO_2055_VCO_CAL1, ci->RF_vco_cal1); in wlc_phy_chanspec_radio2055_setup()
20533 write_radio_reg(pi, RADIO_2055_VCO_CAL2, ci->RF_vco_cal2); in wlc_phy_chanspec_radio2055_setup()
20534 write_radio_reg(pi, RADIO_2055_PLL_LF_C1, ci->RF_pll_lf_c1); in wlc_phy_chanspec_radio2055_setup()
20535 write_radio_reg(pi, RADIO_2055_PLL_LF_R1, ci->RF_pll_lf_r1); in wlc_phy_chanspec_radio2055_setup()
20537 BRCMS_PHY_WAR_PR51571(pi); in wlc_phy_chanspec_radio2055_setup()
20539 write_radio_reg(pi, RADIO_2055_PLL_LF_C2, ci->RF_pll_lf_c2); in wlc_phy_chanspec_radio2055_setup()
20540 write_radio_reg(pi, RADIO_2055_LGBUF_CEN_BUF, ci->RF_lgbuf_cen_buf); in wlc_phy_chanspec_radio2055_setup()
20541 write_radio_reg(pi, RADIO_2055_LGEN_TUNE1, ci->RF_lgen_tune1); in wlc_phy_chanspec_radio2055_setup()
20542 write_radio_reg(pi, RADIO_2055_LGEN_TUNE2, ci->RF_lgen_tune2); in wlc_phy_chanspec_radio2055_setup()
20544 BRCMS_PHY_WAR_PR51571(pi); in wlc_phy_chanspec_radio2055_setup()
20546 write_radio_reg(pi, RADIO_2055_CORE1_LGBUF_A_TUNE, in wlc_phy_chanspec_radio2055_setup()
20548 write_radio_reg(pi, RADIO_2055_CORE1_LGBUF_G_TUNE, in wlc_phy_chanspec_radio2055_setup()
20550 write_radio_reg(pi, RADIO_2055_CORE1_RXRF_REG1, ci->RF_core1_rxrf_reg1); in wlc_phy_chanspec_radio2055_setup()
20551 write_radio_reg(pi, RADIO_2055_CORE1_TX_PGA_PAD_TN, in wlc_phy_chanspec_radio2055_setup()
20554 BRCMS_PHY_WAR_PR51571(pi); in wlc_phy_chanspec_radio2055_setup()
20556 write_radio_reg(pi, RADIO_2055_CORE1_TX_MX_BGTRIM, in wlc_phy_chanspec_radio2055_setup()
20558 write_radio_reg(pi, RADIO_2055_CORE2_LGBUF_A_TUNE, in wlc_phy_chanspec_radio2055_setup()
20560 write_radio_reg(pi, RADIO_2055_CORE2_LGBUF_G_TUNE, in wlc_phy_chanspec_radio2055_setup()
20562 write_radio_reg(pi, RADIO_2055_CORE2_RXRF_REG1, ci->RF_core2_rxrf_reg1); in wlc_phy_chanspec_radio2055_setup()
20564 BRCMS_PHY_WAR_PR51571(pi); in wlc_phy_chanspec_radio2055_setup()
20566 write_radio_reg(pi, RADIO_2055_CORE2_TX_PGA_PAD_TN, in wlc_phy_chanspec_radio2055_setup()
20568 write_radio_reg(pi, RADIO_2055_CORE2_TX_MX_BGTRIM, in wlc_phy_chanspec_radio2055_setup()
20573 write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x05); in wlc_phy_chanspec_radio2055_setup()
20574 write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x45); in wlc_phy_chanspec_radio2055_setup()
20576 BRCMS_PHY_WAR_PR51571(pi); in wlc_phy_chanspec_radio2055_setup()
20578 write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x65); in wlc_phy_chanspec_radio2055_setup()
20584 wlc_phy_chanspec_radio2056_setup(struct brcms_phy *pi, in wlc_phy_chanspec_radio2056_setup() argument
20589 write_radio_reg(pi, in wlc_phy_chanspec_radio2056_setup()
20592 write_radio_reg(pi, RADIO_2056_SYN_PLL_VCOCAL2 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20594 write_radio_reg(pi, RADIO_2056_SYN_PLL_REFDIV | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20596 write_radio_reg(pi, RADIO_2056_SYN_PLL_MMD2 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20598 write_radio_reg(pi, RADIO_2056_SYN_PLL_MMD1 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20600 write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER1 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20602 write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER2 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20604 write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER3 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20606 write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER4 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20608 write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER5 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20610 write_radio_reg(pi, RADIO_2056_SYN_RESERVED_ADDR27 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20612 write_radio_reg(pi, RADIO_2056_SYN_RESERVED_ADDR28 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20614 write_radio_reg(pi, RADIO_2056_SYN_RESERVED_ADDR29 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20616 write_radio_reg(pi, RADIO_2056_SYN_LOGEN_VCOBUF1 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20618 write_radio_reg(pi, RADIO_2056_SYN_LOGEN_MIXER2 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20620 write_radio_reg(pi, RADIO_2056_SYN_LOGEN_BUF3 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20622 write_radio_reg(pi, RADIO_2056_SYN_LOGEN_BUF4 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20625 write_radio_reg(pi, in wlc_phy_chanspec_radio2056_setup()
20628 write_radio_reg(pi, RADIO_2056_RX_LNAG_TUNE | RADIO_2056_RX0, in wlc_phy_chanspec_radio2056_setup()
20630 write_radio_reg(pi, RADIO_2056_TX_INTPAA_BOOST_TUNE | RADIO_2056_TX0, in wlc_phy_chanspec_radio2056_setup()
20632 write_radio_reg(pi, RADIO_2056_TX_INTPAG_BOOST_TUNE | RADIO_2056_TX0, in wlc_phy_chanspec_radio2056_setup()
20634 write_radio_reg(pi, RADIO_2056_TX_PADA_BOOST_TUNE | RADIO_2056_TX0, in wlc_phy_chanspec_radio2056_setup()
20636 write_radio_reg(pi, RADIO_2056_TX_PADG_BOOST_TUNE | RADIO_2056_TX0, in wlc_phy_chanspec_radio2056_setup()
20638 write_radio_reg(pi, RADIO_2056_TX_PGAA_BOOST_TUNE | RADIO_2056_TX0, in wlc_phy_chanspec_radio2056_setup()
20640 write_radio_reg(pi, RADIO_2056_TX_PGAG_BOOST_TUNE | RADIO_2056_TX0, in wlc_phy_chanspec_radio2056_setup()
20642 write_radio_reg(pi, RADIO_2056_TX_MIXA_BOOST_TUNE | RADIO_2056_TX0, in wlc_phy_chanspec_radio2056_setup()
20644 write_radio_reg(pi, RADIO_2056_TX_MIXG_BOOST_TUNE | RADIO_2056_TX0, in wlc_phy_chanspec_radio2056_setup()
20647 write_radio_reg(pi, in wlc_phy_chanspec_radio2056_setup()
20650 write_radio_reg(pi, RADIO_2056_RX_LNAG_TUNE | RADIO_2056_RX1, in wlc_phy_chanspec_radio2056_setup()
20652 write_radio_reg(pi, RADIO_2056_TX_INTPAA_BOOST_TUNE | RADIO_2056_TX1, in wlc_phy_chanspec_radio2056_setup()
20654 write_radio_reg(pi, RADIO_2056_TX_INTPAG_BOOST_TUNE | RADIO_2056_TX1, in wlc_phy_chanspec_radio2056_setup()
20656 write_radio_reg(pi, RADIO_2056_TX_PADA_BOOST_TUNE | RADIO_2056_TX1, in wlc_phy_chanspec_radio2056_setup()
20658 write_radio_reg(pi, RADIO_2056_TX_PADG_BOOST_TUNE | RADIO_2056_TX1, in wlc_phy_chanspec_radio2056_setup()
20660 write_radio_reg(pi, RADIO_2056_TX_PGAA_BOOST_TUNE | RADIO_2056_TX1, in wlc_phy_chanspec_radio2056_setup()
20662 write_radio_reg(pi, RADIO_2056_TX_PGAG_BOOST_TUNE | RADIO_2056_TX1, in wlc_phy_chanspec_radio2056_setup()
20664 write_radio_reg(pi, RADIO_2056_TX_MIXA_BOOST_TUNE | RADIO_2056_TX1, in wlc_phy_chanspec_radio2056_setup()
20666 write_radio_reg(pi, RADIO_2056_TX_MIXG_BOOST_TUNE | RADIO_2056_TX1, in wlc_phy_chanspec_radio2056_setup()
20669 if (NREV_IS(pi->pubpi.phy_rev, 3)) in wlc_phy_chanspec_radio2056_setup()
20671 else if (NREV_IS(pi->pubpi.phy_rev, 4)) in wlc_phy_chanspec_radio2056_setup()
20674 switch (pi->pubpi.radiorev) { in wlc_phy_chanspec_radio2056_setup()
20693 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_chanspec_radio2056_setup()
20694 write_radio_reg(pi, RADIO_2056_SYN_PLL_CP2 | in wlc_phy_chanspec_radio2056_setup()
20698 write_radio_reg(pi, RADIO_2056_SYN_PLL_CP2 | in wlc_phy_chanspec_radio2056_setup()
20702 if (pi->sh->boardflags2 & BFL2_GPLL_WAR) { in wlc_phy_chanspec_radio2056_setup()
20703 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_chanspec_radio2056_setup()
20704 write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER1 | in wlc_phy_chanspec_radio2056_setup()
20706 write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER2 | in wlc_phy_chanspec_radio2056_setup()
20709 if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) || in wlc_phy_chanspec_radio2056_setup()
20710 (pi->sh->chip == BCMA_CHIP_ID_BCM47162)) { in wlc_phy_chanspec_radio2056_setup()
20711 write_radio_reg(pi, in wlc_phy_chanspec_radio2056_setup()
20714 write_radio_reg(pi, in wlc_phy_chanspec_radio2056_setup()
20718 write_radio_reg(pi, in wlc_phy_chanspec_radio2056_setup()
20721 write_radio_reg(pi, in wlc_phy_chanspec_radio2056_setup()
20728 if ((pi->sh->boardflags2 & BFL2_GPLL_WAR2) && in wlc_phy_chanspec_radio2056_setup()
20729 (CHSPEC_IS2G(pi->radio_chanspec))) { in wlc_phy_chanspec_radio2056_setup()
20730 write_radio_reg(pi, in wlc_phy_chanspec_radio2056_setup()
20733 write_radio_reg(pi, in wlc_phy_chanspec_radio2056_setup()
20736 write_radio_reg(pi, in wlc_phy_chanspec_radio2056_setup()
20739 write_radio_reg(pi, RADIO_2056_SYN_PLL_CP2 | RADIO_2056_SYN, in wlc_phy_chanspec_radio2056_setup()
20743 if (pi->sh->boardflags2 & BFL2_APLL_WAR) { in wlc_phy_chanspec_radio2056_setup()
20744 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_chanspec_radio2056_setup()
20745 write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER1 | in wlc_phy_chanspec_radio2056_setup()
20747 write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER2 | in wlc_phy_chanspec_radio2056_setup()
20749 write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER4 | in wlc_phy_chanspec_radio2056_setup()
20751 write_radio_reg(pi, RADIO_2056_SYN_PLL_CP2 | in wlc_phy_chanspec_radio2056_setup()
20756 if (PHY_IPA(pi) && CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_chanspec_radio2056_setup()
20764 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_chanspec_radio2056_setup()
20766 if (NREV_GE(pi->pubpi.phy_rev, 5)) { in wlc_phy_chanspec_radio2056_setup()
20768 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20771 if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) || in wlc_phy_chanspec_radio2056_setup()
20772 (pi->sh->chip == BCMA_CHIP_ID_BCM47162)) { in wlc_phy_chanspec_radio2056_setup()
20783 if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224 || in wlc_phy_chanspec_radio2056_setup()
20784 pi->sh->chip == BCMA_CHIP_ID_BCM43225) && in wlc_phy_chanspec_radio2056_setup()
20785 pi->sh->chippkg == BCMA_PKG_ID_BCM43224_FAB_SMIC) { in wlc_phy_chanspec_radio2056_setup()
20796 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20798 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20800 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20803 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20806 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20809 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20812 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20817 bias = (pi->bw == WL_CHANSPEC_BW_40) ? in wlc_phy_chanspec_radio2056_setup()
20820 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20822 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20824 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20827 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, PA_SPARE1, in wlc_phy_chanspec_radio2056_setup()
20832 if (PHY_IPA(pi) && NREV_IS(pi->pubpi.phy_rev, 6) in wlc_phy_chanspec_radio2056_setup()
20833 && CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_chanspec_radio2056_setup()
20841 freq = CHAN5G_FREQ(CHSPEC_CHANNEL(pi->radio_chanspec)); in wlc_phy_chanspec_radio2056_setup()
20873 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_chanspec_radio2056_setup()
20874 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20876 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20878 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20880 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20883 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20885 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20888 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20893 if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224 || in wlc_phy_chanspec_radio2056_setup()
20894 pi->sh->chip == BCMA_CHIP_ID_BCM43225) && in wlc_phy_chanspec_radio2056_setup()
20895 pi->sh->chippkg == BCMA_PKG_ID_BCM43224_FAB_SMIC) in wlc_phy_chanspec_radio2056_setup()
20898 pabias = (pi->phy_pabias == 0) ? 0x30 : pi->phy_pabias; in wlc_phy_chanspec_radio2056_setup()
20900 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20902 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20904 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_chanspec_radio2056_setup()
20911 wlc_phy_radio205x_vcocal_nphy(pi); in wlc_phy_chanspec_radio2056_setup()
20914 void wlc_phy_radio205x_vcocal_nphy(struct brcms_phy *pi) in wlc_phy_radio205x_vcocal_nphy() argument
20916 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_radio205x_vcocal_nphy()
20917 mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_EN, 0x01, 0x0); in wlc_phy_radio205x_vcocal_nphy()
20918 mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_CAL_RESETN, 0x04, 0x0); in wlc_phy_radio205x_vcocal_nphy()
20919 mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_CAL_RESETN, 0x04, in wlc_phy_radio205x_vcocal_nphy()
20921 mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_EN, 0x01, 0x01); in wlc_phy_radio205x_vcocal_nphy()
20922 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_radio205x_vcocal_nphy()
20923 write_radio_reg(pi, RADIO_2056_SYN_PLL_VCOCAL12, 0x0); in wlc_phy_radio205x_vcocal_nphy()
20924 write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST3, 0x38); in wlc_phy_radio205x_vcocal_nphy()
20925 write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST3, 0x18); in wlc_phy_radio205x_vcocal_nphy()
20926 write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST3, 0x38); in wlc_phy_radio205x_vcocal_nphy()
20927 write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST3, 0x39); in wlc_phy_radio205x_vcocal_nphy()
20935 struct brcms_phy *pi, in wlc_phy_chanspec_radio2057_setup() argument
20944 if (pi->pubpi.radiorev == 5) { in wlc_phy_chanspec_radio2057_setup()
20946 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
20949 write_radio_reg(pi, RADIO_2057_VCOCAL_COUNTVAL1, in wlc_phy_chanspec_radio2057_setup()
20951 write_radio_reg(pi, RADIO_2057_RFPLL_REFMASTER_SPAREXTALSIZE, in wlc_phy_chanspec_radio2057_setup()
20953 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, in wlc_phy_chanspec_radio2057_setup()
20955 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, in wlc_phy_chanspec_radio2057_setup()
20957 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, in wlc_phy_chanspec_radio2057_setup()
20959 write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, in wlc_phy_chanspec_radio2057_setup()
20961 write_radio_reg(pi, RADIO_2057_RFPLL_MMD0, ci2->RF_rfpll_mmd0); in wlc_phy_chanspec_radio2057_setup()
20962 write_radio_reg(pi, RADIO_2057_RFPLL_MMD1, ci2->RF_rfpll_mmd1); in wlc_phy_chanspec_radio2057_setup()
20963 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
20965 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
20968 write_radio_reg(pi, RADIO_2057_LOGEN_INDBUF2G_TUNE, in wlc_phy_chanspec_radio2057_setup()
20971 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
20974 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
20977 write_radio_reg(pi, RADIO_2057_LNA2G_TUNE_CORE0, in wlc_phy_chanspec_radio2057_setup()
20980 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
20983 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
20986 write_radio_reg(pi, RADIO_2057_LNA2G_TUNE_CORE1, in wlc_phy_chanspec_radio2057_setup()
20991 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
20994 write_radio_reg(pi, RADIO_2057_VCOCAL_COUNTVAL1, in wlc_phy_chanspec_radio2057_setup()
20996 write_radio_reg(pi, RADIO_2057_RFPLL_REFMASTER_SPAREXTALSIZE, in wlc_phy_chanspec_radio2057_setup()
20998 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, in wlc_phy_chanspec_radio2057_setup()
21000 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, in wlc_phy_chanspec_radio2057_setup()
21002 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, in wlc_phy_chanspec_radio2057_setup()
21004 write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, ci->RF_cp_kpd_idac); in wlc_phy_chanspec_radio2057_setup()
21005 write_radio_reg(pi, RADIO_2057_RFPLL_MMD0, ci->RF_rfpll_mmd0); in wlc_phy_chanspec_radio2057_setup()
21006 write_radio_reg(pi, RADIO_2057_RFPLL_MMD1, ci->RF_rfpll_mmd1); in wlc_phy_chanspec_radio2057_setup()
21007 write_radio_reg(pi, RADIO_2057_VCOBUF_TUNE, ci->RF_vcobuf_tune); in wlc_phy_chanspec_radio2057_setup()
21008 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
21011 write_radio_reg(pi, RADIO_2057_LOGEN_MX5G_TUNE, in wlc_phy_chanspec_radio2057_setup()
21013 write_radio_reg(pi, RADIO_2057_LOGEN_INDBUF2G_TUNE, in wlc_phy_chanspec_radio2057_setup()
21015 write_radio_reg(pi, RADIO_2057_LOGEN_INDBUF5G_TUNE, in wlc_phy_chanspec_radio2057_setup()
21018 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
21021 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
21024 write_radio_reg(pi, RADIO_2057_PGA_BOOST_TUNE_CORE0, in wlc_phy_chanspec_radio2057_setup()
21026 write_radio_reg(pi, RADIO_2057_TXMIX5G_BOOST_TUNE_CORE0, in wlc_phy_chanspec_radio2057_setup()
21028 write_radio_reg(pi, RADIO_2057_PAD5G_TUNE_MISC_PUS_CORE0, in wlc_phy_chanspec_radio2057_setup()
21030 write_radio_reg(pi, RADIO_2057_LNA2G_TUNE_CORE0, in wlc_phy_chanspec_radio2057_setup()
21032 write_radio_reg(pi, RADIO_2057_LNA5G_TUNE_CORE0, in wlc_phy_chanspec_radio2057_setup()
21035 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
21038 write_radio_reg(pi, in wlc_phy_chanspec_radio2057_setup()
21041 write_radio_reg(pi, RADIO_2057_PGA_BOOST_TUNE_CORE1, in wlc_phy_chanspec_radio2057_setup()
21043 write_radio_reg(pi, RADIO_2057_TXMIX5G_BOOST_TUNE_CORE1, in wlc_phy_chanspec_radio2057_setup()
21045 write_radio_reg(pi, RADIO_2057_PAD5G_TUNE_MISC_PUS_CORE1, in wlc_phy_chanspec_radio2057_setup()
21047 write_radio_reg(pi, RADIO_2057_LNA2G_TUNE_CORE1, in wlc_phy_chanspec_radio2057_setup()
21049 write_radio_reg(pi, RADIO_2057_LNA5G_TUNE_CORE1, in wlc_phy_chanspec_radio2057_setup()
21053 if ((pi->pubpi.radiorev <= 4) || (pi->pubpi.radiorev == 6)) { in wlc_phy_chanspec_radio2057_setup()
21055 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_chanspec_radio2057_setup()
21056 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, in wlc_phy_chanspec_radio2057_setup()
21058 write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, 0x3f); in wlc_phy_chanspec_radio2057_setup()
21059 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, in wlc_phy_chanspec_radio2057_setup()
21061 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, in wlc_phy_chanspec_radio2057_setup()
21064 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, in wlc_phy_chanspec_radio2057_setup()
21066 write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, 0x3f); in wlc_phy_chanspec_radio2057_setup()
21067 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, in wlc_phy_chanspec_radio2057_setup()
21069 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, in wlc_phy_chanspec_radio2057_setup()
21072 } else if ((pi->pubpi.radiorev == 5) || (pi->pubpi.radiorev == 7) || in wlc_phy_chanspec_radio2057_setup()
21073 (pi->pubpi.radiorev == 8)) { in wlc_phy_chanspec_radio2057_setup()
21075 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_chanspec_radio2057_setup()
21076 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, in wlc_phy_chanspec_radio2057_setup()
21078 write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, 0x30); in wlc_phy_chanspec_radio2057_setup()
21079 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, in wlc_phy_chanspec_radio2057_setup()
21081 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, in wlc_phy_chanspec_radio2057_setup()
21084 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, in wlc_phy_chanspec_radio2057_setup()
21086 write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, 0x3f); in wlc_phy_chanspec_radio2057_setup()
21087 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, in wlc_phy_chanspec_radio2057_setup()
21089 write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, in wlc_phy_chanspec_radio2057_setup()
21095 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_chanspec_radio2057_setup()
21096 if (PHY_IPA(pi)) { in wlc_phy_chanspec_radio2057_setup()
21097 if (pi->pubpi.radiorev == 3) in wlc_phy_chanspec_radio2057_setup()
21100 if (pi->pubpi.radiorev == 5) in wlc_phy_chanspec_radio2057_setup()
21104 if (pi->pubpi.radiorev != 5) { in wlc_phy_chanspec_radio2057_setup()
21114 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, coreNum, in wlc_phy_chanspec_radio2057_setup()
21119 WRITE_RADIO_REG4(pi, RADIO_2057, CORE, coreNum, in wlc_phy_chanspec_radio2057_setup()
21127 wlc_phy_radio205x_vcocal_nphy(pi); in wlc_phy_chanspec_radio2057_setup()
21131 wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec, in wlc_phy_chanspec_nphy_setup() argument
21136 val = read_phy_reg(pi, 0x09) & NPHY_BandControl_currentBand; in wlc_phy_chanspec_nphy_setup()
21139 val = bcma_read16(pi->d11core, D11REGOFFS(psm_phy_hdr_param)); in wlc_phy_chanspec_nphy_setup()
21140 bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), in wlc_phy_chanspec_nphy_setup()
21143 or_phy_reg(pi, (NPHY_TO_BPHY_OFF + BPHY_BB_CONFIG), in wlc_phy_chanspec_nphy_setup()
21146 bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), val); in wlc_phy_chanspec_nphy_setup()
21148 or_phy_reg(pi, 0x09, NPHY_BandControl_currentBand); in wlc_phy_chanspec_nphy_setup()
21151 and_phy_reg(pi, 0x09, ~NPHY_BandControl_currentBand); in wlc_phy_chanspec_nphy_setup()
21153 val = bcma_read16(pi->d11core, D11REGOFFS(psm_phy_hdr_param)); in wlc_phy_chanspec_nphy_setup()
21154 bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), in wlc_phy_chanspec_nphy_setup()
21157 and_phy_reg(pi, (NPHY_TO_BPHY_OFF + BPHY_BB_CONFIG), in wlc_phy_chanspec_nphy_setup()
21160 bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), val); in wlc_phy_chanspec_nphy_setup()
21163 write_phy_reg(pi, 0x1ce, ci->PHY_BW1a); in wlc_phy_chanspec_nphy_setup()
21164 write_phy_reg(pi, 0x1cf, ci->PHY_BW2); in wlc_phy_chanspec_nphy_setup()
21165 write_phy_reg(pi, 0x1d0, ci->PHY_BW3); in wlc_phy_chanspec_nphy_setup()
21167 write_phy_reg(pi, 0x1d1, ci->PHY_BW4); in wlc_phy_chanspec_nphy_setup()
21168 write_phy_reg(pi, 0x1d2, ci->PHY_BW5); in wlc_phy_chanspec_nphy_setup()
21169 write_phy_reg(pi, 0x1d3, ci->PHY_BW6); in wlc_phy_chanspec_nphy_setup()
21171 if (CHSPEC_CHANNEL(pi->radio_chanspec) == 14) { in wlc_phy_chanspec_nphy_setup()
21172 wlc_phy_classifier_nphy(pi, NPHY_ClassifierCtrl_ofdm_en, 0); in wlc_phy_chanspec_nphy_setup()
21174 or_phy_reg(pi, NPHY_TO_BPHY_OFF + BPHY_TEST, 0x800); in wlc_phy_chanspec_nphy_setup()
21176 wlc_phy_classifier_nphy(pi, NPHY_ClassifierCtrl_ofdm_en, in wlc_phy_chanspec_nphy_setup()
21180 and_phy_reg(pi, NPHY_TO_BPHY_OFF + BPHY_TEST, ~0x840); in wlc_phy_chanspec_nphy_setup()
21183 if (pi->nphy_txpwrctrl == PHY_TPC_HW_OFF) in wlc_phy_chanspec_nphy_setup()
21184 wlc_phy_txpwr_fixpower_nphy(pi); in wlc_phy_chanspec_nphy_setup()
21186 if (NREV_LT(pi->pubpi.phy_rev, 3)) in wlc_phy_chanspec_nphy_setup()
21187 wlc_phy_adjust_lnagaintbl_nphy(pi); in wlc_phy_chanspec_nphy_setup()
21189 wlc_phy_txlpfbw_nphy(pi); in wlc_phy_chanspec_nphy_setup()
21191 if (NREV_GE(pi->pubpi.phy_rev, 3) in wlc_phy_chanspec_nphy_setup()
21192 && (pi->phy_spuravoid != SPURAVOID_DISABLE)) { in wlc_phy_chanspec_nphy_setup()
21196 if (!CHSPEC_IS40(pi->radio_chanspec)) { in wlc_phy_chanspec_nphy_setup()
21197 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_chanspec_nphy_setup()
21204 } else if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_chanspec_nphy_setup()
21207 } else if (pi->nphy_aband_spurwar_en && in wlc_phy_chanspec_nphy_setup()
21209 if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) in wlc_phy_chanspec_nphy_setup()
21210 && (pi->sh->chippkg == BCMA_PKG_ID_BCM4717)) { in wlc_phy_chanspec_nphy_setup()
21217 if (pi->phy_spuravoid == SPURAVOID_FORCEON) in wlc_phy_chanspec_nphy_setup()
21220 if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) || in wlc_phy_chanspec_nphy_setup()
21221 (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) { in wlc_phy_chanspec_nphy_setup()
21222 bcma_pmu_spuravoid_pllupdate(&pi->d11core->bus->drv_cc, in wlc_phy_chanspec_nphy_setup()
21225 wlapi_bmac_core_phypll_ctl(pi->sh->physhim, false); in wlc_phy_chanspec_nphy_setup()
21226 bcma_pmu_spuravoid_pllupdate(&pi->d11core->bus->drv_cc, in wlc_phy_chanspec_nphy_setup()
21228 wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true); in wlc_phy_chanspec_nphy_setup()
21231 if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) || in wlc_phy_chanspec_nphy_setup()
21232 (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) { in wlc_phy_chanspec_nphy_setup()
21234 bcma_write16(pi->d11core, in wlc_phy_chanspec_nphy_setup()
21237 bcma_write16(pi->d11core, in wlc_phy_chanspec_nphy_setup()
21240 bcma_write16(pi->d11core, in wlc_phy_chanspec_nphy_setup()
21243 bcma_write16(pi->d11core, in wlc_phy_chanspec_nphy_setup()
21248 if (!((pi->sh->chip == BCMA_CHIP_ID_BCM4716) || in wlc_phy_chanspec_nphy_setup()
21249 (pi->sh->chip == BCMA_CHIP_ID_BCM47162))) in wlc_phy_chanspec_nphy_setup()
21250 wlapi_bmac_core_phypll_reset(pi->sh->physhim); in wlc_phy_chanspec_nphy_setup()
21252 mod_phy_reg(pi, 0x01, (0x1 << 15), in wlc_phy_chanspec_nphy_setup()
21255 wlc_phy_resetcca_nphy(pi); in wlc_phy_chanspec_nphy_setup()
21257 pi->phy_isspuravoid = (spuravoid > 0); in wlc_phy_chanspec_nphy_setup()
21260 if (NREV_LT(pi->pubpi.phy_rev, 7)) in wlc_phy_chanspec_nphy_setup()
21261 write_phy_reg(pi, 0x17e, 0x3830); in wlc_phy_chanspec_nphy_setup()
21263 wlc_phy_spurwar_nphy(pi); in wlc_phy_chanspec_nphy_setup()
21266 void wlc_phy_chanspec_set_nphy(struct brcms_phy *pi, u16 chanspec) in wlc_phy_chanspec_set_nphy() argument
21275 (pi, CHSPEC_CHANNEL(chanspec), &freq, &t0, &t1, &t2, &t3)) in wlc_phy_chanspec_set_nphy()
21278 wlc_phy_chanspec_radio_set((struct brcms_phy_pub *) pi, chanspec); in wlc_phy_chanspec_set_nphy()
21280 if (CHSPEC_BW(chanspec) != pi->bw) in wlc_phy_chanspec_set_nphy()
21281 wlapi_bmac_bw_set(pi->sh->physhim, CHSPEC_BW(chanspec)); in wlc_phy_chanspec_set_nphy()
21285 or_phy_reg(pi, 0xa0, BPHY_BAND_SEL_UP20); in wlc_phy_chanspec_set_nphy()
21286 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_chanspec_set_nphy()
21287 or_phy_reg(pi, 0x310, PRIM_SEL_UP20); in wlc_phy_chanspec_set_nphy()
21289 and_phy_reg(pi, 0xa0, ~BPHY_BAND_SEL_UP20); in wlc_phy_chanspec_set_nphy()
21290 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_chanspec_set_nphy()
21291 and_phy_reg(pi, 0x310, in wlc_phy_chanspec_set_nphy()
21296 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_chanspec_set_nphy()
21297 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_chanspec_set_nphy()
21299 if ((pi->pubpi.radiorev <= 4) in wlc_phy_chanspec_set_nphy()
21300 || (pi->pubpi.radiorev == 6)) { in wlc_phy_chanspec_set_nphy()
21301 mod_radio_reg(pi, RADIO_2057_TIA_CONFIG_CORE0, in wlc_phy_chanspec_set_nphy()
21305 mod_radio_reg(pi, RADIO_2057_TIA_CONFIG_CORE1, in wlc_phy_chanspec_set_nphy()
21311 wlc_phy_chanspec_radio2057_setup(pi, t0, t2); in wlc_phy_chanspec_set_nphy()
21312 wlc_phy_chanspec_nphy_setup(pi, chanspec, in wlc_phy_chanspec_set_nphy()
21313 (pi->pubpi.radiorev == 5) ? in wlc_phy_chanspec_set_nphy()
21319 mod_radio_reg(pi, in wlc_phy_chanspec_set_nphy()
21323 wlc_phy_chanspec_radio2056_setup(pi, t1); in wlc_phy_chanspec_set_nphy()
21325 wlc_phy_chanspec_nphy_setup(pi, chanspec, in wlc_phy_chanspec_set_nphy()
21331 mod_radio_reg(pi, RADIO_2055_MASTER_CNTRL1, 0x70, in wlc_phy_chanspec_set_nphy()
21335 wlc_phy_chanspec_radio2055_setup(pi, t3); in wlc_phy_chanspec_set_nphy()
21336 wlc_phy_chanspec_nphy_setup(pi, chanspec, in wlc_phy_chanspec_set_nphy()
21345 struct brcms_phy *pi = container_of(ppi, struct brcms_phy, pubpi_ro); in wlc_phy_antsel_init() local
21349 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_antsel_init()
21352 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_antsel_init()
21358 if (pi->srom_fem2g.antswctrllut == 0) { in wlc_phy_antsel_init()
21359 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_antsel_init()
21361 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_antsel_init()
21363 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_antsel_init()
21365 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_antsel_init()
21369 if (pi->srom_fem5g.antswctrllut == 0) { in wlc_phy_antsel_init()
21370 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_antsel_init()
21372 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_antsel_init()
21374 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_antsel_init()
21376 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, in wlc_phy_antsel_init()
21381 write_phy_reg(pi, 0xc8, 0x0); in wlc_phy_antsel_init()
21382 write_phy_reg(pi, 0xc9, 0x0); in wlc_phy_antsel_init()
21384 bcma_chipco_gpio_control(&pi->d11core->bus->drv_cc, mask, mask); in wlc_phy_antsel_init()
21386 mc = bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); in wlc_phy_antsel_init()
21388 bcma_write32(pi->d11core, D11REGOFFS(maccontrol), mc); in wlc_phy_antsel_init()
21390 bcma_set16(pi->d11core, D11REGOFFS(psm_gpio_oe), mask); in wlc_phy_antsel_init()
21392 bcma_mask16(pi->d11core, D11REGOFFS(psm_gpio_out), ~mask); in wlc_phy_antsel_init()
21395 write_phy_reg(pi, 0xf8, 0x02d8); in wlc_phy_antsel_init()
21396 write_phy_reg(pi, 0xf9, 0x0301); in wlc_phy_antsel_init()
21397 write_phy_reg(pi, 0xfa, 0x02d8); in wlc_phy_antsel_init()
21398 write_phy_reg(pi, 0xfb, 0x0301); in wlc_phy_antsel_init()
21403 u16 wlc_phy_classifier_nphy(struct brcms_phy *pi, u16 mask, u16 val) in wlc_phy_classifier_nphy() argument
21408 if (D11REV_IS(pi->sh->corerev, 16)) { in wlc_phy_classifier_nphy()
21409 suspended = (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & in wlc_phy_classifier_nphy()
21412 wlapi_suspend_mac_and_wait(pi->sh->physhim); in wlc_phy_classifier_nphy()
21415 curr_ctl = read_phy_reg(pi, 0xb0) & (0x7 << 0); in wlc_phy_classifier_nphy()
21419 mod_phy_reg(pi, 0xb0, (0x7 << 0), new_ctl); in wlc_phy_classifier_nphy()
21421 if (D11REV_IS(pi->sh->corerev, 16) && !suspended) in wlc_phy_classifier_nphy()
21422 wlapi_enable_mac(pi->sh->physhim); in wlc_phy_classifier_nphy()
21427 void wlc_phy_force_rfseq_nphy(struct brcms_phy *pi, u8 cmd) in wlc_phy_force_rfseq_nphy() argument
21461 orig_RfseqCoreActv = read_phy_reg(pi, 0xa1); in wlc_phy_force_rfseq_nphy()
21462 or_phy_reg(pi, 0xa1, in wlc_phy_force_rfseq_nphy()
21465 or_phy_reg(pi, 0xa3, trigger_mask); in wlc_phy_force_rfseq_nphy()
21466 SPINWAIT((read_phy_reg(pi, 0xa4) & status_mask), 200000); in wlc_phy_force_rfseq_nphy()
21467 write_phy_reg(pi, 0xa1, orig_RfseqCoreActv); in wlc_phy_force_rfseq_nphy()
21468 WARN(read_phy_reg(pi, 0xa4) & status_mask, "HW error in rf"); in wlc_phy_force_rfseq_nphy()
21472 wlc_phy_rfctrl_override_1tomany_nphy(struct brcms_phy *pi, u16 cmd, u16 value, in wlc_phy_rfctrl_override_1tomany_nphy() argument
21478 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rfctrl_override_1tomany_nphy()
21483 pi, (0x1 << 5), in wlc_phy_rfctrl_override_1tomany_nphy()
21487 pi, (0x1 << 4), value, in wlc_phy_rfctrl_override_1tomany_nphy()
21491 pi, (0x1 << 3), value, in wlc_phy_rfctrl_override_1tomany_nphy()
21497 pi, (0x1 << 2), in wlc_phy_rfctrl_override_1tomany_nphy()
21501 pi, (0x1 << 1), value, in wlc_phy_rfctrl_override_1tomany_nphy()
21505 pi, (0x1 << 0), value, in wlc_phy_rfctrl_override_1tomany_nphy()
21509 pi, (0x1 << 1), value, in wlc_phy_rfctrl_override_1tomany_nphy()
21513 pi, (0x1 << 11), 0, in wlc_phy_rfctrl_override_1tomany_nphy()
21519 pi, (0x1 << 2), in wlc_phy_rfctrl_override_1tomany_nphy()
21523 pi, (0x1 << 1), value, in wlc_phy_rfctrl_override_1tomany_nphy()
21527 pi, (0x1 << 0), value, in wlc_phy_rfctrl_override_1tomany_nphy()
21531 pi, (0x1 << 2), value, in wlc_phy_rfctrl_override_1tomany_nphy()
21535 pi, (0x1 << 11), 1, in wlc_phy_rfctrl_override_1tomany_nphy()
21545 pi, (0x1 << 11), in wlc_phy_rfctrl_override_1tomany_nphy()
21550 pi, (0x3 << 13), in wlc_phy_rfctrl_override_1tomany_nphy()
21561 pi, (0x1 << 12), in wlc_phy_rfctrl_override_1tomany_nphy()
21565 pi, (0x1 << 13), in wlc_phy_rfctrl_override_1tomany_nphy()
21575 wlc_phy_scale_offset_rssi_nphy(struct brcms_phy *pi, u16 scale, s8 offset, in wlc_phy_scale_offset_rssi_nphy() argument
21590 write_phy_reg(pi, 0x1a6, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21595 write_phy_reg(pi, 0x1ac, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21600 write_phy_reg(pi, 0x1b2, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21605 write_phy_reg(pi, 0x1b8, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21610 write_phy_reg(pi, 0x1a4, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21615 write_phy_reg(pi, 0x1aa, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21620 write_phy_reg(pi, 0x1b0, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21625 write_phy_reg(pi, 0x1b6, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21630 write_phy_reg(pi, 0x1a5, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21634 write_phy_reg(pi, 0x1ab, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21639 write_phy_reg(pi, 0x1b1, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21644 write_phy_reg(pi, 0x1b7, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21649 write_phy_reg(pi, 0x1a7, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21653 write_phy_reg(pi, 0x1ad, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21657 write_phy_reg(pi, 0x1b3, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21661 write_phy_reg(pi, 0x1b9, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21666 write_phy_reg(pi, 0x1a8, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21671 write_phy_reg(pi, 0x1ae, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21676 write_phy_reg(pi, 0x1b4, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21681 write_phy_reg(pi, 0x1ba, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21686 write_phy_reg(pi, 0x1a9, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21690 write_phy_reg(pi, 0x1b5, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21695 write_phy_reg(pi, 0x1af, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21700 write_phy_reg(pi, 0x1bb, valuetostuff); in wlc_phy_scale_offset_rssi_nphy()
21703 static void brcms_phy_wr_tx_mux(struct brcms_phy *pi, u8 core) in brcms_phy_wr_tx_mux() argument
21705 if (PHY_IPA(pi)) { in brcms_phy_wr_tx_mux()
21706 if (NREV_GE(pi->pubpi.phy_rev, 7)) in brcms_phy_wr_tx_mux()
21707 write_radio_reg(pi, in brcms_phy_wr_tx_mux()
21711 (CHSPEC_IS5G(pi->radio_chanspec) ? in brcms_phy_wr_tx_mux()
21714 write_radio_reg(pi, in brcms_phy_wr_tx_mux()
21718 (CHSPEC_IS5G(pi->radio_chanspec) ? in brcms_phy_wr_tx_mux()
21721 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in brcms_phy_wr_tx_mux()
21722 write_radio_reg(pi, in brcms_phy_wr_tx_mux()
21728 if (pi->pubpi.radioid == BCM2057_ID) in brcms_phy_wr_tx_mux()
21729 write_radio_reg(pi, in brcms_phy_wr_tx_mux()
21733 write_radio_reg(pi, in brcms_phy_wr_tx_mux()
21742 void wlc_phy_rssisel_nphy(struct brcms_phy *pi, u8 core_code, u8 rssi_type) in wlc_phy_rssisel_nphy() argument
21753 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_rssisel_nphy()
21755 mod_phy_reg(pi, 0x8f, (0x1 << 9), 0); in wlc_phy_rssisel_nphy()
21756 mod_phy_reg(pi, 0xa5, (0x1 << 9), 0); in wlc_phy_rssisel_nphy()
21758 mod_phy_reg(pi, 0xa6, (0x3 << 8), 0); in wlc_phy_rssisel_nphy()
21759 mod_phy_reg(pi, 0xa7, (0x3 << 8), 0); in wlc_phy_rssisel_nphy()
21761 mod_phy_reg(pi, 0xe5, (0x1 << 5), 0); in wlc_phy_rssisel_nphy()
21762 mod_phy_reg(pi, 0xe6, (0x1 << 5), 0); in wlc_phy_rssisel_nphy()
21766 mod_phy_reg(pi, 0xf9, mask, 0); in wlc_phy_rssisel_nphy()
21767 mod_phy_reg(pi, 0xfb, mask, 0); in wlc_phy_rssisel_nphy()
21770 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_rssisel_nphy()
21778 mod_phy_reg(pi, (core == PHY_CORE_0) ? in wlc_phy_rssisel_nphy()
21784 mod_phy_reg(pi, in wlc_phy_rssisel_nphy()
21792 mod_phy_reg(pi, in wlc_phy_rssisel_nphy()
21799 pi->radio_chanspec)) { in wlc_phy_rssisel_nphy()
21814 mod_phy_reg(pi, in wlc_phy_rssisel_nphy()
21821 mod_phy_reg(pi, (core == PHY_CORE_0) ? in wlc_phy_rssisel_nphy()
21827 mod_phy_reg(pi, in wlc_phy_rssisel_nphy()
21833 mod_phy_reg(pi, in wlc_phy_rssisel_nphy()
21841 mod_phy_reg(pi, in wlc_phy_rssisel_nphy()
21847 mod_phy_reg(pi, in wlc_phy_rssisel_nphy()
21854 mod_phy_reg(pi, in wlc_phy_rssisel_nphy()
21860 mod_phy_reg(pi, in wlc_phy_rssisel_nphy()
21864 brcms_phy_wr_tx_mux(pi, core); in wlc_phy_rssisel_nphy()
21866 mod_phy_reg(pi, in wlc_phy_rssisel_nphy()
21890 mod_phy_reg(pi, 0xa6, mask, val); in wlc_phy_rssisel_nphy()
21891 mod_phy_reg(pi, 0xa7, mask, val); in wlc_phy_rssisel_nphy()
21905 mod_phy_reg(pi, 0x7a, mask, val); in wlc_phy_rssisel_nphy()
21906 mod_phy_reg(pi, 0x7d, mask, val); in wlc_phy_rssisel_nphy()
21932 mod_phy_reg(pi, 0xa5, afectrlovr_rssi_mask, in wlc_phy_rssisel_nphy()
21951 mod_phy_reg(pi, 0x78, rfctrlcmd_mask, rfctrlcmd_val); in wlc_phy_rssisel_nphy()
21952 mod_phy_reg(pi, 0xec, rfctrlovr_mask, rfctrlovr_val); in wlc_phy_rssisel_nphy()
21954 mod_phy_reg(pi, 0x78, (0x1 << 0), (startseq << 0)); in wlc_phy_rssisel_nphy()
21957 mod_phy_reg(pi, 0xec, (0x1 << 0), 0); in wlc_phy_rssisel_nphy()
21963 wlc_phy_poll_rssi_nphy(struct brcms_phy *pi, u8 rssi_type, s32 *rssi_buf, in wlc_phy_poll_rssi_nphy() argument
21984 afectrlCore1_save = read_phy_reg(pi, 0xa6); in wlc_phy_poll_rssi_nphy()
21985 afectrlCore2_save = read_phy_reg(pi, 0xa7); in wlc_phy_poll_rssi_nphy()
21986 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_poll_rssi_nphy()
21987 rfctrlMiscReg1_save = read_phy_reg(pi, 0xf9); in wlc_phy_poll_rssi_nphy()
21988 rfctrlMiscReg2_save = read_phy_reg(pi, 0xfb); in wlc_phy_poll_rssi_nphy()
21989 afectrlOverride1_save = read_phy_reg(pi, 0x8f); in wlc_phy_poll_rssi_nphy()
21990 afectrlOverride2_save = read_phy_reg(pi, 0xa5); in wlc_phy_poll_rssi_nphy()
21991 rfctrlOverrideAux0_save = read_phy_reg(pi, 0xe5); in wlc_phy_poll_rssi_nphy()
21992 rfctrlOverrideAux1_save = read_phy_reg(pi, 0xe6); in wlc_phy_poll_rssi_nphy()
21994 afectrlOverride1_save = read_phy_reg(pi, 0xa5); in wlc_phy_poll_rssi_nphy()
21995 rfctrlcmd_save = read_phy_reg(pi, 0x78); in wlc_phy_poll_rssi_nphy()
21996 rfctrloverride_save = read_phy_reg(pi, 0xec); in wlc_phy_poll_rssi_nphy()
21997 rfctrlrssiothers1_save = read_phy_reg(pi, 0x7a); in wlc_phy_poll_rssi_nphy()
21998 rfctrlrssiothers2_save = read_phy_reg(pi, 0x7d); in wlc_phy_poll_rssi_nphy()
22001 wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_ALLRX, rssi_type); in wlc_phy_poll_rssi_nphy()
22003 gpiosel_orig = read_phy_reg(pi, 0xca); in wlc_phy_poll_rssi_nphy()
22004 if (NREV_LT(pi->pubpi.phy_rev, 2)) in wlc_phy_poll_rssi_nphy()
22005 write_phy_reg(pi, 0xca, 5); in wlc_phy_poll_rssi_nphy()
22011 if (NREV_LT(pi->pubpi.phy_rev, 2)) { in wlc_phy_poll_rssi_nphy()
22012 rssi0 = read_phy_reg(pi, 0x1c9); in wlc_phy_poll_rssi_nphy()
22013 rssi1 = read_phy_reg(pi, 0x1ca); in wlc_phy_poll_rssi_nphy()
22015 rssi0 = read_phy_reg(pi, 0x219); in wlc_phy_poll_rssi_nphy()
22016 rssi1 = read_phy_reg(pi, 0x21a); in wlc_phy_poll_rssi_nphy()
22035 if (NREV_LT(pi->pubpi.phy_rev, 2)) in wlc_phy_poll_rssi_nphy()
22036 write_phy_reg(pi, 0xca, gpiosel_orig); in wlc_phy_poll_rssi_nphy()
22038 write_phy_reg(pi, 0xa6, afectrlCore1_save); in wlc_phy_poll_rssi_nphy()
22039 write_phy_reg(pi, 0xa7, afectrlCore2_save); in wlc_phy_poll_rssi_nphy()
22040 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_poll_rssi_nphy()
22041 write_phy_reg(pi, 0xf9, rfctrlMiscReg1_save); in wlc_phy_poll_rssi_nphy()
22042 write_phy_reg(pi, 0xfb, rfctrlMiscReg2_save); in wlc_phy_poll_rssi_nphy()
22043 write_phy_reg(pi, 0x8f, afectrlOverride1_save); in wlc_phy_poll_rssi_nphy()
22044 write_phy_reg(pi, 0xa5, afectrlOverride2_save); in wlc_phy_poll_rssi_nphy()
22045 write_phy_reg(pi, 0xe5, rfctrlOverrideAux0_save); in wlc_phy_poll_rssi_nphy()
22046 write_phy_reg(pi, 0xe6, rfctrlOverrideAux1_save); in wlc_phy_poll_rssi_nphy()
22048 write_phy_reg(pi, 0xa5, afectrlOverride1_save); in wlc_phy_poll_rssi_nphy()
22049 write_phy_reg(pi, 0x78, rfctrlcmd_save); in wlc_phy_poll_rssi_nphy()
22050 write_phy_reg(pi, 0xec, rfctrloverride_save); in wlc_phy_poll_rssi_nphy()
22051 write_phy_reg(pi, 0x7a, rfctrlrssiothers1_save); in wlc_phy_poll_rssi_nphy()
22052 write_phy_reg(pi, 0x7d, rfctrlrssiothers2_save); in wlc_phy_poll_rssi_nphy()
22058 s16 wlc_phy_tempsense_nphy(struct brcms_phy *pi) in wlc_phy_tempsense_nphy() argument
22075 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_tempsense_nphy()
22086 read_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG); in wlc_phy_tempsense_nphy()
22088 afectrlCore1_save = read_phy_reg(pi, 0xa6); in wlc_phy_tempsense_nphy()
22089 afectrlCore2_save = read_phy_reg(pi, 0xa7); in wlc_phy_tempsense_nphy()
22090 afectrlOverride_save = read_phy_reg(pi, 0x8f); in wlc_phy_tempsense_nphy()
22091 afectrlOverride2_save = read_phy_reg(pi, 0xa5); in wlc_phy_tempsense_nphy()
22092 RSSIMultCoef0QPowerDet_save = read_phy_reg(pi, 0x1ae); in wlc_phy_tempsense_nphy()
22093 RfctrlOverride5_save = read_phy_reg(pi, 0x346); in wlc_phy_tempsense_nphy()
22094 RfctrlOverride6_save = read_phy_reg(pi, 0x347); in wlc_phy_tempsense_nphy()
22095 RfctrlMiscReg5_save = read_phy_reg(pi, 0x344); in wlc_phy_tempsense_nphy()
22096 RfctrlMiscReg6_save = read_phy_reg(pi, 0x345); in wlc_phy_tempsense_nphy()
22098 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0A, 16, in wlc_phy_tempsense_nphy()
22100 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0E, 16, in wlc_phy_tempsense_nphy()
22102 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x02, 16, in wlc_phy_tempsense_nphy()
22104 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x03, 16, in wlc_phy_tempsense_nphy()
22107 write_phy_reg(pi, 0x1ae, 0x0); in wlc_phy_tempsense_nphy()
22111 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x02, 16, in wlc_phy_tempsense_nphy()
22113 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x03, 16, in wlc_phy_tempsense_nphy()
22118 write_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, in wlc_phy_tempsense_nphy()
22121 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 1), in wlc_phy_tempsense_nphy()
22124 mod_phy_reg(pi, 0xa6, (0x1 << 7), 0); in wlc_phy_tempsense_nphy()
22125 mod_phy_reg(pi, 0xa7, (0x1 << 7), 0); in wlc_phy_tempsense_nphy()
22126 mod_phy_reg(pi, 0x8f, (0x1 << 7), (0x1 << 7)); in wlc_phy_tempsense_nphy()
22127 mod_phy_reg(pi, 0xa5, (0x1 << 7), (0x1 << 7)); in wlc_phy_tempsense_nphy()
22129 mod_phy_reg(pi, 0xa6, (0x1 << 2), (0x1 << 2)); in wlc_phy_tempsense_nphy()
22130 mod_phy_reg(pi, 0xa7, (0x1 << 2), (0x1 << 2)); in wlc_phy_tempsense_nphy()
22131 mod_phy_reg(pi, 0x8f, (0x1 << 2), (0x1 << 2)); in wlc_phy_tempsense_nphy()
22132 mod_phy_reg(pi, 0xa5, (0x1 << 2), (0x1 << 2)); in wlc_phy_tempsense_nphy()
22134 mod_phy_reg(pi, 0xa6, (0x1 << 2), 0); in wlc_phy_tempsense_nphy()
22135 mod_phy_reg(pi, 0xa7, (0x1 << 2), 0); in wlc_phy_tempsense_nphy()
22136 mod_phy_reg(pi, 0xa6, (0x1 << 3), 0); in wlc_phy_tempsense_nphy()
22137 mod_phy_reg(pi, 0xa7, (0x1 << 3), 0); in wlc_phy_tempsense_nphy()
22138 mod_phy_reg(pi, 0x8f, (0x1 << 3), (0x1 << 3)); in wlc_phy_tempsense_nphy()
22139 mod_phy_reg(pi, 0xa5, (0x1 << 3), (0x1 << 3)); in wlc_phy_tempsense_nphy()
22140 mod_phy_reg(pi, 0xa6, (0x1 << 6), 0); in wlc_phy_tempsense_nphy()
22141 mod_phy_reg(pi, 0xa7, (0x1 << 6), 0); in wlc_phy_tempsense_nphy()
22142 mod_phy_reg(pi, 0x8f, (0x1 << 6), (0x1 << 6)); in wlc_phy_tempsense_nphy()
22143 mod_phy_reg(pi, 0xa5, (0x1 << 6), (0x1 << 6)); in wlc_phy_tempsense_nphy()
22147 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0A, 16, in wlc_phy_tempsense_nphy()
22149 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0E, 16, in wlc_phy_tempsense_nphy()
22154 wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp, 1); in wlc_phy_tempsense_nphy()
22155 write_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, in wlc_phy_tempsense_nphy()
22159 wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp2, 1); in wlc_phy_tempsense_nphy()
22176 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0A, 16, in wlc_phy_tempsense_nphy()
22178 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0E, 16, in wlc_phy_tempsense_nphy()
22183 wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp2, 1); in wlc_phy_tempsense_nphy()
22184 write_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, in wlc_phy_tempsense_nphy()
22188 wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp, 1); in wlc_phy_tempsense_nphy()
22190 write_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, in wlc_phy_tempsense_nphy()
22193 write_phy_reg(pi, 0xa6, afectrlCore1_save); in wlc_phy_tempsense_nphy()
22194 write_phy_reg(pi, 0xa7, afectrlCore2_save); in wlc_phy_tempsense_nphy()
22195 write_phy_reg(pi, 0x8f, afectrlOverride_save); in wlc_phy_tempsense_nphy()
22196 write_phy_reg(pi, 0xa5, afectrlOverride2_save); in wlc_phy_tempsense_nphy()
22197 write_phy_reg(pi, 0x1ae, RSSIMultCoef0QPowerDet_save); in wlc_phy_tempsense_nphy()
22198 write_phy_reg(pi, 0x346, RfctrlOverride5_save); in wlc_phy_tempsense_nphy()
22199 write_phy_reg(pi, 0x347, RfctrlOverride6_save); in wlc_phy_tempsense_nphy()
22200 write_phy_reg(pi, 0x344, RfctrlMiscReg5_save); in wlc_phy_tempsense_nphy()
22201 write_phy_reg(pi, 0x345, RfctrlMiscReg5_save); in wlc_phy_tempsense_nphy()
22203 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0A, 16, in wlc_phy_tempsense_nphy()
22205 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0E, 16, in wlc_phy_tempsense_nphy()
22207 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x02, 16, in wlc_phy_tempsense_nphy()
22209 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x03, 16, in wlc_phy_tempsense_nphy()
22212 if (pi->sh->chip == BCMA_CHIP_ID_BCM5357) { in wlc_phy_tempsense_nphy()
22222 offset = (s16) pi->phy_tempsense_offset; in wlc_phy_tempsense_nphy()
22224 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_tempsense_nphy()
22226 read_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE); in wlc_phy_tempsense_nphy()
22228 afectrlCore1_save = read_phy_reg(pi, 0xa6); in wlc_phy_tempsense_nphy()
22229 afectrlCore2_save = read_phy_reg(pi, 0xa7); in wlc_phy_tempsense_nphy()
22230 afectrlOverride_save = read_phy_reg(pi, 0x8f); in wlc_phy_tempsense_nphy()
22231 afectrlOverride2_save = read_phy_reg(pi, 0xa5); in wlc_phy_tempsense_nphy()
22232 gpioSel_save = read_phy_reg(pi, 0xca); in wlc_phy_tempsense_nphy()
22234 write_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE, 0x01); in wlc_phy_tempsense_nphy()
22236 wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp, 1); in wlc_phy_tempsense_nphy()
22237 if (NREV_LT(pi->pubpi.phy_rev, 7)) in wlc_phy_tempsense_nphy()
22238 write_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE, 0x05); in wlc_phy_tempsense_nphy()
22240 wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp2, 1); in wlc_phy_tempsense_nphy()
22241 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_tempsense_nphy()
22242 write_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, 0x01); in wlc_phy_tempsense_nphy()
22244 write_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE, 0x01); in wlc_phy_tempsense_nphy()
22249 write_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE, in wlc_phy_tempsense_nphy()
22252 write_phy_reg(pi, 0xca, gpioSel_save); in wlc_phy_tempsense_nphy()
22253 write_phy_reg(pi, 0xa6, afectrlCore1_save); in wlc_phy_tempsense_nphy()
22254 write_phy_reg(pi, 0xa7, afectrlCore2_save); in wlc_phy_tempsense_nphy()
22255 write_phy_reg(pi, 0x8f, afectrlOverride_save); in wlc_phy_tempsense_nphy()
22256 write_phy_reg(pi, 0xa5, afectrlOverride2_save); in wlc_phy_tempsense_nphy()
22258 offset = (s16) pi->phy_tempsense_offset; in wlc_phy_tempsense_nphy()
22262 read_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1); in wlc_phy_tempsense_nphy()
22264 read_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2); in wlc_phy_tempsense_nphy()
22266 read_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1); in wlc_phy_tempsense_nphy()
22268 read_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2); in wlc_phy_tempsense_nphy()
22270 read_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1); in wlc_phy_tempsense_nphy()
22272 read_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2); in wlc_phy_tempsense_nphy()
22273 pd_pll_ts_save = read_radio_reg(pi, RADIO_2055_PD_PLL_TS); in wlc_phy_tempsense_nphy()
22275 afectrlCore1_save = read_phy_reg(pi, 0xa6); in wlc_phy_tempsense_nphy()
22276 afectrlCore2_save = read_phy_reg(pi, 0xa7); in wlc_phy_tempsense_nphy()
22277 afectrlOverride_save = read_phy_reg(pi, 0xa5); in wlc_phy_tempsense_nphy()
22278 gpioSel_save = read_phy_reg(pi, 0xca); in wlc_phy_tempsense_nphy()
22280 write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1, 0x01); in wlc_phy_tempsense_nphy()
22281 write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1, 0x01); in wlc_phy_tempsense_nphy()
22282 write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2, 0x08); in wlc_phy_tempsense_nphy()
22283 write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2, 0x08); in wlc_phy_tempsense_nphy()
22284 write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1, 0x04); in wlc_phy_tempsense_nphy()
22285 write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2, 0x04); in wlc_phy_tempsense_nphy()
22286 write_radio_reg(pi, RADIO_2055_PD_PLL_TS, 0x00); in wlc_phy_tempsense_nphy()
22288 wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp, 1); in wlc_phy_tempsense_nphy()
22289 xor_radio_reg(pi, RADIO_2055_CAL_TS, 0x80); in wlc_phy_tempsense_nphy()
22291 wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp, 1); in wlc_phy_tempsense_nphy()
22292 xor_radio_reg(pi, RADIO_2055_CAL_TS, 0x80); in wlc_phy_tempsense_nphy()
22294 wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp2, 1); in wlc_phy_tempsense_nphy()
22295 xor_radio_reg(pi, RADIO_2055_CAL_TS, 0x80); in wlc_phy_tempsense_nphy()
22312 write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1, in wlc_phy_tempsense_nphy()
22314 write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2, in wlc_phy_tempsense_nphy()
22316 write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1, in wlc_phy_tempsense_nphy()
22318 write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1, in wlc_phy_tempsense_nphy()
22320 write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2, in wlc_phy_tempsense_nphy()
22322 write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2, in wlc_phy_tempsense_nphy()
22324 write_radio_reg(pi, RADIO_2055_PD_PLL_TS, pd_pll_ts_save); in wlc_phy_tempsense_nphy()
22326 write_phy_reg(pi, 0xca, gpioSel_save); in wlc_phy_tempsense_nphy()
22327 write_phy_reg(pi, 0xa6, afectrlCore1_save); in wlc_phy_tempsense_nphy()
22328 write_phy_reg(pi, 0xa7, afectrlCore2_save); in wlc_phy_tempsense_nphy()
22329 write_phy_reg(pi, 0xa5, afectrlOverride_save); in wlc_phy_tempsense_nphy()
22336 wlc_phy_set_rssi_2055_vcm(struct brcms_phy *pi, u8 rssi_type, u8 *vcm_buf) in wlc_phy_set_rssi_2055_vcm() argument
22340 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_set_rssi_2055_vcm()
22343 mod_radio_reg(pi, in wlc_phy_set_rssi_2055_vcm()
22349 mod_radio_reg(pi, in wlc_phy_set_rssi_2055_vcm()
22356 mod_radio_reg(pi, in wlc_phy_set_rssi_2055_vcm()
22362 mod_radio_reg(pi, in wlc_phy_set_rssi_2055_vcm()
22371 mod_radio_reg(pi, in wlc_phy_set_rssi_2055_vcm()
22378 mod_radio_reg(pi, in wlc_phy_set_rssi_2055_vcm()
22388 static void wlc_phy_rssi_cal_nphy_rev3(struct brcms_phy *pi) in wlc_phy_rssi_cal_nphy_rev3() argument
22439 classif_state = wlc_phy_classifier_nphy(pi, 0, 0); in wlc_phy_rssi_cal_nphy_rev3()
22440 wlc_phy_classifier_nphy(pi, (0x7 << 0), 4); in wlc_phy_rssi_cal_nphy_rev3()
22441 wlc_phy_clip_det_nphy(pi, 0, clip_state); in wlc_phy_rssi_cal_nphy_rev3()
22442 wlc_phy_clip_det_nphy(pi, 1, clip_off); in wlc_phy_rssi_cal_nphy_rev3()
22444 NPHY_Rfctrlintc1_save = read_phy_reg(pi, 0x91); in wlc_phy_rssi_cal_nphy_rev3()
22445 NPHY_Rfctrlintc2_save = read_phy_reg(pi, 0x92); in wlc_phy_rssi_cal_nphy_rev3()
22446 NPHY_AfectrlOverride1_save = read_phy_reg(pi, 0x8f); in wlc_phy_rssi_cal_nphy_rev3()
22447 NPHY_AfectrlOverride2_save = read_phy_reg(pi, 0xa5); in wlc_phy_rssi_cal_nphy_rev3()
22448 NPHY_AfectrlCore1_save = read_phy_reg(pi, 0xa6); in wlc_phy_rssi_cal_nphy_rev3()
22449 NPHY_AfectrlCore2_save = read_phy_reg(pi, 0xa7); in wlc_phy_rssi_cal_nphy_rev3()
22450 NPHY_RfctrlOverride0_save = read_phy_reg(pi, 0xe7); in wlc_phy_rssi_cal_nphy_rev3()
22451 NPHY_RfctrlOverride1_save = read_phy_reg(pi, 0xec); in wlc_phy_rssi_cal_nphy_rev3()
22452 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rssi_cal_nphy_rev3()
22453 NPHY_REV7_RfctrlOverride3_save = read_phy_reg(pi, 0x342); in wlc_phy_rssi_cal_nphy_rev3()
22454 NPHY_REV7_RfctrlOverride4_save = read_phy_reg(pi, 0x343); in wlc_phy_rssi_cal_nphy_rev3()
22455 NPHY_REV7_RfctrlOverride5_save = read_phy_reg(pi, 0x346); in wlc_phy_rssi_cal_nphy_rev3()
22456 NPHY_REV7_RfctrlOverride6_save = read_phy_reg(pi, 0x347); in wlc_phy_rssi_cal_nphy_rev3()
22458 NPHY_RfctrlOverrideAux0_save = read_phy_reg(pi, 0xe5); in wlc_phy_rssi_cal_nphy_rev3()
22459 NPHY_RfctrlOverrideAux1_save = read_phy_reg(pi, 0xe6); in wlc_phy_rssi_cal_nphy_rev3()
22460 NPHY_RfctrlCmd_save = read_phy_reg(pi, 0x78); in wlc_phy_rssi_cal_nphy_rev3()
22461 NPHY_RfctrlMiscReg1_save = read_phy_reg(pi, 0xf9); in wlc_phy_rssi_cal_nphy_rev3()
22462 NPHY_RfctrlMiscReg2_save = read_phy_reg(pi, 0xfb); in wlc_phy_rssi_cal_nphy_rev3()
22463 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rssi_cal_nphy_rev3()
22464 NPHY_REV7_RfctrlMiscReg3_save = read_phy_reg(pi, 0x340); in wlc_phy_rssi_cal_nphy_rev3()
22465 NPHY_REV7_RfctrlMiscReg4_save = read_phy_reg(pi, 0x341); in wlc_phy_rssi_cal_nphy_rev3()
22466 NPHY_REV7_RfctrlMiscReg5_save = read_phy_reg(pi, 0x344); in wlc_phy_rssi_cal_nphy_rev3()
22467 NPHY_REV7_RfctrlMiscReg6_save = read_phy_reg(pi, 0x345); in wlc_phy_rssi_cal_nphy_rev3()
22469 NPHY_RfctrlRSSIOTHERS1_save = read_phy_reg(pi, 0x7a); in wlc_phy_rssi_cal_nphy_rev3()
22470 NPHY_RfctrlRSSIOTHERS2_save = read_phy_reg(pi, 0x7d); in wlc_phy_rssi_cal_nphy_rev3()
22472 wlc_phy_rfctrlintc_override_nphy(pi, NPHY_RfctrlIntc_override_OFF, 0, in wlc_phy_rssi_cal_nphy_rev3()
22474 wlc_phy_rfctrlintc_override_nphy(pi, NPHY_RfctrlIntc_override_TRSW, 1, in wlc_phy_rssi_cal_nphy_rev3()
22477 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_rssi_cal_nphy_rev3()
22479 pi, in wlc_phy_rssi_cal_nphy_rev3()
22483 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 0), 0, 0, 0); in wlc_phy_rssi_cal_nphy_rev3()
22485 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_rssi_cal_nphy_rev3()
22487 pi, in wlc_phy_rssi_cal_nphy_rev3()
22491 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 1), 1, 0, 0); in wlc_phy_rssi_cal_nphy_rev3()
22493 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rssi_cal_nphy_rev3()
22494 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 7), in wlc_phy_rssi_cal_nphy_rev3()
22497 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 6), 1, 0, 0, in wlc_phy_rssi_cal_nphy_rev3()
22500 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 7), 1, 0, 0); in wlc_phy_rssi_cal_nphy_rev3()
22501 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 6), 1, 0, 0); in wlc_phy_rssi_cal_nphy_rev3()
22504 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rssi_cal_nphy_rev3()
22505 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rssi_cal_nphy_rev3()
22507 pi, (0x1 << 5), in wlc_phy_rssi_cal_nphy_rev3()
22511 pi, (0x1 << 4), 1, 0, in wlc_phy_rssi_cal_nphy_rev3()
22515 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 5), 0, 0, 0); in wlc_phy_rssi_cal_nphy_rev3()
22516 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 4), 1, 0, 0); in wlc_phy_rssi_cal_nphy_rev3()
22520 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rssi_cal_nphy_rev3()
22522 pi, (0x1 << 4), in wlc_phy_rssi_cal_nphy_rev3()
22526 pi, (0x1 << 5), 1, 0, in wlc_phy_rssi_cal_nphy_rev3()
22530 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 4), 0, 0, 0); in wlc_phy_rssi_cal_nphy_rev3()
22531 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 5), 1, 0, 0); in wlc_phy_rssi_cal_nphy_rev3()
22536 (struct brcms_phy_pub *) pi); in wlc_phy_rssi_cal_nphy_rev3()
22540 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_rssi_cal_nphy_rev3()
22545 wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, in wlc_phy_rssi_cal_nphy_rev3()
22551 wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, in wlc_phy_rssi_cal_nphy_rev3()
22559 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_rssi_cal_nphy_rev3()
22560 mod_radio_reg(pi, (core == PHY_CORE_0) ? in wlc_phy_rssi_cal_nphy_rev3()
22565 mod_radio_reg(pi, RADIO_2056_RX_RSSI_MISC | in wlc_phy_rssi_cal_nphy_rev3()
22572 wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_NB, in wlc_phy_rssi_cal_nphy_rev3()
22609 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_rssi_cal_nphy_rev3()
22610 mod_radio_reg(pi, (core == PHY_CORE_0) ? in wlc_phy_rssi_cal_nphy_rev3()
22615 mod_radio_reg(pi, RADIO_2056_RX_RSSI_MISC | in wlc_phy_rssi_cal_nphy_rev3()
22652 pi, 0x0, in wlc_phy_rssi_cal_nphy_rev3()
22667 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_rssi_cal_nphy_rev3()
22681 wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, in wlc_phy_rssi_cal_nphy_rev3()
22688 wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, in wlc_phy_rssi_cal_nphy_rev3()
22696 wlc_phy_poll_rssi_nphy(pi, rssi_type, poll_result_core, in wlc_phy_rssi_cal_nphy_rev3()
22728 pi, 0x0, in wlc_phy_rssi_cal_nphy_rev3()
22746 write_phy_reg(pi, 0x91, NPHY_Rfctrlintc1_save); in wlc_phy_rssi_cal_nphy_rev3()
22747 write_phy_reg(pi, 0x92, NPHY_Rfctrlintc2_save); in wlc_phy_rssi_cal_nphy_rev3()
22749 wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); in wlc_phy_rssi_cal_nphy_rev3()
22751 mod_phy_reg(pi, 0xe7, (0x1 << 0), 1 << 0); in wlc_phy_rssi_cal_nphy_rev3()
22752 mod_phy_reg(pi, 0x78, (0x1 << 0), 1 << 0); in wlc_phy_rssi_cal_nphy_rev3()
22753 mod_phy_reg(pi, 0xe7, (0x1 << 0), 0); in wlc_phy_rssi_cal_nphy_rev3()
22755 mod_phy_reg(pi, 0xec, (0x1 << 0), 1 << 0); in wlc_phy_rssi_cal_nphy_rev3()
22756 mod_phy_reg(pi, 0x78, (0x1 << 1), 1 << 1); in wlc_phy_rssi_cal_nphy_rev3()
22757 mod_phy_reg(pi, 0xec, (0x1 << 0), 0); in wlc_phy_rssi_cal_nphy_rev3()
22759 write_phy_reg(pi, 0x8f, NPHY_AfectrlOverride1_save); in wlc_phy_rssi_cal_nphy_rev3()
22760 write_phy_reg(pi, 0xa5, NPHY_AfectrlOverride2_save); in wlc_phy_rssi_cal_nphy_rev3()
22761 write_phy_reg(pi, 0xa6, NPHY_AfectrlCore1_save); in wlc_phy_rssi_cal_nphy_rev3()
22762 write_phy_reg(pi, 0xa7, NPHY_AfectrlCore2_save); in wlc_phy_rssi_cal_nphy_rev3()
22763 write_phy_reg(pi, 0xe7, NPHY_RfctrlOverride0_save); in wlc_phy_rssi_cal_nphy_rev3()
22764 write_phy_reg(pi, 0xec, NPHY_RfctrlOverride1_save); in wlc_phy_rssi_cal_nphy_rev3()
22765 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rssi_cal_nphy_rev3()
22766 write_phy_reg(pi, 0x342, NPHY_REV7_RfctrlOverride3_save); in wlc_phy_rssi_cal_nphy_rev3()
22767 write_phy_reg(pi, 0x343, NPHY_REV7_RfctrlOverride4_save); in wlc_phy_rssi_cal_nphy_rev3()
22768 write_phy_reg(pi, 0x346, NPHY_REV7_RfctrlOverride5_save); in wlc_phy_rssi_cal_nphy_rev3()
22769 write_phy_reg(pi, 0x347, NPHY_REV7_RfctrlOverride6_save); in wlc_phy_rssi_cal_nphy_rev3()
22771 write_phy_reg(pi, 0xe5, NPHY_RfctrlOverrideAux0_save); in wlc_phy_rssi_cal_nphy_rev3()
22772 write_phy_reg(pi, 0xe6, NPHY_RfctrlOverrideAux1_save); in wlc_phy_rssi_cal_nphy_rev3()
22773 write_phy_reg(pi, 0x78, NPHY_RfctrlCmd_save); in wlc_phy_rssi_cal_nphy_rev3()
22774 write_phy_reg(pi, 0xf9, NPHY_RfctrlMiscReg1_save); in wlc_phy_rssi_cal_nphy_rev3()
22775 write_phy_reg(pi, 0xfb, NPHY_RfctrlMiscReg2_save); in wlc_phy_rssi_cal_nphy_rev3()
22776 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rssi_cal_nphy_rev3()
22777 write_phy_reg(pi, 0x340, NPHY_REV7_RfctrlMiscReg3_save); in wlc_phy_rssi_cal_nphy_rev3()
22778 write_phy_reg(pi, 0x341, NPHY_REV7_RfctrlMiscReg4_save); in wlc_phy_rssi_cal_nphy_rev3()
22779 write_phy_reg(pi, 0x344, NPHY_REV7_RfctrlMiscReg5_save); in wlc_phy_rssi_cal_nphy_rev3()
22780 write_phy_reg(pi, 0x345, NPHY_REV7_RfctrlMiscReg6_save); in wlc_phy_rssi_cal_nphy_rev3()
22782 write_phy_reg(pi, 0x7a, NPHY_RfctrlRSSIOTHERS1_save); in wlc_phy_rssi_cal_nphy_rev3()
22783 write_phy_reg(pi, 0x7d, NPHY_RfctrlRSSIOTHERS2_save); in wlc_phy_rssi_cal_nphy_rev3()
22785 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_rssi_cal_nphy_rev3()
22786 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rssi_cal_nphy_rev3()
22787 pi->rssical_cache.rssical_radio_regs_2G[0] = in wlc_phy_rssi_cal_nphy_rev3()
22788 read_radio_reg(pi, RADIO_2057_NB_MASTER_CORE0); in wlc_phy_rssi_cal_nphy_rev3()
22789 pi->rssical_cache.rssical_radio_regs_2G[1] = in wlc_phy_rssi_cal_nphy_rev3()
22790 read_radio_reg(pi, RADIO_2057_NB_MASTER_CORE1); in wlc_phy_rssi_cal_nphy_rev3()
22792 pi->rssical_cache.rssical_radio_regs_2G[0] = in wlc_phy_rssi_cal_nphy_rev3()
22793 read_radio_reg(pi, in wlc_phy_rssi_cal_nphy_rev3()
22796 pi->rssical_cache.rssical_radio_regs_2G[1] = in wlc_phy_rssi_cal_nphy_rev3()
22797 read_radio_reg(pi, in wlc_phy_rssi_cal_nphy_rev3()
22802 pi->rssical_cache.rssical_phyregs_2G[0] = in wlc_phy_rssi_cal_nphy_rev3()
22803 read_phy_reg(pi, 0x1a6); in wlc_phy_rssi_cal_nphy_rev3()
22804 pi->rssical_cache.rssical_phyregs_2G[1] = in wlc_phy_rssi_cal_nphy_rev3()
22805 read_phy_reg(pi, 0x1ac); in wlc_phy_rssi_cal_nphy_rev3()
22806 pi->rssical_cache.rssical_phyregs_2G[2] = in wlc_phy_rssi_cal_nphy_rev3()
22807 read_phy_reg(pi, 0x1b2); in wlc_phy_rssi_cal_nphy_rev3()
22808 pi->rssical_cache.rssical_phyregs_2G[3] = in wlc_phy_rssi_cal_nphy_rev3()
22809 read_phy_reg(pi, 0x1b8); in wlc_phy_rssi_cal_nphy_rev3()
22810 pi->rssical_cache.rssical_phyregs_2G[4] = in wlc_phy_rssi_cal_nphy_rev3()
22811 read_phy_reg(pi, 0x1a4); in wlc_phy_rssi_cal_nphy_rev3()
22812 pi->rssical_cache.rssical_phyregs_2G[5] = in wlc_phy_rssi_cal_nphy_rev3()
22813 read_phy_reg(pi, 0x1aa); in wlc_phy_rssi_cal_nphy_rev3()
22814 pi->rssical_cache.rssical_phyregs_2G[6] = in wlc_phy_rssi_cal_nphy_rev3()
22815 read_phy_reg(pi, 0x1b0); in wlc_phy_rssi_cal_nphy_rev3()
22816 pi->rssical_cache.rssical_phyregs_2G[7] = in wlc_phy_rssi_cal_nphy_rev3()
22817 read_phy_reg(pi, 0x1b6); in wlc_phy_rssi_cal_nphy_rev3()
22818 pi->rssical_cache.rssical_phyregs_2G[8] = in wlc_phy_rssi_cal_nphy_rev3()
22819 read_phy_reg(pi, 0x1a5); in wlc_phy_rssi_cal_nphy_rev3()
22820 pi->rssical_cache.rssical_phyregs_2G[9] = in wlc_phy_rssi_cal_nphy_rev3()
22821 read_phy_reg(pi, 0x1ab); in wlc_phy_rssi_cal_nphy_rev3()
22822 pi->rssical_cache.rssical_phyregs_2G[10] = in wlc_phy_rssi_cal_nphy_rev3()
22823 read_phy_reg(pi, 0x1b1); in wlc_phy_rssi_cal_nphy_rev3()
22824 pi->rssical_cache.rssical_phyregs_2G[11] = in wlc_phy_rssi_cal_nphy_rev3()
22825 read_phy_reg(pi, 0x1b7); in wlc_phy_rssi_cal_nphy_rev3()
22827 pi->nphy_rssical_chanspec_2G = pi->radio_chanspec; in wlc_phy_rssi_cal_nphy_rev3()
22829 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rssi_cal_nphy_rev3()
22830 pi->rssical_cache.rssical_radio_regs_5G[0] = in wlc_phy_rssi_cal_nphy_rev3()
22831 read_radio_reg(pi, RADIO_2057_NB_MASTER_CORE0); in wlc_phy_rssi_cal_nphy_rev3()
22832 pi->rssical_cache.rssical_radio_regs_5G[1] = in wlc_phy_rssi_cal_nphy_rev3()
22833 read_radio_reg(pi, RADIO_2057_NB_MASTER_CORE1); in wlc_phy_rssi_cal_nphy_rev3()
22835 pi->rssical_cache.rssical_radio_regs_5G[0] = in wlc_phy_rssi_cal_nphy_rev3()
22836 read_radio_reg(pi, in wlc_phy_rssi_cal_nphy_rev3()
22839 pi->rssical_cache.rssical_radio_regs_5G[1] = in wlc_phy_rssi_cal_nphy_rev3()
22840 read_radio_reg(pi, in wlc_phy_rssi_cal_nphy_rev3()
22845 pi->rssical_cache.rssical_phyregs_5G[0] = in wlc_phy_rssi_cal_nphy_rev3()
22846 read_phy_reg(pi, 0x1a6); in wlc_phy_rssi_cal_nphy_rev3()
22847 pi->rssical_cache.rssical_phyregs_5G[1] = in wlc_phy_rssi_cal_nphy_rev3()
22848 read_phy_reg(pi, 0x1ac); in wlc_phy_rssi_cal_nphy_rev3()
22849 pi->rssical_cache.rssical_phyregs_5G[2] = in wlc_phy_rssi_cal_nphy_rev3()
22850 read_phy_reg(pi, 0x1b2); in wlc_phy_rssi_cal_nphy_rev3()
22851 pi->rssical_cache.rssical_phyregs_5G[3] = in wlc_phy_rssi_cal_nphy_rev3()
22852 read_phy_reg(pi, 0x1b8); in wlc_phy_rssi_cal_nphy_rev3()
22853 pi->rssical_cache.rssical_phyregs_5G[4] = in wlc_phy_rssi_cal_nphy_rev3()
22854 read_phy_reg(pi, 0x1a4); in wlc_phy_rssi_cal_nphy_rev3()
22855 pi->rssical_cache.rssical_phyregs_5G[5] = in wlc_phy_rssi_cal_nphy_rev3()
22856 read_phy_reg(pi, 0x1aa); in wlc_phy_rssi_cal_nphy_rev3()
22857 pi->rssical_cache.rssical_phyregs_5G[6] = in wlc_phy_rssi_cal_nphy_rev3()
22858 read_phy_reg(pi, 0x1b0); in wlc_phy_rssi_cal_nphy_rev3()
22859 pi->rssical_cache.rssical_phyregs_5G[7] = in wlc_phy_rssi_cal_nphy_rev3()
22860 read_phy_reg(pi, 0x1b6); in wlc_phy_rssi_cal_nphy_rev3()
22861 pi->rssical_cache.rssical_phyregs_5G[8] = in wlc_phy_rssi_cal_nphy_rev3()
22862 read_phy_reg(pi, 0x1a5); in wlc_phy_rssi_cal_nphy_rev3()
22863 pi->rssical_cache.rssical_phyregs_5G[9] = in wlc_phy_rssi_cal_nphy_rev3()
22864 read_phy_reg(pi, 0x1ab); in wlc_phy_rssi_cal_nphy_rev3()
22865 pi->rssical_cache.rssical_phyregs_5G[10] = in wlc_phy_rssi_cal_nphy_rev3()
22866 read_phy_reg(pi, 0x1b1); in wlc_phy_rssi_cal_nphy_rev3()
22867 pi->rssical_cache.rssical_phyregs_5G[11] = in wlc_phy_rssi_cal_nphy_rev3()
22868 read_phy_reg(pi, 0x1b7); in wlc_phy_rssi_cal_nphy_rev3()
22870 pi->nphy_rssical_chanspec_5G = pi->radio_chanspec; in wlc_phy_rssi_cal_nphy_rev3()
22873 wlc_phy_classifier_nphy(pi, (0x7 << 0), classif_state); in wlc_phy_rssi_cal_nphy_rev3()
22874 wlc_phy_clip_det_nphy(pi, 1, clip_state); in wlc_phy_rssi_cal_nphy_rev3()
22877 static void wlc_phy_rssi_cal_nphy_rev2(struct brcms_phy *pi, u8 rssi_type) in wlc_phy_rssi_cal_nphy_rev2() argument
22921 classif_state = wlc_phy_classifier_nphy(pi, 0, 0); in wlc_phy_rssi_cal_nphy_rev2()
22922 wlc_phy_classifier_nphy(pi, (0x7 << 0), 4); in wlc_phy_rssi_cal_nphy_rev2()
22923 wlc_phy_clip_det_nphy(pi, 0, clip_state); in wlc_phy_rssi_cal_nphy_rev2()
22924 wlc_phy_clip_det_nphy(pi, 1, clip_off); in wlc_phy_rssi_cal_nphy_rev2()
22928 CHSPEC_IS5G(pi->radio_chanspec) ? 0x140 : 0x110; in wlc_phy_rssi_cal_nphy_rev2()
22930 rfctrlintc_state[0] = read_phy_reg(pi, 0x91); in wlc_phy_rssi_cal_nphy_rev2()
22931 rfpdcorerxtx_state[0] = read_radio_reg(pi, RADIO_2055_PD_CORE1_RXTX); in wlc_phy_rssi_cal_nphy_rev2()
22932 write_phy_reg(pi, 0x91, rfctrlintc_override_val); in wlc_phy_rssi_cal_nphy_rev2()
22933 write_radio_reg(pi, RADIO_2055_PD_CORE1_RXTX, rf_pd_val); in wlc_phy_rssi_cal_nphy_rev2()
22935 rfctrlintc_state[1] = read_phy_reg(pi, 0x92); in wlc_phy_rssi_cal_nphy_rev2()
22936 rfpdcorerxtx_state[1] = read_radio_reg(pi, RADIO_2055_PD_CORE2_RXTX); in wlc_phy_rssi_cal_nphy_rev2()
22937 write_phy_reg(pi, 0x92, rfctrlintc_override_val); in wlc_phy_rssi_cal_nphy_rev2()
22938 write_radio_reg(pi, RADIO_2055_PD_CORE2_RXTX, rf_pd_val); in wlc_phy_rssi_cal_nphy_rev2()
22943 read_radio_reg(pi, RADIO_2055_PD_CORE1_RSSI_MISC) & pd_mask; in wlc_phy_rssi_cal_nphy_rev2()
22945 read_radio_reg(pi, RADIO_2055_PD_CORE2_RSSI_MISC) & pd_mask; in wlc_phy_rssi_cal_nphy_rev2()
22946 mod_radio_reg(pi, RADIO_2055_PD_CORE1_RSSI_MISC, pd_mask, 0); in wlc_phy_rssi_cal_nphy_rev2()
22947 mod_radio_reg(pi, RADIO_2055_PD_CORE2_RSSI_MISC, pd_mask, 0); in wlc_phy_rssi_cal_nphy_rev2()
22951 read_radio_reg(pi, RADIO_2055_SP_RSSI_CORE1) & rssi_ctrl_mask; in wlc_phy_rssi_cal_nphy_rev2()
22953 read_radio_reg(pi, RADIO_2055_SP_RSSI_CORE2) & rssi_ctrl_mask; in wlc_phy_rssi_cal_nphy_rev2()
22954 wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_ALLRX, rssi_type); in wlc_phy_rssi_cal_nphy_rev2()
22956 wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, RADIO_MIMO_CORESEL_ALLRX, in wlc_phy_rssi_cal_nphy_rev2()
22958 wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, RADIO_MIMO_CORESEL_ALLRX, in wlc_phy_rssi_cal_nphy_rev2()
22965 wlc_phy_set_rssi_2055_vcm(pi, rssi_type, vcm_tmp); in wlc_phy_rssi_cal_nphy_rev2()
22967 wlc_phy_poll_rssi_nphy(pi, rssi_type, &poll_results[vcm][0], in wlc_phy_rssi_cal_nphy_rev2()
23000 wlc_phy_set_rssi_2055_vcm(pi, rssi_type, vcm_final); in wlc_phy_rssi_cal_nphy_rev2()
23025 wlc_phy_scale_offset_rssi_nphy(pi, 0x0, in wlc_phy_rssi_cal_nphy_rev2()
23036 mod_radio_reg(pi, RADIO_2055_PD_CORE1_RSSI_MISC, pd_mask, pd_state[0]); in wlc_phy_rssi_cal_nphy_rev2()
23037 mod_radio_reg(pi, RADIO_2055_PD_CORE2_RSSI_MISC, pd_mask, pd_state[1]); in wlc_phy_rssi_cal_nphy_rev2()
23039 wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE1, in wlc_phy_rssi_cal_nphy_rev2()
23042 wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE1, in wlc_phy_rssi_cal_nphy_rev2()
23045 wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE1, in wlc_phy_rssi_cal_nphy_rev2()
23048 wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE2, in wlc_phy_rssi_cal_nphy_rev2()
23051 wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE2, in wlc_phy_rssi_cal_nphy_rev2()
23054 wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE2, in wlc_phy_rssi_cal_nphy_rev2()
23056 wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_OFF, rssi_type); in wlc_phy_rssi_cal_nphy_rev2()
23058 write_phy_reg(pi, 0x91, rfctrlintc_state[0]); in wlc_phy_rssi_cal_nphy_rev2()
23059 write_radio_reg(pi, RADIO_2055_PD_CORE1_RXTX, rfpdcorerxtx_state[0]); in wlc_phy_rssi_cal_nphy_rev2()
23060 write_phy_reg(pi, 0x92, rfctrlintc_state[1]); in wlc_phy_rssi_cal_nphy_rev2()
23061 write_radio_reg(pi, RADIO_2055_PD_CORE2_RXTX, rfpdcorerxtx_state[1]); in wlc_phy_rssi_cal_nphy_rev2()
23063 wlc_phy_classifier_nphy(pi, (0x7 << 0), classif_state); in wlc_phy_rssi_cal_nphy_rev2()
23064 wlc_phy_clip_det_nphy(pi, 1, clip_state); in wlc_phy_rssi_cal_nphy_rev2()
23066 wlc_phy_resetcca_nphy(pi); in wlc_phy_rssi_cal_nphy_rev2()
23069 void wlc_phy_rssi_cal_nphy(struct brcms_phy *pi) in wlc_phy_rssi_cal_nphy() argument
23071 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_rssi_cal_nphy()
23072 wlc_phy_rssi_cal_nphy_rev3(pi); in wlc_phy_rssi_cal_nphy()
23074 wlc_phy_rssi_cal_nphy_rev2(pi, NPHY_RSSI_SEL_NB); in wlc_phy_rssi_cal_nphy()
23075 wlc_phy_rssi_cal_nphy_rev2(pi, NPHY_RSSI_SEL_W1); in wlc_phy_rssi_cal_nphy()
23076 wlc_phy_rssi_cal_nphy_rev2(pi, NPHY_RSSI_SEL_W2); in wlc_phy_rssi_cal_nphy()
23081 wlc_phy_rssi_compute_nphy(struct brcms_phy *pi, struct d11rxhdr *rxh) in wlc_phy_rssi_compute_nphy() argument
23105 if (pi->sh->rssi_mode == RSSI_ANT_MERGE_MAX) in wlc_phy_rssi_compute_nphy()
23107 else if (pi->sh->rssi_mode == RSSI_ANT_MERGE_MIN) in wlc_phy_rssi_compute_nphy()
23109 else if (pi->sh->rssi_mode == RSSI_ANT_MERGE_AVG) in wlc_phy_rssi_compute_nphy()
23116 wlc_phy_loadsampletable_nphy(struct brcms_phy *pi, struct cordic_iq *tone_buf, in wlc_phy_loadsampletable_nphy() argument
23126 if (pi->phyhang_avoid) in wlc_phy_loadsampletable_nphy()
23127 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_loadsampletable_nphy()
23132 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_SAMPLEPLAY, num_samps, 0, 32, in wlc_phy_loadsampletable_nphy()
23137 if (pi->phyhang_avoid) in wlc_phy_loadsampletable_nphy()
23138 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_loadsampletable_nphy()
23142 wlc_phy_gen_load_samples_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val, in wlc_phy_gen_load_samples_nphy() argument
23151 is_phybw40 = CHSPEC_IS40(pi->radio_chanspec); in wlc_phy_gen_load_samples_nphy()
23156 spur = read_phy_reg(pi, 0x01); in wlc_phy_gen_load_samples_nphy()
23182 wlc_phy_loadsampletable_nphy(pi, tone_buf, num_samps); in wlc_phy_gen_load_samples_nphy()
23190 wlc_phy_runsamples_nphy(struct brcms_phy *pi, u16 num_samps, u16 loops, in wlc_phy_runsamples_nphy() argument
23200 if (pi->phyhang_avoid) in wlc_phy_runsamples_nphy()
23201 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_runsamples_nphy()
23204 if (CHSPEC_IS40(pi->radio_chanspec)) in wlc_phy_runsamples_nphy()
23207 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_runsamples_nphy()
23209 lpf_bw_ctl_override3 = read_phy_reg(pi, 0x342) & (0x1 << 7); in wlc_phy_runsamples_nphy()
23210 lpf_bw_ctl_override4 = read_phy_reg(pi, 0x343) & (0x1 << 7); in wlc_phy_runsamples_nphy()
23212 lpf_bw_ctl_miscreg3 = read_phy_reg(pi, 0x340) & in wlc_phy_runsamples_nphy()
23214 lpf_bw_ctl_miscreg4 = read_phy_reg(pi, 0x341) & in wlc_phy_runsamples_nphy()
23218 pi, in wlc_phy_runsamples_nphy()
23221 (pi, in wlc_phy_runsamples_nphy()
23225 pi->nphy_sample_play_lpf_bw_ctl_ovr = true; in wlc_phy_runsamples_nphy()
23227 lpf_bw_ctl_miscreg3 = read_phy_reg(pi, 0x340) & in wlc_phy_runsamples_nphy()
23229 lpf_bw_ctl_miscreg4 = read_phy_reg(pi, 0x341) & in wlc_phy_runsamples_nphy()
23234 if ((pi->nphy_bb_mult_save & BB_MULT_VALID_MASK) == 0) { in wlc_phy_runsamples_nphy()
23236 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, 1, 87, 16, in wlc_phy_runsamples_nphy()
23238 pi->nphy_bb_mult_save = in wlc_phy_runsamples_nphy()
23245 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 1, 87, 16, in wlc_phy_runsamples_nphy()
23249 if (pi->phyhang_avoid) in wlc_phy_runsamples_nphy()
23250 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_runsamples_nphy()
23252 write_phy_reg(pi, 0xc6, num_samps - 1); in wlc_phy_runsamples_nphy()
23255 write_phy_reg(pi, 0xc4, loops - 1); in wlc_phy_runsamples_nphy()
23257 write_phy_reg(pi, 0xc4, loops); in wlc_phy_runsamples_nphy()
23259 write_phy_reg(pi, 0xc5, wait); in wlc_phy_runsamples_nphy()
23261 orig_RfseqCoreActv = read_phy_reg(pi, 0xa1); in wlc_phy_runsamples_nphy()
23262 or_phy_reg(pi, 0xa1, NPHY_RfseqMode_CoreActv_override); in wlc_phy_runsamples_nphy()
23265 and_phy_reg(pi, 0xc2, 0x7FFF); in wlc_phy_runsamples_nphy()
23267 or_phy_reg(pi, 0xc2, 0x8000); in wlc_phy_runsamples_nphy()
23271 write_phy_reg(pi, 0xc3, sample_cmd); in wlc_phy_runsamples_nphy()
23274 SPINWAIT(((read_phy_reg(pi, 0xa4) & 0x1) == 1), 1000); in wlc_phy_runsamples_nphy()
23276 write_phy_reg(pi, 0xa1, orig_RfseqCoreActv); in wlc_phy_runsamples_nphy()
23280 wlc_phy_tx_tone_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val, in wlc_phy_tx_tone_nphy() argument
23287 num_samps = wlc_phy_gen_load_samples_nphy(pi, f_kHz, max_val, in wlc_phy_tx_tone_nphy()
23292 wlc_phy_runsamples_nphy(pi, num_samps, loops, wait, iqmode, in wlc_phy_tx_tone_nphy()
23298 void wlc_phy_stopplayback_nphy(struct brcms_phy *pi) in wlc_phy_stopplayback_nphy() argument
23303 if (pi->phyhang_avoid) in wlc_phy_stopplayback_nphy()
23304 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_stopplayback_nphy()
23306 playback_status = read_phy_reg(pi, 0xc7); in wlc_phy_stopplayback_nphy()
23308 or_phy_reg(pi, 0xc3, NPHY_sampleCmd_STOP); in wlc_phy_stopplayback_nphy()
23310 and_phy_reg(pi, 0xc2, in wlc_phy_stopplayback_nphy()
23313 and_phy_reg(pi, 0xc3, (u16) ~(0x1 << 2)); in wlc_phy_stopplayback_nphy()
23315 if ((pi->nphy_bb_mult_save & BB_MULT_VALID_MASK) != 0) { in wlc_phy_stopplayback_nphy()
23317 bb_mult = pi->nphy_bb_mult_save & BB_MULT_MASK; in wlc_phy_stopplayback_nphy()
23318 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 1, 87, 16, in wlc_phy_stopplayback_nphy()
23321 pi->nphy_bb_mult_save = 0; in wlc_phy_stopplayback_nphy()
23324 if (NREV_IS(pi->pubpi.phy_rev, 7) || NREV_GE(pi->pubpi.phy_rev, 8)) { in wlc_phy_stopplayback_nphy()
23325 if (pi->nphy_sample_play_lpf_bw_ctl_ovr) { in wlc_phy_stopplayback_nphy()
23327 pi, in wlc_phy_stopplayback_nphy()
23331 pi->nphy_sample_play_lpf_bw_ctl_ovr = false; in wlc_phy_stopplayback_nphy()
23335 if (pi->phyhang_avoid) in wlc_phy_stopplayback_nphy()
23336 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_stopplayback_nphy()
23339 static u32 *brcms_phy_get_tx_pwrctrl_tbl(struct brcms_phy *pi) in brcms_phy_get_tx_pwrctrl_tbl() argument
23342 uint phyrev = pi->pubpi.phy_rev; in brcms_phy_get_tx_pwrctrl_tbl()
23344 if (PHY_IPA(pi)) { in brcms_phy_get_tx_pwrctrl_tbl()
23346 wlc_phy_get_ipa_gaintbl_nphy(pi); in brcms_phy_get_tx_pwrctrl_tbl()
23348 if (CHSPEC_IS5G(pi->radio_chanspec)) { in brcms_phy_get_tx_pwrctrl_tbl()
23353 (pi->srom_fem5g.extpagain == 3) ? in brcms_phy_get_tx_pwrctrl_tbl()
23360 if (pi->pubpi.radiorev == 3) in brcms_phy_get_tx_pwrctrl_tbl()
23363 else if (pi->pubpi.radiorev == 5) in brcms_phy_get_tx_pwrctrl_tbl()
23368 (pi->srom_fem2g.extpagain == 3)) in brcms_phy_get_tx_pwrctrl_tbl()
23380 struct nphy_txgains wlc_phy_get_tx_gain_nphy(struct brcms_phy *pi) in wlc_phy_get_tx_gain_nphy() argument
23387 if (pi->nphy_txpwrctrl == PHY_TPC_HW_OFF) { in wlc_phy_get_tx_gain_nphy()
23388 if (pi->phyhang_avoid) in wlc_phy_get_tx_gain_nphy()
23389 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_get_tx_gain_nphy()
23391 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, in wlc_phy_get_tx_gain_nphy()
23394 if (pi->phyhang_avoid) in wlc_phy_get_tx_gain_nphy()
23395 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_get_tx_gain_nphy()
23398 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_get_tx_gain_nphy()
23409 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_get_tx_gain_nphy()
23430 uint phyrev = pi->pubpi.phy_rev; in wlc_phy_get_tx_gain_nphy()
23432 base_idx[0] = (read_phy_reg(pi, 0x1ed) >> 8) & 0x7f; in wlc_phy_get_tx_gain_nphy()
23433 base_idx[1] = (read_phy_reg(pi, 0x1ee) >> 8) & 0x7f; in wlc_phy_get_tx_gain_nphy()
23437 brcms_phy_get_tx_pwrctrl_tbl(pi); in wlc_phy_get_tx_gain_nphy()
23498 wlc_phy_iqcal_gainparams_nphy(struct brcms_phy *pi, u16 core_no, in wlc_phy_iqcal_gainparams_nphy() argument
23505 u8 band_idx = (CHSPEC_IS5G(pi->radio_chanspec) ? 1 : 0); in wlc_phy_iqcal_gainparams_nphy()
23507 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_iqcal_gainparams_nphy()
23508 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_iqcal_gainparams_nphy()
23515 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_iqcal_gainparams_nphy()
23557 static void wlc_phy_txcal_radio_setup_nphy(struct brcms_phy *pi) in wlc_phy_txcal_radio_setup_nphy() argument
23561 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_txcal_radio_setup_nphy()
23565 pi->tx_rx_cal_radio_saveregs[(core * 11) + 0] = in wlc_phy_txcal_radio_setup_nphy()
23566 READ_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23569 pi->tx_rx_cal_radio_saveregs[(core * 11) + 1] = in wlc_phy_txcal_radio_setup_nphy()
23570 READ_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23573 pi->tx_rx_cal_radio_saveregs[(core * 11) + 2] = in wlc_phy_txcal_radio_setup_nphy()
23574 READ_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23577 pi->tx_rx_cal_radio_saveregs[(core * 11) + 3] = in wlc_phy_txcal_radio_setup_nphy()
23578 READ_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23581 pi->tx_rx_cal_radio_saveregs[(core * 11) + 4] = 0; in wlc_phy_txcal_radio_setup_nphy()
23583 pi->tx_rx_cal_radio_saveregs[(core * 11) + 5] = in wlc_phy_txcal_radio_setup_nphy()
23584 READ_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23587 if (pi->pubpi.radiorev != 5) in wlc_phy_txcal_radio_setup_nphy()
23588 pi->tx_rx_cal_radio_saveregs[(core * 11) + 6] = in wlc_phy_txcal_radio_setup_nphy()
23589 READ_RADIO_REG3(pi, RADIO_2057, TX, in wlc_phy_txcal_radio_setup_nphy()
23593 pi->tx_rx_cal_radio_saveregs[(core * 11) + 7] = in wlc_phy_txcal_radio_setup_nphy()
23594 READ_RADIO_REG3(pi, RADIO_2057, TX, core, TSSIG); in wlc_phy_txcal_radio_setup_nphy()
23596 pi->tx_rx_cal_radio_saveregs[(core * 11) + 8] = in wlc_phy_txcal_radio_setup_nphy()
23597 READ_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23600 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_txcal_radio_setup_nphy()
23601 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23603 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23605 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23607 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23609 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23611 if (pi->use_int_tx_iqlo_cal_nphy) { in wlc_phy_txcal_radio_setup_nphy()
23612 WRITE_RADIO_REG3(pi, RADIO_2057, TX, in wlc_phy_txcal_radio_setup_nphy()
23614 if (!(pi-> in wlc_phy_txcal_radio_setup_nphy()
23616 WRITE_RADIO_REG3(pi, RADIO_2057, in wlc_phy_txcal_radio_setup_nphy()
23620 WRITE_RADIO_REG3(pi, RADIO_2057, in wlc_phy_txcal_radio_setup_nphy()
23624 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23627 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23629 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23631 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23633 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23636 if (pi->pubpi.radiorev != 5) in wlc_phy_txcal_radio_setup_nphy()
23637 WRITE_RADIO_REG3(pi, RADIO_2057, TX, in wlc_phy_txcal_radio_setup_nphy()
23639 if (pi->use_int_tx_iqlo_cal_nphy) { in wlc_phy_txcal_radio_setup_nphy()
23640 WRITE_RADIO_REG3(pi, RADIO_2057, TX, in wlc_phy_txcal_radio_setup_nphy()
23643 if (!(pi-> in wlc_phy_txcal_radio_setup_nphy()
23645 WRITE_RADIO_REG3(pi, RADIO_2057, in wlc_phy_txcal_radio_setup_nphy()
23649 WRITE_RADIO_REG3(pi, RADIO_2057, in wlc_phy_txcal_radio_setup_nphy()
23653 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_setup_nphy()
23657 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txcal_radio_setup_nphy()
23664 pi->tx_rx_cal_radio_saveregs[(core * 11) + 0] = in wlc_phy_txcal_radio_setup_nphy()
23665 read_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23669 pi->tx_rx_cal_radio_saveregs[(core * 11) + 1] = in wlc_phy_txcal_radio_setup_nphy()
23670 read_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23674 pi->tx_rx_cal_radio_saveregs[(core * 11) + 2] = in wlc_phy_txcal_radio_setup_nphy()
23675 read_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23679 pi->tx_rx_cal_radio_saveregs[(core * 11) + 3] = in wlc_phy_txcal_radio_setup_nphy()
23681 pi, in wlc_phy_txcal_radio_setup_nphy()
23685 pi->tx_rx_cal_radio_saveregs[(core * 11) + 4] = in wlc_phy_txcal_radio_setup_nphy()
23686 read_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23690 pi->tx_rx_cal_radio_saveregs[(core * 11) + 5] = in wlc_phy_txcal_radio_setup_nphy()
23691 read_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23695 pi->tx_rx_cal_radio_saveregs[(core * 11) + 6] = in wlc_phy_txcal_radio_setup_nphy()
23696 read_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23699 pi->tx_rx_cal_radio_saveregs[(core * 11) + 7] = in wlc_phy_txcal_radio_setup_nphy()
23700 read_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23703 pi->tx_rx_cal_radio_saveregs[(core * 11) + 8] = in wlc_phy_txcal_radio_setup_nphy()
23704 read_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23708 pi->tx_rx_cal_radio_saveregs[(core * 11) + 9] = in wlc_phy_txcal_radio_setup_nphy()
23709 read_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23713 pi->tx_rx_cal_radio_saveregs[(core * 11) + 10] = in wlc_phy_txcal_radio_setup_nphy()
23714 read_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23718 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_txcal_radio_setup_nphy()
23719 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23722 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23725 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23728 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23731 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23735 if (PHY_IPA(pi)) { in wlc_phy_txcal_radio_setup_nphy()
23737 pi, in wlc_phy_txcal_radio_setup_nphy()
23740 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23745 pi, in wlc_phy_txcal_radio_setup_nphy()
23748 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23752 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23755 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23759 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23762 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23766 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23769 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23772 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23775 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23778 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23781 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23785 if (PHY_IPA(pi)) { in wlc_phy_txcal_radio_setup_nphy()
23788 pi, in wlc_phy_txcal_radio_setup_nphy()
23791 if (NREV_LT(pi->pubpi.phy_rev, 5)) in wlc_phy_txcal_radio_setup_nphy()
23793 pi, in wlc_phy_txcal_radio_setup_nphy()
23799 pi, in wlc_phy_txcal_radio_setup_nphy()
23805 pi, in wlc_phy_txcal_radio_setup_nphy()
23808 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23813 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23816 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23819 write_radio_reg(pi, in wlc_phy_txcal_radio_setup_nphy()
23826 pi->tx_rx_cal_radio_saveregs[0] = in wlc_phy_txcal_radio_setup_nphy()
23827 read_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1); in wlc_phy_txcal_radio_setup_nphy()
23828 write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1, 0x29); in wlc_phy_txcal_radio_setup_nphy()
23829 pi->tx_rx_cal_radio_saveregs[1] = in wlc_phy_txcal_radio_setup_nphy()
23830 read_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2); in wlc_phy_txcal_radio_setup_nphy()
23831 write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2, 0x54); in wlc_phy_txcal_radio_setup_nphy()
23833 pi->tx_rx_cal_radio_saveregs[2] = in wlc_phy_txcal_radio_setup_nphy()
23834 read_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1); in wlc_phy_txcal_radio_setup_nphy()
23835 write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1, 0x29); in wlc_phy_txcal_radio_setup_nphy()
23836 pi->tx_rx_cal_radio_saveregs[3] = in wlc_phy_txcal_radio_setup_nphy()
23837 read_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2); in wlc_phy_txcal_radio_setup_nphy()
23838 write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2, 0x54); in wlc_phy_txcal_radio_setup_nphy()
23840 pi->tx_rx_cal_radio_saveregs[4] = in wlc_phy_txcal_radio_setup_nphy()
23841 read_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1); in wlc_phy_txcal_radio_setup_nphy()
23842 pi->tx_rx_cal_radio_saveregs[5] = in wlc_phy_txcal_radio_setup_nphy()
23843 read_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2); in wlc_phy_txcal_radio_setup_nphy()
23845 if ((read_phy_reg(pi, 0x09) & NPHY_BandControl_currentBand) == in wlc_phy_txcal_radio_setup_nphy()
23848 write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1, 0x04); in wlc_phy_txcal_radio_setup_nphy()
23849 write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2, 0x04); in wlc_phy_txcal_radio_setup_nphy()
23852 write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1, 0x20); in wlc_phy_txcal_radio_setup_nphy()
23853 write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2, 0x20); in wlc_phy_txcal_radio_setup_nphy()
23856 if (NREV_LT(pi->pubpi.phy_rev, 2)) { in wlc_phy_txcal_radio_setup_nphy()
23858 or_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM, 0x20); in wlc_phy_txcal_radio_setup_nphy()
23859 or_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM, 0x20); in wlc_phy_txcal_radio_setup_nphy()
23862 and_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM, 0xdf); in wlc_phy_txcal_radio_setup_nphy()
23863 and_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM, 0xdf); in wlc_phy_txcal_radio_setup_nphy()
23868 static void wlc_phy_txcal_radio_cleanup_nphy(struct brcms_phy *pi) in wlc_phy_txcal_radio_cleanup_nphy() argument
23872 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_txcal_radio_cleanup_nphy()
23875 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_cleanup_nphy()
23877 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23881 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, IQCAL_VCM_HG, in wlc_phy_txcal_radio_cleanup_nphy()
23882 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23886 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, IQCAL_IDAC, in wlc_phy_txcal_radio_cleanup_nphy()
23887 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23891 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TSSI_VCM, in wlc_phy_txcal_radio_cleanup_nphy()
23892 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23896 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TX_SSI_MUX, in wlc_phy_txcal_radio_cleanup_nphy()
23897 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23901 if (pi->pubpi.radiorev != 5) in wlc_phy_txcal_radio_cleanup_nphy()
23902 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_txcal_radio_cleanup_nphy()
23904 pi->tx_rx_cal_radio_saveregs in wlc_phy_txcal_radio_cleanup_nphy()
23907 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TSSIG, in wlc_phy_txcal_radio_cleanup_nphy()
23908 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23912 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TSSI_MISC1, in wlc_phy_txcal_radio_cleanup_nphy()
23913 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23917 } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txcal_radio_cleanup_nphy()
23922 write_radio_reg(pi, in wlc_phy_txcal_radio_cleanup_nphy()
23924 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23928 write_radio_reg(pi, in wlc_phy_txcal_radio_cleanup_nphy()
23930 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23934 write_radio_reg(pi, in wlc_phy_txcal_radio_cleanup_nphy()
23936 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23940 write_radio_reg(pi, RADIO_2056_TX_TSSI_VCM | jtag_core, in wlc_phy_txcal_radio_cleanup_nphy()
23941 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23945 write_radio_reg(pi, in wlc_phy_txcal_radio_cleanup_nphy()
23947 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23951 write_radio_reg(pi, in wlc_phy_txcal_radio_cleanup_nphy()
23953 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23957 write_radio_reg(pi, RADIO_2056_TX_TSSIA | jtag_core, in wlc_phy_txcal_radio_cleanup_nphy()
23958 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23962 write_radio_reg(pi, RADIO_2056_TX_TSSIG | jtag_core, in wlc_phy_txcal_radio_cleanup_nphy()
23963 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23967 write_radio_reg(pi, in wlc_phy_txcal_radio_cleanup_nphy()
23969 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23973 write_radio_reg(pi, in wlc_phy_txcal_radio_cleanup_nphy()
23975 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23979 write_radio_reg(pi, in wlc_phy_txcal_radio_cleanup_nphy()
23981 pi-> in wlc_phy_txcal_radio_cleanup_nphy()
23987 write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1, in wlc_phy_txcal_radio_cleanup_nphy()
23988 pi->tx_rx_cal_radio_saveregs[0]); in wlc_phy_txcal_radio_cleanup_nphy()
23989 write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2, in wlc_phy_txcal_radio_cleanup_nphy()
23990 pi->tx_rx_cal_radio_saveregs[1]); in wlc_phy_txcal_radio_cleanup_nphy()
23991 write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1, in wlc_phy_txcal_radio_cleanup_nphy()
23992 pi->tx_rx_cal_radio_saveregs[2]); in wlc_phy_txcal_radio_cleanup_nphy()
23993 write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2, in wlc_phy_txcal_radio_cleanup_nphy()
23994 pi->tx_rx_cal_radio_saveregs[3]); in wlc_phy_txcal_radio_cleanup_nphy()
23995 write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1, in wlc_phy_txcal_radio_cleanup_nphy()
23996 pi->tx_rx_cal_radio_saveregs[4]); in wlc_phy_txcal_radio_cleanup_nphy()
23997 write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2, in wlc_phy_txcal_radio_cleanup_nphy()
23998 pi->tx_rx_cal_radio_saveregs[5]); in wlc_phy_txcal_radio_cleanup_nphy()
24002 static void wlc_phy_txcal_physetup_nphy(struct brcms_phy *pi) in wlc_phy_txcal_physetup_nphy() argument
24006 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txcal_physetup_nphy()
24007 pi->tx_rx_cal_phy_saveregs[0] = read_phy_reg(pi, 0xa6); in wlc_phy_txcal_physetup_nphy()
24008 pi->tx_rx_cal_phy_saveregs[1] = read_phy_reg(pi, 0xa7); in wlc_phy_txcal_physetup_nphy()
24013 mod_phy_reg(pi, 0xa6, mask, val); in wlc_phy_txcal_physetup_nphy()
24014 mod_phy_reg(pi, 0xa7, mask, val); in wlc_phy_txcal_physetup_nphy()
24016 val = read_phy_reg(pi, 0x8f); in wlc_phy_txcal_physetup_nphy()
24017 pi->tx_rx_cal_phy_saveregs[2] = val; in wlc_phy_txcal_physetup_nphy()
24019 write_phy_reg(pi, 0x8f, val); in wlc_phy_txcal_physetup_nphy()
24021 val = read_phy_reg(pi, 0xa5); in wlc_phy_txcal_physetup_nphy()
24022 pi->tx_rx_cal_phy_saveregs[3] = val; in wlc_phy_txcal_physetup_nphy()
24024 write_phy_reg(pi, 0xa5, val); in wlc_phy_txcal_physetup_nphy()
24026 pi->tx_rx_cal_phy_saveregs[4] = read_phy_reg(pi, 0x01); in wlc_phy_txcal_physetup_nphy()
24027 mod_phy_reg(pi, 0x01, (0x1 << 15), 0); in wlc_phy_txcal_physetup_nphy()
24029 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 3, 16, in wlc_phy_txcal_physetup_nphy()
24031 pi->tx_rx_cal_phy_saveregs[5] = val; in wlc_phy_txcal_physetup_nphy()
24033 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 3, 16, in wlc_phy_txcal_physetup_nphy()
24036 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 19, 16, in wlc_phy_txcal_physetup_nphy()
24038 pi->tx_rx_cal_phy_saveregs[6] = val; in wlc_phy_txcal_physetup_nphy()
24040 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 19, 16, in wlc_phy_txcal_physetup_nphy()
24043 pi->tx_rx_cal_phy_saveregs[7] = read_phy_reg(pi, 0x91); in wlc_phy_txcal_physetup_nphy()
24044 pi->tx_rx_cal_phy_saveregs[8] = read_phy_reg(pi, 0x92); in wlc_phy_txcal_physetup_nphy()
24046 if (!(pi->use_int_tx_iqlo_cal_nphy)) in wlc_phy_txcal_physetup_nphy()
24048 pi, in wlc_phy_txcal_physetup_nphy()
24056 pi, in wlc_phy_txcal_physetup_nphy()
24063 wlc_phy_rfctrlintc_override_nphy(pi, in wlc_phy_txcal_physetup_nphy()
24066 wlc_phy_rfctrlintc_override_nphy(pi, in wlc_phy_txcal_physetup_nphy()
24070 pi->tx_rx_cal_phy_saveregs[9] = read_phy_reg(pi, 0x297); in wlc_phy_txcal_physetup_nphy()
24071 pi->tx_rx_cal_phy_saveregs[10] = read_phy_reg(pi, 0x29b); in wlc_phy_txcal_physetup_nphy()
24072 mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x297 : in wlc_phy_txcal_physetup_nphy()
24075 mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x297 : in wlc_phy_txcal_physetup_nphy()
24078 if (NREV_IS(pi->pubpi.phy_rev, 7) in wlc_phy_txcal_physetup_nphy()
24079 || NREV_GE(pi->pubpi.phy_rev, 8)) in wlc_phy_txcal_physetup_nphy()
24081 pi, (0x1 << 7), in wlc_phy_txcal_physetup_nphy()
24083 (pi, in wlc_phy_txcal_physetup_nphy()
24087 if (pi->use_int_tx_iqlo_cal_nphy in wlc_phy_txcal_physetup_nphy()
24088 && !(pi->internal_tx_iqlo_cal_tapoff_intpa_nphy)) { in wlc_phy_txcal_physetup_nphy()
24090 if (NREV_IS(pi->pubpi.phy_rev, 7)) { in wlc_phy_txcal_physetup_nphy()
24092 mod_radio_reg(pi, RADIO_2057_OVR_REG0, 1 << 4, in wlc_phy_txcal_physetup_nphy()
24095 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_txcal_physetup_nphy()
24097 pi, in wlc_phy_txcal_physetup_nphy()
24101 pi, in wlc_phy_txcal_physetup_nphy()
24106 pi, in wlc_phy_txcal_physetup_nphy()
24110 pi, in wlc_phy_txcal_physetup_nphy()
24114 } else if (NREV_GE(pi->pubpi.phy_rev, 8)) { in wlc_phy_txcal_physetup_nphy()
24116 pi, in wlc_phy_txcal_physetup_nphy()
24123 pi->tx_rx_cal_phy_saveregs[0] = read_phy_reg(pi, 0xa6); in wlc_phy_txcal_physetup_nphy()
24124 pi->tx_rx_cal_phy_saveregs[1] = read_phy_reg(pi, 0xa7); in wlc_phy_txcal_physetup_nphy()
24129 mod_phy_reg(pi, 0xa6, mask, val); in wlc_phy_txcal_physetup_nphy()
24130 mod_phy_reg(pi, 0xa7, mask, val); in wlc_phy_txcal_physetup_nphy()
24132 val = read_phy_reg(pi, 0xa5); in wlc_phy_txcal_physetup_nphy()
24133 pi->tx_rx_cal_phy_saveregs[2] = val; in wlc_phy_txcal_physetup_nphy()
24135 write_phy_reg(pi, 0xa5, val); in wlc_phy_txcal_physetup_nphy()
24137 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 2, 16, in wlc_phy_txcal_physetup_nphy()
24139 pi->tx_rx_cal_phy_saveregs[3] = val; in wlc_phy_txcal_physetup_nphy()
24141 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 2, 16, in wlc_phy_txcal_physetup_nphy()
24144 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 18, 16, in wlc_phy_txcal_physetup_nphy()
24146 pi->tx_rx_cal_phy_saveregs[4] = val; in wlc_phy_txcal_physetup_nphy()
24148 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 18, 16, in wlc_phy_txcal_physetup_nphy()
24151 pi->tx_rx_cal_phy_saveregs[5] = read_phy_reg(pi, 0x91); in wlc_phy_txcal_physetup_nphy()
24152 pi->tx_rx_cal_phy_saveregs[6] = read_phy_reg(pi, 0x92); in wlc_phy_txcal_physetup_nphy()
24153 val = CHSPEC_IS5G(pi->radio_chanspec) ? 0x180 : 0x120; in wlc_phy_txcal_physetup_nphy()
24154 write_phy_reg(pi, 0x91, val); in wlc_phy_txcal_physetup_nphy()
24155 write_phy_reg(pi, 0x92, val); in wlc_phy_txcal_physetup_nphy()
24159 static void wlc_phy_txcal_phycleanup_nphy(struct brcms_phy *pi) in wlc_phy_txcal_phycleanup_nphy() argument
24163 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txcal_phycleanup_nphy()
24164 write_phy_reg(pi, 0xa6, pi->tx_rx_cal_phy_saveregs[0]); in wlc_phy_txcal_phycleanup_nphy()
24165 write_phy_reg(pi, 0xa7, pi->tx_rx_cal_phy_saveregs[1]); in wlc_phy_txcal_phycleanup_nphy()
24166 write_phy_reg(pi, 0x8f, pi->tx_rx_cal_phy_saveregs[2]); in wlc_phy_txcal_phycleanup_nphy()
24167 write_phy_reg(pi, 0xa5, pi->tx_rx_cal_phy_saveregs[3]); in wlc_phy_txcal_phycleanup_nphy()
24168 write_phy_reg(pi, 0x01, pi->tx_rx_cal_phy_saveregs[4]); in wlc_phy_txcal_phycleanup_nphy()
24170 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 3, 16, in wlc_phy_txcal_phycleanup_nphy()
24171 &pi->tx_rx_cal_phy_saveregs[5]); in wlc_phy_txcal_phycleanup_nphy()
24172 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 19, 16, in wlc_phy_txcal_phycleanup_nphy()
24173 &pi->tx_rx_cal_phy_saveregs[6]); in wlc_phy_txcal_phycleanup_nphy()
24175 write_phy_reg(pi, 0x91, pi->tx_rx_cal_phy_saveregs[7]); in wlc_phy_txcal_phycleanup_nphy()
24176 write_phy_reg(pi, 0x92, pi->tx_rx_cal_phy_saveregs[8]); in wlc_phy_txcal_phycleanup_nphy()
24178 write_phy_reg(pi, 0x297, pi->tx_rx_cal_phy_saveregs[9]); in wlc_phy_txcal_phycleanup_nphy()
24179 write_phy_reg(pi, 0x29b, pi->tx_rx_cal_phy_saveregs[10]); in wlc_phy_txcal_phycleanup_nphy()
24181 if (NREV_IS(pi->pubpi.phy_rev, 7) in wlc_phy_txcal_phycleanup_nphy()
24182 || NREV_GE(pi->pubpi.phy_rev, 8)) in wlc_phy_txcal_phycleanup_nphy()
24184 pi, (0x1 << 7), 0, 0, in wlc_phy_txcal_phycleanup_nphy()
24188 wlc_phy_resetcca_nphy(pi); in wlc_phy_txcal_phycleanup_nphy()
24190 if (pi->use_int_tx_iqlo_cal_nphy in wlc_phy_txcal_phycleanup_nphy()
24191 && !(pi->internal_tx_iqlo_cal_tapoff_intpa_nphy)) { in wlc_phy_txcal_phycleanup_nphy()
24193 if (NREV_IS(pi->pubpi.phy_rev, 7)) { in wlc_phy_txcal_phycleanup_nphy()
24194 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_txcal_phycleanup_nphy()
24196 pi, in wlc_phy_txcal_phycleanup_nphy()
24200 pi, in wlc_phy_txcal_phycleanup_nphy()
24205 pi, in wlc_phy_txcal_phycleanup_nphy()
24209 pi, in wlc_phy_txcal_phycleanup_nphy()
24214 mod_radio_reg(pi, RADIO_2057_OVR_REG0, 1 << 4, in wlc_phy_txcal_phycleanup_nphy()
24216 } else if (NREV_GE(pi->pubpi.phy_rev, 8)) { in wlc_phy_txcal_phycleanup_nphy()
24218 pi, in wlc_phy_txcal_phycleanup_nphy()
24226 mod_phy_reg(pi, 0xa6, mask, pi->tx_rx_cal_phy_saveregs[0]); in wlc_phy_txcal_phycleanup_nphy()
24227 mod_phy_reg(pi, 0xa7, mask, pi->tx_rx_cal_phy_saveregs[1]); in wlc_phy_txcal_phycleanup_nphy()
24228 write_phy_reg(pi, 0xa5, pi->tx_rx_cal_phy_saveregs[2]); in wlc_phy_txcal_phycleanup_nphy()
24230 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 2, 16, in wlc_phy_txcal_phycleanup_nphy()
24231 &pi->tx_rx_cal_phy_saveregs[3]); in wlc_phy_txcal_phycleanup_nphy()
24233 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 18, 16, in wlc_phy_txcal_phycleanup_nphy()
24234 &pi->tx_rx_cal_phy_saveregs[4]); in wlc_phy_txcal_phycleanup_nphy()
24236 write_phy_reg(pi, 0x91, pi->tx_rx_cal_phy_saveregs[5]); in wlc_phy_txcal_phycleanup_nphy()
24237 write_phy_reg(pi, 0x92, pi->tx_rx_cal_phy_saveregs[6]); in wlc_phy_txcal_phycleanup_nphy()
24242 wlc_phy_est_tonepwr_nphy(struct brcms_phy *pi, s32 *qdBm_pwrbuf, u8 num_samps) in wlc_phy_est_tonepwr_nphy() argument
24251 tssi_reg = read_phy_reg(pi, 0x1e9); in wlc_phy_est_tonepwr_nphy()
24260 CHSPEC_IS5G(pi->radio_chanspec) ? in wlc_phy_est_tonepwr_nphy()
24263 wlc_phy_poll_rssi_nphy(pi, tssi_type, rssi_buf, num_samps); in wlc_phy_est_tonepwr_nphy()
24281 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_CORE1TXPWRCTL, 1, in wlc_phy_est_tonepwr_nphy()
24283 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_CORE2TXPWRCTL, 1, in wlc_phy_est_tonepwr_nphy()
24287 static void wlc_phy_update_txcal_ladder_nphy(struct brcms_phy *pi, u16 core) in wlc_phy_update_txcal_ladder_nphy() argument
24307 ((pi->nphy_txcal_bbmult >> 8) & 0xff) : in wlc_phy_update_txcal_ladder_nphy()
24308 (pi->nphy_txcal_bbmult & 0xff); in wlc_phy_update_txcal_ladder_nphy()
24316 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 1, index, 16, in wlc_phy_update_txcal_ladder_nphy()
24324 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 1, index + 32, in wlc_phy_update_txcal_ladder_nphy()
24329 static u8 wlc_phy_txpwr_idx_cur_get_nphy(struct brcms_phy *pi, u8 core) in wlc_phy_txpwr_idx_cur_get_nphy() argument
24332 tmp = read_phy_reg(pi, ((core == PHY_CORE_0) ? 0x1ed : 0x1ee)); in wlc_phy_txpwr_idx_cur_get_nphy()
24339 wlc_phy_txpwr_idx_cur_set_nphy(struct brcms_phy *pi, u8 idx0, u8 idx1) in wlc_phy_txpwr_idx_cur_set_nphy() argument
24341 mod_phy_reg(pi, 0x1e7, (0x7f << 0), idx0); in wlc_phy_txpwr_idx_cur_set_nphy()
24343 if (NREV_GT(pi->pubpi.phy_rev, 1)) in wlc_phy_txpwr_idx_cur_set_nphy()
24344 mod_phy_reg(pi, 0x222, (0xff << 0), idx1); in wlc_phy_txpwr_idx_cur_set_nphy()
24347 static u16 wlc_phy_ipa_get_bbmult_nphy(struct brcms_phy *pi) in wlc_phy_ipa_get_bbmult_nphy() argument
24351 wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &m0m1); in wlc_phy_ipa_get_bbmult_nphy()
24356 static void wlc_phy_ipa_set_bbmult_nphy(struct brcms_phy *pi, u8 m0, u8 m1) in wlc_phy_ipa_set_bbmult_nphy() argument
24360 wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &m0m1); in wlc_phy_ipa_set_bbmult_nphy()
24361 wlc_phy_table_write_nphy(pi, 15, 1, 95, 16, &m0m1); in wlc_phy_ipa_set_bbmult_nphy()
24365 wlc_phy_papd_cal_setup_nphy(struct brcms_phy *pi, in wlc_phy_papd_cal_setup_nphy() argument
24373 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_papd_cal_setup_nphy()
24375 if (NREV_IS(pi->pubpi.phy_rev, 7) in wlc_phy_papd_cal_setup_nphy()
24376 || NREV_GE(pi->pubpi.phy_rev, 8)) in wlc_phy_papd_cal_setup_nphy()
24378 pi, (0x1 << 7), in wlc_phy_papd_cal_setup_nphy()
24380 (pi, in wlc_phy_papd_cal_setup_nphy()
24384 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_papd_cal_setup_nphy()
24385 if (pi->pubpi.radiorev == 5) in wlc_phy_papd_cal_setup_nphy()
24387 else if ((pi->pubpi.radiorev == 7) in wlc_phy_papd_cal_setup_nphy()
24388 || (pi->pubpi.radiorev == 8)) in wlc_phy_papd_cal_setup_nphy()
24390 else if ((pi->pubpi.radiorev <= 4) in wlc_phy_papd_cal_setup_nphy()
24391 || (pi->pubpi.radiorev == 6)) in wlc_phy_papd_cal_setup_nphy()
24394 if ((pi->pubpi.radiorev == 4) || in wlc_phy_papd_cal_setup_nphy()
24395 (pi->pubpi.radiorev == 6)) in wlc_phy_papd_cal_setup_nphy()
24397 else if ((pi->pubpi.radiorev == 3) in wlc_phy_papd_cal_setup_nphy()
24398 || (pi->pubpi.radiorev == 7) in wlc_phy_papd_cal_setup_nphy()
24399 || (pi->pubpi.radiorev == 8)) in wlc_phy_papd_cal_setup_nphy()
24403 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 11), in wlc_phy_papd_cal_setup_nphy()
24408 pi, in wlc_phy_papd_cal_setup_nphy()
24412 pi, in wlc_phy_papd_cal_setup_nphy()
24416 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), in wlc_phy_papd_cal_setup_nphy()
24419 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 2), 1, in wlc_phy_papd_cal_setup_nphy()
24422 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 0), 0, in wlc_phy_papd_cal_setup_nphy()
24425 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 1), 1, in wlc_phy_papd_cal_setup_nphy()
24428 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 8), 0, in wlc_phy_papd_cal_setup_nphy()
24431 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 9), 1, in wlc_phy_papd_cal_setup_nphy()
24434 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 10), 0, in wlc_phy_papd_cal_setup_nphy()
24437 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), 1, in wlc_phy_papd_cal_setup_nphy()
24441 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 5), in wlc_phy_papd_cal_setup_nphy()
24444 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 4), 0, in wlc_phy_papd_cal_setup_nphy()
24448 state->afectrl[core] = read_phy_reg(pi, (core == PHY_CORE_0) ? in wlc_phy_papd_cal_setup_nphy()
24451 read_phy_reg(pi, (core == PHY_CORE_0) ? 0x8f : 0xa5); in wlc_phy_papd_cal_setup_nphy()
24453 read_phy_reg(pi, (core == PHY_CORE_0) ? 0xa7 : 0xa6); in wlc_phy_papd_cal_setup_nphy()
24455 read_phy_reg(pi, (core == PHY_CORE_0) ? 0xa5 : 0x8f); in wlc_phy_papd_cal_setup_nphy()
24457 mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0xa6 : 0xa7), in wlc_phy_papd_cal_setup_nphy()
24459 mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0x8f : in wlc_phy_papd_cal_setup_nphy()
24462 mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0xa7 : 0xa6), in wlc_phy_papd_cal_setup_nphy()
24464 mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0xa5 : in wlc_phy_papd_cal_setup_nphy()
24467 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_papd_cal_setup_nphy()
24469 READ_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_setup_nphy()
24472 READ_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_setup_nphy()
24475 READ_RADIO_REG3(pi, RADIO_2057, TX, off_core, in wlc_phy_papd_cal_setup_nphy()
24478 READ_RADIO_REG3(pi, RADIO_2057, TX, off_core, in wlc_phy_papd_cal_setup_nphy()
24481 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_setup_nphy()
24484 if ((pi->pubpi.radiorev == 3) || in wlc_phy_papd_cal_setup_nphy()
24485 (pi->pubpi.radiorev == 4) || in wlc_phy_papd_cal_setup_nphy()
24486 (pi->pubpi.radiorev == 6)) in wlc_phy_papd_cal_setup_nphy()
24487 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_setup_nphy()
24489 else if (pi->pubpi.radiorev == 5) in wlc_phy_papd_cal_setup_nphy()
24490 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_setup_nphy()
24493 else if ((pi->pubpi.radiorev == 7) in wlc_phy_papd_cal_setup_nphy()
24494 || (pi->pubpi.radiorev == 8)) in wlc_phy_papd_cal_setup_nphy()
24495 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_setup_nphy()
24498 WRITE_RADIO_REG3(pi, RADIO_2057, TX, off_core, in wlc_phy_papd_cal_setup_nphy()
24500 WRITE_RADIO_REG3(pi, RADIO_2057, TX, off_core, in wlc_phy_papd_cal_setup_nphy()
24504 READ_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_setup_nphy()
24507 READ_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_setup_nphy()
24510 READ_RADIO_REG3(pi, RADIO_2057, TX, off_core, in wlc_phy_papd_cal_setup_nphy()
24513 READ_RADIO_REG3(pi, RADIO_2057, TX, off_core, in wlc_phy_papd_cal_setup_nphy()
24516 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_setup_nphy()
24519 if ((pi->pubpi.radiorev == 7) in wlc_phy_papd_cal_setup_nphy()
24520 || (pi->pubpi.radiorev == 8)) in wlc_phy_papd_cal_setup_nphy()
24521 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_setup_nphy()
24525 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_setup_nphy()
24528 WRITE_RADIO_REG3(pi, RADIO_2057, TX, off_core, in wlc_phy_papd_cal_setup_nphy()
24530 WRITE_RADIO_REG3(pi, RADIO_2057, TX, off_core, in wlc_phy_papd_cal_setup_nphy()
24536 wlc_phy_tx_tone_nphy(pi, tone_freq, 181, 0, 0, false); in wlc_phy_papd_cal_setup_nphy()
24538 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : in wlc_phy_papd_cal_setup_nphy()
24541 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_papd_cal_setup_nphy()
24544 mod_phy_reg(pi, (off_core == PHY_CORE_0) ? 0x297 : in wlc_phy_papd_cal_setup_nphy()
24547 mod_phy_reg(pi, (off_core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_papd_cal_setup_nphy()
24552 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), 0, 0x3, 0); in wlc_phy_papd_cal_setup_nphy()
24554 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 1, 0, 0); in wlc_phy_papd_cal_setup_nphy()
24556 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 0), 0, 0x3, 0); in wlc_phy_papd_cal_setup_nphy()
24558 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 2), 1, 0x3, 0); in wlc_phy_papd_cal_setup_nphy()
24559 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 1), 1, 0x3, 0); in wlc_phy_papd_cal_setup_nphy()
24561 state->afectrl[core] = read_phy_reg(pi, (core == PHY_CORE_0) ? in wlc_phy_papd_cal_setup_nphy()
24564 read_phy_reg(pi, (core == PHY_CORE_0) ? 0x8f : 0xa5); in wlc_phy_papd_cal_setup_nphy()
24566 mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0xa6 : 0xa7), in wlc_phy_papd_cal_setup_nphy()
24568 mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0x8f : in wlc_phy_papd_cal_setup_nphy()
24575 READ_RADIO_REG2(pi, RADIO_2056, RX, core, VGA_MASTER); in wlc_phy_papd_cal_setup_nphy()
24576 WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, VGA_MASTER, 0x2b); in wlc_phy_papd_cal_setup_nphy()
24577 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_papd_cal_setup_nphy()
24579 READ_RADIO_REG2(pi, RADIO_2056, RX, core, in wlc_phy_papd_cal_setup_nphy()
24582 READ_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_papd_cal_setup_nphy()
24585 WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, TXFBMIX_G, in wlc_phy_papd_cal_setup_nphy()
24587 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_papd_cal_setup_nphy()
24591 READ_RADIO_REG2(pi, RADIO_2056, RX, core, in wlc_phy_papd_cal_setup_nphy()
24594 READ_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_papd_cal_setup_nphy()
24597 WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, TXFBMIX_A, in wlc_phy_papd_cal_setup_nphy()
24599 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_papd_cal_setup_nphy()
24606 wlc_phy_tx_tone_nphy(pi, tone_freq, 181, 0, 0, false); in wlc_phy_papd_cal_setup_nphy()
24608 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : in wlc_phy_papd_cal_setup_nphy()
24611 mod_phy_reg(pi, (off_core == PHY_CORE_0) ? 0x297 : in wlc_phy_papd_cal_setup_nphy()
24614 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 0, 0x3, 0); in wlc_phy_papd_cal_setup_nphy()
24619 wlc_phy_papd_cal_cleanup_nphy(struct brcms_phy *pi, in wlc_phy_papd_cal_cleanup_nphy() argument
24624 wlc_phy_stopplayback_nphy(pi); in wlc_phy_papd_cal_cleanup_nphy()
24626 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_papd_cal_cleanup_nphy()
24628 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_papd_cal_cleanup_nphy()
24630 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_papd_cal_cleanup_nphy()
24631 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_cleanup_nphy()
24633 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_cleanup_nphy()
24637 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_cleanup_nphy()
24639 WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, in wlc_phy_papd_cal_cleanup_nphy()
24645 if ((pi->pubpi.radiorev == 4) || (pi->pubpi.radiorev == 6)) in wlc_phy_papd_cal_cleanup_nphy()
24647 pi, (0x1 << 2), in wlc_phy_papd_cal_cleanup_nphy()
24652 pi, (0x1 << 2), in wlc_phy_papd_cal_cleanup_nphy()
24656 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 1), in wlc_phy_papd_cal_cleanup_nphy()
24659 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 0), 0, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24661 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 2), 0, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24663 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 11), 1, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24665 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), 0, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24667 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 11), 0, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24669 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 12), 0, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24671 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 2), 1, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24673 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 0), 0, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24675 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 1), 1, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24677 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 8), 0, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24679 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 9), 1, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24681 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 10), 0, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24683 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), 1, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24685 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 5), 0, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24687 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 4), 0, 0x3, 1, in wlc_phy_papd_cal_cleanup_nphy()
24690 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_papd_cal_cleanup_nphy()
24692 write_phy_reg(pi, (core == PHY_CORE_0) ? in wlc_phy_papd_cal_cleanup_nphy()
24694 write_phy_reg(pi, (core == PHY_CORE_0) ? 0x8f : in wlc_phy_papd_cal_cleanup_nphy()
24698 wlc_phy_ipa_set_bbmult_nphy(pi, (state->mm >> 8) & 0xff, in wlc_phy_papd_cal_cleanup_nphy()
24701 if (NREV_IS(pi->pubpi.phy_rev, 7) in wlc_phy_papd_cal_cleanup_nphy()
24702 || NREV_GE(pi->pubpi.phy_rev, 8)) in wlc_phy_papd_cal_cleanup_nphy()
24704 pi, (0x1 << 7), 0, 0, in wlc_phy_papd_cal_cleanup_nphy()
24708 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), 0, 0x3, 1); in wlc_phy_papd_cal_cleanup_nphy()
24709 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 13), 0, 0x3, 1); in wlc_phy_papd_cal_cleanup_nphy()
24710 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 0), 0, 0x3, 1); in wlc_phy_papd_cal_cleanup_nphy()
24712 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 2), 0, 0x3, 1); in wlc_phy_papd_cal_cleanup_nphy()
24713 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 1), 0, 0x3, 1); in wlc_phy_papd_cal_cleanup_nphy()
24715 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_papd_cal_cleanup_nphy()
24717 WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, VGA_MASTER, in wlc_phy_papd_cal_cleanup_nphy()
24719 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_papd_cal_cleanup_nphy()
24720 WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, in wlc_phy_papd_cal_cleanup_nphy()
24722 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_papd_cal_cleanup_nphy()
24726 WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, in wlc_phy_papd_cal_cleanup_nphy()
24728 WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, in wlc_phy_papd_cal_cleanup_nphy()
24733 write_phy_reg(pi, (core == PHY_CORE_0) ? in wlc_phy_papd_cal_cleanup_nphy()
24735 write_phy_reg(pi, (core == PHY_CORE_0) ? 0x8f : in wlc_phy_papd_cal_cleanup_nphy()
24739 wlc_phy_ipa_set_bbmult_nphy(pi, (state->mm >> 8) & 0xff, in wlc_phy_papd_cal_cleanup_nphy()
24742 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 0, 0x3, 1); in wlc_phy_papd_cal_cleanup_nphy()
24747 wlc_phy_a1_nphy(struct brcms_phy *pi, u8 core, u32 winsz, u32 start, in wlc_phy_a1_nphy() argument
24761 wlc_phy_table_read_nphy(pi, in wlc_phy_a1_nphy()
24790 wlc_phy_table_write_nphy(pi, in wlc_phy_a1_nphy()
24799 wlc_phy_a2_nphy(struct brcms_phy *pi, struct nphy_ipa_txcalgains *txgains, in wlc_phy_a2_nphy() argument
24809 if (NREV_LT(pi->pubpi.phy_rev, 3)) in wlc_phy_a2_nphy()
24817 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_a2_nphy()
24819 phy_a9 = wlc_phy_get_tx_gain_nphy(pi); in wlc_phy_a2_nphy()
24821 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_a2_nphy()
24834 pi, in wlc_phy_a2_nphy()
24838 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_a2_nphy()
24839 if ((pi->pubpi.radiorev <= 4) in wlc_phy_a2_nphy()
24840 || (pi->pubpi.radiorev == 6)) in wlc_phy_a2_nphy()
24841 m[core] = (pi->bw == WL_CHANSPEC_BW_40) ? in wlc_phy_a2_nphy()
24844 m[core] = (pi->bw == WL_CHANSPEC_BW_40) ? in wlc_phy_a2_nphy()
24847 m[core] = (pi->bw == WL_CHANSPEC_BW_40) ? 75 : 107; in wlc_phy_a2_nphy()
24851 wlc_phy_ipa_set_bbmult_nphy(pi, m[0], m[1]); in wlc_phy_a2_nphy()
24855 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_a2_nphy()
24856 if ((pi->pubpi.radiorev == 4) in wlc_phy_a2_nphy()
24857 || (pi->pubpi.radiorev == 6)) { in wlc_phy_a2_nphy()
24865 if ((pi->pubpi.radiorev == 5) in wlc_phy_a2_nphy()
24866 || (pi->pubpi.radiorev == 7) in wlc_phy_a2_nphy()
24867 || (pi->pubpi.radiorev == 8)) { in wlc_phy_a2_nphy()
24877 if ((pi->pubpi.radiorev == 5) in wlc_phy_a2_nphy()
24878 && (CHSPEC_IS2G(pi->radio_chanspec))) in wlc_phy_a2_nphy()
24880 else if (((pi->pubpi.radiorev == 7) && in wlc_phy_a2_nphy()
24881 (CHSPEC_IS2G(pi->radio_chanspec))) || in wlc_phy_a2_nphy()
24882 ((pi->pubpi.radiorev == 8) && in wlc_phy_a2_nphy()
24883 (CHSPEC_IS2G(pi->radio_chanspec)))) in wlc_phy_a2_nphy()
24894 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : in wlc_phy_a2_nphy()
24897 mod_phy_reg(pi, (phy_a7 == PHY_CORE_0) ? 0x297 : in wlc_phy_a2_nphy()
24900 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
24903 mod_phy_reg(pi, (phy_a7 == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
24906 write_phy_reg(pi, 0x2a1, 0x80); in wlc_phy_a2_nphy()
24907 write_phy_reg(pi, 0x2a2, 0x100); in wlc_phy_a2_nphy()
24909 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
24912 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
24915 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
24918 write_phy_reg(pi, 0x2e5, 0x20); in wlc_phy_a2_nphy()
24920 mod_phy_reg(pi, 0x2a0, (0x3f << 0), (phy_a3) << 0); in wlc_phy_a2_nphy()
24922 mod_phy_reg(pi, 0x29f, (0x3f << 0), (phy_a1) << 0); in wlc_phy_a2_nphy()
24924 mod_phy_reg(pi, 0x29f, (0x3f << 8), (phy_a2) << 8); in wlc_phy_a2_nphy()
24926 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), in wlc_phy_a2_nphy()
24929 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), in wlc_phy_a2_nphy()
24933 write_phy_reg(pi, 0x2be, 1); in wlc_phy_a2_nphy()
24934 SPINWAIT(read_phy_reg(pi, 0x2be), 10 * 1000 * 1000); in wlc_phy_a2_nphy()
24936 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), in wlc_phy_a2_nphy()
24940 wlc_phy_table_write_nphy(pi, in wlc_phy_a2_nphy()
24947 if (CHSPEC_IS5G(pi->radio_chanspec)) in wlc_phy_a2_nphy()
24948 wlc_phy_a1_nphy(pi, core, 5, 0, 35); in wlc_phy_a2_nphy()
24952 pi, in wlc_phy_a2_nphy()
24961 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_a2_nphy()
24962 if (NREV_GE(pi->pubpi.phy_rev, 6) && in wlc_phy_a2_nphy()
24963 pi->sh->chip == BCMA_CHIP_ID_BCM47162) { in wlc_phy_a2_nphy()
24965 } else if (NREV_GE(pi->pubpi.phy_rev, 6)) { in wlc_phy_a2_nphy()
24967 } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { in wlc_phy_a2_nphy()
24975 wlc_phy_rfctrl_override_nphy(pi, in wlc_phy_a2_nphy()
24980 wlc_phy_rfctrl_override_nphy(pi, in wlc_phy_a2_nphy()
24987 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_a2_nphy()
24988 m[core] = (pi->bw == WL_CHANSPEC_BW_40) ? 45 : 64; in wlc_phy_a2_nphy()
24990 m[core] = (pi->bw == WL_CHANSPEC_BW_40) ? 75 : 107; in wlc_phy_a2_nphy()
24993 wlc_phy_ipa_set_bbmult_nphy(pi, m[0], m[1]); in wlc_phy_a2_nphy()
25012 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : in wlc_phy_a2_nphy()
25015 mod_phy_reg(pi, (phy_a7 == PHY_CORE_0) ? 0x297 : in wlc_phy_a2_nphy()
25018 if (NREV_GE(pi->pubpi.phy_rev, 6)) { in wlc_phy_a2_nphy()
25019 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
25022 mod_phy_reg(pi, (phy_a7 == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
25025 write_phy_reg(pi, 0x2a1, 0x20); in wlc_phy_a2_nphy()
25026 write_phy_reg(pi, 0x2a2, 0x60); in wlc_phy_a2_nphy()
25028 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
25031 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
25034 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
25037 write_phy_reg(pi, 0x2e5, 0x20); in wlc_phy_a2_nphy()
25039 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
25042 mod_phy_reg(pi, (phy_a7 == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
25045 write_phy_reg(pi, 0x2a1, 0x80); in wlc_phy_a2_nphy()
25046 write_phy_reg(pi, 0x2a2, 0x600); in wlc_phy_a2_nphy()
25048 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
25051 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
25054 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a2_nphy()
25057 mod_phy_reg(pi, 0x2a0, (0x3f << 8), (0x20) << 8); in wlc_phy_a2_nphy()
25061 mod_phy_reg(pi, 0x2a0, (0x3f << 0), (phy_a3) << 0); in wlc_phy_a2_nphy()
25063 mod_phy_reg(pi, 0x29f, (0x3f << 0), (phy_a1) << 0); in wlc_phy_a2_nphy()
25065 mod_phy_reg(pi, 0x29f, (0x3f << 8), (phy_a2) << 8); in wlc_phy_a2_nphy()
25067 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 1, 0x3, 0); in wlc_phy_a2_nphy()
25069 write_phy_reg(pi, 0x2be, 1); in wlc_phy_a2_nphy()
25070 SPINWAIT(read_phy_reg(pi, 0x2be), 10 * 1000 * 1000); in wlc_phy_a2_nphy()
25072 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 0, 0x3, 0); in wlc_phy_a2_nphy()
25074 wlc_phy_table_write_nphy(pi, in wlc_phy_a2_nphy()
25081 wlc_phy_a1_nphy(pi, core, 5, 0, 40); in wlc_phy_a2_nphy()
25085 static u8 wlc_phy_a3_nphy(struct brcms_phy *pi, u8 start_gain, u8 core) in wlc_phy_a3_nphy() argument
25105 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_a3_nphy()
25110 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_a3_nphy()
25111 if (pi->pubpi.radiorev == 5) { in wlc_phy_a3_nphy()
25117 } else if ((pi->pubpi.radiorev == 7) in wlc_phy_a3_nphy()
25118 || (pi->pubpi.radiorev == 8)) { in wlc_phy_a3_nphy()
25140 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_a3_nphy()
25147 wlc_phy_a2_nphy(pi, &phy_a4, CAL_GCTRL, core); in wlc_phy_a3_nphy()
25149 wlc_phy_table_read_nphy(pi, in wlc_phy_a3_nphy()
25193 wlc_phy_a2_nphy(pi, &phy_a4, CAL_GCTRL, core); in wlc_phy_a3_nphy()
25195 wlc_phy_table_read_nphy(pi, in wlc_phy_a3_nphy()
25236 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_a3_nphy()
25243 static void wlc_phy_a4(struct brcms_phy *pi, bool full_cal) in wlc_phy_a4() argument
25260 if (pi->nphy_papd_skip == 1) in wlc_phy_a4()
25263 phy_b3 = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & in wlc_phy_a4()
25266 wlapi_suspend_mac_and_wait(pi->sh->physhim); in wlc_phy_a4()
25268 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_a4()
25270 pi->nphy_force_papd_cal = false; in wlc_phy_a4()
25272 for (phy_b5 = 0; phy_b5 < pi->pubpi.phy_corenum; phy_b5++) in wlc_phy_a4()
25273 pi->nphy_papd_tx_gain_at_last_cal[phy_b5] = in wlc_phy_a4()
25274 wlc_phy_txpwr_idx_cur_get_nphy(pi, phy_b5); in wlc_phy_a4()
25276 pi->nphy_papd_last_cal = pi->sh->now; in wlc_phy_a4()
25277 pi->nphy_papd_recal_counter++; in wlc_phy_a4()
25279 phy_b4 = pi->nphy_txpwrctrl; in wlc_phy_a4()
25280 wlc_phy_txpwrctrl_enable_nphy(pi, PHY_TPC_HW_OFF); in wlc_phy_a4()
25282 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_SCALARTBL0, 64, 0, 32, in wlc_phy_a4()
25284 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_SCALARTBL1, 64, 0, 32, in wlc_phy_a4()
25287 phy_b9 = read_phy_reg(pi, 0x01); in wlc_phy_a4()
25288 mod_phy_reg(pi, 0x01, (0x1 << 15), 0); in wlc_phy_a4()
25290 for (phy_b5 = 0; phy_b5 < pi->pubpi.phy_corenum; phy_b5++) { in wlc_phy_a4()
25293 wlc_phy_table_write_nphy(pi, in wlc_phy_a4()
25301 wlc_phy_ipa_restore_tx_digi_filts_nphy(pi); in wlc_phy_a4()
25303 phy_b2.mm = wlc_phy_ipa_get_bbmult_nphy(pi); in wlc_phy_a4()
25304 for (phy_b5 = 0; phy_b5 < pi->pubpi.phy_corenum; phy_b5++) { in wlc_phy_a4()
25305 wlc_phy_papd_cal_setup_nphy(pi, &phy_b2, phy_b5); in wlc_phy_a4()
25307 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_a4()
25308 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_a4()
25309 if ((pi->pubpi.radiorev == 3) in wlc_phy_a4()
25310 || (pi->pubpi.radiorev == 4) in wlc_phy_a4()
25311 || (pi->pubpi.radiorev == 6)) { in wlc_phy_a4()
25312 pi->nphy_papd_cal_gain_index[phy_b5] = in wlc_phy_a4()
25314 } else if (pi->pubpi.radiorev == 5) { in wlc_phy_a4()
25315 pi->nphy_papd_cal_gain_index[phy_b5] = in wlc_phy_a4()
25317 pi->nphy_papd_cal_gain_index[phy_b5] = in wlc_phy_a4()
25319 pi, in wlc_phy_a4()
25320 pi-> in wlc_phy_a4()
25325 } else if ((pi->pubpi.radiorev == 7) in wlc_phy_a4()
25326 || (pi->pubpi.radiorev == 8)) { in wlc_phy_a4()
25328 pi->nphy_papd_cal_gain_index[phy_b5] = in wlc_phy_a4()
25330 pi->nphy_papd_cal_gain_index[phy_b5] = in wlc_phy_a4()
25332 pi, in wlc_phy_a4()
25333 pi-> in wlc_phy_a4()
25341 pi->nphy_papd_cal_gain_index[phy_b5]; in wlc_phy_a4()
25344 pi->nphy_papd_cal_gain_index[phy_b5] = 0; in wlc_phy_a4()
25345 pi->nphy_papd_cal_gain_index[phy_b5] = in wlc_phy_a4()
25347 pi, in wlc_phy_a4()
25348 pi-> in wlc_phy_a4()
25352 pi->nphy_papd_cal_gain_index[phy_b5]; in wlc_phy_a4()
25358 wlc_phy_a3_nphy(pi, phy_b1[phy_b5].index, in wlc_phy_a4()
25361 pi->nphy_papd_cal_gain_index[phy_b5] = in wlc_phy_a4()
25365 switch (pi->nphy_papd_cal_type) { in wlc_phy_a4()
25367 wlc_phy_a2_nphy(pi, &phy_b1[phy_b5], CAL_FULL, phy_b5); in wlc_phy_a4()
25370 wlc_phy_a2_nphy(pi, &phy_b1[phy_b5], CAL_SOFT, phy_b5); in wlc_phy_a4()
25374 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_a4()
25375 wlc_phy_papd_cal_cleanup_nphy(pi, &phy_b2); in wlc_phy_a4()
25378 if (NREV_LT(pi->pubpi.phy_rev, 7)) in wlc_phy_a4()
25379 wlc_phy_papd_cal_cleanup_nphy(pi, &phy_b2); in wlc_phy_a4()
25381 for (phy_b5 = 0; phy_b5 < pi->pubpi.phy_corenum; phy_b5++) { in wlc_phy_a4()
25384 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_a4()
25385 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_a4()
25386 if (pi->pubpi.radiorev == 3) in wlc_phy_a4()
25388 else if (pi->pubpi.radiorev == 5) in wlc_phy_a4()
25396 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_a4()
25399 if ((pi->pubpi.radiorev == 3) || in wlc_phy_a4()
25400 (pi->pubpi.radiorev == 4) || in wlc_phy_a4()
25401 (pi->pubpi.radiorev == 6)) { in wlc_phy_a4()
25406 } else if (pi->pubpi.radiorev == 5) { in wlc_phy_a4()
25410 } else if ((pi->pubpi.radiorev == 7) || in wlc_phy_a4()
25411 (pi->pubpi.radiorev == 8)) { in wlc_phy_a4()
25418 if ((pi->pubpi.radiorev == 3) || in wlc_phy_a4()
25419 (pi->pubpi.radiorev == 4) || in wlc_phy_a4()
25420 (pi->pubpi.radiorev == 6)) in wlc_phy_a4()
25425 else if ((pi->pubpi.radiorev == 7) in wlc_phy_a4()
25426 || (pi->pubpi.radiorev == 8)) in wlc_phy_a4()
25434 if (CHSPEC_IS2G(pi->radio_chanspec)) in wlc_phy_a4()
25443 mod_phy_reg(pi, (phy_b5 == PHY_CORE_0) ? 0x298 : in wlc_phy_a4()
25446 pi->nphy_papd_epsilon_offset[phy_b5] = phy_b6; in wlc_phy_a4()
25448 if (NREV_LT(pi->pubpi.phy_rev, 5)) in wlc_phy_a4()
25455 if (CHSPEC_IS2G(pi->radio_chanspec)) { in wlc_phy_a4()
25471 mod_phy_reg(pi, (phy_b5 == PHY_CORE_0) ? 0x298 : in wlc_phy_a4()
25474 pi->nphy_papd_epsilon_offset[phy_b5] = phy_b6; in wlc_phy_a4()
25478 mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x297 : in wlc_phy_a4()
25481 mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x297 : in wlc_phy_a4()
25484 if (NREV_GE(pi->pubpi.phy_rev, 6)) { in wlc_phy_a4()
25485 mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a4()
25488 mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a4()
25492 mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a4()
25495 mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x2a3 : in wlc_phy_a4()
25499 pi->nphy_papdcomp = NPHY_PAPD_COMP_ON; in wlc_phy_a4()
25501 write_phy_reg(pi, 0x01, phy_b9); in wlc_phy_a4()
25503 wlc_phy_ipa_set_tx_digi_filts_nphy(pi); in wlc_phy_a4()
25505 wlc_phy_txpwrctrl_enable_nphy(pi, phy_b4); in wlc_phy_a4()
25507 wlc_phy_txpwr_index_nphy(pi, (1 << 0), in wlc_phy_a4()
25508 (s8) (pi->nphy_txpwrindex[0]. in wlc_phy_a4()
25510 wlc_phy_txpwr_index_nphy(pi, (1 << 1), in wlc_phy_a4()
25511 (s8) (pi->nphy_txpwrindex[1]. in wlc_phy_a4()
25515 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_a4()
25518 wlapi_enable_mac(pi->sh->physhim); in wlc_phy_a4()
25521 void wlc_phy_cal_perical_nphy_run(struct brcms_phy *pi, u8 caltype) in wlc_phy_cal_perical_nphy_run() argument
25529 if (PHY_MUTED(pi)) in wlc_phy_cal_perical_nphy_run()
25533 fullcal = (pi->radio_chanspec != pi->nphy_txiqlocal_chanspec); in wlc_phy_cal_perical_nphy_run()
25537 if (pi->cal_type_override != PHY_PERICAL_AUTO) in wlc_phy_cal_perical_nphy_run()
25539 (pi->cal_type_override == in wlc_phy_cal_perical_nphy_run()
25542 if ((pi->mphase_cal_phase_id > MPHASE_CAL_STATE_INIT)) { in wlc_phy_cal_perical_nphy_run()
25543 if (pi->nphy_txiqlocal_chanspec != pi->radio_chanspec) in wlc_phy_cal_perical_nphy_run()
25544 wlc_phy_cal_perical_mphase_restart(pi); in wlc_phy_cal_perical_nphy_run()
25547 if ((pi->mphase_cal_phase_id == MPHASE_CAL_STATE_RXCAL)) in wlc_phy_cal_perical_nphy_run()
25548 wlapi_bmac_write_shm(pi->sh->physhim, M_CTS_DURATION, 10000); in wlc_phy_cal_perical_nphy_run()
25550 wlapi_suspend_mac_and_wait(pi->sh->physhim); in wlc_phy_cal_perical_nphy_run()
25552 wlc_phyreg_enter((struct brcms_phy_pub *) pi); in wlc_phy_cal_perical_nphy_run()
25554 if ((pi->mphase_cal_phase_id == MPHASE_CAL_STATE_IDLE) || in wlc_phy_cal_perical_nphy_run()
25555 (pi->mphase_cal_phase_id == MPHASE_CAL_STATE_INIT)) { in wlc_phy_cal_perical_nphy_run()
25556 pi->nphy_cal_orig_pwr_idx[0] = in wlc_phy_cal_perical_nphy_run()
25557 (u8) ((read_phy_reg(pi, 0x1ed) >> 8) & 0x7f); in wlc_phy_cal_perical_nphy_run()
25558 pi->nphy_cal_orig_pwr_idx[1] = in wlc_phy_cal_perical_nphy_run()
25559 (u8) ((read_phy_reg(pi, 0x1ee) >> 8) & 0x7f); in wlc_phy_cal_perical_nphy_run()
25561 if (pi->nphy_txpwrctrl != PHY_TPC_HW_OFF) { in wlc_phy_cal_perical_nphy_run()
25562 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, in wlc_phy_cal_perical_nphy_run()
25564 pi->nphy_cal_orig_tx_gain); in wlc_phy_cal_perical_nphy_run()
25566 pi->nphy_cal_orig_tx_gain[0] = 0; in wlc_phy_cal_perical_nphy_run()
25567 pi->nphy_cal_orig_tx_gain[1] = 0; in wlc_phy_cal_perical_nphy_run()
25570 target_gain = wlc_phy_get_tx_gain_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25571 tx_pwr_ctrl_state = pi->nphy_txpwrctrl; in wlc_phy_cal_perical_nphy_run()
25572 wlc_phy_txpwrctrl_enable_nphy(pi, PHY_TPC_HW_OFF); in wlc_phy_cal_perical_nphy_run()
25574 if (pi->antsel_type == ANTSEL_2x3) in wlc_phy_cal_perical_nphy_run()
25575 wlc_phy_antsel_init((struct brcms_phy_pub *) pi, true); in wlc_phy_cal_perical_nphy_run()
25577 mphase = (pi->mphase_cal_phase_id != MPHASE_CAL_STATE_IDLE); in wlc_phy_cal_perical_nphy_run()
25580 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_cal_perical_nphy_run()
25581 wlc_phy_precal_txgain_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25582 pi->nphy_cal_target_gain = wlc_phy_get_tx_gain_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25585 target_gain = pi->nphy_cal_target_gain; in wlc_phy_cal_perical_nphy_run()
25588 wlc_phy_cal_txiqlo_nphy(pi, target_gain, fullcal, in wlc_phy_cal_perical_nphy_run()
25590 if (PHY_IPA(pi)) in wlc_phy_cal_perical_nphy_run()
25591 wlc_phy_a4(pi, true); in wlc_phy_cal_perical_nphy_run()
25593 wlc_phyreg_exit((struct brcms_phy_pub *) pi); in wlc_phy_cal_perical_nphy_run()
25594 wlapi_enable_mac(pi->sh->physhim); in wlc_phy_cal_perical_nphy_run()
25595 wlapi_bmac_write_shm(pi->sh->physhim, M_CTS_DURATION, in wlc_phy_cal_perical_nphy_run()
25597 wlapi_suspend_mac_and_wait(pi->sh->physhim); in wlc_phy_cal_perical_nphy_run()
25598 wlc_phyreg_enter((struct brcms_phy_pub *) pi); in wlc_phy_cal_perical_nphy_run()
25600 if (0 == wlc_phy_cal_rxiq_nphy(pi, target_gain, in wlc_phy_cal_perical_nphy_run()
25601 (pi->first_cal_after_assoc || in wlc_phy_cal_perical_nphy_run()
25602 (pi->cal_type_override == in wlc_phy_cal_perical_nphy_run()
25604 wlc_phy_savecal_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25606 wlc_phy_txpwrctrl_coeff_setup_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25608 pi->nphy_perical_last = pi->sh->now; in wlc_phy_cal_perical_nphy_run()
25612 wlc_phy_rssi_cal_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25614 if (pi->first_cal_after_assoc in wlc_phy_cal_perical_nphy_run()
25615 || (pi->cal_type_override == PHY_PERICAL_FULL)) { in wlc_phy_cal_perical_nphy_run()
25616 pi->first_cal_after_assoc = false; in wlc_phy_cal_perical_nphy_run()
25617 wlc_phy_txpwrctrl_idle_tssi_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25618 wlc_phy_txpwrctrl_pwr_setup_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25621 if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_cal_perical_nphy_run()
25622 wlc_phy_radio205x_vcocal_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25624 switch (pi->mphase_cal_phase_id) { in wlc_phy_cal_perical_nphy_run()
25626 pi->nphy_perical_last = pi->sh->now; in wlc_phy_cal_perical_nphy_run()
25627 pi->nphy_txiqlocal_chanspec = pi->radio_chanspec; in wlc_phy_cal_perical_nphy_run()
25629 if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_cal_perical_nphy_run()
25630 wlc_phy_precal_txgain_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25632 pi->nphy_cal_target_gain = wlc_phy_get_tx_gain_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25633 pi->mphase_cal_phase_id++; in wlc_phy_cal_perical_nphy_run()
25642 if ((pi->radar_percal_mask & 0x10) != 0) in wlc_phy_cal_perical_nphy_run()
25643 pi->nphy_rxcal_active = true; in wlc_phy_cal_perical_nphy_run()
25646 (pi, pi->nphy_cal_target_gain, fullcal, in wlc_phy_cal_perical_nphy_run()
25649 wlc_phy_cal_perical_mphase_reset(pi); in wlc_phy_cal_perical_nphy_run()
25653 if (NREV_LE(pi->pubpi.phy_rev, 2) && in wlc_phy_cal_perical_nphy_run()
25654 (pi->mphase_cal_phase_id == in wlc_phy_cal_perical_nphy_run()
25656 pi->mphase_cal_phase_id += 2; in wlc_phy_cal_perical_nphy_run()
25658 pi->mphase_cal_phase_id++; in wlc_phy_cal_perical_nphy_run()
25662 if ((pi->radar_percal_mask & 0x2) != 0) in wlc_phy_cal_perical_nphy_run()
25663 pi->nphy_rxcal_active = true; in wlc_phy_cal_perical_nphy_run()
25665 if (PHY_IPA(pi)) in wlc_phy_cal_perical_nphy_run()
25666 wlc_phy_a4(pi, true); in wlc_phy_cal_perical_nphy_run()
25668 pi->mphase_cal_phase_id++; in wlc_phy_cal_perical_nphy_run()
25672 if ((pi->radar_percal_mask & 0x1) != 0) in wlc_phy_cal_perical_nphy_run()
25673 pi->nphy_rxcal_active = true; in wlc_phy_cal_perical_nphy_run()
25674 if (wlc_phy_cal_rxiq_nphy(pi, target_gain, in wlc_phy_cal_perical_nphy_run()
25675 (pi->first_cal_after_assoc || in wlc_phy_cal_perical_nphy_run()
25676 (pi->cal_type_override == in wlc_phy_cal_perical_nphy_run()
25679 wlc_phy_savecal_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25681 pi->mphase_cal_phase_id++; in wlc_phy_cal_perical_nphy_run()
25685 if ((pi->radar_percal_mask & 0x4) != 0) in wlc_phy_cal_perical_nphy_run()
25686 pi->nphy_rxcal_active = true; in wlc_phy_cal_perical_nphy_run()
25687 wlc_phy_txpwrctrl_coeff_setup_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25688 wlc_phy_rssi_cal_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25690 if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_cal_perical_nphy_run()
25691 wlc_phy_radio205x_vcocal_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25695 if (pi->first_cal_after_assoc) in wlc_phy_cal_perical_nphy_run()
25696 pi->mphase_cal_phase_id++; in wlc_phy_cal_perical_nphy_run()
25698 wlc_phy_cal_perical_mphase_reset(pi); in wlc_phy_cal_perical_nphy_run()
25703 if ((pi->radar_percal_mask & 0x8) != 0) in wlc_phy_cal_perical_nphy_run()
25704 pi->nphy_rxcal_active = true; in wlc_phy_cal_perical_nphy_run()
25706 if (pi->first_cal_after_assoc) { in wlc_phy_cal_perical_nphy_run()
25707 pi->first_cal_after_assoc = false; in wlc_phy_cal_perical_nphy_run()
25708 wlc_phy_txpwrctrl_idle_tssi_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25709 wlc_phy_txpwrctrl_pwr_setup_nphy(pi); in wlc_phy_cal_perical_nphy_run()
25712 wlc_phy_cal_perical_mphase_reset(pi); in wlc_phy_cal_perical_nphy_run()
25716 wlc_phy_cal_perical_mphase_reset(pi); in wlc_phy_cal_perical_nphy_run()
25721 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_cal_perical_nphy_run()
25725 wlc_phy_txpwr_index_nphy(pi, 1, in wlc_phy_cal_perical_nphy_run()
25726 pi-> in wlc_phy_cal_perical_nphy_run()
25729 wlc_phy_txpwr_index_nphy(pi, 2, in wlc_phy_cal_perical_nphy_run()
25730 pi-> in wlc_phy_cal_perical_nphy_run()
25734 pi->nphy_txpwrindex[0].index = -1; in wlc_phy_cal_perical_nphy_run()
25735 pi->nphy_txpwrindex[1].index = -1; in wlc_phy_cal_perical_nphy_run()
25737 wlc_phy_txpwr_index_nphy(pi, (1 << 0), in wlc_phy_cal_perical_nphy_run()
25738 (s8) (pi-> in wlc_phy_cal_perical_nphy_run()
25743 wlc_phy_txpwr_index_nphy(pi, (1 << 1), in wlc_phy_cal_perical_nphy_run()
25744 (s8) (pi-> in wlc_phy_cal_perical_nphy_run()
25753 wlc_phy_txpwrctrl_enable_nphy(pi, tx_pwr_ctrl_state); in wlc_phy_cal_perical_nphy_run()
25754 wlc_phyreg_exit((struct brcms_phy_pub *) pi); in wlc_phy_cal_perical_nphy_run()
25755 wlapi_enable_mac(pi->sh->physhim); in wlc_phy_cal_perical_nphy_run()
25759 wlc_phy_cal_txiqlo_nphy(struct brcms_phy *pi, struct nphy_txgains target_gain, in wlc_phy_cal_txiqlo_nphy() argument
25841 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_cal_txiqlo_nphy()
25843 if (NREV_GE(pi->pubpi.phy_rev, 4)) { in wlc_phy_cal_txiqlo_nphy()
25844 phyhang_avoid_state = pi->phyhang_avoid; in wlc_phy_cal_txiqlo_nphy()
25845 pi->phyhang_avoid = false; in wlc_phy_cal_txiqlo_nphy()
25848 if (CHSPEC_IS40(pi->radio_chanspec)) in wlc_phy_cal_txiqlo_nphy()
25853 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, gain_save); in wlc_phy_cal_txiqlo_nphy()
25856 wlc_phy_iqcal_gainparams_nphy(pi, core_no, target_gain, in wlc_phy_cal_txiqlo_nphy()
25861 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, cal_gain); in wlc_phy_cal_txiqlo_nphy()
25863 wlc_phy_txcal_radio_setup_nphy(pi); in wlc_phy_cal_txiqlo_nphy()
25865 wlc_phy_txcal_physetup_nphy(pi); in wlc_phy_cal_txiqlo_nphy()
25868 if (!(NREV_GE(pi->pubpi.phy_rev, 6) || in wlc_phy_cal_txiqlo_nphy()
25869 (NREV_IS(pi->pubpi.phy_rev, 5) && PHY_IPA(pi) in wlc_phy_cal_txiqlo_nphy()
25870 && (CHSPEC_IS2G(pi->radio_chanspec))))) { in wlc_phy_cal_txiqlo_nphy()
25879 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, tbl_len, 0, in wlc_phy_cal_txiqlo_nphy()
25889 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, tbl_len, 32, in wlc_phy_cal_txiqlo_nphy()
25893 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_cal_txiqlo_nphy()
25894 write_phy_reg(pi, 0xc2, 0x8ad9); in wlc_phy_cal_txiqlo_nphy()
25896 write_phy_reg(pi, 0xc2, 0x8aa9); in wlc_phy_cal_txiqlo_nphy()
25901 if (pi->mphase_cal_phase_id > MPHASE_CAL_STATE_TXPHASE0) { in wlc_phy_cal_txiqlo_nphy()
25902 wlc_phy_runsamples_nphy(pi, phy_bw * 8, 0xffff, 0, 1, 0, false); in wlc_phy_cal_txiqlo_nphy()
25906 wlc_phy_tx_tone_nphy(pi, tone_freq, max_val, 1, 0, in wlc_phy_cal_txiqlo_nphy()
25912 if (pi->mphase_cal_phase_id > MPHASE_CAL_STATE_TXPHASE0) { in wlc_phy_cal_txiqlo_nphy()
25913 tbl_ptr = pi->mphase_txcal_bestcoeffs; in wlc_phy_cal_txiqlo_nphy()
25914 tbl_len = ARRAY_SIZE(pi->mphase_txcal_bestcoeffs); in wlc_phy_cal_txiqlo_nphy()
25915 if (NREV_LT(pi->pubpi.phy_rev, 3)) in wlc_phy_cal_txiqlo_nphy()
25918 if ((!fullcal) && (pi->nphy_txiqlocal_coeffsvalid)) { in wlc_phy_cal_txiqlo_nphy()
25920 tbl_ptr = pi->nphy_txiqlocal_bestc; in wlc_phy_cal_txiqlo_nphy()
25921 tbl_len = ARRAY_SIZE(pi->nphy_txiqlocal_bestc); in wlc_phy_cal_txiqlo_nphy()
25922 if (NREV_LT(pi->pubpi.phy_rev, 3)) in wlc_phy_cal_txiqlo_nphy()
25928 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_cal_txiqlo_nphy()
25940 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, tbl_len, 64, in wlc_phy_cal_txiqlo_nphy()
25944 max_cal_cmds = (NREV_GE(pi->pubpi.phy_rev, 3)) ? in wlc_phy_cal_txiqlo_nphy()
25949 max_cal_cmds = (NREV_GE(pi->pubpi.phy_rev, 3)) ? in wlc_phy_cal_txiqlo_nphy()
25956 cal_cnt = pi->mphase_txcal_cmdidx; in wlc_phy_cal_txiqlo_nphy()
25957 if ((cal_cnt + pi->mphase_txcal_numcmds) < max_cal_cmds) in wlc_phy_cal_txiqlo_nphy()
25958 num_cals = cal_cnt + pi->mphase_txcal_numcmds; in wlc_phy_cal_txiqlo_nphy()
25969 cal_cmd = (NREV_GE(pi->pubpi.phy_rev, 3)) ? in wlc_phy_cal_txiqlo_nphy()
25974 cal_cmd = (NREV_GE(pi->pubpi.phy_rev, 3)) ? in wlc_phy_cal_txiqlo_nphy()
25983 if (NREV_GE(pi->pubpi.phy_rev, 6) || in wlc_phy_cal_txiqlo_nphy()
25984 (NREV_IS(pi->pubpi.phy_rev, 5) && in wlc_phy_cal_txiqlo_nphy()
25985 PHY_IPA(pi) in wlc_phy_cal_txiqlo_nphy()
25986 && (CHSPEC_IS2G(pi->radio_chanspec)))) { in wlc_phy_cal_txiqlo_nphy()
25989 pi, in wlc_phy_cal_txiqlo_nphy()
25998 write_phy_reg(pi, 0xc1, val); in wlc_phy_cal_txiqlo_nphy()
26003 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, in wlc_phy_cal_txiqlo_nphy()
26010 wlc_phy_table_write_nphy(pi, in wlc_phy_cal_txiqlo_nphy()
26016 write_phy_reg(pi, 0xc0, cal_cmd); in wlc_phy_cal_txiqlo_nphy()
26018 SPINWAIT(((read_phy_reg(pi, 0xc0) & 0xc000) != 0), in wlc_phy_cal_txiqlo_nphy()
26020 if (WARN(read_phy_reg(pi, 0xc0) & 0xc000, in wlc_phy_cal_txiqlo_nphy()
26024 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, in wlc_phy_cal_txiqlo_nphy()
26026 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, in wlc_phy_cal_txiqlo_nphy()
26039 pi->mphase_txcal_cmdidx = num_cals; in wlc_phy_cal_txiqlo_nphy()
26040 if (pi->mphase_txcal_cmdidx >= max_cal_cmds) in wlc_phy_cal_txiqlo_nphy()
26041 pi->mphase_txcal_cmdidx = 0; in wlc_phy_cal_txiqlo_nphy()
26045 (NREV_LE(pi->pubpi.phy_rev, 2)) ? in wlc_phy_cal_txiqlo_nphy()
26049 || (pi->mphase_cal_phase_id == mphase_cal_lastphase)) { in wlc_phy_cal_txiqlo_nphy()
26051 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 96, in wlc_phy_cal_txiqlo_nphy()
26053 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 80, in wlc_phy_cal_txiqlo_nphy()
26056 if (NREV_LT(pi->pubpi.phy_rev, 2)) { in wlc_phy_cal_txiqlo_nphy()
26064 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 88, in wlc_phy_cal_txiqlo_nphy()
26067 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 101, in wlc_phy_cal_txiqlo_nphy()
26069 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 85, in wlc_phy_cal_txiqlo_nphy()
26072 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 93, in wlc_phy_cal_txiqlo_nphy()
26075 tbl_len = ARRAY_SIZE(pi->nphy_txiqlocal_bestc); in wlc_phy_cal_txiqlo_nphy()
26076 if (NREV_LT(pi->pubpi.phy_rev, 3)) in wlc_phy_cal_txiqlo_nphy()
26079 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, in wlc_phy_cal_txiqlo_nphy()
26081 pi->nphy_txiqlocal_bestc); in wlc_phy_cal_txiqlo_nphy()
26083 pi->nphy_txiqlocal_coeffsvalid = true; in wlc_phy_cal_txiqlo_nphy()
26084 pi->nphy_txiqlocal_chanspec = pi->radio_chanspec; in wlc_phy_cal_txiqlo_nphy()
26086 tbl_len = ARRAY_SIZE(pi->mphase_txcal_bestcoeffs); in wlc_phy_cal_txiqlo_nphy()
26087 if (NREV_LT(pi->pubpi.phy_rev, 3)) in wlc_phy_cal_txiqlo_nphy()
26090 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, in wlc_phy_cal_txiqlo_nphy()
26092 pi->mphase_txcal_bestcoeffs); in wlc_phy_cal_txiqlo_nphy()
26095 wlc_phy_stopplayback_nphy(pi); in wlc_phy_cal_txiqlo_nphy()
26097 write_phy_reg(pi, 0xc2, 0x0000); in wlc_phy_cal_txiqlo_nphy()
26101 wlc_phy_txcal_phycleanup_nphy(pi); in wlc_phy_cal_txiqlo_nphy()
26103 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, in wlc_phy_cal_txiqlo_nphy()
26106 wlc_phy_txcal_radio_cleanup_nphy(pi); in wlc_phy_cal_txiqlo_nphy()
26108 if (NREV_LT(pi->pubpi.phy_rev, 2)) { in wlc_phy_cal_txiqlo_nphy()
26110 || (pi->mphase_cal_phase_id == mphase_cal_lastphase)) in wlc_phy_cal_txiqlo_nphy()
26111 wlc_phy_tx_iq_war_nphy(pi); in wlc_phy_cal_txiqlo_nphy()
26114 if (NREV_GE(pi->pubpi.phy_rev, 4)) in wlc_phy_cal_txiqlo_nphy()
26115 pi->phyhang_avoid = phyhang_avoid_state; in wlc_phy_cal_txiqlo_nphy()
26117 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_cal_txiqlo_nphy()
26122 static void wlc_phy_reapply_txcal_coeffs_nphy(struct brcms_phy *pi) in wlc_phy_reapply_txcal_coeffs_nphy() argument
26126 if ((pi->nphy_txiqlocal_chanspec == pi->radio_chanspec) && in wlc_phy_reapply_txcal_coeffs_nphy()
26127 (pi->nphy_txiqlocal_coeffsvalid)) { in wlc_phy_reapply_txcal_coeffs_nphy()
26128 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, in wlc_phy_reapply_txcal_coeffs_nphy()
26131 if ((pi->nphy_txiqlocal_bestc[0] != tbl_buf[0]) || in wlc_phy_reapply_txcal_coeffs_nphy()
26132 (pi->nphy_txiqlocal_bestc[1] != tbl_buf[1]) || in wlc_phy_reapply_txcal_coeffs_nphy()
26133 (pi->nphy_txiqlocal_bestc[2] != tbl_buf[2]) || in wlc_phy_reapply_txcal_coeffs_nphy()
26134 (pi->nphy_txiqlocal_bestc[3] != tbl_buf[3])) { in wlc_phy_reapply_txcal_coeffs_nphy()
26136 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 80, in wlc_phy_reapply_txcal_coeffs_nphy()
26137 16, pi->nphy_txiqlocal_bestc); in wlc_phy_reapply_txcal_coeffs_nphy()
26143 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 88, in wlc_phy_reapply_txcal_coeffs_nphy()
26146 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 85, in wlc_phy_reapply_txcal_coeffs_nphy()
26148 &pi->nphy_txiqlocal_bestc[5]); in wlc_phy_reapply_txcal_coeffs_nphy()
26150 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 93, in wlc_phy_reapply_txcal_coeffs_nphy()
26152 &pi->nphy_txiqlocal_bestc[5]); in wlc_phy_reapply_txcal_coeffs_nphy()
26158 wlc_phy_rx_iq_coeffs_nphy(struct brcms_phy *pi, u8 write, in wlc_phy_rx_iq_coeffs_nphy() argument
26162 write_phy_reg(pi, 0x9a, pcomp->a0); in wlc_phy_rx_iq_coeffs_nphy()
26163 write_phy_reg(pi, 0x9b, pcomp->b0); in wlc_phy_rx_iq_coeffs_nphy()
26164 write_phy_reg(pi, 0x9c, pcomp->a1); in wlc_phy_rx_iq_coeffs_nphy()
26165 write_phy_reg(pi, 0x9d, pcomp->b1); in wlc_phy_rx_iq_coeffs_nphy()
26167 pcomp->a0 = read_phy_reg(pi, 0x9a); in wlc_phy_rx_iq_coeffs_nphy()
26168 pcomp->b0 = read_phy_reg(pi, 0x9b); in wlc_phy_rx_iq_coeffs_nphy()
26169 pcomp->a1 = read_phy_reg(pi, 0x9c); in wlc_phy_rx_iq_coeffs_nphy()
26170 pcomp->b1 = read_phy_reg(pi, 0x9d); in wlc_phy_rx_iq_coeffs_nphy()
26175 wlc_phy_rx_iq_est_nphy(struct brcms_phy *pi, struct phy_iq_est *est, in wlc_phy_rx_iq_est_nphy() argument
26180 write_phy_reg(pi, 0x12b, num_samps); in wlc_phy_rx_iq_est_nphy()
26181 mod_phy_reg(pi, 0x12a, (0xff << 0), (wait_time << 0)); in wlc_phy_rx_iq_est_nphy()
26182 mod_phy_reg(pi, 0x129, NPHY_IqestCmd_iqMode, in wlc_phy_rx_iq_est_nphy()
26185 mod_phy_reg(pi, 0x129, NPHY_IqestCmd_iqstart, NPHY_IqestCmd_iqstart); in wlc_phy_rx_iq_est_nphy()
26187 SPINWAIT(((read_phy_reg(pi, 0x129) & NPHY_IqestCmd_iqstart) != 0), in wlc_phy_rx_iq_est_nphy()
26189 if (WARN(read_phy_reg(pi, 0x129) & NPHY_IqestCmd_iqstart, in wlc_phy_rx_iq_est_nphy()
26193 if ((read_phy_reg(pi, 0x129) & NPHY_IqestCmd_iqstart) == 0) { in wlc_phy_rx_iq_est_nphy()
26194 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_rx_iq_est_nphy()
26196 (read_phy_reg(pi, in wlc_phy_rx_iq_est_nphy()
26198 | read_phy_reg(pi, NPHY_IqestipwrAccLo(core)); in wlc_phy_rx_iq_est_nphy()
26200 (read_phy_reg(pi, in wlc_phy_rx_iq_est_nphy()
26202 | read_phy_reg(pi, NPHY_IqestqpwrAccLo(core)); in wlc_phy_rx_iq_est_nphy()
26204 (read_phy_reg(pi, in wlc_phy_rx_iq_est_nphy()
26206 read_phy_reg(pi, NPHY_IqestIqAccLo(core)); in wlc_phy_rx_iq_est_nphy()
26212 static void wlc_phy_calc_rx_iq_comp_nphy(struct brcms_phy *pi, u8 core_mask) in wlc_phy_calc_rx_iq_comp_nphy() argument
26227 wlc_phy_rx_iq_coeffs_nphy(pi, 0, &old_comp); in wlc_phy_calc_rx_iq_comp_nphy()
26229 wlc_phy_rx_iq_coeffs_nphy(pi, 1, &new_comp); in wlc_phy_calc_rx_iq_comp_nphy()
26232 wlc_phy_rx_iq_est_nphy(pi, est, 0x4000, 32, 0); in wlc_phy_calc_rx_iq_comp_nphy()
26236 for (curr_core = 0; curr_core < pi->pubpi.phy_corenum; curr_core++) { in wlc_phy_calc_rx_iq_comp_nphy()
26299 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_calc_rx_iq_comp_nphy()
26309 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_calc_rx_iq_comp_nphy()
26331 wlc_phy_rx_iq_coeffs_nphy(pi, 1, &new_comp); in wlc_phy_calc_rx_iq_comp_nphy()
26334 static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) in wlc_phy_rxcal_radio_setup_nphy() argument
26340 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rxcal_radio_setup_nphy()
26342 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rxcal_radio_setup_nphy()
26343 pi->tx_rx_cal_radio_saveregs[0] = in wlc_phy_rxcal_radio_setup_nphy()
26344 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26346 pi->tx_rx_cal_radio_saveregs[1] = in wlc_phy_rxcal_radio_setup_nphy()
26347 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26350 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26353 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26358 pi->tx_rx_cal_radio_saveregs[0] = in wlc_phy_rxcal_radio_setup_nphy()
26359 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26361 pi->tx_rx_cal_radio_saveregs[1] = in wlc_phy_rxcal_radio_setup_nphy()
26362 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26366 pi, in wlc_phy_rxcal_radio_setup_nphy()
26370 pi, in wlc_phy_rxcal_radio_setup_nphy()
26376 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rxcal_radio_setup_nphy()
26377 pi->tx_rx_cal_radio_saveregs[0] = in wlc_phy_rxcal_radio_setup_nphy()
26378 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26380 pi->tx_rx_cal_radio_saveregs[1] = in wlc_phy_rxcal_radio_setup_nphy()
26381 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26385 pi, in wlc_phy_rxcal_radio_setup_nphy()
26389 pi, in wlc_phy_rxcal_radio_setup_nphy()
26394 pi->tx_rx_cal_radio_saveregs[0] = in wlc_phy_rxcal_radio_setup_nphy()
26395 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26397 pi->tx_rx_cal_radio_saveregs[1] = in wlc_phy_rxcal_radio_setup_nphy()
26398 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26401 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26404 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26412 pi->tx_rx_cal_radio_saveregs[0] = in wlc_phy_rxcal_radio_setup_nphy()
26413 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26416 pi->tx_rx_cal_radio_saveregs[1] = in wlc_phy_rxcal_radio_setup_nphy()
26417 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26421 if (pi->pubpi.radiorev >= 5) { in wlc_phy_rxcal_radio_setup_nphy()
26422 pi->tx_rx_cal_radio_saveregs[2] = in wlc_phy_rxcal_radio_setup_nphy()
26423 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26426 pi->tx_rx_cal_radio_saveregs[3] = in wlc_phy_rxcal_radio_setup_nphy()
26427 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26432 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rxcal_radio_setup_nphy()
26434 if (pi->pubpi.radiorev >= 5) { in wlc_phy_rxcal_radio_setup_nphy()
26435 pi->tx_rx_cal_radio_saveregs[4] = in wlc_phy_rxcal_radio_setup_nphy()
26436 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26441 pi, in wlc_phy_rxcal_radio_setup_nphy()
26445 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26449 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26453 pi->tx_rx_cal_radio_saveregs[4] = in wlc_phy_rxcal_radio_setup_nphy()
26454 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26459 (pi->tx_rx_cal_radio_saveregs in wlc_phy_rxcal_radio_setup_nphy()
26464 mod_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26470 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26473 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26477 if (pi->pubpi.radiorev >= 5) { in wlc_phy_rxcal_radio_setup_nphy()
26478 pi->tx_rx_cal_radio_saveregs[4] = in wlc_phy_rxcal_radio_setup_nphy()
26480 pi, in wlc_phy_rxcal_radio_setup_nphy()
26485 pi, in wlc_phy_rxcal_radio_setup_nphy()
26490 pi, in wlc_phy_rxcal_radio_setup_nphy()
26496 pi, in wlc_phy_rxcal_radio_setup_nphy()
26502 pi->tx_rx_cal_radio_saveregs[4] = in wlc_phy_rxcal_radio_setup_nphy()
26504 pi, in wlc_phy_rxcal_radio_setup_nphy()
26509 (pi-> in wlc_phy_rxcal_radio_setup_nphy()
26515 mod_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26521 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26524 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26530 pi->tx_rx_cal_radio_saveregs[0] = in wlc_phy_rxcal_radio_setup_nphy()
26531 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26534 pi->tx_rx_cal_radio_saveregs[1] = in wlc_phy_rxcal_radio_setup_nphy()
26535 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26539 if (pi->pubpi.radiorev >= 5) { in wlc_phy_rxcal_radio_setup_nphy()
26540 pi->tx_rx_cal_radio_saveregs[2] = in wlc_phy_rxcal_radio_setup_nphy()
26541 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26544 pi->tx_rx_cal_radio_saveregs[3] = in wlc_phy_rxcal_radio_setup_nphy()
26545 read_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26550 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rxcal_radio_setup_nphy()
26552 if (pi->pubpi.radiorev >= 5) { in wlc_phy_rxcal_radio_setup_nphy()
26553 pi->tx_rx_cal_radio_saveregs[4] = in wlc_phy_rxcal_radio_setup_nphy()
26555 pi, in wlc_phy_rxcal_radio_setup_nphy()
26560 pi, in wlc_phy_rxcal_radio_setup_nphy()
26565 pi, in wlc_phy_rxcal_radio_setup_nphy()
26571 pi, in wlc_phy_rxcal_radio_setup_nphy()
26576 pi->tx_rx_cal_radio_saveregs[4] = in wlc_phy_rxcal_radio_setup_nphy()
26578 pi, in wlc_phy_rxcal_radio_setup_nphy()
26583 (pi-> in wlc_phy_rxcal_radio_setup_nphy()
26589 mod_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26595 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26598 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26602 if (pi->pubpi.radiorev >= 5) { in wlc_phy_rxcal_radio_setup_nphy()
26603 pi->tx_rx_cal_radio_saveregs[4] = in wlc_phy_rxcal_radio_setup_nphy()
26605 pi, in wlc_phy_rxcal_radio_setup_nphy()
26610 pi, in wlc_phy_rxcal_radio_setup_nphy()
26615 pi, in wlc_phy_rxcal_radio_setup_nphy()
26621 pi, in wlc_phy_rxcal_radio_setup_nphy()
26626 pi->tx_rx_cal_radio_saveregs[4] = in wlc_phy_rxcal_radio_setup_nphy()
26628 pi, in wlc_phy_rxcal_radio_setup_nphy()
26633 (pi-> in wlc_phy_rxcal_radio_setup_nphy()
26639 mod_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26645 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26648 write_radio_reg(pi, in wlc_phy_rxcal_radio_setup_nphy()
26656 static void wlc_phy_rxcal_radio_cleanup_nphy(struct brcms_phy *pi, u8 rx_core) in wlc_phy_rxcal_radio_cleanup_nphy() argument
26658 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rxcal_radio_cleanup_nphy()
26660 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rxcal_radio_cleanup_nphy()
26662 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26664 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26667 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26669 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26674 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26676 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26679 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26681 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26686 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rxcal_radio_cleanup_nphy()
26688 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26690 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26693 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26695 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26700 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26702 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26705 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26707 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26714 write_radio_reg(pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26717 pi->tx_rx_cal_radio_saveregs[0]); in wlc_phy_rxcal_radio_cleanup_nphy()
26719 write_radio_reg(pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26722 pi->tx_rx_cal_radio_saveregs[1]); in wlc_phy_rxcal_radio_cleanup_nphy()
26724 if (pi->pubpi.radiorev >= 5) { in wlc_phy_rxcal_radio_cleanup_nphy()
26725 write_radio_reg(pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26728 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26731 write_radio_reg(pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26734 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26738 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rxcal_radio_cleanup_nphy()
26739 if (pi->pubpi.radiorev >= 5) in wlc_phy_rxcal_radio_cleanup_nphy()
26741 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26744 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26749 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26752 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26756 if (pi->pubpi.radiorev >= 5) in wlc_phy_rxcal_radio_cleanup_nphy()
26758 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26761 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26766 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26769 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26775 write_radio_reg(pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26778 pi->tx_rx_cal_radio_saveregs[0]); in wlc_phy_rxcal_radio_cleanup_nphy()
26780 write_radio_reg(pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26783 pi->tx_rx_cal_radio_saveregs[1]); in wlc_phy_rxcal_radio_cleanup_nphy()
26785 if (pi->pubpi.radiorev >= 5) { in wlc_phy_rxcal_radio_cleanup_nphy()
26786 write_radio_reg(pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26789 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26792 write_radio_reg(pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26795 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26799 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rxcal_radio_cleanup_nphy()
26800 if (pi->pubpi.radiorev >= 5) in wlc_phy_rxcal_radio_cleanup_nphy()
26802 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26805 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26810 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26813 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26817 if (pi->pubpi.radiorev >= 5) in wlc_phy_rxcal_radio_cleanup_nphy()
26819 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26822 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26827 pi, in wlc_phy_rxcal_radio_cleanup_nphy()
26830 pi-> in wlc_phy_rxcal_radio_cleanup_nphy()
26838 static void wlc_phy_rxcal_physetup_nphy(struct brcms_phy *pi, u8 rx_core) in wlc_phy_rxcal_physetup_nphy() argument
26843 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_rxcal_physetup_nphy()
26848 pi->tx_rx_cal_phy_saveregs[0] = read_phy_reg(pi, 0xa2); in wlc_phy_rxcal_physetup_nphy()
26849 pi->tx_rx_cal_phy_saveregs[1] = in wlc_phy_rxcal_physetup_nphy()
26850 read_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0xa6 : 0xa7); in wlc_phy_rxcal_physetup_nphy()
26851 pi->tx_rx_cal_phy_saveregs[2] = in wlc_phy_rxcal_physetup_nphy()
26852 read_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0x8f : 0xa5); in wlc_phy_rxcal_physetup_nphy()
26853 pi->tx_rx_cal_phy_saveregs[3] = read_phy_reg(pi, 0x91); in wlc_phy_rxcal_physetup_nphy()
26854 pi->tx_rx_cal_phy_saveregs[4] = read_phy_reg(pi, 0x92); in wlc_phy_rxcal_physetup_nphy()
26855 pi->tx_rx_cal_phy_saveregs[5] = read_phy_reg(pi, 0x7a); in wlc_phy_rxcal_physetup_nphy()
26856 pi->tx_rx_cal_phy_saveregs[6] = read_phy_reg(pi, 0x7d); in wlc_phy_rxcal_physetup_nphy()
26857 pi->tx_rx_cal_phy_saveregs[7] = read_phy_reg(pi, 0xe7); in wlc_phy_rxcal_physetup_nphy()
26858 pi->tx_rx_cal_phy_saveregs[8] = read_phy_reg(pi, 0xec); in wlc_phy_rxcal_physetup_nphy()
26859 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rxcal_physetup_nphy()
26860 pi->tx_rx_cal_phy_saveregs[11] = read_phy_reg(pi, 0x342); in wlc_phy_rxcal_physetup_nphy()
26861 pi->tx_rx_cal_phy_saveregs[12] = read_phy_reg(pi, 0x343); in wlc_phy_rxcal_physetup_nphy()
26862 pi->tx_rx_cal_phy_saveregs[13] = read_phy_reg(pi, 0x346); in wlc_phy_rxcal_physetup_nphy()
26863 pi->tx_rx_cal_phy_saveregs[14] = read_phy_reg(pi, 0x347); in wlc_phy_rxcal_physetup_nphy()
26866 pi->tx_rx_cal_phy_saveregs[9] = read_phy_reg(pi, 0x297); in wlc_phy_rxcal_physetup_nphy()
26867 pi->tx_rx_cal_phy_saveregs[10] = read_phy_reg(pi, 0x29b); in wlc_phy_rxcal_physetup_nphy()
26868 mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x297 : in wlc_phy_rxcal_physetup_nphy()
26871 mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x297 : in wlc_phy_rxcal_physetup_nphy()
26874 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rxcal_physetup_nphy()
26876 mod_phy_reg(pi, 0xa2, (0xf << 0), (1 << tx_core) << 0); in wlc_phy_rxcal_physetup_nphy()
26878 mod_phy_reg(pi, 0xa2, (0xf << 12), (1 << (1 - rx_core)) << 12); in wlc_phy_rxcal_physetup_nphy()
26882 mod_phy_reg(pi, 0xa2, (0xf << 12), (1 << tx_core) << 12); in wlc_phy_rxcal_physetup_nphy()
26883 mod_phy_reg(pi, 0xa2, (0xf << 0), (1 << tx_core) << 0); in wlc_phy_rxcal_physetup_nphy()
26884 mod_phy_reg(pi, 0xa2, (0xf << 4), (1 << rx_core) << 4); in wlc_phy_rxcal_physetup_nphy()
26885 mod_phy_reg(pi, 0xa2, (0xf << 8), (1 << rx_core) << 8); in wlc_phy_rxcal_physetup_nphy()
26888 mod_phy_reg(pi, ((rx_core == PHY_CORE_0) ? 0xa6 : 0xa7), (0x1 << 2), 0); in wlc_phy_rxcal_physetup_nphy()
26889 mod_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0x8f : 0xa5, in wlc_phy_rxcal_physetup_nphy()
26891 if (NREV_LT(pi->pubpi.phy_rev, 7)) { in wlc_phy_rxcal_physetup_nphy()
26892 mod_phy_reg(pi, ((rx_core == PHY_CORE_0) ? 0xa6 : 0xa7), in wlc_phy_rxcal_physetup_nphy()
26894 mod_phy_reg(pi, (rx_core == PHY_CORE_0) ? in wlc_phy_rxcal_physetup_nphy()
26899 wlc_phy_rfctrlintc_override_nphy(pi, NPHY_RfctrlIntc_override_PA, 0, in wlc_phy_rxcal_physetup_nphy()
26903 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rxcal_physetup_nphy()
26904 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), in wlc_phy_rxcal_physetup_nphy()
26907 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 9), 0, 0, 0, in wlc_phy_rxcal_physetup_nphy()
26909 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 10), 1, 0, 0, in wlc_phy_rxcal_physetup_nphy()
26911 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 0), 1, 0, 0, in wlc_phy_rxcal_physetup_nphy()
26913 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 1), 1, 0, 0, in wlc_phy_rxcal_physetup_nphy()
26915 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 11), 0, 0, 0, in wlc_phy_rxcal_physetup_nphy()
26917 if (CHSPEC_IS40(pi->radio_chanspec)) in wlc_phy_rxcal_physetup_nphy()
26919 pi, in wlc_phy_rxcal_physetup_nphy()
26925 pi, in wlc_phy_rxcal_physetup_nphy()
26930 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 7), in wlc_phy_rxcal_physetup_nphy()
26933 wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 5), 0, 0, 0, in wlc_phy_rxcal_physetup_nphy()
26936 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 0, 3, 0); in wlc_phy_rxcal_physetup_nphy()
26939 wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX); in wlc_phy_rxcal_physetup_nphy()
26941 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rxcal_physetup_nphy()
26943 wlc_phy_rfctrlintc_override_nphy(pi, in wlc_phy_rxcal_physetup_nphy()
26956 wlc_phy_rfctrlintc_override_nphy(pi, in wlc_phy_rxcal_physetup_nphy()
26959 wlc_phy_rfctrlintc_override_nphy(pi, in wlc_phy_rxcal_physetup_nphy()
26965 static void wlc_phy_rxcal_phycleanup_nphy(struct brcms_phy *pi, u8 rx_core) in wlc_phy_rxcal_phycleanup_nphy() argument
26968 write_phy_reg(pi, 0xa2, pi->tx_rx_cal_phy_saveregs[0]); in wlc_phy_rxcal_phycleanup_nphy()
26969 write_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0xa6 : 0xa7, in wlc_phy_rxcal_phycleanup_nphy()
26970 pi->tx_rx_cal_phy_saveregs[1]); in wlc_phy_rxcal_phycleanup_nphy()
26971 write_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0x8f : 0xa5, in wlc_phy_rxcal_phycleanup_nphy()
26972 pi->tx_rx_cal_phy_saveregs[2]); in wlc_phy_rxcal_phycleanup_nphy()
26973 write_phy_reg(pi, 0x91, pi->tx_rx_cal_phy_saveregs[3]); in wlc_phy_rxcal_phycleanup_nphy()
26974 write_phy_reg(pi, 0x92, pi->tx_rx_cal_phy_saveregs[4]); in wlc_phy_rxcal_phycleanup_nphy()
26976 write_phy_reg(pi, 0x7a, pi->tx_rx_cal_phy_saveregs[5]); in wlc_phy_rxcal_phycleanup_nphy()
26977 write_phy_reg(pi, 0x7d, pi->tx_rx_cal_phy_saveregs[6]); in wlc_phy_rxcal_phycleanup_nphy()
26978 write_phy_reg(pi, 0xe7, pi->tx_rx_cal_phy_saveregs[7]); in wlc_phy_rxcal_phycleanup_nphy()
26979 write_phy_reg(pi, 0xec, pi->tx_rx_cal_phy_saveregs[8]); in wlc_phy_rxcal_phycleanup_nphy()
26980 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rxcal_phycleanup_nphy()
26981 write_phy_reg(pi, 0x342, pi->tx_rx_cal_phy_saveregs[11]); in wlc_phy_rxcal_phycleanup_nphy()
26982 write_phy_reg(pi, 0x343, pi->tx_rx_cal_phy_saveregs[12]); in wlc_phy_rxcal_phycleanup_nphy()
26983 write_phy_reg(pi, 0x346, pi->tx_rx_cal_phy_saveregs[13]); in wlc_phy_rxcal_phycleanup_nphy()
26984 write_phy_reg(pi, 0x347, pi->tx_rx_cal_phy_saveregs[14]); in wlc_phy_rxcal_phycleanup_nphy()
26987 write_phy_reg(pi, 0x297, pi->tx_rx_cal_phy_saveregs[9]); in wlc_phy_rxcal_phycleanup_nphy()
26988 write_phy_reg(pi, 0x29b, pi->tx_rx_cal_phy_saveregs[10]); in wlc_phy_rxcal_phycleanup_nphy()
26992 wlc_phy_rxcal_gainctrl_nphy_rev5(struct brcms_phy *pi, u8 rx_core, in wlc_phy_rxcal_gainctrl_nphy_rev5() argument
27014 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_rxcal_gainctrl_nphy_rev5()
27022 wlc_phy_rx_iq_coeffs_nphy(pi, 0, &save_comp); in wlc_phy_rxcal_gainctrl_nphy_rev5()
27024 wlc_phy_rx_iq_coeffs_nphy(pi, 1, &zero_comp); in wlc_phy_rxcal_gainctrl_nphy_rev5()
27026 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_rxcal_gainctrl_nphy_rev5()
27027 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_rxcal_gainctrl_nphy_rev5()
27029 else if (NREV_GE(pi->pubpi.phy_rev, 4)) in wlc_phy_rxcal_gainctrl_nphy_rev5()
27033 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_rxcal_gainctrl_nphy_rev5()
27038 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_rxcal_gainctrl_nphy_rev5()
27046 hpvga = (NREV_GE(pi->pubpi.phy_rev, 7)) ? in wlc_phy_rxcal_gainctrl_nphy_rev5()
27054 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_rxcal_gainctrl_nphy_rev5()
27056 pi, in wlc_phy_rxcal_gainctrl_nphy_rev5()
27063 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), in wlc_phy_rxcal_gainctrl_nphy_rev5()
27071 pi->nphy_rxcal_pwr_idx[tx_core] = txpwrindex; in wlc_phy_rxcal_gainctrl_nphy_rev5()
27074 nphy_rxcal_txgain[0] = 0x8ff0 | pi->nphy_gmval; in wlc_phy_rxcal_gainctrl_nphy_rev5()
27075 nphy_rxcal_txgain[1] = 0x8ff0 | pi->nphy_gmval; in wlc_phy_rxcal_gainctrl_nphy_rev5()
27076 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, in wlc_phy_rxcal_gainctrl_nphy_rev5()
27080 wlc_phy_txpwr_index_nphy(pi, tx_core + 1, txpwrindex, in wlc_phy_rxcal_gainctrl_nphy_rev5()
27084 wlc_phy_tx_tone_nphy(pi, (CHSPEC_IS40(pi->radio_chanspec)) ? in wlc_phy_rxcal_gainctrl_nphy_rev5()
27089 wlc_phy_rx_iq_est_nphy(pi, est, num_samps, 32, 0); in wlc_phy_rxcal_gainctrl_nphy_rev5()
27142 wlc_phy_stopplayback_nphy(pi); in wlc_phy_rxcal_gainctrl_nphy_rev5()
27155 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_rxcal_gainctrl_nphy_rev5()
27164 pi, in wlc_phy_rxcal_gainctrl_nphy_rev5()
27173 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), in wlc_phy_rxcal_gainctrl_nphy_rev5()
27191 wlc_phy_rx_iq_coeffs_nphy(pi, 1, &save_comp); in wlc_phy_rxcal_gainctrl_nphy_rev5()
27195 wlc_phy_rxcal_gainctrl_nphy(struct brcms_phy *pi, u8 rx_core, u16 *rxgain, in wlc_phy_rxcal_gainctrl_nphy() argument
27198 wlc_phy_rxcal_gainctrl_nphy_rev5(pi, rx_core, rxgain, cal_type); in wlc_phy_rxcal_gainctrl_nphy()
27202 wlc_phy_rc_sweep_nphy(struct brcms_phy *pi, u8 core_idx, u8 loopback_type) in wlc_phy_rc_sweep_nphy() argument
27236 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_rc_sweep_nphy()
27241 if (CHSPEC_IS40(pi->radio_chanspec)) { in wlc_phy_rc_sweep_nphy()
27264 read_radio_reg(pi, in wlc_phy_rc_sweep_nphy()
27268 read_radio_reg(pi, in wlc_phy_rc_sweep_nphy()
27272 orig_dcBypass = ((read_phy_reg(pi, 0x48) >> 8) & 1); in wlc_phy_rc_sweep_nphy()
27274 orig_RxStrnFilt40Num[0] = read_phy_reg(pi, 0x267); in wlc_phy_rc_sweep_nphy()
27275 orig_RxStrnFilt40Num[1] = read_phy_reg(pi, 0x268); in wlc_phy_rc_sweep_nphy()
27276 orig_RxStrnFilt40Num[2] = read_phy_reg(pi, 0x269); in wlc_phy_rc_sweep_nphy()
27277 orig_RxStrnFilt40Den[0] = read_phy_reg(pi, 0x26a); in wlc_phy_rc_sweep_nphy()
27278 orig_RxStrnFilt40Den[1] = read_phy_reg(pi, 0x26b); in wlc_phy_rc_sweep_nphy()
27279 orig_RxStrnFilt40Num[3] = read_phy_reg(pi, 0x26c); in wlc_phy_rc_sweep_nphy()
27280 orig_RxStrnFilt40Num[4] = read_phy_reg(pi, 0x26d); in wlc_phy_rc_sweep_nphy()
27281 orig_RxStrnFilt40Num[5] = read_phy_reg(pi, 0x26e); in wlc_phy_rc_sweep_nphy()
27282 orig_RxStrnFilt40Den[2] = read_phy_reg(pi, 0x26f); in wlc_phy_rc_sweep_nphy()
27283 orig_RxStrnFilt40Den[3] = read_phy_reg(pi, 0x270); in wlc_phy_rc_sweep_nphy()
27285 orig_rfctrloverride[0] = read_phy_reg(pi, 0xe7); in wlc_phy_rc_sweep_nphy()
27286 orig_rfctrloverride[1] = read_phy_reg(pi, 0xec); in wlc_phy_rc_sweep_nphy()
27287 orig_rfctrlauxreg[0] = read_phy_reg(pi, 0xf8); in wlc_phy_rc_sweep_nphy()
27288 orig_rfctrlauxreg[1] = read_phy_reg(pi, 0xfa); in wlc_phy_rc_sweep_nphy()
27289 orig_rfctrlrssiothers = read_phy_reg(pi, (core_idx == 0) ? 0x7a : 0x7d); in wlc_phy_rc_sweep_nphy()
27291 write_radio_reg(pi, (RADIO_2056_TX_TXLPF_RCCAL | radio_addr_offset_tx), in wlc_phy_rc_sweep_nphy()
27294 write_radio_reg(pi, in wlc_phy_rc_sweep_nphy()
27298 mod_phy_reg(pi, 0x48, (0x1 << 8), (0x1 << 8)); in wlc_phy_rc_sweep_nphy()
27300 write_phy_reg(pi, 0x267, 0x02d4); in wlc_phy_rc_sweep_nphy()
27301 write_phy_reg(pi, 0x268, 0x0000); in wlc_phy_rc_sweep_nphy()
27302 write_phy_reg(pi, 0x269, 0x0000); in wlc_phy_rc_sweep_nphy()
27303 write_phy_reg(pi, 0x26a, 0x0000); in wlc_phy_rc_sweep_nphy()
27304 write_phy_reg(pi, 0x26b, 0x0000); in wlc_phy_rc_sweep_nphy()
27305 write_phy_reg(pi, 0x26c, 0x02d4); in wlc_phy_rc_sweep_nphy()
27306 write_phy_reg(pi, 0x26d, 0x0000); in wlc_phy_rc_sweep_nphy()
27307 write_phy_reg(pi, 0x26e, 0x0000); in wlc_phy_rc_sweep_nphy()
27308 write_phy_reg(pi, 0x26f, 0x0000); in wlc_phy_rc_sweep_nphy()
27309 write_phy_reg(pi, 0x270, 0x0000); in wlc_phy_rc_sweep_nphy()
27311 or_phy_reg(pi, (core_idx == 0) ? 0xe7 : 0xec, (0x1 << 8)); in wlc_phy_rc_sweep_nphy()
27312 or_phy_reg(pi, (core_idx == 0) ? 0xec : 0xe7, (0x1 << 15)); in wlc_phy_rc_sweep_nphy()
27313 or_phy_reg(pi, (core_idx == 0) ? 0xe7 : 0xec, (0x1 << 9)); in wlc_phy_rc_sweep_nphy()
27314 or_phy_reg(pi, (core_idx == 0) ? 0xe7 : 0xec, (0x1 << 10)); in wlc_phy_rc_sweep_nphy()
27316 mod_phy_reg(pi, (core_idx == 0) ? 0xfa : 0xf8, in wlc_phy_rc_sweep_nphy()
27318 mod_phy_reg(pi, (core_idx == 0) ? 0xf8 : 0xfa, in wlc_phy_rc_sweep_nphy()
27320 mod_phy_reg(pi, (core_idx == 0) ? 0xf8 : 0xfa, in wlc_phy_rc_sweep_nphy()
27322 mod_phy_reg(pi, (core_idx == 0) ? 0x7a : 0x7d, in wlc_phy_rc_sweep_nphy()
27329 write_radio_reg(pi, in wlc_phy_rc_sweep_nphy()
27335 wlc_phy_tx_tone_nphy(pi, ref_tone, NPHY_RXCAL_TONEAMP, in wlc_phy_rc_sweep_nphy()
27339 wlc_phy_rx_iq_est_nphy(pi, est, num_samps, 32, 0); in wlc_phy_rc_sweep_nphy()
27354 wlc_phy_tx_tone_nphy(pi, target_bw, NPHY_RXCAL_TONEAMP, in wlc_phy_rc_sweep_nphy()
27359 wlc_phy_rx_iq_est_nphy(pi, est, num_samps, 32, 0); in wlc_phy_rc_sweep_nphy()
27392 if (CHSPEC_IS40(pi->radio_chanspec)) { in wlc_phy_rc_sweep_nphy()
27402 write_radio_reg(pi, in wlc_phy_rc_sweep_nphy()
27408 wlc_phy_stopplayback_nphy(pi); in wlc_phy_rc_sweep_nphy()
27410 write_radio_reg(pi, (RADIO_2056_TX_TXLPF_RCCAL | radio_addr_offset_tx), in wlc_phy_rc_sweep_nphy()
27412 write_radio_reg(pi, in wlc_phy_rc_sweep_nphy()
27416 mod_phy_reg(pi, 0x48, (0x1 << 8), (orig_dcBypass << 8)); in wlc_phy_rc_sweep_nphy()
27418 write_phy_reg(pi, 0x267, orig_RxStrnFilt40Num[0]); in wlc_phy_rc_sweep_nphy()
27419 write_phy_reg(pi, 0x268, orig_RxStrnFilt40Num[1]); in wlc_phy_rc_sweep_nphy()
27420 write_phy_reg(pi, 0x269, orig_RxStrnFilt40Num[2]); in wlc_phy_rc_sweep_nphy()
27421 write_phy_reg(pi, 0x26a, orig_RxStrnFilt40Den[0]); in wlc_phy_rc_sweep_nphy()
27422 write_phy_reg(pi, 0x26b, orig_RxStrnFilt40Den[1]); in wlc_phy_rc_sweep_nphy()
27423 write_phy_reg(pi, 0x26c, orig_RxStrnFilt40Num[3]); in wlc_phy_rc_sweep_nphy()
27424 write_phy_reg(pi, 0x26d, orig_RxStrnFilt40Num[4]); in wlc_phy_rc_sweep_nphy()
27425 write_phy_reg(pi, 0x26e, orig_RxStrnFilt40Num[5]); in wlc_phy_rc_sweep_nphy()
27426 write_phy_reg(pi, 0x26f, orig_RxStrnFilt40Den[2]); in wlc_phy_rc_sweep_nphy()
27427 write_phy_reg(pi, 0x270, orig_RxStrnFilt40Den[3]); in wlc_phy_rc_sweep_nphy()
27429 write_phy_reg(pi, 0xe7, orig_rfctrloverride[0]); in wlc_phy_rc_sweep_nphy()
27430 write_phy_reg(pi, 0xec, orig_rfctrloverride[1]); in wlc_phy_rc_sweep_nphy()
27431 write_phy_reg(pi, 0xf8, orig_rfctrlauxreg[0]); in wlc_phy_rc_sweep_nphy()
27432 write_phy_reg(pi, 0xfa, orig_rfctrlauxreg[1]); in wlc_phy_rc_sweep_nphy()
27433 write_phy_reg(pi, (core_idx == 0) ? 0x7a : 0x7d, orig_rfctrlrssiothers); in wlc_phy_rc_sweep_nphy()
27435 pi->nphy_anarxlpf_adjusted = false; in wlc_phy_rc_sweep_nphy()
27441 static int wlc_phy_cal_rxiq_nphy_rev3(struct brcms_phy *pi, in wlc_phy_cal_rxiq_nphy_rev3() argument
27457 orig_BBConfig = read_phy_reg(pi, 0x01); in wlc_phy_cal_rxiq_nphy_rev3()
27458 mod_phy_reg(pi, 0x01, (0x1 << 15), 0); in wlc_phy_cal_rxiq_nphy_rev3()
27460 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_cal_rxiq_nphy_rev3()
27462 if (NREV_GE(pi->pubpi.phy_rev, 4)) { in wlc_phy_cal_rxiq_nphy_rev3()
27463 phyhang_avoid_state = pi->phyhang_avoid; in wlc_phy_cal_rxiq_nphy_rev3()
27464 pi->phyhang_avoid = false; in wlc_phy_cal_rxiq_nphy_rev3()
27467 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, gain_save); in wlc_phy_cal_rxiq_nphy_rev3()
27470 wlc_phy_iqcal_gainparams_nphy(pi, core_no, target_gain, in wlc_phy_cal_rxiq_nphy_rev3()
27475 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, cal_gain); in wlc_phy_cal_rxiq_nphy_rev3()
27478 (struct brcms_phy_pub *) pi); in wlc_phy_cal_rxiq_nphy_rev3()
27480 for (rx_core = 0; rx_core < pi->pubpi.phy_corenum; rx_core++) { in wlc_phy_cal_rxiq_nphy_rev3()
27485 wlc_phy_rxcal_physetup_nphy(pi, rx_core); in wlc_phy_cal_rxiq_nphy_rev3()
27487 wlc_phy_rxcal_radio_setup_nphy(pi, rx_core); in wlc_phy_cal_rxiq_nphy_rev3()
27491 wlc_phy_rxcal_gainctrl_nphy(pi, rx_core, NULL, 0); in wlc_phy_cal_rxiq_nphy_rev3()
27493 wlc_phy_tx_tone_nphy(pi, in wlc_phy_cal_rxiq_nphy_rev3()
27495 pi->radio_chanspec)) ? in wlc_phy_cal_rxiq_nphy_rev3()
27504 wlc_phy_calc_rx_iq_comp_nphy(pi, rx_core + 1); in wlc_phy_cal_rxiq_nphy_rev3()
27505 wlc_phy_stopplayback_nphy(pi); in wlc_phy_cal_rxiq_nphy_rev3()
27509 && NREV_LT(pi->pubpi.phy_rev, 7)) { in wlc_phy_cal_rxiq_nphy_rev3()
27515 (struct brcms_phy_pub *) pi, 3); in wlc_phy_cal_rxiq_nphy_rev3()
27517 wlc_phy_rxcal_gainctrl_nphy(pi, rx_core, NULL, in wlc_phy_cal_rxiq_nphy_rev3()
27521 wlc_phy_rc_sweep_nphy(pi, rx_core, 1); in wlc_phy_cal_rxiq_nphy_rev3()
27522 pi->nphy_rccal_value = best_rccal[rx_core]; in wlc_phy_cal_rxiq_nphy_rev3()
27526 (struct brcms_phy_pub *) pi, in wlc_phy_cal_rxiq_nphy_rev3()
27531 wlc_phy_rxcal_radio_cleanup_nphy(pi, rx_core); in wlc_phy_cal_rxiq_nphy_rev3()
27533 wlc_phy_rxcal_phycleanup_nphy(pi, rx_core); in wlc_phy_cal_rxiq_nphy_rev3()
27534 wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); in wlc_phy_cal_rxiq_nphy_rev3()
27540 write_radio_reg(pi, in wlc_phy_cal_rxiq_nphy_rev3()
27544 for (rx_core = 0; rx_core < pi->pubpi.phy_corenum; rx_core++) { in wlc_phy_cal_rxiq_nphy_rev3()
27549 if (PHY_IPA(pi)) { in wlc_phy_cal_rxiq_nphy_rev3()
27551 (pi->bw == WL_CHANSPEC_BW_40) ? 24 : 12; in wlc_phy_cal_rxiq_nphy_rev3()
27552 txlpf_idac = (pi->bw == WL_CHANSPEC_BW_40) ? in wlc_phy_cal_rxiq_nphy_rev3()
27554 WRITE_RADIO_REG2(pi, RADIO_2056, TX, rx_core, in wlc_phy_cal_rxiq_nphy_rev3()
27563 write_radio_reg(pi, (RADIO_2056_RX_RXLPF_RCCAL_HPC | in wlc_phy_cal_rxiq_nphy_rev3()
27569 write_radio_reg(pi, (RADIO_2056_TX_TXLPF_RCCAL | in wlc_phy_cal_rxiq_nphy_rev3()
27577 write_phy_reg(pi, 0x01, orig_BBConfig); in wlc_phy_cal_rxiq_nphy_rev3()
27579 wlc_phy_resetcca_nphy(pi); in wlc_phy_cal_rxiq_nphy_rev3()
27581 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_cal_rxiq_nphy_rev3()
27583 pi, in wlc_phy_cal_rxiq_nphy_rev3()
27587 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), 0, 0x3, 1); in wlc_phy_cal_rxiq_nphy_rev3()
27589 wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); in wlc_phy_cal_rxiq_nphy_rev3()
27591 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, in wlc_phy_cal_rxiq_nphy_rev3()
27594 if (NREV_GE(pi->pubpi.phy_rev, 4)) in wlc_phy_cal_rxiq_nphy_rev3()
27595 pi->phyhang_avoid = phyhang_avoid_state; in wlc_phy_cal_rxiq_nphy_rev3()
27597 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_cal_rxiq_nphy_rev3()
27603 wlc_phy_cal_rxiq_nphy_rev2(struct brcms_phy *pi, in wlc_phy_cal_rxiq_nphy_rev2() argument
27627 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_cal_rxiq_nphy_rev2()
27629 if (NREV_LT(pi->pubpi.phy_rev, 2)) in wlc_phy_cal_rxiq_nphy_rev2()
27630 wlc_phy_reapply_txcal_coeffs_nphy(pi); in wlc_phy_cal_rxiq_nphy_rev2()
27632 wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, gain_save); in wlc_phy_cal_rxiq_nphy_rev2()
27635 wlc_phy_iqcal_gainparams_nphy(pi, core_no, target_gain, in wlc_phy_cal_rxiq_nphy_rev2()
27640 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, cal_gain); in wlc_phy_cal_rxiq_nphy_rev2()
27650 orig_RfseqCoreActv = read_phy_reg(pi, 0xa2); in wlc_phy_cal_rxiq_nphy_rev2()
27651 orig_AfectrlCore = read_phy_reg(pi, (rx_core == PHY_CORE_0) ? in wlc_phy_cal_rxiq_nphy_rev2()
27653 orig_AfectrlOverride = read_phy_reg(pi, 0xa5); in wlc_phy_cal_rxiq_nphy_rev2()
27654 orig_RfctrlIntcRx = read_phy_reg(pi, (rx_core == PHY_CORE_0) ? in wlc_phy_cal_rxiq_nphy_rev2()
27656 orig_RfctrlIntcTx = read_phy_reg(pi, (tx_core == PHY_CORE_0) ? in wlc_phy_cal_rxiq_nphy_rev2()
27659 mod_phy_reg(pi, 0xa2, (0xf << 12), (1 << tx_core) << 12); in wlc_phy_cal_rxiq_nphy_rev2()
27660 mod_phy_reg(pi, 0xa2, (0xf << 0), (1 << tx_core) << 0); in wlc_phy_cal_rxiq_nphy_rev2()
27662 or_phy_reg(pi, ((rx_core == PHY_CORE_0) ? 0xa6 : 0xa7), in wlc_phy_cal_rxiq_nphy_rev2()
27664 or_phy_reg(pi, 0xa5, ((0x1 << 1) | (0x1 << 2))); in wlc_phy_cal_rxiq_nphy_rev2()
27666 if (((pi->nphy_rxcalparams) & 0xff000000)) in wlc_phy_cal_rxiq_nphy_rev2()
27667 write_phy_reg(pi, in wlc_phy_cal_rxiq_nphy_rev2()
27669 (CHSPEC_IS5G(pi->radio_chanspec) ? in wlc_phy_cal_rxiq_nphy_rev2()
27672 write_phy_reg(pi, in wlc_phy_cal_rxiq_nphy_rev2()
27674 (CHSPEC_IS5G(pi->radio_chanspec) ? in wlc_phy_cal_rxiq_nphy_rev2()
27677 write_phy_reg(pi, (tx_core == PHY_CORE_0) ? 0x91 : 0x92, in wlc_phy_cal_rxiq_nphy_rev2()
27678 (CHSPEC_IS5G(pi->radio_chanspec) ? 0x148 : in wlc_phy_cal_rxiq_nphy_rev2()
27690 if ((pi->nphy_rxcalparams & 0x10000)) { in wlc_phy_cal_rxiq_nphy_rev2()
27691 mod_radio_reg(pi, RADIO_2055_CORE1_GEN_SPARE2, mask, in wlc_phy_cal_rxiq_nphy_rev2()
27693 mod_radio_reg(pi, RADIO_2055_CORE2_GEN_SPARE2, mask, in wlc_phy_cal_rxiq_nphy_rev2()
27747 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 10), in wlc_phy_cal_rxiq_nphy_rev2()
27751 wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); in wlc_phy_cal_rxiq_nphy_rev2()
27753 wlc_phy_stopplayback_nphy(pi); in wlc_phy_cal_rxiq_nphy_rev2()
27756 bcmerror = wlc_phy_tx_tone_nphy(pi, 4000, in wlc_phy_cal_rxiq_nphy_rev2()
27757 (u16) (pi->nphy_rxcalparams & in wlc_phy_cal_rxiq_nphy_rev2()
27761 phy_bw = (CHSPEC_IS40(pi->radio_chanspec)) ? in wlc_phy_cal_rxiq_nphy_rev2()
27763 wlc_phy_runsamples_nphy(pi, phy_bw * 8, 0xffff, in wlc_phy_cal_rxiq_nphy_rev2()
27770 wlc_phy_rx_iq_est_nphy(pi, est, in wlc_phy_cal_rxiq_nphy_rev2()
27780 wlc_phy_calc_rx_iq_comp_nphy(pi, in wlc_phy_cal_rxiq_nphy_rev2()
27785 wlc_phy_stopplayback_nphy(pi); in wlc_phy_cal_rxiq_nphy_rev2()
27792 and_radio_reg(pi, RADIO_2055_CORE1_GEN_SPARE2, ~mask); in wlc_phy_cal_rxiq_nphy_rev2()
27793 and_radio_reg(pi, RADIO_2055_CORE2_GEN_SPARE2, ~mask); in wlc_phy_cal_rxiq_nphy_rev2()
27795 write_phy_reg(pi, (tx_core == PHY_CORE_0) ? 0x91 : in wlc_phy_cal_rxiq_nphy_rev2()
27797 write_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0x91 : in wlc_phy_cal_rxiq_nphy_rev2()
27799 write_phy_reg(pi, 0xa5, orig_AfectrlOverride); in wlc_phy_cal_rxiq_nphy_rev2()
27800 write_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0xa6 : in wlc_phy_cal_rxiq_nphy_rev2()
27802 write_phy_reg(pi, 0xa2, orig_RfseqCoreActv); in wlc_phy_cal_rxiq_nphy_rev2()
27808 wlc_phy_rfctrl_override_nphy(pi, (0x1 << 10), 0, 0x3, 1); in wlc_phy_cal_rxiq_nphy_rev2()
27809 wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); in wlc_phy_cal_rxiq_nphy_rev2()
27811 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, in wlc_phy_cal_rxiq_nphy_rev2()
27814 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_cal_rxiq_nphy_rev2()
27820 wlc_phy_cal_rxiq_nphy(struct brcms_phy *pi, struct nphy_txgains target_gain, in wlc_phy_cal_rxiq_nphy() argument
27823 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_cal_rxiq_nphy()
27826 if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_cal_rxiq_nphy()
27827 return wlc_phy_cal_rxiq_nphy_rev3(pi, target_gain, cal_type, in wlc_phy_cal_rxiq_nphy()
27830 return wlc_phy_cal_rxiq_nphy_rev2(pi, target_gain, debug); in wlc_phy_cal_rxiq_nphy()
27833 void wlc_phy_txpwr_fixpower_nphy(struct brcms_phy *pi) in wlc_phy_txpwr_fixpower_nphy() argument
27841 if (pi->phyhang_avoid) in wlc_phy_txpwr_fixpower_nphy()
27842 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_txpwr_fixpower_nphy()
27844 if (pi->sh->sromrev < 4) { in wlc_phy_txpwr_fixpower_nphy()
27848 chan_freq_range = wlc_phy_get_chan_freq_range_nphy(pi, 0); in wlc_phy_txpwr_fixpower_nphy()
27863 if (NREV_GE(pi->pubpi.phy_rev, 7)) in wlc_phy_txpwr_fixpower_nphy()
27865 else if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_txpwr_fixpower_nphy()
27868 if (NREV_LT(pi->pubpi.phy_rev, 7)) { in wlc_phy_txpwr_fixpower_nphy()
27875 pi->nphy_txpwrindex[PHY_CORE_0].index_internal = txpi[0]; in wlc_phy_txpwr_fixpower_nphy()
27876 pi->nphy_txpwrindex[PHY_CORE_1].index_internal = txpi[1]; in wlc_phy_txpwr_fixpower_nphy()
27877 pi->nphy_txpwrindex[PHY_CORE_0].index_internal_save = txpi[0]; in wlc_phy_txpwr_fixpower_nphy()
27878 pi->nphy_txpwrindex[PHY_CORE_1].index_internal_save = txpi[1]; in wlc_phy_txpwr_fixpower_nphy()
27880 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_txpwr_fixpower_nphy()
27881 uint phyrev = pi->pubpi.phy_rev; in wlc_phy_txpwr_fixpower_nphy()
27884 if (PHY_IPA(pi)) { in wlc_phy_txpwr_fixpower_nphy()
27886 wlc_phy_get_ipa_gaintbl_nphy(pi); in wlc_phy_txpwr_fixpower_nphy()
27889 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_txpwr_fixpower_nphy()
27896 pi->srom_fem5g.extpagain == in wlc_phy_txpwr_fixpower_nphy()
27909 (pi->srom_fem2g.extpagain == 3)) { in wlc_phy_txpwr_fixpower_nphy()
27936 mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0x8f : in wlc_phy_txpwr_fixpower_nphy()
27939 mod_phy_reg(pi, 0xa5, (0x1 << 14), (0x1 << 14)); in wlc_phy_txpwr_fixpower_nphy()
27941 write_phy_reg(pi, (core == PHY_CORE_0) ? 0xaa : 0xab, dac_gain); in wlc_phy_txpwr_fixpower_nphy()
27943 wlc_phy_table_write_nphy(pi, 7, 1, (0x110 + core), 16, in wlc_phy_txpwr_fixpower_nphy()
27946 wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &m1m2); in wlc_phy_txpwr_fixpower_nphy()
27949 wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &m1m2); in wlc_phy_txpwr_fixpower_nphy()
27951 if (PHY_IPA(pi)) { in wlc_phy_txpwr_fixpower_nphy()
27952 wlc_phy_table_read_nphy(pi, in wlc_phy_txpwr_fixpower_nphy()
27960 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : in wlc_phy_txpwr_fixpower_nphy()
27964 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : in wlc_phy_txpwr_fixpower_nphy()
27970 and_phy_reg(pi, 0xbf, (u16) (~(0x1f << 0))); in wlc_phy_txpwr_fixpower_nphy()
27972 if (pi->phyhang_avoid) in wlc_phy_txpwr_fixpower_nphy()
27973 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_txpwr_fixpower_nphy()
28032 void wlc_phy_txpwr_apply_nphy(struct brcms_phy *pi) in wlc_phy_txpwr_apply_nphy() argument
28045 tmp_max_pwr = min(pi->nphy_pwrctrl_info[0].max_pwr_2g, in wlc_phy_txpwr_apply_nphy()
28046 pi->nphy_pwrctrl_info[1].max_pwr_2g); in wlc_phy_txpwr_apply_nphy()
28048 pwr_offsets1[0] = pi->cck2gpo; in wlc_phy_txpwr_apply_nphy()
28049 wlc_phy_txpwr_nphy_srom_convert(pi->tx_srom_max_rate_2g, in wlc_phy_txpwr_apply_nphy()
28055 pwr_offsets1[0] = (u16) (pi->ofdm2gpo & 0xffff); in wlc_phy_txpwr_apply_nphy()
28057 (u16) (pi->ofdm2gpo >> 16) & 0xffff; in wlc_phy_txpwr_apply_nphy()
28059 pwr_offsets2 = pi->mcs2gpo; in wlc_phy_txpwr_apply_nphy()
28061 tmp_cddpo = pi->cdd2gpo; in wlc_phy_txpwr_apply_nphy()
28062 tmp_stbcpo = pi->stbc2gpo; in wlc_phy_txpwr_apply_nphy()
28063 tmp_bw40po = pi->bw402gpo; in wlc_phy_txpwr_apply_nphy()
28065 tx_srom_max_rate = pi->tx_srom_max_rate_2g; in wlc_phy_txpwr_apply_nphy()
28069 tmp_max_pwr = min(pi->nphy_pwrctrl_info[0].max_pwr_5gm, in wlc_phy_txpwr_apply_nphy()
28070 pi->nphy_pwrctrl_info[1].max_pwr_5gm); in wlc_phy_txpwr_apply_nphy()
28072 pwr_offsets1[0] = (u16) (pi->ofdm5gpo & 0xffff); in wlc_phy_txpwr_apply_nphy()
28074 (u16) (pi->ofdm5gpo >> 16) & 0xffff; in wlc_phy_txpwr_apply_nphy()
28076 pwr_offsets2 = pi->mcs5gpo; in wlc_phy_txpwr_apply_nphy()
28078 tmp_cddpo = pi->cdd5gpo; in wlc_phy_txpwr_apply_nphy()
28079 tmp_stbcpo = pi->stbc5gpo; in wlc_phy_txpwr_apply_nphy()
28080 tmp_bw40po = pi->bw405gpo; in wlc_phy_txpwr_apply_nphy()
28082 tx_srom_max_rate = pi->tx_srom_max_rate_5g_mid; in wlc_phy_txpwr_apply_nphy()
28086 tmp_max_pwr = min(pi->nphy_pwrctrl_info[0].max_pwr_5gl, in wlc_phy_txpwr_apply_nphy()
28087 pi->nphy_pwrctrl_info[1].max_pwr_5gl); in wlc_phy_txpwr_apply_nphy()
28089 pwr_offsets1[0] = (u16) (pi->ofdm5glpo & 0xffff); in wlc_phy_txpwr_apply_nphy()
28091 (u16) (pi->ofdm5glpo >> 16) & 0xffff; in wlc_phy_txpwr_apply_nphy()
28093 pwr_offsets2 = pi->mcs5glpo; in wlc_phy_txpwr_apply_nphy()
28095 tmp_cddpo = pi->cdd5glpo; in wlc_phy_txpwr_apply_nphy()
28096 tmp_stbcpo = pi->stbc5glpo; in wlc_phy_txpwr_apply_nphy()
28097 tmp_bw40po = pi->bw405glpo; in wlc_phy_txpwr_apply_nphy()
28099 tx_srom_max_rate = pi->tx_srom_max_rate_5g_low; in wlc_phy_txpwr_apply_nphy()
28103 tmp_max_pwr = min(pi->nphy_pwrctrl_info[0].max_pwr_5gh, in wlc_phy_txpwr_apply_nphy()
28104 pi->nphy_pwrctrl_info[1].max_pwr_5gh); in wlc_phy_txpwr_apply_nphy()
28106 pwr_offsets1[0] = (u16) (pi->ofdm5ghpo & 0xffff); in wlc_phy_txpwr_apply_nphy()
28108 (u16) (pi->ofdm5ghpo >> 16) & 0xffff; in wlc_phy_txpwr_apply_nphy()
28110 pwr_offsets2 = pi->mcs5ghpo; in wlc_phy_txpwr_apply_nphy()
28112 tmp_cddpo = pi->cdd5ghpo; in wlc_phy_txpwr_apply_nphy()
28113 tmp_stbcpo = pi->stbc5ghpo; in wlc_phy_txpwr_apply_nphy()
28114 tmp_bw40po = pi->bw405ghpo; in wlc_phy_txpwr_apply_nphy()
28116 tx_srom_max_rate = pi->tx_srom_max_rate_5g_hi; in wlc_phy_txpwr_apply_nphy()
28134 if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_txpwr_apply_nphy()
28149 if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_txpwr_apply_nphy()
28214 if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_txpwr_apply_nphy()
28227 void wlc_phy_txpower_recalc_target_nphy(struct brcms_phy *pi) in wlc_phy_txpower_recalc_target_nphy() argument
28230 wlc_phy_txpwr_limit_to_tbl_nphy(pi); in wlc_phy_txpower_recalc_target_nphy()
28231 wlc_phy_txpwrctrl_pwr_setup_nphy(pi); in wlc_phy_txpower_recalc_target_nphy()
28233 tx_pwr_ctrl_state = pi->nphy_txpwrctrl; in wlc_phy_txpower_recalc_target_nphy()
28235 if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) { in wlc_phy_txpower_recalc_target_nphy()
28236 wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, MCTL_PHYLOCK); in wlc_phy_txpower_recalc_target_nphy()
28237 (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); in wlc_phy_txpower_recalc_target_nphy()
28241 wlc_phy_txpwrctrl_enable_nphy(pi, tx_pwr_ctrl_state); in wlc_phy_txpower_recalc_target_nphy()
28243 if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) in wlc_phy_txpower_recalc_target_nphy()
28244 wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, 0); in wlc_phy_txpower_recalc_target_nphy()
28247 static bool wlc_phy_txpwr_ison_nphy(struct brcms_phy *pi) in wlc_phy_txpwr_ison_nphy() argument
28249 return read_phy_reg((pi), 0x1e7) & ((0x1 << 15) | in wlc_phy_txpwr_ison_nphy()
28253 u16 wlc_phy_txpwr_idx_get_nphy(struct brcms_phy *pi) in wlc_phy_txpwr_idx_get_nphy() argument
28258 if (wlc_phy_txpwr_ison_nphy(pi)) { in wlc_phy_txpwr_idx_get_nphy()
28259 pwr_idx[0] = wlc_phy_txpwr_idx_cur_get_nphy(pi, PHY_CORE_0); in wlc_phy_txpwr_idx_get_nphy()
28260 pwr_idx[1] = wlc_phy_txpwr_idx_cur_get_nphy(pi, PHY_CORE_1); in wlc_phy_txpwr_idx_get_nphy()
28264 tmp = ((pi->nphy_txpwrindex[PHY_CORE_0].index_internal & 0xff) in wlc_phy_txpwr_idx_get_nphy()
28266 (pi->nphy_txpwrindex[PHY_CORE_1].index_internal & 0xff); in wlc_phy_txpwr_idx_get_nphy()
28272 void wlc_phy_txpwr_papd_cal_nphy(struct brcms_phy *pi) in wlc_phy_txpwr_papd_cal_nphy() argument
28274 if (PHY_IPA(pi) in wlc_phy_txpwr_papd_cal_nphy()
28275 && (pi->nphy_force_papd_cal in wlc_phy_txpwr_papd_cal_nphy()
28276 || (wlc_phy_txpwr_ison_nphy(pi) in wlc_phy_txpwr_papd_cal_nphy()
28279 abs(wlc_phy_txpwr_idx_cur_get_nphy(pi, 0) - in wlc_phy_txpwr_papd_cal_nphy()
28280 pi->nphy_papd_tx_gain_at_last_cal[0]) >= 4) in wlc_phy_txpwr_papd_cal_nphy()
28282 abs(wlc_phy_txpwr_idx_cur_get_nphy(pi, 1) - in wlc_phy_txpwr_papd_cal_nphy()
28283 pi->nphy_papd_tx_gain_at_last_cal[1]) >= 4))))) in wlc_phy_txpwr_papd_cal_nphy()
28284 wlc_phy_a4(pi, true); in wlc_phy_txpwr_papd_cal_nphy()
28287 void wlc_phy_txpwrctrl_enable_nphy(struct brcms_phy *pi, u8 ctrl_type) in wlc_phy_txpwrctrl_enable_nphy() argument
28296 if (pi->phyhang_avoid) in wlc_phy_txpwrctrl_enable_nphy()
28297 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_txpwrctrl_enable_nphy()
28302 pi->nphy_txpwrctrl = ctrl_type; in wlc_phy_txpwrctrl_enable_nphy()
28309 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwrctrl_enable_nphy()
28311 if (wlc_phy_txpwr_ison_nphy(pi)) { in wlc_phy_txpwrctrl_enable_nphy()
28312 for (core = 0; core < pi->pubpi.phy_corenum; in wlc_phy_txpwrctrl_enable_nphy()
28314 pi->nphy_txpwr_idx[core] = in wlc_phy_txpwrctrl_enable_nphy()
28316 pi, in wlc_phy_txpwrctrl_enable_nphy()
28326 wlc_phy_table_write_nphy(pi, 26, tbl_len, tbl_offset, 16, in wlc_phy_txpwrctrl_enable_nphy()
28328 wlc_phy_table_write_nphy(pi, 27, tbl_len, tbl_offset, 16, in wlc_phy_txpwrctrl_enable_nphy()
28331 if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_txpwrctrl_enable_nphy()
28332 and_phy_reg(pi, 0x1e7, in wlc_phy_txpwrctrl_enable_nphy()
28336 and_phy_reg(pi, 0x1e7, in wlc_phy_txpwrctrl_enable_nphy()
28339 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwrctrl_enable_nphy()
28340 or_phy_reg(pi, 0x8f, (0x1 << 8)); in wlc_phy_txpwrctrl_enable_nphy()
28341 or_phy_reg(pi, 0xa5, (0x1 << 8)); in wlc_phy_txpwrctrl_enable_nphy()
28343 or_phy_reg(pi, 0xa5, (0x1 << 14)); in wlc_phy_txpwrctrl_enable_nphy()
28346 if (NREV_IS(pi->pubpi.phy_rev, 2)) in wlc_phy_txpwrctrl_enable_nphy()
28347 mod_phy_reg(pi, 0xdc, 0x00ff, 0x53); in wlc_phy_txpwrctrl_enable_nphy()
28348 else if (NREV_LT(pi->pubpi.phy_rev, 2)) in wlc_phy_txpwrctrl_enable_nphy()
28349 mod_phy_reg(pi, 0xdc, 0x00ff, 0x5a); in wlc_phy_txpwrctrl_enable_nphy()
28351 if (NREV_LT(pi->pubpi.phy_rev, 2) && in wlc_phy_txpwrctrl_enable_nphy()
28352 pi->bw == WL_CHANSPEC_BW_40) in wlc_phy_txpwrctrl_enable_nphy()
28353 wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_IQSWAP_WAR, in wlc_phy_txpwrctrl_enable_nphy()
28358 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE1TXPWRCTL, 84, 64, in wlc_phy_txpwrctrl_enable_nphy()
28359 8, pi->adj_pwr_tbl_nphy); in wlc_phy_txpwrctrl_enable_nphy()
28360 wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE2TXPWRCTL, 84, 64, in wlc_phy_txpwrctrl_enable_nphy()
28361 8, pi->adj_pwr_tbl_nphy); in wlc_phy_txpwrctrl_enable_nphy()
28367 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwrctrl_enable_nphy()
28372 mod_phy_reg(pi, 0x1e7, mask, val); in wlc_phy_txpwrctrl_enable_nphy()
28374 if (CHSPEC_IS5G(pi->radio_chanspec)) { in wlc_phy_txpwrctrl_enable_nphy()
28375 if (NREV_GE(pi->pubpi.phy_rev, 7)) { in wlc_phy_txpwrctrl_enable_nphy()
28376 mod_phy_reg(pi, 0x1e7, (0x7f << 0), 0x32); in wlc_phy_txpwrctrl_enable_nphy()
28377 mod_phy_reg(pi, 0x222, (0xff << 0), 0x32); in wlc_phy_txpwrctrl_enable_nphy()
28379 mod_phy_reg(pi, 0x1e7, (0x7f << 0), 0x64); in wlc_phy_txpwrctrl_enable_nphy()
28380 if (NREV_GT(pi->pubpi.phy_rev, 1)) in wlc_phy_txpwrctrl_enable_nphy()
28381 mod_phy_reg(pi, 0x222, in wlc_phy_txpwrctrl_enable_nphy()
28386 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwrctrl_enable_nphy()
28387 if ((pi->nphy_txpwr_idx[0] != 128) in wlc_phy_txpwrctrl_enable_nphy()
28388 && (pi->nphy_txpwr_idx[1] != 128)) in wlc_phy_txpwrctrl_enable_nphy()
28389 wlc_phy_txpwr_idx_cur_set_nphy(pi, in wlc_phy_txpwrctrl_enable_nphy()
28390 pi-> in wlc_phy_txpwrctrl_enable_nphy()
28393 pi-> in wlc_phy_txpwrctrl_enable_nphy()
28398 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwrctrl_enable_nphy()
28399 and_phy_reg(pi, 0x8f, ~(0x1 << 8)); in wlc_phy_txpwrctrl_enable_nphy()
28400 and_phy_reg(pi, 0xa5, ~(0x1 << 8)); in wlc_phy_txpwrctrl_enable_nphy()
28402 and_phy_reg(pi, 0xa5, ~(0x1 << 14)); in wlc_phy_txpwrctrl_enable_nphy()
28405 if (NREV_IS(pi->pubpi.phy_rev, 2)) in wlc_phy_txpwrctrl_enable_nphy()
28406 mod_phy_reg(pi, 0xdc, 0x00ff, 0x3b); in wlc_phy_txpwrctrl_enable_nphy()
28407 else if (NREV_LT(pi->pubpi.phy_rev, 2)) in wlc_phy_txpwrctrl_enable_nphy()
28408 mod_phy_reg(pi, 0xdc, 0x00ff, 0x40); in wlc_phy_txpwrctrl_enable_nphy()
28410 if (NREV_LT(pi->pubpi.phy_rev, 2) && in wlc_phy_txpwrctrl_enable_nphy()
28411 pi->bw == WL_CHANSPEC_BW_40) in wlc_phy_txpwrctrl_enable_nphy()
28412 wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_IQSWAP_WAR, in wlc_phy_txpwrctrl_enable_nphy()
28415 if (PHY_IPA(pi)) { in wlc_phy_txpwrctrl_enable_nphy()
28416 mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x297 : in wlc_phy_txpwrctrl_enable_nphy()
28419 mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x297 : in wlc_phy_txpwrctrl_enable_nphy()
28426 if (pi->phyhang_avoid) in wlc_phy_txpwrctrl_enable_nphy()
28427 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_txpwrctrl_enable_nphy()
28431 wlc_phy_txpwr_index_nphy(struct brcms_phy *pi, u8 core_mask, s8 txpwrindex, in wlc_phy_txpwr_index_nphy() argument
28448 if (pi->phyhang_avoid) in wlc_phy_txpwr_index_nphy()
28449 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_phy_txpwr_index_nphy()
28455 for (core = 0; core < pi->pubpi.phy_corenum; core++) { in wlc_phy_txpwr_index_nphy()
28463 if (pi->nphy_txpwrindex[core].index < 0) in wlc_phy_txpwr_index_nphy()
28466 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwr_index_nphy()
28467 mod_phy_reg(pi, 0x8f, in wlc_phy_txpwr_index_nphy()
28469 pi->nphy_txpwrindex[core]. in wlc_phy_txpwr_index_nphy()
28471 mod_phy_reg(pi, 0xa5, (0x1 << 8), in wlc_phy_txpwr_index_nphy()
28472 pi->nphy_txpwrindex[core]. in wlc_phy_txpwr_index_nphy()
28475 mod_phy_reg(pi, 0xa5, in wlc_phy_txpwr_index_nphy()
28477 pi->nphy_txpwrindex[core]. in wlc_phy_txpwr_index_nphy()
28481 write_phy_reg(pi, (core == PHY_CORE_0) ? in wlc_phy_txpwr_index_nphy()
28483 pi->nphy_txpwrindex[core].AfeCtrlDacGain); in wlc_phy_txpwr_index_nphy()
28485 wlc_phy_table_write_nphy(pi, 7, 1, (0x110 + core), 16, in wlc_phy_txpwr_index_nphy()
28486 &pi->nphy_txpwrindex[core]. in wlc_phy_txpwr_index_nphy()
28489 wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &m1m2); in wlc_phy_txpwr_index_nphy()
28492 (pi->nphy_txpwrindex[core].bbmult << 8) : in wlc_phy_txpwr_index_nphy()
28493 (pi->nphy_txpwrindex[core].bbmult << 0)); in wlc_phy_txpwr_index_nphy()
28494 wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &m1m2); in wlc_phy_txpwr_index_nphy()
28498 pi, 15, 2, (80 + 2 * core), 16, in wlc_phy_txpwr_index_nphy()
28499 &pi->nphy_txpwrindex[core].iqcomp_a); in wlc_phy_txpwr_index_nphy()
28501 pi, 15, 1, (85 + core), 16, in wlc_phy_txpwr_index_nphy()
28502 &pi->nphy_txpwrindex[core].locomp); in wlc_phy_txpwr_index_nphy()
28504 pi, 15, 1, (93 + core), 16, in wlc_phy_txpwr_index_nphy()
28505 &pi->nphy_txpwrindex[core].locomp); in wlc_phy_txpwr_index_nphy()
28508 wlc_phy_txpwrctrl_enable_nphy(pi, pi->nphy_txpwrctrl); in wlc_phy_txpwr_index_nphy()
28510 pi->nphy_txpwrindex[core].index_internal = in wlc_phy_txpwr_index_nphy()
28511 pi->nphy_txpwrindex[core].index_internal_save; in wlc_phy_txpwr_index_nphy()
28514 if (pi->nphy_txpwrindex[core].index < 0) { in wlc_phy_txpwr_index_nphy()
28516 if (NREV_GE(pi->pubpi.phy_rev, 3)) { in wlc_phy_txpwr_index_nphy()
28517 mod_phy_reg(pi, 0x8f, in wlc_phy_txpwr_index_nphy()
28519 pi->nphy_txpwrindex[core]. in wlc_phy_txpwr_index_nphy()
28521 mod_phy_reg(pi, 0xa5, (0x1 << 8), in wlc_phy_txpwr_index_nphy()
28522 pi->nphy_txpwrindex[core]. in wlc_phy_txpwr_index_nphy()
28525 pi->nphy_txpwrindex[core]. in wlc_phy_txpwr_index_nphy()
28527 read_phy_reg(pi, 0xa5); in wlc_phy_txpwr_index_nphy()
28530 pi->nphy_txpwrindex[core].AfeCtrlDacGain = in wlc_phy_txpwr_index_nphy()
28531 read_phy_reg(pi, (core == PHY_CORE_0) ? in wlc_phy_txpwr_index_nphy()
28534 wlc_phy_table_read_nphy(pi, 7, 1, in wlc_phy_txpwr_index_nphy()
28536 &pi-> in wlc_phy_txpwr_index_nphy()
28540 wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, in wlc_phy_txpwr_index_nphy()
28544 pi->nphy_txpwrindex[core].bbmult = (u8) tmpval; in wlc_phy_txpwr_index_nphy()
28546 wlc_phy_table_read_nphy(pi, 15, 2, in wlc_phy_txpwr_index_nphy()
28548 &pi-> in wlc_phy_txpwr_index_nphy()
28552 wlc_phy_table_read_nphy(pi, 15, 1, (85 + core), in wlc_phy_txpwr_index_nphy()
28554 &pi-> in wlc_phy_txpwr_index_nphy()
28558 pi->nphy_txpwrindex[core].index_internal_save = in wlc_phy_txpwr_index_nphy()
28559 pi->nphy_txpwrindex[core]. in wlc_phy_txpwr_index_nphy()
28563 tx_pwr_ctrl_state = pi->nphy_txpwrctrl; in wlc_phy_txpwr_index_nphy()
28564 wlc_phy_txpwrctrl_enable_nphy(pi, PHY_TPC_HW_OFF); in wlc_phy_txpwr_index_nphy()
28566 if (NREV_IS(pi->pubpi.phy_rev, 1)) in wlc_phy_txpwr_index_nphy()
28567 wlapi_bmac_phyclk_fgc(pi->sh->physhim, ON); in wlc_phy_txpwr_index_nphy()
28569 wlc_phy_table_read_nphy(pi, txpwrctl_tbl, 1, in wlc_phy_txpwr_index_nphy()
28573 if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_txpwr_index_nphy()
28583 if (NREV_GE(pi->pubpi.phy_rev, 3)) in wlc_phy_txpwr_index_nphy()
28584 mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0x8f : in wlc_phy_txpwr_index_nphy()
28587 mod_phy_reg(pi, 0xa5, (0x1 << 14), (0x1 << 14)); in wlc_phy_txpwr_index_nphy()
28589 write_phy_reg(pi, (core == PHY_CORE_0) ? in wlc_phy_txpwr_index_nphy()
28592 wlc_phy_table_write_nphy(pi, 7, 1, (0x110 + core), 16, in wlc_phy_txpwr_index_nphy()
28595 wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &m1m2); in wlc_phy_txpwr_index_nphy()
28600 wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &m1m2); in wlc_phy_txpwr_index_nphy()
28602 wlc_phy_table_read_nphy(pi, txpwrctl_tbl, 1, in wlc_phy_txpwr_index_nphy()
28611 wlc_phy_table_write_nphy(pi, 15, 2, in wlc_phy_txpwr_index_nphy()
28616 wlc_phy_table_read_nphy(pi, txpwrctl_tbl, 1, in wlc_phy_txpwr_index_nphy()
28620 wlc_phy_table_write_nphy(pi, 15, 1, (85 + core), in wlc_phy_txpwr_index_nphy()
28623 if (NREV_IS(pi->pubpi.phy_rev, 1)) in wlc_phy_txpwr_index_nphy()
28624 wlapi_bmac_phyclk_fgc(pi->sh->physhim, OFF); in wlc_phy_txpwr_index_nphy()
28626 if (PHY_IPA(pi)) { in wlc_phy_txpwr_index_nphy()
28627 wlc_phy_table_read_nphy(pi, in wlc_phy_txpwr_index_nphy()
28634 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : in wlc_phy_txpwr_index_nphy()
28638 mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : in wlc_phy_txpwr_index_nphy()
28643 wlc_phy_txpwrctrl_enable_nphy(pi, tx_pwr_ctrl_state); in wlc_phy_txpwr_index_nphy()
28646 pi->nphy_txpwrindex[core].index = txpwrindex; in wlc_phy_txpwr_index_nphy()
28649 if (pi->phyhang_avoid) in wlc_phy_txpwr_index_nphy()
28650 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_phy_txpwr_index_nphy()
28654 wlc_phy_txpower_sromlimit_get_nphy(struct brcms_phy *pi, uint chan, u8 *max_pwr, in wlc_phy_txpower_sromlimit_get_nphy() argument
28659 chan_freq_range = wlc_phy_get_chan_freq_range_nphy(pi, chan); in wlc_phy_txpower_sromlimit_get_nphy()
28662 *max_pwr = pi->tx_srom_max_rate_2g[txp_rate_idx]; in wlc_phy_txpower_sromlimit_get_nphy()
28665 *max_pwr = pi->tx_srom_max_rate_5g_mid[txp_rate_idx]; in wlc_phy_txpower_sromlimit_get_nphy()
28668 *max_pwr = pi->tx_srom_max_rate_5g_low[txp_rate_idx]; in wlc_phy_txpower_sromlimit_get_nphy()
28671 *max_pwr = pi->tx_srom_max_rate_5g_hi[txp_rate_idx]; in wlc_phy_txpower_sromlimit_get_nphy()
28674 *max_pwr = pi->tx_srom_max_rate_2g[txp_rate_idx]; in wlc_phy_txpower_sromlimit_get_nphy()
28681 void wlc_phy_stay_in_carriersearch_nphy(struct brcms_phy *pi, bool enable) in wlc_phy_stay_in_carriersearch_nphy() argument
28686 if (pi->nphy_deaf_count == 0) { in wlc_phy_stay_in_carriersearch_nphy()
28687 pi->classifier_state = in wlc_phy_stay_in_carriersearch_nphy()
28688 wlc_phy_classifier_nphy(pi, 0, 0); in wlc_phy_stay_in_carriersearch_nphy()
28689 wlc_phy_classifier_nphy(pi, (0x7 << 0), 4); in wlc_phy_stay_in_carriersearch_nphy()
28690 wlc_phy_clip_det_nphy(pi, 0, pi->clip_state); in wlc_phy_stay_in_carriersearch_nphy()
28691 wlc_phy_clip_det_nphy(pi, 1, clip_off); in wlc_phy_stay_in_carriersearch_nphy()
28694 pi->nphy_deaf_count++; in wlc_phy_stay_in_carriersearch_nphy()
28696 wlc_phy_resetcca_nphy(pi); in wlc_phy_stay_in_carriersearch_nphy()
28699 pi->nphy_deaf_count--; in wlc_phy_stay_in_carriersearch_nphy()
28701 if (pi->nphy_deaf_count == 0) { in wlc_phy_stay_in_carriersearch_nphy()
28702 wlc_phy_classifier_nphy(pi, (0x7 << 0), in wlc_phy_stay_in_carriersearch_nphy()
28703 pi->classifier_state); in wlc_phy_stay_in_carriersearch_nphy()
28704 wlc_phy_clip_det_nphy(pi, 1, pi->clip_state); in wlc_phy_stay_in_carriersearch_nphy()
28709 void wlc_nphy_deaf_mode(struct brcms_phy *pi, bool mode) in wlc_nphy_deaf_mode() argument
28711 wlapi_suspend_mac_and_wait(pi->sh->physhim); in wlc_nphy_deaf_mode()
28714 if (pi->nphy_deaf_count == 0) in wlc_nphy_deaf_mode()
28715 wlc_phy_stay_in_carriersearch_nphy(pi, true); in wlc_nphy_deaf_mode()
28716 } else if (pi->nphy_deaf_count > 0) { in wlc_nphy_deaf_mode()
28717 wlc_phy_stay_in_carriersearch_nphy(pi, false); in wlc_nphy_deaf_mode()
28720 wlapi_enable_mac(pi->sh->physhim); in wlc_nphy_deaf_mode()