/* do band-specific ucode IHR, SHM, and SCR inits */
if (D11REV_IS(wlc_hw->corerev, 23)) {
- if (BRCMS_ISNPHY(wlc_hw->band)) {
+ if (BRCMS_ISNPHY(wlc_hw->band))
brcms_c_write_inits(wlc_hw, d11n0bsinitvals16);
- } else {
+ else
wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev"
" %d\n", __func__, wlc_hw->unit,
wlc_hw->corerev);
- }
} else {
if (D11REV_IS(wlc_hw->corerev, 24)) {
- if (BRCMS_ISLCNPHY(wlc_hw->band)) {
+ if (BRCMS_ISLCNPHY(wlc_hw->band))
brcms_c_write_inits(wlc_hw,
d11lcn0bsinitvals24);
- } else
+ else
wiphy_err(wiphy, "%s: wl%d: unsupported phy in"
" core rev %d\n", __func__,
wlc_hw->unit, wlc_hw->corerev);
* transmission count)
*/
if (!(txs->status & TX_STATUS_AMPDU)
- && (txs->status & TX_STATUS_INTERMEDIATE)) {
+ && (txs->status & TX_STATUS_INTERMEDIATE))
return false;
- }
return brcms_c_dotxstatus(wlc_hw->wlc, txs, s2);
}
/* BCN template is available */
/* ZZZ: Use AP_ACTIVE ? */
if (AP_ENAB(wlc->pub) && (!APSTA_ENAB(wlc->pub))
- && (macintstatus & MI_BCNTPL)) {
+ && (macintstatus & MI_BCNTPL))
brcms_c_update_beacon(wlc);
- }
/* tx status */
if (macintstatus & MI_TFS) {
brcms_b_tx_fifo_suspended(wlc_hw, TX_DATA_FIFO);
/* noise sample collected */
- if (macintstatus & MI_BG_NOISE) {
+ if (macintstatus & MI_BG_NOISE)
wlc_phy_noise_sample_intr(wlc_hw->band->pi);
- }
if (macintstatus & MI_GP0) {
wiphy_err(wiphy, "wl%d: PSM microcode watchdog fired at %d "
}
/* gptimer timeout */
- if (macintstatus & MI_TO) {
+ if (macintstatus & MI_TO)
W_REG(®s->gptimer, 0);
- }
if (macintstatus & MI_RFDISABLE) {
BCMMSG(wlc->wiphy, "wl%d: BMAC Detected a change on the"
M_HOST_FLAGS5
};
- for (idx = 0; idx < MHFMAX; idx++) {
+ for (idx = 0; idx < MHFMAX; idx++)
brcms_b_write_shm(wlc_hw, addr[idx], mhfs[idx]);
- }
}
/* set the maccontrol register to desired reset state and
struct brcms_c_info *wlc = wlc_hw->wlc;
/* update SYNTHPU_DLY */
- if (BRCMS_ISLCNPHY(wlc->band)) {
+ if (BRCMS_ISLCNPHY(wlc->band))
v = SYNTHPU_DLY_LPPHY_US;
- } else if (BRCMS_ISNPHY(wlc->band) && (NREV_GE(wlc->band->phyrev, 3))) {
+ else if (BRCMS_ISNPHY(wlc->band) && (NREV_GE(wlc->band->phyrev, 3)))
v = SYNTHPU_DLY_NPHY_US;
- } else {
+ else
v = SYNTHPU_DLY_BPHY_US;
- }
brcms_b_write_shm(wlc_hw, M_SYNTHPU_DLY, v);
}
(SICF_PRST | SICF_PCLKE));
phy_in_reset = true;
} else {
-
ai_core_cflags(wlc_hw->sih,
(SICF_PRST | SICF_PCLKE | SICF_BWMASK),
(SICF_PRST | SICF_PCLKE | phy_bw_clkbits));
wlc_hw->wlc->band = wlc_hw->wlc->bandstate[bandunit];
/* set gmode core flag */
- if (wlc_hw->sbclk && !wlc_hw->noreset) {
+ if (wlc_hw->sbclk && !wlc_hw->noreset)
ai_core_cflags(wlc_hw->sih, SICF_GMODE,
((bandunit == 0) ? SICF_GMODE : 0));
- }
}
static bool brcms_c_isgoodchip(struct brcms_hardware *wlc_hw)
varname = "il0macaddr";
macaddr = getvar(wlc_hw->vars, varname);
- if (macaddr == NULL) {
+ if (macaddr == NULL)
wiphy_err(wlc_hw->wlc->wiphy, "wl%d: wlc_get_macaddr: macaddr "
"getvar(%s) not found\n", wlc_hw->unit, varname);
- }
return macaddr;
}
/* reset the dma engines except first time thru */
if (ai_iscoreup(wlc_hw->sih)) {
for (i = 0; i < NFIFO; i++)
- if ((wlc_hw->di[i]) && (!dma_txreset(wlc_hw->di[i]))) {
+ if ((wlc_hw->di[i]) && (!dma_txreset(wlc_hw->di[i])))
wiphy_err(wlc_hw->wlc->wiphy, "wl%d: %s: "
"dma_txreset[%d]: cannot stop dma\n",
wlc_hw->unit, __func__, i);
- }
if ((wlc_hw->di[RX_FIFO])
- && (!wlc_dma_rxreset(wlc_hw, RX_FIFO))) {
+ && (!wlc_dma_rxreset(wlc_hw, RX_FIFO)))
wiphy_err(wlc_hw->wlc->wiphy, "wl%d: %s: dma_rxreset"
"[%d]: cannot stop dma\n",
wlc_hw->unit, __func__, RX_FIFO);
- }
}
/* if noreset, just stop the psm and return */
if (wlc_hw->noreset) {
fatal = true;
}
- if (intstatus & I_RU) {
+ if (intstatus & I_RU)
wiphy_err(wiphy, "wl%d: fifo %d: receive descriptor "
"underflow\n", idx, unit);
- }
if (intstatus & I_XU) {
wiphy_err(wiphy, "wl%d: fifo %d: transmit fifo "
null_ether_addr);
} else {
/* resume tx fifos */
- if (!wlc_hw->wlc->tx_suspended) {
+ if (!wlc_hw->wlc->tx_suspended)
brcms_b_tx_fifo_resume(wlc_hw, TX_DATA_FIFO);
- }
+
brcms_b_tx_fifo_resume(wlc_hw, TX_CTL_FIFO);
brcms_b_tx_fifo_resume(wlc_hw, TX_AC_BK_FIFO);
brcms_b_tx_fifo_resume(wlc_hw, TX_AC_VI_FIFO);
W_REG(®s->macintstatus, macintstatus);
/* MI_DMAINT is indication of non-zero intstatus */
- if (macintstatus & MI_DMAINT) {
+ if (macintstatus & MI_DMAINT)
/*
* only fifo interrupt enabled is I_RI in
* RX_FIFO. If MI_DMAINT is set, assume it
*/
W_REG(®s->intctrlregs[RX_FIFO].intstatus,
DEF_RXINTMASK);
- }
return macintstatus;
}
tmp = R_REG(®s->clk_ctl_st);
if ((tmp & (CCS_ERSRC_AVAIL_HT)) !=
- (CCS_ERSRC_AVAIL_HT)) {
+ (CCS_ERSRC_AVAIL_HT))
wiphy_err(wlc_hw->wlc->wiphy, "%s: turn on PHY"
" PLL failed\n", __func__);
- }
} else {
OR_REG(®s->clk_ctl_st,
(CCS_ERSRC_REQ_D11PLL | CCS_ERSRC_REQ_PHYPLL));
if ((tmp &
(CCS_ERSRC_AVAIL_D11PLL | CCS_ERSRC_AVAIL_PHYPLL))
!=
- (CCS_ERSRC_AVAIL_D11PLL | CCS_ERSRC_AVAIL_PHYPLL)) {
+ (CCS_ERSRC_AVAIL_D11PLL | CCS_ERSRC_AVAIL_PHYPLL))
wiphy_err(wlc_hw->wlc->wiphy, "%s: turn on "
"PHY PLL failed\n", __func__);
- }
}
} else {
/* Since the PLL may be shared, other cores can still be requesting it;
W_REG(®s->objaddr, sel | (offset >> 2));
(void)R_REG(®s->objaddr);
- if (offset & 2) {
+ if (offset & 2)
v = R_REG(objdata_hi);
- } else {
+ else
v = R_REG(objdata_lo);
- }
return v;
}
W_REG(®s->objaddr, sel | (offset >> 2));
(void)R_REG(®s->objaddr);
- if (offset & 2) {
+ if (offset & 2)
W_REG(objdata_hi, v);
- } else {
+ else
W_REG(objdata_lo, v);
- }
}
/* Copy a buffer to shared memory of specified type .
mboolset(wlc_hw->pllreq, req_bit);
if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) {
- if (!wlc_hw->sbclk) {
+ if (!wlc_hw->sbclk)
brcms_b_xtal(wlc_hw, ON);
- }
}
} else {
if (!mboolisset(wlc_hw->pllreq, req_bit))
mboolclr(wlc_hw->pllreq, req_bit);
if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) {
- if (wlc_hw->sbclk) {
+ if (wlc_hw->sbclk)
brcms_b_xtal(wlc_hw, OFF);
- }
}
}
" %d\n", __func__, wlc_hw->unit,
wlc_hw->corerev);
} else if (D11REV_IS(wlc_hw->corerev, 24)) {
- if (BRCMS_ISLCNPHY(wlc_hw->band)) {
+ if (BRCMS_ISLCNPHY(wlc_hw->band))
brcms_c_write_inits(wlc_hw, d11lcn0initvals24);
- } else {
+ else
wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev"
" %d\n", __func__, wlc_hw->unit,
wlc_hw->corerev);
- }
} else {
wiphy_err(wiphy, "%s: wl%d: unsupported corerev %d\n",
__func__, wlc_hw->unit, wlc_hw->corerev);
}
/* For old ucode, txfifo sizes needs to be modified(increased) */
- if (fifosz_fixup == true) {
+ if (fifosz_fixup == true)
brcms_b_corerev_fifofixup(wlc_hw);
- }
/* check txfifo allocations match between ucode and driver */
buf[TX_AC_BE_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE0);
i = TX_ATIM_FIFO;
err = -1;
}
- if (err != 0) {
+ if (err != 0)
wiphy_err(wiphy, "wlc_coreinit: txfifo mismatch: ucode size %d"
" driver size %d index %d\n", buf[i],
wlc_hw->xmtfifo_sz[i], i);
- }
/* make sure we can still talk to the mac */
WARN_ON(R_REG(®s->maccontrol) == 0xffffffff);
/* Uninitialized; read from HW */
int ac;
- for (ac = 0; ac < AC_COUNT; ac++) {
+ for (ac = 0; ac < AC_COUNT; ac++)
wlc->wme_retries[ac] =
brcms_c_read_shm(wlc, M_AC_TXLMT_ADDR(ac));
- }
}
}
int err = 0;
struct brcms_c_info *wlc = cfg->wlc;
- if (cfg == wlc->cfg) {
+ if (cfg == wlc->cfg)
/* enter the MAC addr into the RXE match registers */
brcms_c_set_addrmatch(wlc, RCM_MAC_OFFSET, cfg->cur_etheraddr);
- }
brcms_c_ampdu_macaddr_upd(wlc);
struct brcms_c_info *wlc = cfg->wlc;
/* if primary config, we need to update BSSID in RXE match registers */
- if (cfg == wlc->cfg) {
+ if (cfg == wlc->cfg)
brcms_c_set_addrmatch(wlc, RCM_BSSID_OFFSET, cfg->BSSID);
- }
#ifdef SUPPORT_HWKEYS
- else if (BSSCFG_STA(cfg) && cfg->BSS) {
+ else if (BSSCFG_STA(cfg) && cfg->BSS)
brcms_c_rcmta_add_bssid(wlc, cfg);
- }
+
#endif
}
}
#if NCONF
/* pick siso/cdd as default for OFDM (note no basic rate MCSs are supported yet) */
- if (IS_OFDM(lowest_basic_rspec)) {
+ if (IS_OFDM(lowest_basic_rspec))
lowest_basic_rspec |= (wlc->stf->ss_opmode << RSPEC_STF_SHIFT);
- }
+
#endif
return lowest_basic_rspec;
* to set up a beacon for testing, the test routines should write it down,
* not expect the inits to populate a bogus beacon.
*/
- if (BRCMS_PHY_11N_CAP(wlc->band)) {
+ if (BRCMS_PHY_11N_CAP(wlc->band))
brcms_c_write_shm(wlc, M_BCN_TXTSF_OFFSET,
wlc->band->bcntsfoff);
- }
}
} else {
/* disable an active IBSS if we are not on the home channel */
/* check device id(srom, nvram etc.) to set bands */
if (wlc_hw->deviceid == BCM43224_D11N_ID ||
- wlc_hw->deviceid == BCM43224_D11N_ID_VEN1) {
+ wlc_hw->deviceid == BCM43224_D11N_ID_VEN1)
/* Dualband boards */
wlc_hw->_nbands = 2;
- } else
+ else
wlc_hw->_nbands = 1;
if ((wlc_hw->sih->chip == BCM43225_CHIP_ID))
if (wlc->pub->wlfeatureflag & WL_SWFL_NOHWRADIO || wlc->pub->hw_off)
return;
- if (brcms_b_radio_read_hwdisabled(wlc->hw)) {
+ if (brcms_b_radio_read_hwdisabled(wlc->hw))
mboolset(wlc->pub->radio_disabled, WL_RADIO_HW_DISABLE);
- } else {
+ else
mboolclr(wlc->pub->radio_disabled, WL_RADIO_HW_DISABLE);
- }
}
/* return true if Minimum Power Consumption should be entered, false otherwise */
* wlc->mpc_delay_off to wlc->mpc_dlycnt, so that we restart the countdown of mpc_delay_off
*/
if ((wlc->prev_non_delay_mpc == false) &&
- (brcms_c_is_non_delay_mpc(wlc) == true) && wlc->mpc_delay_off) {
+ (brcms_c_is_non_delay_mpc(wlc) == true) && wlc->mpc_delay_off)
wlc->mpc_delay_off = wlc->mpc_dlycnt;
- }
+
wlc->prev_non_delay_mpc = brcms_c_is_non_delay_mpc(wlc);
}
*/
static void brcms_c_radio_upd(struct brcms_c_info *wlc)
{
- if (wlc->pub->radio_disabled) {
+ if (wlc->pub->radio_disabled)
brcms_c_radio_disable(wlc);
- } else {
+ else
brcms_c_radio_enable(wlc);
- }
}
/* maintain LED behavior in down state */
/* Manage TKIP countermeasures timers */
FOREACH_BSS(wlc, i, cfg)
- if (cfg->tk_cm_dt) {
+ if (cfg->tk_cm_dt)
cfg->tk_cm_dt--;
- }
- if (cfg->tk_cm_bt) {
+ if (cfg->tk_cm_bt)
cfg->tk_cm_bt--;
- }
END_FOREACH_BSS()
/* Call any registered watchdog handlers */
if ((wlc->pub->boardflags & BFL_FEM)
&& (wlc->pub->sih->chip == BCM4313_CHIP_ID)) {
if (wlc->pub->boardrev >= 0x1250
- && (wlc->pub->boardflags & BFL_FEM_BT)) {
+ && (wlc->pub->boardflags & BFL_FEM_BT))
brcms_c_mhf(wlc, MHF5, MHF5_4313_GPIOCTRL,
MHF5_4313_GPIOCTRL, BRCM_BAND_ALL);
- } else {
+ else
brcms_c_mhf(wlc, MHF4, MHF4_EXTPA_ENABLE,
MHF4_EXTPA_ENABLE, BRCM_BAND_ALL);
- }
}
/*
brcms_c_radio_monitor_stop(wlc);
/* Set EDCF hostflags */
- if (EDCF_ENAB(wlc->pub)) {
+ if (EDCF_ENAB(wlc->pub))
brcms_c_mhf(wlc, MHF1, MHF1_EDCF, MHF1_EDCF, BRCM_BAND_ALL);
- } else {
+ else
brcms_c_mhf(wlc, MHF1, MHF1_EDCF, 0, BRCM_BAND_ALL);
- }
if (BRCMS_WAR16165(wlc))
brcms_c_mhf(wlc, MHF2, MHF2_PCISLOWCLKWAR, MHF2_PCISLOWCLKWAR,
brcms_c_txflowcontrol_reset(wlc);
/* flush tx queues */
- for (qi = wlc->tx_queues; qi != NULL; qi = qi->next) {
+ for (qi = wlc->tx_queues; qi != NULL; qi = qi->next)
brcmu_pktq_flush(&qi->q, true, NULL, NULL);
- }
callbacks += brcms_b_down_finish(wlc->hw);
band->rspec_override = 0;
brcms_c_reprate_init(wlc);
}
- if (band->mrspec_override && !IS_CCK(band->mrspec_override)) {
+ if (band->mrspec_override && !IS_CCK(band->mrspec_override))
band->mrspec_override = 0;
- }
}
band->gmode = gmode;
wlc->shortslot_override = shortslot;
- if (AP_ENAB(wlc->pub)) {
+ if (AP_ENAB(wlc->pub))
/* wlc->ap->shortslot_restrict = shortslot_restrict; */
wlc->PLCPHdr_override =
(preamble !=
BRCMS_PLCP_LONG) ? BRCMS_PLCP_SHORT : BRCMS_PLCP_AUTO;
- }
if ((AP_ENAB(wlc->pub) && preamble != BRCMS_PLCP_LONG)
|| preamble == BRCMS_PLCP_SHORT)
brcms_b_retrylimit_upd(wlc->hw, wlc->SRL, wlc->LRL);
- for (ac = 0; ac < AC_COUNT; ac++) {
+ for (ac = 0; ac < AC_COUNT; ac++)
BRCMS_WME_RETRY_SHORT_SET(wlc, ac, wlc->SRL);
- }
+
brcms_c_wme_retries_write(wlc);
} else
bcmerror = -EINVAL;
brcms_b_retrylimit_upd(wlc->hw, wlc->SRL, wlc->LRL);
- for (ac = 0; ac < AC_COUNT; ac++) {
+ for (ac = 0; ac < AC_COUNT; ac++)
BRCMS_WME_RETRY_LONG_SET(wlc, ac, wlc->LRL);
- }
+
brcms_c_wme_retries_write(wlc);
} else
bcmerror = -EINVAL;
} else {
/* driver is down, so just update the brcms_c_info
* value */
- if (wlc->shortslot_override == BRCMS_SHORTSLOT_AUTO) {
+ if (wlc->shortslot_override == BRCMS_SHORTSLOT_AUTO)
wlc->shortslot = false;
- } else {
+ else
wlc->shortslot =
(wlc->shortslot_override ==
BRCMS_SHORTSLOT_ON);
- }
}
break;
if (!wlc->clk)
return;
- for (ac = 0; ac < AC_COUNT; ac++) {
+ for (ac = 0; ac < AC_COUNT; ac++)
brcms_c_write_shm(wlc, M_AC_TXLMT_ADDR(ac),
wlc->wme_retries[ac]);
- }
}
#ifdef BCMDBG
/* merge counters from dma module */
for (i = 0; i < NFIFO; i++) {
- if (wlc->hw->di[i]) {
+ if (wlc->hw->di[i])
dma_counterreset(wlc->hw->di[i]);
- }
}
}
*/
if (!EDCF_ENAB(wlc->pub)
|| (wlc->pub->wlfeatureflag & WL_SWFL_FLOWCONTROL)) {
- if (pktq_len(q) >= wlc->pub->tunables->datahiwat) {
+ if (pktq_len(q) >= wlc->pub->tunables->datahiwat)
brcms_c_txflowcontrol(wlc, qi, ON, ALLPRIO);
- }
} else if (wlc->pub->_priofc) {
if (pktq_plen(q, wlc_prio2prec_map[prio]) >=
- wlc->pub->tunables->datahiwat) {
+ wlc->pub->tunables->datahiwat)
brcms_c_txflowcontrol(wlc, qi, ON, prio);
- }
}
}
count = 1;
err = brcms_c_prep_pdu(wlc, pkt[0], &fifo);
if (!err) {
- for (i = 0; i < count; i++) {
+ for (i = 0; i < count; i++)
brcms_c_txfifo(wlc, fifo, pkt[i], true,
1);
- }
}
}
if (!EDCF_ENAB(wlc->pub)
|| (wlc->pub->wlfeatureflag & WL_SWFL_FLOWCONTROL)) {
if (brcms_c_txflowcontrol_prio_isset(wlc, qi, ALLPRIO)
- && (pktq_len(q) < wlc->pub->tunables->datahiwat / 2)) {
+ && (pktq_len(q) < wlc->pub->tunables->datahiwat / 2))
brcms_c_txflowcontrol(wlc, qi, OFF, ALLPRIO);
- }
} else if (wlc->pub->_priofc) {
int prio;
for (prio = MAXPRIO; prio >= 0; prio--) {
if (brcms_c_txflowcontrol_prio_isset(wlc, qi, prio) &&
(pktq_plen(q, wlc_prio2prec_map[prio]) <
- wlc->pub->tunables->datahiwat / 2)) {
+ wlc->pub->tunables->datahiwat / 2))
brcms_c_txflowcontrol(wlc, qi, OFF, prio);
- }
}
}
in_send_q = false;
/* When a BC/MC frame is being committed to the BCMC fifo via DMA (NOT PIO), update
* ucode or BSS info as appropriate.
*/
- if (fifo == TX_BCMC_FIFO) {
+ if (fifo == TX_BCMC_FIFO)
frameid = le16_to_cpu(txh->TxFrameID);
- }
-
if (BRCMS_WAR16165(wlc))
brcms_c_war16165(wlc, true);
if (frameid != INVALIDFID)
BCMCFID(wlc, frameid);
- if (dma_txfast(wlc->hw->di[fifo], p, commit) < 0) {
+ if (dma_txfast(wlc->hw->di[fifo], p, commit) < 0)
wiphy_err(wlc->wiphy, "txfifo: fatal, toss frames !!!\n");
- }
}
void
brcms_c_compute_plcp(struct brcms_c_info *wlc, u32 rspec,
uint length, u8 *plcp)
{
- if (IS_MCS(rspec)) {
+ if (IS_MCS(rspec))
brcms_c_compute_mimo_plcp(rspec, length, plcp);
- } else if (IS_OFDM(rspec)) {
+ else if (IS_OFDM(rspec))
brcms_c_compute_ofdm_plcp(rspec, length, plcp);
- } else {
+ else
brcms_c_compute_cck_plcp(wlc, rspec, length, plcp);
- }
return;
}
sifs = SIFS(wlc->band);
- if (!cts_only) { /* RTS/CTS */
+ if (!cts_only) {
+ /* RTS/CTS */
dur = 3 * sifs;
dur +=
(u16) brcms_c_calc_cts_time(wlc, rts_rate,
rts_preamble_type);
- } else { /* CTS-TO-SELF */
+ } else {
+ /* CTS-TO-SELF */
dur = 2 * sifs;
}
{
u32 rts_rspec = 0;
- if (use_rspec) {
+ if (use_rspec)
/* use frame rate as rts rate */
rts_rspec = rspec;
-
- } else if (wlc->band->gmode && wlc->protection->_g && !IS_CCK(rspec)) {
+ else if (wlc->band->gmode && wlc->protection->_g && !IS_CCK(rspec))
/* Use 11Mbps as the g protection RTS target rate and fallback.
* Use the BRCMS_BASIC_RATE() lookup to find the best basic rate
* under the target in case 11 Mbps is not Basic.
* if the OFDM rate we are protecting is 6 or 9 Mbps, 11 is more robust.
*/
rts_rspec = BRCMS_BASIC_RATE(wlc, BRCM_RATE_11M);
- } else {
+ else
/* calculate RTS rate and fallback rate based on the frame rate
* RTS must be sent at a basic rate since it is a
* control frame, sec 9.6 of 802.11 spec
*/
rts_rspec = BRCMS_BASIC_RATE(wlc, rspec);
- }
if (BRCMS_PHY_11N_CAP(wlc->band)) {
/* set rts txbw to correct side band */
* the packet itself, thus phylen = packet length + ICV_LEN + FCS_LEN
* in this case
*/
- if (key) {
+ if (key)
phylen += key->icv_len;
- }
/* Get tx_info */
tx_info = IEEE80211_SKB_CB(p);
frameid = bcmc_fid_generate(wlc, NULL, txh);
} else {
/* Increment the counter for first fragment */
- if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) {
+ if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
SCB_SEQNUM(scb, p->priority)++;
- }
/* extract fragment number from frame first */
seq = le16_to_cpu(seq) & FRAGNUM_MASK;
txrate[1] = txrate[0] + 1;
/* if rate control algorithm didn't give us a fallback rate, use the primary rate */
- if (txrate[1]->idx < 0) {
+ if (txrate[1]->idx < 0)
txrate[1] = txrate[0];
- }
for (k = 0; k < hw->max_rates; k++) {
is_mcs[k] =
} else {
rate_val[k] = txrate[k]->idx;
}
+
/* Currently only support same setting for primay and fallback rates.
* Unify flags for each rate into a single value for the frame
*/
} else if (IS_OFDM(rspec[k])) {
if (wlc->ofdm_40txbw != AUTO)
mimo_txbw = wlc->ofdm_40txbw;
- } else {
- if (wlc->cck_40txbw != AUTO)
- mimo_txbw = wlc->cck_40txbw;
+ } else if (wlc->cck_40txbw != AUTO) {
+ mimo_txbw = wlc->cck_40txbw;
}
} else {
/* mcs32 is 40 b/w only.
* This is possible for probe packets on a STA during SCAN
*/
- if ((rspec[k] & RSPEC_RATE_MASK) == 32) {
+ if ((rspec[k] & RSPEC_RATE_MASK) == 32)
/* mcs 0 */
rspec[k] = RSPEC_MIMORATE;
- }
+
mimo_txbw = PHY_TXC1_BW_20MHZ;
}
/* if SGI is selected, then forced mm for single stream */
if ((rspec[k] & RSPEC_SHORT_GI)
&& IS_SINGLE_STREAM(rspec[k] &
- RSPEC_RATE_MASK)) {
+ RSPEC_RATE_MASK))
preamble_type[k] = BRCMS_MM_PREAMBLE;
- }
}
/* should be better conditionalized */
#ifdef SUPPORT_40MHZ
/* add null delimiter count */
- if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && IS_MCS(rspec)) {
+ if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && IS_MCS(rspec))
txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM] =
brcm_c_ampdu_null_delim_cnt(wlc->ampdu, scb, rspec, phylen);
- }
+
#endif
/* Now that RTS/RTS FB preamble types are updated, write the final value */
/* update txop byte threshold (txop minus intraframe overhead) */
if (wlc->edcf_txop[ac] >= (dur - frag_dur)) {
- {
- uint newfragthresh;
-
+ uint newfragthresh;
+
+ newfragthresh =
+ brcms_c_calc_frame_len(wlc,
+ rspec[0], preamble_type[0],
+ (wlc->edcf_txop[ac] -
+ (dur - frag_dur)));
+ /* range bound the fragthreshold */
+ if (newfragthresh < DOT11_MIN_FRAG_LEN)
newfragthresh =
- brcms_c_calc_frame_len(wlc,
- rspec[0], preamble_type[0],
- (wlc->edcf_txop[ac] -
- (dur - frag_dur)));
- /* range bound the fragthreshold */
- if (newfragthresh < DOT11_MIN_FRAG_LEN)
- newfragthresh =
- DOT11_MIN_FRAG_LEN;
- else if (newfragthresh >
- wlc->usr_fragthresh)
- newfragthresh =
- wlc->usr_fragthresh;
- /* update the fragthresh and do txc update */
- if (wlc->fragthresh[queue] !=
- (u16) newfragthresh) {
- wlc->fragthresh[queue] =
- (u16) newfragthresh;
- }
- }
- } else
+ DOT11_MIN_FRAG_LEN;
+ else if (newfragthresh >
+ wlc->usr_fragthresh)
+ newfragthresh =
+ wlc->usr_fragthresh;
+ /* update the fragthresh and do txc update */
+ if (wlc->fragthresh[queue] !=
+ (u16) newfragthresh)
+ wlc->fragthresh[queue] =
+ (u16) newfragthresh;
+ } else {
wiphy_err(wlc->wiphy, "wl%d: %s txop invalid "
"for rate %d\n",
wlc->pub->unit, fifo_names[queue],
RSPEC2RATE(rspec[0]));
+ }
if (dur > wlc->edcf_txop[ac])
wiphy_err(wlc->wiphy, "wl%d: %s: %s txop "
{
struct brcms_bss_cfg *cfg = wlc->cfg;
- if (!cfg->BSS) {
+ if (!cfg->BSS)
/* DirFrmQ is now valid...defer setting until end of ATIM window */
wlc->qvalid |= MCMD_DIRFRMQVAL;
- }
}
static void brcms_c_war16165(struct brcms_c_info *wlc, bool tx)
/* Clear MHF2_TXBCMC_NOW flag if BCMC fifo has drained */
if (AP_ENAB(wlc->pub) &&
- !TXPKTPENDGET(wlc, TX_BCMC_FIFO)) {
+ !TXPKTPENDGET(wlc, TX_BCMC_FIFO))
brcms_c_mhf(wlc, MHF2, MHF2_TXBCMC_NOW, 0, BRCM_BAND_AUTO);
- }
/* figure out which bsscfg is being worked on... */
}
}
/* check received pkt has at least frame control field */
- if (len < D11_PHY_HDR_LEN + sizeof(h->frame_control)) {
+ if (len < D11_PHY_HDR_LEN + sizeof(h->frame_control))
goto toss;
- }
is_amsdu = rxh->RxStatus2 & RXS_AMSDU_MASK;
* which a response ACK/CTS should be sent.
*/
basic_rate = BRCMS_BASIC_RATE(wlc, rate);
- if (basic_rate == 0) {
+ if (basic_rate == 0)
/* This should only happen if we are using a
* restricted rateset.
*/
basic_rate = rs.rates[0] & BRCMS_RATE_MASK;
- }
brcms_c_write_rate_shm(wlc, rate, basic_rate);
}
struct brcms_c_rateset *hw_rateset;
uint i;
- if ((band == BRCM_BAND_AUTO) || (band == wlc->band->bandtype)) {
+ if ((band == BRCM_BAND_AUTO) || (band == wlc->band->bandtype))
hw_rateset = &wlc->band->hw_rateset;
- } else if (NBANDS(wlc) > 1) {
+ else if (NBANDS(wlc) > 1)
hw_rateset = &wlc->bandstate[OTHERBANDUNIT(wlc)]->hw_rateset;
- } else {
+ else
/* other band specified and we are a single band device */
return false;
- }
/* check if this is a mimo rate */
if (IS_MCS(rspec)) {
if (hw_rateset->rates[i] == RSPEC2RATE(rspec))
return true;
error:
- if (verbose) {
+ if (verbose)
wiphy_err(wlc->wiphy, "wl%d: valid_rate: rate spec 0x%x "
"not in hw_rateset\n", wlc->pub->unit, rspec);
- }
return false;
}
plcp = (struct cck_phy_hdr *) buf;
/* PLCP for Probe Response frames are filled in from core's rate table */
- if (type == IEEE80211_STYPE_BEACON && !MBSS_BCN_ENAB(cfg)) {
+ if (type == IEEE80211_STYPE_BEACON && !MBSS_BCN_ENAB(cfg))
/* fill in PLCP */
brcms_c_compute_plcp(wlc, bcn_rspec,
(DOT11_MAC_HDR_LEN + body_len + FCS_LEN),
(u8 *) plcp);
- }
/* "Regular" and 16 MBSS but not for 4 MBSS */
/* Update the phytxctl for the beacon based on the rspec */
if (!SOFTBCN_ENAB(cfg))
/* Clear the soft intmask */
wlc->defmacintmask &= ~MI_BCNTPL;
- if (!cfg->up) { /* Only allow updates on an UP bss */
+ if (!cfg->up)
+ /* Only allow updates on an UP bss */
return;
- }
/* Optimize: Some of if/else could be combined */
if (!MBSS_BCN_ENAB(cfg) && HWBCN_ENAB(cfg)) {
/* Check if both templates are in use, if so sched. an interrupt
* that will call back into this routine
*/
- if ((R_REG(®s->maccommand) & both_valid) == both_valid) {
+ if ((R_REG(®s->maccommand) & both_valid) == both_valid)
/* clear any previous status */
W_REG(®s->macintstatus, MI_BCNTPL);
- }
+
/* Check that after scheduling the interrupt both of the
* templates are still busy. if not clear the int. & remask
*/
== NRATE_OVERRIDE_MCS_ONLY);
int bcmerror = 0;
- if (!ismcs) {
+ if (!ismcs)
return (u32) rate;
- }
/* validate the combination of rate/mcs/stf is allowed */
if (N_ENAB(wlc->pub) && ismcs) {
rspec |= RSPEC_SHORT_GI;
if ((rate != 0)
- && !brcms_c_valid_rate(wlc, rspec, cur_band->bandtype, true)) {
+ && !brcms_c_valid_rate(wlc, rspec, cur_band->bandtype, true))
return rate;
- }
return rspec;
done:
{
uint prio_mask;
- if (prio == ALLPRIO) {
+ if (prio == ALLPRIO)
prio_mask = TXQ_STOP_FOR_PRIOFC_MASK;
- } else {
+ else
prio_mask = NBITVAL(prio);
- }
return (q->stopped & prio_mask) == prio_mask;
}
BCMMSG(wlc->wiphy, "flow control kicks in\n");
- if (prio == ALLPRIO) {
+ if (prio == ALLPRIO)
prio_bits = TXQ_STOP_FOR_PRIOFC_MASK;
- } else {
+ else
prio_bits = NBITVAL(prio);
- }
cur_bits = qi->stopped & prio_bits;
* Otherwise update the bit and continue
*/
if (on) {
- if (cur_bits == prio_bits) {
+ if (cur_bits == prio_bits)
return;
- }
+
mboolset(qi->stopped, prio_bits);
} else {
- if (cur_bits == 0) {
+ if (cur_bits == 0)
return;
- }
+
mboolclr(qi->stopped, prio_bits);
}
/* If there is a flow control override we will not change the external
* flow control state.
*/
- if (qi->stopped & ~TXQ_STOP_FOR_PRIOFC_MASK) {
+ if (qi->stopped & ~TXQ_STOP_FOR_PRIOFC_MASK)
return;
- }
brcms_c_txflowcontrol_signal(wlc, qi, on, prio);
}
/* if there was a previous override bit on, then setting this
* makes no difference.
*/
- if (prev_override) {
+ if (prev_override)
return;
- }
brcms_c_txflowcontrol_signal(wlc, qi, ON, ALLPRIO);
} else {
* flow control if it was the only bit set. For any other
* override setting, just return
*/
- if (prev_override != override) {
+ if (prev_override != override)
return;
- }
if (qi->stopped == 0) {
brcms_c_txflowcontrol_signal(wlc, qi, OFF, ALLPRIO);
/* wait for queue and DMA fifos to run dry */
while (!pktq_empty(&wlc->pkt_queue->q) ||
- TXPKTPENDTOT(wlc) > 0) {
+ TXPKTPENDTOT(wlc) > 0)
brcms_msleep(wlc->wl, 1);
- }
}
int brcms_c_set_par(struct brcms_c_info *wlc, enum wlc_par_id par_id,
((core == PHY_CORE_0) ? radio_type##_##jspace##0 : radio_type##_##jspace##1))
#define WRITE_RADIO_REG2(pi, radio_type, jspace, core, reg_name, value) \
write_radio_reg(pi, radio_type##_##jspace##_##reg_name | \
- ((core == PHY_CORE_0) ? radio_type##_##jspace##0 : radio_type##_##jspace##1), value);
+ ((core == PHY_CORE_0) ? radio_type##_##jspace##0 : \
+ radio_type##_##jspace##1), value)
#define WRITE_RADIO_SYN(pi, radio_type, reg_name, value) \
- write_radio_reg(pi, radio_type##_##SYN##_##reg_name, value);
+ write_radio_reg(pi, radio_type##_##SYN##_##reg_name, value)
#define READ_RADIO_REG3(pi, radio_type, jspace, core, reg_name) \
read_radio_reg(pi, ((core == PHY_CORE_0) ? radio_type##_##jspace##0##_##reg_name : \
- radio_type##_##jspace##1##_##reg_name));
+ radio_type##_##jspace##1##_##reg_name))
#define WRITE_RADIO_REG3(pi, radio_type, jspace, core, reg_name, value) \
write_radio_reg(pi, ((core == PHY_CORE_0) ? radio_type##_##jspace##0##_##reg_name : \
- radio_type##_##jspace##1##_##reg_name), value);
+ radio_type##_##jspace##1##_##reg_name), value)
#define READ_RADIO_REG4(pi, radio_type, jspace, core, reg_name) \
read_radio_reg(pi, ((core == PHY_CORE_0) ? radio_type##_##reg_name##_##jspace##0 : \
- radio_type##_##reg_name##_##jspace##1));
+ radio_type##_##reg_name##_##jspace##1))
#define WRITE_RADIO_REG4(pi, radio_type, jspace, core, reg_name, value) \
write_radio_reg(pi, ((core == PHY_CORE_0) ? radio_type##_##reg_name##_##jspace##0 : \
- radio_type##_##reg_name##_##jspace##1), value);
+ radio_type##_##reg_name##_##jspace##1), value)
#define NPHY_ACI_MAX_UNDETECT_WINDOW_SZ 40
#define NPHY_ACI_CHANNEL_DELTA 5
phybist4 = read_phy_reg(pi, 0x156);
if ((phybist0 == 0) && (phybist1 == 0x4000) && (phybist2 == 0x1fe0) &&
- (phybist3 == 0) && (phybist4 == 0)) {
+ (phybist3 == 0) && (phybist4 == 0))
return true;
- }
return false;
}
or_phy_reg(pi, NPHY_TO_BPHY_OFF + BPHY_LNA_GAIN_RANGE, 0x1a);
} else {
-
write_phy_reg(pi, NPHY_TO_BPHY_OFF + BPHY_STEP, 0x668);
}
}
case 1:
- if (pi->aa2g == 7) {
-
+ if (pi->aa2g == 7)
wlc_phy_table_write_nphy(pi,
NPHY_TBL_ID_ANTSWCTRLLUT,
2, 0x21, 8,
&ant_sw_ctrl_tbl_rev8_2o3
[0]);
- } else {
+ else
wlc_phy_table_write_nphy(pi,
NPHY_TBL_ID_ANTSWCTRLLUT,
2, 0x21, 8,
&ant_sw_ctrl_tbl_rev8
[0]);
- }
+
wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT,
2, 0x25, 8,
&ant_sw_ctrl_tbl_rev8[2]);
}
}
} else {
- for (idx = 0; idx < mimophytbl_info_sz_rev0_volatile; idx++) {
+ for (idx = 0; idx < mimophytbl_info_sz_rev0_volatile; idx++)
wlc_phy_write_table_nphy(pi,
&mimophytbl_info_rev0_volatile
[idx]);
- }
}
}
wlc_phy_write_txmacreg_nphy(pi, holdoff, delay);
- if (pi && pi->sh && (pi->sh->_rifs_phy != rifs)) {
+ if (pi && pi->sh && (pi->sh->_rifs_phy != rifs))
pi->sh->_rifs_phy = rifs;
- }
}
bool wlc_phy_attach_nphy(struct brcms_phy *pi)
{
uint i;
- if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 6)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 6))
pi->phyhang_avoid = true;
- }
if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 7)) {
-
pi->nphy_gband_spurwar_en = true;
-
- if (pi->sh->boardflags2 & BFL2_SPUR_WAR) {
+ if (pi->sh->boardflags2 & BFL2_SPUR_WAR)
pi->nphy_aband_spurwar_en = true;
- }
}
if (NREV_GE(pi->pubpi.phy_rev, 6) && NREV_LT(pi->pubpi.phy_rev, 7)) {
-
- if (pi->sh->boardflags2 & BFL2_2G_SPUR_WAR) {
+ if (pi->sh->boardflags2 & BFL2_2G_SPUR_WAR)
pi->nphy_gband_spurwar2_en = true;
- }
}
pi->n_preamble_override = AUTO;
pi->nphy_elna_gain_config = false;
pi->radio_is_on = false;
- for (i = 0; i < pi->pubpi.phy_corenum; i++) {
+ for (i = 0; i < pi->pubpi.phy_corenum; i++)
pi->nphy_txpwrindex[i].index = AUTO;
- }
wlc_phy_txpwrctrl_config_nphy(pi);
if (pi->nphy_txpwrctrl == PHY_TPC_HW_ON)
core = 0;
- if (!(pi->measure_hold & PHY_HOLD_FOR_SCAN)) {
+ if (!(pi->measure_hold & PHY_HOLD_FOR_SCAN))
pi->measure_hold |= PHY_HOLD_FOR_NOT_ASSOC;
- }
if ((ISNPHY(pi)) && (NREV_GE(pi->pubpi.phy_rev, 5)) &&
((pi->sh->chippkg == BCM4717_PKG_ID) ||
(pi->sh->chippkg == BCM4718_PKG_ID))) {
if ((pi->sh->boardflags & BFL_EXTLNA) &&
- (CHSPEC_IS2G(pi->radio_chanspec))) {
+ (CHSPEC_IS2G(pi->radio_chanspec)))
ai_corereg(pi->sh->sih, SI_CC_IDX,
offsetof(struct chipcregs, chipcontrol),
0x40, 0x40);
- }
}
if ((pi->nphy_gband_spurwar2_en) && CHSPEC_IS2G(pi->radio_chanspec) &&
write_phy_reg(pi, 0x1ff, 48);
- if (NREV_LT(pi->pubpi.phy_rev, 8)) {
+ if (NREV_LT(pi->pubpi.phy_rev, 8))
wlc_phy_update_mimoconfig_nphy(pi, pi->n_preamble_override);
- }
wlc_phy_stf_chain_upd_nphy(pi);
}
wlc_phy_ipa_set_tx_digi_filts_nphy(pi);
- } else {
-
- if (NREV_GE(pi->pubpi.phy_rev, 5)) {
- wlc_phy_extpa_set_tx_digi_filts_nphy(pi);
- }
+ } else if (NREV_GE(pi->pubpi.phy_rev, 5)) {
+ wlc_phy_extpa_set_tx_digi_filts_nphy(pi);
}
wlc_phy_workarounds_nphy(pi);
tx_pwrctrl_tbl = wlc_phy_get_ipa_gaintbl_nphy(pi);
} else {
if (CHSPEC_IS5G(pi->radio_chanspec)) {
- if (NREV_IS(pi->pubpi.phy_rev, 3)) {
+ if (NREV_IS(pi->pubpi.phy_rev, 3))
tx_pwrctrl_tbl =
nphy_tpc_5GHz_txgain_rev3;
- } else if (NREV_IS(pi->pubpi.phy_rev, 4)) {
+ else if (NREV_IS(pi->pubpi.phy_rev, 4))
tx_pwrctrl_tbl =
(pi->srom_fem5g.extpagain == 3) ?
nphy_tpc_5GHz_txgain_HiPwrEPA :
nphy_tpc_5GHz_txgain_rev4;
- } else {
+ else
tx_pwrctrl_tbl =
nphy_tpc_5GHz_txgain_rev5;
- }
-
} else {
if (NREV_GE(pi->pubpi.phy_rev, 7)) {
- if (pi->pubpi.radiorev == 5) {
+ if (pi->pubpi.radiorev == 5)
tx_pwrctrl_tbl =
nphy_tpc_txgain_epa_2057rev5;
- } else if (pi->pubpi.radiorev == 3) {
+ else if (pi->pubpi.radiorev == 3)
tx_pwrctrl_tbl =
nphy_tpc_txgain_epa_2057rev3;
- }
-
} else {
if (NREV_GE(pi->pubpi.phy_rev, 5) &&
- (pi->srom_fem2g.extpagain == 3)) {
+ (pi->srom_fem2g.extpagain == 3))
tx_pwrctrl_tbl =
nphy_tpc_txgain_HiPwrEPA;
- } else {
+ else
tx_pwrctrl_tbl =
nphy_tpc_txgain_rev3;
- }
}
}
}
if (CHSPEC_IS2G(pi->radio_chanspec)) {
if ((pi->pubpi.radiorev == 3) ||
(pi->pubpi.radiorev == 4) ||
- (pi->pubpi.radiorev == 6)) {
+ (pi->pubpi.radiorev == 6))
rfpwr_offset = (s16)
nphy_papd_padgain_dlt_2g_2057rev3n4
[pad_gn];
- } else if (pi->pubpi.radiorev == 5) {
+ else if (pi->pubpi.radiorev == 5)
rfpwr_offset = (s16)
nphy_papd_padgain_dlt_2g_2057rev5
[pad_gn];
- } else if ((pi->pubpi.radiorev == 7)
+ else if ((pi->pubpi.radiorev == 7)
|| (pi->pubpi.radiorev ==
- 8)) {
+ 8))
rfpwr_offset = (s16)
nphy_papd_padgain_dlt_2g_2057rev7
[pad_gn];
- }
} else {
if ((pi->pubpi.radiorev == 3) ||
(pi->pubpi.radiorev == 4) ||
- (pi->pubpi.radiorev == 6)) {
+ (pi->pubpi.radiorev == 6))
rfpwr_offset = (s16)
nphy_papd_pgagain_dlt_5g_2057
[pga_gn];
- } else if ((pi->pubpi.radiorev == 7)
+ else if ((pi->pubpi.radiorev == 7)
|| (pi->pubpi.radiorev ==
- 8)) {
+ 8))
rfpwr_offset = (s16)
nphy_papd_pgagain_dlt_5g_2057rev7
[pga_gn];
- }
}
wlc_phy_table_write_nphy(pi,
NPHY_TBL_ID_CORE1TXPWRCTL,
for (idx = 0; idx < 128; idx++) {
pga_gn = (tx_pwrctrl_tbl[idx] >> 24) & 0xf;
- if (CHSPEC_IS2G(pi->radio_chanspec)) {
+ if (CHSPEC_IS2G(pi->radio_chanspec))
rfpwr_offset = (s16)
nphy_papd_pga_gain_delta_ipa_2g
[pga_gn];
- } else {
+ else
rfpwr_offset = (s16)
nphy_papd_pga_gain_delta_ipa_5g
[pga_gn];
- }
wlc_phy_table_write_nphy(pi,
NPHY_TBL_ID_CORE1TXPWRCTL,
192, 32, nphy_tpc_txgain);
}
- if (pi->sh->phyrxchain != 0x3) {
+ if (pi->sh->phyrxchain != 0x3)
wlc_phy_rxcore_setstate_nphy((struct brcms_phy_pub *) pi,
pi->sh->phyrxchain);
- }
- if (PHY_PERICAL_MPHASE_PENDING(pi)) {
+ if (PHY_PERICAL_MPHASE_PENDING(pi))
wlc_phy_cal_perical_mphase_restart(pi);
- }
if (!NORADIO_ENAB(pi->pubpi)) {
bool do_rssi_cal = false;
(pi->nphy_rssical_chanspec_2G == 0) :
(pi->nphy_rssical_chanspec_5G == 0);
- if (do_rssi_cal) {
+ if (do_rssi_cal)
wlc_phy_rssi_cal_nphy(pi);
- } else {
+ else
wlc_phy_restore_rssical_nphy(pi);
- }
} else {
wlc_phy_rssi_cal_nphy(pi);
}
- if (!SCAN_RM_IN_PROGRESS(pi)) {
+ if (!SCAN_RM_IN_PROGRESS(pi))
do_nphy_cal = (CHSPEC_IS2G(pi->radio_chanspec)) ?
(pi->nphy_iqcal_chanspec_2G == 0) :
(pi->nphy_iqcal_chanspec_5G == 0);
- }
if (!pi->do_initcal)
do_nphy_cal = false;
(pi, target_gain, true, false) == 0) {
if (wlc_phy_cal_rxiq_nphy
(pi, target_gain, 2,
- false) == 0) {
+ false) == 0)
wlc_phy_savecal_nphy(pi);
- }
}
} else if (pi->mphase_cal_phase_id ==
MPHASE_CAL_STATE_IDLE) {
-
wlc_phy_cal_perical((struct brcms_phy_pub *) pi,
PHY_PERICAL_PHYINIT);
}
pi->rfctrlIntc1_save = read_phy_reg(pi, 0x91);
pi->rfctrlIntc2_save = read_phy_reg(pi, 0x92);
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
rfctrlintc_override_val = 0x1480;
- } else if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+ else if (NREV_GE(pi->pubpi.phy_rev, 3))
rfctrlintc_override_val =
CHSPEC_IS5G(pi->radio_chanspec) ? 0x600 : 0x480;
- } else {
+ else
rfctrlintc_override_val =
CHSPEC_IS5G(pi->radio_chanspec) ? 0x180 : 0x120;
- }
write_phy_reg(pi, 0x91, rfctrlintc_override_val);
write_phy_reg(pi, 0x92, rfctrlintc_override_val);
} else {
-
write_phy_reg(pi, 0x91, pi->rfctrlIntc1_save);
write_phy_reg(pi, 0x92, pi->rfctrlIntc2_save);
}
txrx_chain = NPHY_RfseqCoreActv_TxRxChain0;
CoreActv_override = true;
- if (NREV_LE(pi->pubpi.phy_rev, 2)) {
+ if (NREV_LE(pi->pubpi.phy_rev, 2))
and_phy_reg(pi, 0xa0, ~0x20);
- }
} else if (pi->nphy_txrx_chain == BRCMS_N_TXRX_CHAIN1) {
txrx_chain = NPHY_RfseqCoreActv_TxRxChain1;
CoreActv_override = true;
- if (NREV_LE(pi->pubpi.phy_rev, 2)) {
+ if (NREV_LE(pi->pubpi.phy_rev, 2))
or_phy_reg(pi, 0xa0, 0x20);
- }
}
mod_phy_reg(pi, 0xa2, ((0xf << 0) | (0xf << 4)), txrx_chain);
if (CoreActv_override) {
-
pi->nphy_perical = PHY_PERICAL_DISABLE;
or_phy_reg(pi, 0xa1, NPHY_RfseqMode_CoreActv_override);
} else {
&tbl_opcode);
break;
} else if (tbl_buf[i] ==
- NPHY_REV3_RFSEQ_CMD_END) {
+ NPHY_REV3_RFSEQ_CMD_END)
break;
- }
}
}
}
{
u8 idx, idx2, i, delta_ind;
- for (idx = TXP_FIRST_CCK; idx <= TXP_LAST_CCK; idx++) {
+ for (idx = TXP_FIRST_CCK; idx <= TXP_LAST_CCK; idx++)
pi->adj_pwr_tbl_nphy[idx] = pi->tx_power_offset[idx];
- }
for (i = 0; i < 4; i++) {
idx2 = 0;
{
if (core == PHY_CORE_0) {
write_phy_reg(pi, 0x38, 0x4);
- if (CHSPEC_IS2G(pi->radio_chanspec)) {
+ if (CHSPEC_IS2G(pi->radio_chanspec))
write_phy_reg(pi, 0x37, 0x0060);
- } else {
+ else
write_phy_reg(pi, 0x37, 0x1080);
- }
} else if (core == PHY_CORE_1) {
write_phy_reg(pi, 0x2ae, 0x4);
- if (CHSPEC_IS2G(pi->radio_chanspec)) {
+ if (CHSPEC_IS2G(pi->radio_chanspec))
write_phy_reg(pi, 0x2ad, 0x0060);
- } else {
+ else
write_phy_reg(pi, 0x2ad, 0x1080);
- }
}
}
txchain0 = txchain & 0x1;
txchain1 = (txchain & 0x2) >> 1;
- if (!txchain0) {
+ if (!txchain0)
wlc_phy_war_force_trsw_to_R_cliplo_nphy(pi, PHY_CORE_0);
- }
- if (!txchain1) {
+ if (!txchain1)
wlc_phy_war_force_trsw_to_R_cliplo_nphy(pi, PHY_CORE_1);
- }
}
static void wlc_phy_workarounds_nphy(struct brcms_phy *pi)
u16 freq;
int coreNum;
- if (CHSPEC_IS5G(pi->radio_chanspec)) {
+ if (CHSPEC_IS5G(pi->radio_chanspec))
wlc_phy_classifier_nphy(pi, NPHY_ClassifierCtrl_cck_en, 0);
- } else {
+ else
wlc_phy_classifier_nphy(pi, NPHY_ClassifierCtrl_cck_en, 1);
- }
if (pi->phyhang_avoid)
wlc_phy_stay_in_carriersearch_nphy(pi, true);
write_phy_reg(pi, 0x240, 0x1b0);
}
- if (NREV_GE(pi->pubpi.phy_rev, 8)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 8))
mod_phy_reg(pi, 0xbd, (0xff << 0), (114 << 0));
- }
wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x00, 16,
&dac_control);
wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x16e, 16,
rfseq_rx2tx_dacbufpu_rev7);
- if (PHY_IPA(pi)) {
+ if (PHY_IPA(pi))
wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX,
rfseq_rx2tx_events_rev3_ipa,
rfseq_rx2tx_dlys_rev3_ipa,
sizeof
(rfseq_rx2tx_events_rev3_ipa
[0]));
- }
mod_phy_reg(pi, 0x299, (0x3 << 14), (0x1 << 14));
mod_phy_reg(pi, 0x29d, (0x3 << 14), (0x1 << 14));
NPHY_REV7_RFCTRLOVERRIDE_ID2);
}
- if (!NORADIO_ENAB(pi->pubpi)) {
+ if (!NORADIO_ENAB(pi->pubpi))
write_phy_reg(pi, 0x32f, 0x3);
- }
- if ((pi->pubpi.radiorev == 4) || (pi->pubpi.radiorev == 6)) {
+ if ((pi->pubpi.radiorev == 4) || (pi->pubpi.radiorev == 6))
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 2),
1, 0x3, 0,
NPHY_REV7_RFCTRLOVERRIDE_ID0);
- }
if ((pi->pubpi.radiorev == 3) || (pi->pubpi.radiorev == 4) ||
(pi->pubpi.radiorev == 6)) {
if (CHSPEC_IS2G(pi->radio_chanspec)) {
if ((pi->pubpi.radiorev == 3)
|| (pi->pubpi.radiorev == 4)
- || (pi->pubpi.radiorev == 6)) {
-
+ || (pi->pubpi.radiorev == 6))
txgm_idac_bleed = 0x7f;
- }
for (coreNum = 0; coreNum <= 1; coreNum++) {
if (txgm_idac_bleed != 0)
sizeof(rfseq_tx2rx_events_rev3) /
sizeof(rfseq_tx2rx_events_rev3[0]));
- if (PHY_IPA(pi)) {
+ if (PHY_IPA(pi))
wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX,
rfseq_rx2tx_events_rev3_ipa,
rfseq_rx2tx_dlys_rev3_ipa,
sizeof
(rfseq_rx2tx_events_rev3_ipa
[0]));
- }
if ((pi->sh->hw_phyrxchain != 0x3) &&
(pi->sh->hw_phyrxchain != pi->sh->hw_phytxchain)) {
[0]));
}
- if (CHSPEC_IS2G(pi->radio_chanspec)) {
+ if (CHSPEC_IS2G(pi->radio_chanspec))
write_phy_reg(pi, 0x6a, 0x2);
- } else {
+ else
write_phy_reg(pi, 0x6a, 0x9c40);
- }
mod_phy_reg(pi, 0x294, (0xf << 8), (7 << 8));
if (NREV_GE(pi->pubpi.phy_rev, 6)) {
- if (pi->sh->boardflags2 & BFL2_SINGLEANT_CCK) {
+ if (pi->sh->boardflags2 & BFL2_SINGLEANT_CCK)
wlapi_bmac_mhf(pi->sh->physhim, MHF4,
MHF4_BPHY_TXCORE0,
MHF4_BPHY_TXCORE0, BRCM_BAND_ALL);
- }
}
} else {
write_phy_reg(pi, 0x194, 0x0);
}
- if (NREV_IS(pi->pubpi.phy_rev, 2)) {
+ if (NREV_IS(pi->pubpi.phy_rev, 2))
mod_phy_reg(pi, 0x221,
NPHY_FORCESIG_DECODEGATEDCLKS,
NPHY_FORCESIG_DECODEGATEDCLKS);
- }
}
if (pi->phyhang_avoid)
if (NREV_GE(pi->pubpi.phy_rev, 7)) {
if (pi->pubpi.radiorev == 5) {
-
wlc_phy_workarounds_nphy_gainctrl_2057_rev5(pi);
} else if (pi->pubpi.radiorev == 7) {
wlc_phy_workarounds_nphy_gainctrl_2057_rev6(pi);
crsmin_th = crsminA_th_rev6;
crsminl_th = crsminlA_th_rev6;
if ((pi->pubpi.radiorev == 11) &&
- (CHSPEC_IS40(pi->radio_chanspec) == 0)) {
+ (CHSPEC_IS40(pi->radio_chanspec) == 0))
crsminu_th = crsminuA_th_rev6_224B0;
- } else {
+ else
crsminu_th = crsminuA_th_rev6;
- }
+
nbclip_th = nbclipA_th_rev6;
rssi_gain = rssiA_gain_rev6;
} else if (NREV_IS(pi->pubpi.phy_rev, 5)) {
mod_phy_reg(pi, 0x20, (0x1f << 7), (hpf_code << 7));
mod_phy_reg(pi, 0x36, (0x1f << 7), (hpf_code << 7));
- for (ctr = 0; ctr < 4; ctr++) {
+ for (ctr = 0; ctr < 4; ctr++)
regval[ctr] = (hpf_code << 8) | 0x7c;
- }
wlc_phy_table_write_nphy(pi, 7, 4, 0x106, 16, regval);
wlc_phy_adjust_lnagaintbl_nphy(pi);
wlc_phy_table_write_nphy(pi, 2, 4, 8, 16, regval);
wlc_phy_table_write_nphy(pi, 3, 4, 8, 16, regval);
- for (ctr = 0; ctr < 4; ctr++) {
+ for (ctr = 0; ctr < 4; ctr++)
regval[ctr] = (hpf_code << 8) | 0x74;
- }
wlc_phy_table_write_nphy(pi, 7, 4, 0x106, 16, regval);
}
if (NREV_IS(pi->pubpi.phy_rev, 2)) {
- for (ctr = 0; ctr < 21; ctr++) {
+ for (ctr = 0; ctr < 21; ctr++)
regval[ctr] = 3 * ctr;
- }
wlc_phy_table_write_nphy(pi, 0, 21, 32, 16, regval);
wlc_phy_table_write_nphy(pi, 1, 21, 32, 16, regval);
- for (ctr = 0; ctr < 21; ctr++) {
+ for (ctr = 0; ctr < 21; ctr++)
regval[ctr] = (u16) ctr;
- }
wlc_phy_table_write_nphy(pi, 2, 21, 32, 16, regval);
wlc_phy_table_write_nphy(pi, 3, 21, 32, 16, regval);
}
} else {
mod_phy_reg(pi, 0x280, (0xff << 0), (crsminl_th << 0));
}
-
}
-
}
static void wlc_phy_adjust_lnagaintbl_nphy(struct brcms_phy *pi)
regval[2] = nphy_def_lnagains[3] + gain_delta[core];
regval[3] = nphy_def_lnagains[3] + gain_delta[core];
} else {
- for (ctr = 0; ctr < 4; ctr++) {
+ for (ctr = 0; ctr < 4; ctr++)
regval[ctr] =
nphy_def_lnagains[ctr] + gain_delta[core];
- }
}
wlc_phy_table_write_nphy(pi, core, 4, 8, 16, regval);
mod_radio_reg(pi, RADIO_2056_SYN_COM_RESET, 0x2, 0x0);
if ((pi->sh->boardflags2 & BFL2_LEGACY)
- || (pi->sh->boardflags2 & BFL2_XTALBUFOUTEN)) {
-
+ || (pi->sh->boardflags2 & BFL2_XTALBUFOUTEN))
mod_radio_reg(pi, RADIO_2056_SYN_PLL_MAST2, 0xf4, 0x0);
- } else {
-
+ else
mod_radio_reg(pi, RADIO_2056_SYN_PLL_MAST2, 0xfc, 0x0);
- }
mod_radio_reg(pi, RADIO_2056_SYN_RCCAL_CTRL0, 0x1, 0x0);
- if (pi->phy_init_por) {
+ if (pi->phy_init_por)
wlc_phy_radio205x_rcal(pi);
- }
}
static void wlc_phy_radio_init_2057(struct brcms_phy *pi)
struct radio_20xx_regs *regs_2057_ptr = NULL;
if (NREV_IS(pi->pubpi.phy_rev, 7)) {
-
regs_2057_ptr = regs_2057_rev4;
} else if (NREV_IS(pi->pubpi.phy_rev, 8)
|| NREV_IS(pi->pubpi.phy_rev, 9)) {
switch (pi->pubpi.radiorev) {
case 5:
- if (pi->pubpi.radiover == 0x0) {
-
+ if (pi->pubpi.radiover == 0x0)
regs_2057_ptr = regs_2057_rev5;
-
- } else if (pi->pubpi.radiover == 0x1) {
-
+ else if (pi->pubpi.radiover == 0x1)
regs_2057_ptr = regs_2057_rev5v1;
- } else {
+ else
break;
- }
case 7:
break;
default:
- if (NORADIO_ENAB(pi->pubpi)) {
+ if (NORADIO_ENAB(pi->pubpi))
goto fail;
- }
+
break;
}
} else if (NREV_IS(pi->pubpi.phy_rev, 16)) {
}
}
- if (i >= tbl_len) {
+ if (i >= tbl_len)
goto fail;
- }
+
if (pi->pubpi.radiorev == 5) {
*t2 = &chan_info_tbl_p_2[i];
freq = chan_info_tbl_p_2[i].freq;
tbl_len = ARRAY_SIZE(chan_info_nphyrev6_2056v11);
break;
default:
- if (NORADIO_ENAB(pi->pubpi)) {
+ if (NORADIO_ENAB(pi->pubpi))
goto fail;
- }
+
break;
}
}
break;
}
- if (i >= tbl_len) {
+ if (i >= tbl_len)
goto fail;
- }
+
*t1 = &chan_info_tbl_p_1[i];
freq = chan_info_tbl_p_1[i].freq;
if (chan_info_nphy_2055[i].chan == channel)
break;
- if (i >= ARRAY_SIZE(chan_info_nphy_2055)) {
+ if (i >= ARRAY_SIZE(chan_info_nphy_2055))
goto fail;
- }
+
*t3 = &chan_info_nphy_2055[i];
freq = chan_info_nphy_2055[i].freq;
}
if (CHSPEC_IS2G(pi->radio_chanspec))
return WL_CHAN_FREQ_RANGE_2G;
- if ((freq >= BASE_LOW_5G_CHAN) && (freq < BASE_MID_5G_CHAN)) {
+ if ((freq >= BASE_LOW_5G_CHAN) && (freq < BASE_MID_5G_CHAN))
return WL_CHAN_FREQ_RANGE_5GL;
- } else if ((freq >= BASE_MID_5G_CHAN) && (freq < BASE_HIGH_5G_CHAN)) {
+ else if ((freq >= BASE_MID_5G_CHAN) && (freq < BASE_HIGH_5G_CHAN))
return WL_CHAN_FREQ_RANGE_5GM;
- } else {
+ else
return WL_CHAN_FREQ_RANGE_5GH;
- }
}
static void
break;
}
}
- if (CHSPEC_IS2G(pi->radio_chanspec)) {
+ if (CHSPEC_IS2G(pi->radio_chanspec))
write_radio_reg(pi, RADIO_2056_SYN_PLL_CP2 |
RADIO_2056_SYN,
(u16) regs_SYN_2056_ptr[0x49 - 2].init_g);
- } else {
+ else
write_radio_reg(pi, RADIO_2056_SYN_PLL_CP2 |
RADIO_2056_SYN,
(u16) regs_SYN_2056_ptr[0x49 - 2].init_a);
- }
if (pi->sh->boardflags2 & BFL2_GPLL_WAR) {
if (CHSPEC_IS2G(pi->radio_chanspec)) {
paa_boost_tune = 0x0;
pada_boost_tune = 0x77;
- if (freq != 5825) {
+ if (freq != 5825)
pgaa_boost_tune = -(int)(freq - 18) / 36 + 168;
- } else {
+ else
pgaa_boost_tune = 6;
- }
+
mixa_boost_tune = 0xf;
}
if ((pi->sh->chip == BCM43224_CHIP_ID) ||
(pi->sh->chip == BCM43225_CHIP_ID)) {
- if (pi->sh->chippkg == BCM43224_FAB_SMIC) {
+ if (pi->sh->chippkg == BCM43224_FAB_SMIC)
cascbias = 0x35;
- }
}
pabias = (pi->phy_pabias == 0) ? 0x30 : pi->phy_pabias;
for (i = 0; i < MAX_205x_RCAL_WAITLOOPS; i++) {
rcal_reg = read_radio_reg(pi, RADIO_2057_RCAL_STATUS);
- if (rcal_reg & 0x1) {
+ if (rcal_reg & 0x1)
break;
- }
+
udelay(100);
}
rcal_reg = read_radio_reg(pi,
RADIO_2056_SYN_RCAL_CODE_OUT |
RADIO_2056_SYN);
- if (rcal_reg & 0x80) {
+ if (rcal_reg & 0x80)
break;
- }
+
udelay(100);
}
if (CHSPEC_IS2G(pi->radio_chanspec)) {
if (PHY_IPA(pi)) {
- if (pi->pubpi.radiorev == 3) {
+ if (pi->pubpi.radiorev == 3)
txmix2g_tune_boost_pu = 0x6b;
- }
if (pi->pubpi.radiorev == 5)
pad2g_tune_pus = 0x73;
for (i = 0; i < MAX_205x_RCAL_WAITLOOPS; i++) {
rccal_valid = read_radio_reg(pi, RADIO_2057_RCCAL_DONE_OSCCAP);
- if (rccal_valid & 0x2) {
+ if (rccal_valid & 0x2)
break;
- }
+
udelay(500);
}
for (i = 0; i < MAX_205x_RCAL_WAITLOOPS; i++) {
rccal_valid = read_radio_reg(pi, RADIO_2057_RCCAL_DONE_OSCCAP);
- if (rccal_valid & 0x2) {
+ if (rccal_valid & 0x2)
break;
- }
+
udelay(500);
}
for (i = 0; i < MAX_205x_RCAL_WAITLOOPS; i++) {
rccal_valid = read_radio_reg(pi, RADIO_2057_RCCAL_DONE_OSCCAP);
- if (rccal_valid & 0x2) {
+ if (rccal_valid & 0x2)
break;
- }
+
udelay(500);
}
u8 tx_lpf_bw = 0;
if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 7)) {
- if (CHSPEC_IS40(pi->radio_chanspec)) {
+ if (CHSPEC_IS40(pi->radio_chanspec))
tx_lpf_bw = 3;
- } else {
+ else
tx_lpf_bw = 1;
- }
if (PHY_IPA(pi)) {
- if (CHSPEC_IS40(pi->radio_chanspec)) {
+ if (CHSPEC_IS40(pi->radio_chanspec))
tx_lpf_bw = 5;
- } else {
+ else
tx_lpf_bw = 4;
- }
}
+
write_phy_reg(pi, 0xe8,
(tx_lpf_bw << 0) |
(tx_lpf_bw << 3) |
if (PHY_IPA(pi)) {
- if (CHSPEC_IS40(pi->radio_chanspec)) {
+ if (CHSPEC_IS40(pi->radio_chanspec))
tx_lpf_bw = 4;
- } else {
+ else
tx_lpf_bw = 1;
- }
write_phy_reg(pi, 0xe9,
(tx_lpf_bw << 0) |
if (CHSPEC_IS2G(pi->radio_chanspec)) {
if ((cur_channel == 11)
- && CHSPEC_IS40(pi->radio_chanspec)) {
-
+ && CHSPEC_IS40(pi->radio_chanspec))
wlc_phy_adjust_min_noisevar_nphy(pi, 2,
nphy_adj_tone_id_buf,
nphy_adj_noise_var_buf);
- } else {
-
+ else
wlc_phy_adjust_min_noisevar_nphy(pi, 0,
NULL,
NULL);
- }
}
+
wlc_phy_adjust_crsminpwr_nphy(pi,
NPHY_ADJUSTED_MINCRSPOWER);
}
tempval = 0;
} else {
-
wlc_phy_adjust_min_noisevar_nphy(pi, 0, NULL,
NULL);
}
}
if (nphy_adj_tone_id_buf[0]
- && nphy_adj_noise_var_buf[0]) {
+ && nphy_adj_noise_var_buf[0])
wlc_phy_adjust_min_noisevar_nphy(pi, 1,
nphy_adj_tone_id_buf,
nphy_adj_noise_var_buf);
- } else {
+ else
wlc_phy_adjust_min_noisevar_nphy(pi, 0, NULL,
NULL);
- }
}
if (pi->phyhang_avoid)
and_phy_reg(pi, NPHY_TO_BPHY_OFF + BPHY_TEST, ~0x840);
}
- if (pi->nphy_txpwrctrl == PHY_TPC_HW_OFF) {
+ if (pi->nphy_txpwrctrl == PHY_TPC_HW_OFF)
wlc_phy_txpwr_fixpower_nphy(pi);
- }
-
- if (NREV_LT(pi->pubpi.phy_rev, 3)) {
+ if (NREV_LT(pi->pubpi.phy_rev, 3))
wlc_phy_adjust_lnagaintbl_nphy(pi);
- }
wlc_phy_txlpfbw_nphy(pi);
val = CHSPEC_CHANNEL(chanspec);
if (!CHSPEC_IS40(pi->radio_chanspec)) {
if (NREV_GE(pi->pubpi.phy_rev, 7)) {
- if ((val == 13) || (val == 14) || (val == 153)) {
+ if ((val == 13) || (val == 14) || (val == 153))
spuravoid = 1;
- }
- } else {
-
- if (((val >= 5) && (val <= 8)) || (val == 13)
+ } else if (((val >= 5) && (val <= 8)) || (val == 13)
|| (val == 14)) {
spuravoid = 1;
- }
}
+ } else if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (val == 54)
+ spuravoid = 1;
} else {
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
- if (val == 54) {
- spuravoid = 1;
- }
- } else {
-
- if (pi->nphy_aband_spurwar_en &&
- ((val == 38) || (val == 102)
- || (val == 118)))
- spuravoid = 1;
- }
+ if (pi->nphy_aband_spurwar_en &&
+ ((val == 38) || (val == 102)
+ || (val == 118)))
+ spuravoid = 1;
}
if (pi->phy_spuravoid == SPURAVOID_FORCEON)
struct chan_info_nphy_radio2057_rev5 *t2 = NULL;
struct chan_info_nphy_2055 *t3 = NULL;
- if (NORADIO_ENAB(pi->pubpi)) {
+ if (NORADIO_ENAB(pi->pubpi))
return;
- }
if (!wlc_phy_chan2freq_nphy
(pi, CHSPEC_CHANNEL(chanspec), &freq, &t0, &t1, &t2, &t3))
if (CHSPEC_IS40(chanspec)) {
if (CHSPEC_SB_UPPER(chanspec)) {
or_phy_reg(pi, 0xa0, BPHY_BAND_SEL_UP20);
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
or_phy_reg(pi, 0x310, PRIM_SEL_UP20);
- }
} else {
and_phy_reg(pi, 0xa0, ~BPHY_BAND_SEL_UP20);
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
and_phy_reg(pi, 0x310,
(~PRIM_SEL_UP20 & 0xffff));
- }
}
}
u16 rx2tx_lpf_rc_lut_offset = 0;
if (offset == 0) {
- if (CHSPEC_IS40(pi->radio_chanspec)) {
+ if (CHSPEC_IS40(pi->radio_chanspec))
rx2tx_lpf_rc_lut_offset = 0x159;
- } else {
+ else
rx2tx_lpf_rc_lut_offset = 0x154;
- }
} else {
rx2tx_lpf_rc_lut_offset = offset;
}
|| (core_mask & (1 << core_num))) {
or_phy_reg(pi, en_addr, en_mask);
- if (addr != 0xffff) {
+ if (addr != 0xffff)
mod_phy_reg(pi, val_addr,
val_mask,
(value <<
val_shift));
- }
}
}
}
|| (core_mask & (1 << core_num))) {
or_phy_reg(pi, en_addr, en_mask);
- if (addr != 0xffff) {
+ if (addr != 0xffff)
mod_phy_reg(pi, val_addr,
val_mask,
(value <<
val_shift));
- }
}
}
}
break;
}
- if ((addr != 0xffff) && (core_mask & (1 << core_num))) {
+ if ((addr != 0xffff) && (core_mask & (1 << core_num)))
mod_phy_reg(pi, addr, mask, (value << shift));
- }
}
or_phy_reg(pi, 0xec, (0x1 << 0));
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_NB)) {
+ (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_NB))
write_phy_reg(pi, 0x1a6, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_NB)) {
+ (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_NB))
write_phy_reg(pi, 0x1ac, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_NB)) {
+ (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_NB))
write_phy_reg(pi, 0x1b2, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_NB)) {
+ (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_NB))
write_phy_reg(pi, 0x1b8, valuetostuff);
- }
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W1)) {
+ (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W1))
write_phy_reg(pi, 0x1a4, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W1)) {
+ (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W1))
write_phy_reg(pi, 0x1aa, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W1)) {
+ (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W1))
write_phy_reg(pi, 0x1b0, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W1)) {
+ (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W1))
write_phy_reg(pi, 0x1b6, valuetostuff);
- }
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W2)) {
+ (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W2))
write_phy_reg(pi, 0x1a5, valuetostuff);
- }
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W2)) {
+ (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W2))
write_phy_reg(pi, 0x1ab, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W2)) {
+ (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W2))
write_phy_reg(pi, 0x1b1, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W2)) {
+ (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W2))
write_phy_reg(pi, 0x1b7, valuetostuff);
- }
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_TBD)) {
+ (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_TBD))
write_phy_reg(pi, 0x1a7, valuetostuff);
- }
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_TBD)) {
+ (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_TBD))
write_phy_reg(pi, 0x1ad, valuetostuff);
- }
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_TBD)) {
+ (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_TBD))
write_phy_reg(pi, 0x1b3, valuetostuff);
- }
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_TBD)) {
+ (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_TBD))
write_phy_reg(pi, 0x1b9, valuetostuff);
- }
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_IQ)) {
+ (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_IQ))
write_phy_reg(pi, 0x1a8, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_IQ)) {
+ (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_IQ))
write_phy_reg(pi, 0x1ae, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_IQ)) {
+ (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_IQ))
write_phy_reg(pi, 0x1b4, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_IQ)) {
+ (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_IQ))
write_phy_reg(pi, 0x1ba, valuetostuff);
- }
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rssi_type == NPHY_RSSI_SEL_TSSI_2G)) {
+ (rssi_type == NPHY_RSSI_SEL_TSSI_2G))
write_phy_reg(pi, 0x1a9, valuetostuff);
- }
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rssi_type == NPHY_RSSI_SEL_TSSI_2G)) {
+ (rssi_type == NPHY_RSSI_SEL_TSSI_2G))
write_phy_reg(pi, 0x1b5, valuetostuff);
- }
if (((coresel == RADIO_MIMO_CORESEL_CORE1) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rssi_type == NPHY_RSSI_SEL_TSSI_5G)) {
+ (rssi_type == NPHY_RSSI_SEL_TSSI_5G))
write_phy_reg(pi, 0x1af, valuetostuff);
- }
+
if (((coresel == RADIO_MIMO_CORESEL_CORE2) ||
(coresel == RADIO_MIMO_CORESEL_ALLRX)) &&
- (rssi_type == NPHY_RSSI_SEL_TSSI_5G)) {
+ (rssi_type == NPHY_RSSI_SEL_TSSI_5G))
write_phy_reg(pi, 0x1bb, valuetostuff);
- }
}
void wlc_phy_rssisel_nphy(struct brcms_phy *pi, u8 core_code, u8 rssi_type)
if (rssi_type == NPHY_RSSI_SEL_W1 ||
rssi_type == NPHY_RSSI_SEL_W2 ||
rssi_type == NPHY_RSSI_SEL_NB) {
-
mod_phy_reg(pi,
(core ==
PHY_CORE_0) ? 0xa6 : 0xa7,
0xe5 : 0xe6, mask, val);
} else {
if (rssi_type == NPHY_RSSI_SEL_TBD) {
-
mask = (0x3 << 8);
val = 1 << 8;
mod_phy_reg(pi,
: 0xa7, mask, val);
} else if (rssi_type ==
NPHY_RSSI_SEL_IQ) {
-
mask = (0x3 << 8);
val = 2 << 8;
mod_phy_reg(pi,
PHY_CORE_0) ? 0xa6
: 0xa7, mask, val);
} else {
-
mask = (0x3 << 8);
val = 3 << 8;
mod_phy_reg(pi,
if (PHY_IPA(pi)) {
if (NREV_GE
(pi->pubpi.phy_rev,
- 7)) {
-
+ 7))
write_radio_reg
(pi,
((core ==
radio_chanspec)
? 0xc :
0xe));
- } else {
+ else
write_radio_reg
(pi,
RADIO_2056_TX_TX_SSI_MUX
radio_chanspec)
? 0xc :
0xe));
- }
} else {
if (NREV_GE
if ((rssi_type == NPHY_RSSI_SEL_W1) ||
(rssi_type == NPHY_RSSI_SEL_W2) ||
- (rssi_type == NPHY_RSSI_SEL_NB)) {
-
+ (rssi_type == NPHY_RSSI_SEL_NB))
val = 0x0;
- } else if (rssi_type == NPHY_RSSI_SEL_TBD) {
-
+ else if (rssi_type == NPHY_RSSI_SEL_TBD)
val = 0x1;
- } else if (rssi_type == NPHY_RSSI_SEL_IQ) {
-
+ else if (rssi_type == NPHY_RSSI_SEL_IQ)
val = 0x2;
- } else {
-
+ else
val = 0x3;
- }
+
mask = ((0x3 << 12) | (0x3 << 14));
val = (val << 12) | (val << 14);
mod_phy_reg(pi, 0xa6, mask, val);
if ((rssi_type == NPHY_RSSI_SEL_W1) ||
(rssi_type == NPHY_RSSI_SEL_W2) ||
(rssi_type == NPHY_RSSI_SEL_NB)) {
- if (rssi_type == NPHY_RSSI_SEL_W1) {
+ if (rssi_type == NPHY_RSSI_SEL_W1)
val = 0x1;
- }
- if (rssi_type == NPHY_RSSI_SEL_W2) {
+ if (rssi_type == NPHY_RSSI_SEL_W2)
val = 0x2;
- }
- if (rssi_type == NPHY_RSSI_SEL_NB) {
+ if (rssi_type == NPHY_RSSI_SEL_NB)
val = 0x3;
- }
+
mask = (0x3 << 4);
val = (val << 4);
mod_phy_reg(pi, 0x7a, mask, val);
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_ALLRX, rssi_type);
gpiosel_orig = read_phy_reg(pi, 0xca);
- if (NREV_LT(pi->pubpi.phy_rev, 2)) {
+ if (NREV_LT(pi->pubpi.phy_rev, 2))
write_phy_reg(pi, 0xca, 5);
- }
- for (ctr = 0; ctr < 4; ctr++) {
+ for (ctr = 0; ctr < 4; ctr++)
rssi_buf[ctr] = 0;
- }
for (samp = 0; samp < nsamps; samp++) {
if (NREV_LT(pi->pubpi.phy_rev, 2)) {
tmp_buf[ctr++] = ((s8) ((rssi1 & 0x3f) << 2)) >> 2;
tmp_buf[ctr++] = ((s8) (((rssi1 >> 8) & 0x3f) << 2)) >> 2;
- for (ctr = 0; ctr < 4; ctr++) {
+ for (ctr = 0; ctr < 4; ctr++)
rssi_buf[ctr] += tmp_buf[ctr];
- }
}
rssi_out_val |= (rssi_buf[1] & 0xff) << 16;
rssi_out_val |= (rssi_buf[0] & 0xff) << 24;
- if (NREV_LT(pi->pubpi.phy_rev, 2)) {
+ if (NREV_LT(pi->pubpi.phy_rev, 2))
write_phy_reg(pi, 0xca, gpiosel_orig);
- }
write_phy_reg(pi, 0xa6, afectrlCore1_save);
write_phy_reg(pi, 0xa7, afectrlCore2_save);
write_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE, 0x05);
wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp2, 1);
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
write_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, 0x01);
- } else {
+ else
write_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE, 0x01);
- }
radio_temp[0] =
(126 * (radio_temp[1] + radio_temp2[1]) + 3987) / 64;
RADIO_2055_NBRSSI_VCM_Q_SHIFT);
}
} else {
-
- if (core == PHY_CORE_0) {
+ if (core == PHY_CORE_0)
mod_radio_reg(pi,
RADIO_2055_CORE1_RXBB_RSSI_CTRL5,
RADIO_2055_WBRSSI_VCM_IQ_MASK,
vcm_buf[2 *
core] <<
RADIO_2055_WBRSSI_VCM_IQ_SHIFT);
- } else {
+ else
mod_radio_reg(pi,
RADIO_2055_CORE2_RXBB_RSSI_CTRL5,
RADIO_2055_WBRSSI_VCM_IQ_MASK,
vcm_buf[2 *
core] <<
RADIO_2055_WBRSSI_VCM_IQ_SHIFT);
- }
}
}
}
void wlc_phy_rssi_cal_nphy(struct brcms_phy *pi)
{
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
-
wlc_phy_rssi_cal_nphy_rev3(pi);
} else {
wlc_phy_rssi_cal_nphy_rev2(pi, NPHY_RSSI_SEL_NB);
for (vcm = 0; vcm < 4; vcm++) {
vcm_tmp[0] = vcm_tmp[1] = vcm_tmp[2] = vcm_tmp[3] = vcm;
- if (rssi_type != NPHY_RSSI_SEL_W2) {
+ if (rssi_type != NPHY_RSSI_SEL_W2)
wlc_phy_set_rssi_2055_vcm(pi, rssi_type, vcm_tmp);
- }
wlc_phy_poll_rssi_nphy(pi, rssi_type, &poll_results[vcm][0],
NPHY_RSSICAL_NPOLL);
if ((rssi_type == NPHY_RSSI_SEL_W1)
|| (rssi_type == NPHY_RSSI_SEL_W2)) {
- for (ctr = 0; ctr < 2; ctr++) {
+ for (ctr = 0; ctr < 2; ctr++)
poll_miniq[vcm][ctr] =
min(poll_results[vcm][ctr * 2 + 0],
poll_results[vcm][ctr * 2 + 1]);
- }
}
}
min_d = curr_d;
min_vcm = vcm;
}
- if (poll_results[vcm][result_idx] < min_poll) {
+ if (poll_results[vcm][result_idx] < min_poll)
min_poll = poll_results[vcm][result_idx];
- }
}
vcm_final[result_idx] = min_vcm;
poll_results_min[result_idx] = min_poll;
}
- if (rssi_type != NPHY_RSSI_SEL_W2) {
+ if (rssi_type != NPHY_RSSI_SEL_W2)
wlc_phy_set_rssi_2055_vcm(pi, rssi_type, vcm_final);
- }
for (result_idx = 0; result_idx < 4; result_idx++) {
fine_digital_offset[result_idx] =
}
if (poll_results_min[result_idx] ==
- NPHY_RSSICAL_MAXREAD * NPHY_RSSICAL_NPOLL) {
+ NPHY_RSSICAL_MAXREAD * NPHY_RSSICAL_NPOLL)
fine_digital_offset[result_idx] =
(target_code - NPHY_RSSICAL_MAXREAD - 1);
- }
wlc_phy_scale_offset_rssi_nphy(pi, 0x0,
(s8)
mod_radio_reg(pi, RADIO_2055_PD_CORE1_RSSI_MISC, pd_mask, pd_state[0]);
mod_radio_reg(pi, RADIO_2055_PD_CORE2_RSSI_MISC, pd_mask, pd_state[1]);
- if (rssi_ctrl_state[0] == RADIO_2055_NBRSSI_SEL) {
+ if (rssi_ctrl_state[0] == RADIO_2055_NBRSSI_SEL)
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE1,
NPHY_RSSI_SEL_NB);
- } else if (rssi_ctrl_state[0] == RADIO_2055_WBRSSI_G1_SEL) {
+ else if (rssi_ctrl_state[0] == RADIO_2055_WBRSSI_G1_SEL)
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE1,
NPHY_RSSI_SEL_W1);
- } else if (rssi_ctrl_state[0] == RADIO_2055_WBRSSI_G2_SEL) {
+ else if (rssi_ctrl_state[0] == RADIO_2055_WBRSSI_G2_SEL)
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE1,
NPHY_RSSI_SEL_W2);
- } else {
+ else
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE1,
NPHY_RSSI_SEL_W2);
- }
- if (rssi_ctrl_state[1] == RADIO_2055_NBRSSI_SEL) {
+ if (rssi_ctrl_state[1] == RADIO_2055_NBRSSI_SEL)
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE2,
NPHY_RSSI_SEL_NB);
- } else if (rssi_ctrl_state[1] == RADIO_2055_WBRSSI_G1_SEL) {
+ else if (rssi_ctrl_state[1] == RADIO_2055_WBRSSI_G1_SEL)
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE2,
NPHY_RSSI_SEL_W1);
- } else if (rssi_ctrl_state[1] == RADIO_2055_WBRSSI_G2_SEL) {
+ else if (rssi_ctrl_state[1] == RADIO_2055_WBRSSI_G2_SEL)
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE2,
NPHY_RSSI_SEL_W2);
- } else {
+ else
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE2,
NPHY_RSSI_SEL_W2);
- }
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_OFF, rssi_type);
mask = (0x1 << 4) | (0x1 << 5);
- if (CHSPEC_IS5G(pi->radio_chanspec)) {
+ if (CHSPEC_IS5G(pi->radio_chanspec))
val = value << 5;
- } else {
+ else
val = value << 4;
- }
mod_phy_reg(pi,
(core ==
}
}
}
- } else {
- return;
}
}
wlc_phy_rfctrlintc_override_nphy(pi, NPHY_RfctrlIntc_override_TRSW, 1,
RADIO_MIMO_CORESEL_ALLRXTX);
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
wlc_phy_rfctrl_override_1tomany_nphy(pi,
NPHY_REV7_RfctrlOverride_cmd_rxrf_pu,
0, 0, 0);
- } else {
+ else
wlc_phy_rfctrl_override_nphy(pi, (0x1 << 0), 0, 0, 0);
- }
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
wlc_phy_rfctrl_override_1tomany_nphy(pi,
NPHY_REV7_RfctrlOverride_cmd_rx_pu,
1, 0, 0);
- } else {
+ else
wlc_phy_rfctrl_override_nphy(pi, (0x1 << 1), 1, 0, 0);
- }
if (NREV_GE(pi->pubpi.phy_rev, 7)) {
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 7),
NPHY_RAIL_Q, NPHY_RSSI_SEL_NB);
for (vcm = 0; vcm < vcm_level_max; vcm++) {
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
-
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
mod_radio_reg(pi, (core == PHY_CORE_0) ?
RADIO_2057_NB_MASTER_CORE0 :
RADIO_2057_NB_MASTER_CORE1,
RADIO_2057_VCM_MASK, vcm);
- } else {
-
+ else
mod_radio_reg(pi, RADIO_2056_RX_RSSI_MISC |
((core ==
PHY_CORE_0) ? RADIO_2056_RX0 :
RADIO_2056_RX1),
RADIO_2056_VCM_MASK,
vcm << RADIO_2056_RSSI_VCM_SHIFT);
- }
wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_NB,
&poll_results[vcm][0],
min_vcm = vcm;
}
if (poll_results[vcm][result_idx] <
- min_poll) {
+ min_poll)
min_poll =
poll_results[vcm]
[result_idx];
- }
}
vcm_final = min_vcm;
poll_results_min[result_idx] = min_poll;
}
}
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
mod_radio_reg(pi, (core == PHY_CORE_0) ?
RADIO_2057_NB_MASTER_CORE0 :
RADIO_2057_NB_MASTER_CORE1,
RADIO_2057_VCM_MASK, vcm_final);
- } else {
+ else
mod_radio_reg(pi, RADIO_2056_RX_RSSI_MISC |
((core ==
PHY_CORE_0) ? RADIO_2056_RX0 :
RADIO_2056_RX1), RADIO_2056_VCM_MASK,
vcm_final << RADIO_2056_RSSI_VCM_SHIFT);
- }
for (result_idx = 0; result_idx < 4; result_idx++) {
if (core == result_idx / 2) {
}
if (poll_results_min[result_idx] ==
- NPHY_RSSICAL_MAXREAD * NPHY_RSSICAL_NPOLL) {
+ NPHY_RSSICAL_MAXREAD * NPHY_RSSICAL_NPOLL)
fine_digital_offset[result_idx] =
(NPHY_RSSICAL_NB_TARGET -
NPHY_RSSICAL_MAXREAD - 1);
- }
wlc_phy_scale_offset_rssi_nphy(pi, 0x0,
(s8)
}
tone_buf = kmalloc(sizeof(struct cs32) * tbl_len, GFP_ATOMIC);
- if (tone_buf == NULL) {
+ if (tone_buf == NULL)
return 0;
- }
num_samps = (u16) tbl_len;
rot = FIXED((f_kHz * 36) / phy_bw) / 100;
num_samps =
wlc_phy_gen_load_samples_nphy(pi, f_kHz, max_val, dac_test_mode);
- if (num_samps == 0) {
+ if (num_samps == 0)
return -EBADE;
- }
wlc_phy_runsamples_nphy(pi, num_samps, loops, wait, iqmode,
dac_test_mode, modify_bbmult);
u32 *data_buf = NULL;
data_buf = kmalloc(sizeof(u32) * num_samps, GFP_ATOMIC);
- if (data_buf == NULL) {
+ if (data_buf == NULL)
return;
- }
if (pi->phyhang_avoid)
wlc_phy_stay_in_carriersearch_nphy(pi, true);
- for (t = 0; t < num_samps; t++) {
+ for (t = 0; t < num_samps; t++)
data_buf[t] = ((((unsigned int)tone_buf[t].i) & 0x3ff) << 10) |
(((unsigned int)tone_buf[t].q) & 0x3ff);
- }
wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_SAMPLEPLAY, num_samps, 0, 32,
data_buf);
write_phy_reg(pi, 0xc6, num_samps - 1);
- if (loops != 0xffff) {
+ if (loops != 0xffff)
write_phy_reg(pi, 0xc4, loops - 1);
- } else {
+ else
write_phy_reg(pi, 0xc4, loops);
- }
+
write_phy_reg(pi, 0xc5, wait);
orig_RfseqCoreActv = read_phy_reg(pi, 0xa1);
wlc_phy_stay_in_carriersearch_nphy(pi, true);
playback_status = read_phy_reg(pi, 0xc7);
- if (playback_status & 0x1) {
+ if (playback_status & 0x1)
or_phy_reg(pi, 0xc3, NPHY_sampleCmd_STOP);
- } else if (playback_status & 0x2) {
-
+ else if (playback_status & 0x2)
and_phy_reg(pi, 0xc2,
(u16) ~NPHY_iqloCalCmdGctl_IQLO_CAL_EN);
- }
and_phy_reg(pi, 0xc3, (u16) ~(0x1 << 2));
wlc_phy_get_ipa_gaintbl_nphy(pi);
} else {
if (CHSPEC_IS5G(pi->radio_chanspec)) {
- if (NREV_IS(phyrev, 3)) {
+ if (NREV_IS(phyrev, 3))
tx_pwrctrl_tbl =
nphy_tpc_5GHz_txgain_rev3;
- } else if (NREV_IS(phyrev, 4)) {
+ else if (NREV_IS(phyrev, 4))
tx_pwrctrl_tbl =
(pi->srom_fem5g.
extpagain ==
nphy_tpc_5GHz_txgain_HiPwrEPA
:
nphy_tpc_5GHz_txgain_rev4;
- } else {
+ else
tx_pwrctrl_tbl =
nphy_tpc_5GHz_txgain_rev5;
- }
} else {
if (NREV_GE(phyrev, 7)) {
if (pi->pubpi.
- radiorev == 3) {
+ radiorev == 3)
tx_pwrctrl_tbl =
nphy_tpc_txgain_epa_2057rev3;
- } else if (pi->pubpi.
+ else if (pi->pubpi.
radiorev ==
- 5) {
+ 5)
tx_pwrctrl_tbl =
nphy_tpc_txgain_epa_2057rev5;
- }
-
} else {
if (NREV_GE(phyrev, 5)
&& (pi->srom_fem2g.
extpagain ==
- 3)) {
+ 3))
tx_pwrctrl_tbl =
nphy_tpc_txgain_HiPwrEPA;
- } else {
+ else
tx_pwrctrl_tbl =
nphy_tpc_txgain_rev3;
- }
}
}
}
u8 band_idx = (CHSPEC_IS5G(pi->radio_chanspec) ? 1 : 0);
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
params->txlpf = target_gain.txlpf[core_no];
- }
+
params->txgm = target_gain.txgm[core_no];
params->pga = target_gain.pga[core_no];
params->pad = target_gain.pad[core_no];
params->ipa = target_gain.ipa[core_no];
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
params->cal_gain =
((params->txlpf << 15) | (params->
txgm << 12) | (params->
pga << 8) |
(params->pad << 3) | (params->ipa));
- } else {
+ else
params->cal_gain =
((params->txgm << 12) | (params->
pga << 8) | (params->
pad << 4) |
(params->ipa));
- }
+
params->ncorr[0] = 0x79;
params->ncorr[1] = 0x79;
params->ncorr[2] = 0x79;
if (pi->use_int_tx_iqlo_cal_nphy) {
WRITE_RADIO_REG3(pi, RADIO_2057, TX,
core, TX_SSI_MUX, 0x4);
- if (!
- (pi->
- internal_tx_iqlo_cal_tapoff_intpa_nphy)) {
-
+ if (!(pi->
+ internal_tx_iqlo_cal_tapoff_intpa_nphy))
WRITE_RADIO_REG3(pi, RADIO_2057,
TX, core,
TSSIA, 0x31);
- } else {
-
+ else
WRITE_RADIO_REG3(pi, RADIO_2057,
TX, core,
TSSIA, 0x21);
- }
}
WRITE_RADIO_REG3(pi, RADIO_2057, TX, core,
TSSI_MISC1, 0x00);
WRITE_RADIO_REG3(pi, RADIO_2057, TX,
core, TX_SSI_MUX,
0x06);
- if (!
- (pi->
- internal_tx_iqlo_cal_tapoff_intpa_nphy)) {
-
+ if (!(pi->
+ internal_tx_iqlo_cal_tapoff_intpa_nphy))
WRITE_RADIO_REG3(pi, RADIO_2057,
TX, core,
TSSIG, 0x31);
- } else {
-
+ else
WRITE_RADIO_REG3(pi, RADIO_2057,
TX, core,
TSSIG, 0x21);
- }
}
WRITE_RADIO_REG3(pi, RADIO_2057, TX, core,
TSSI_MISC1, 0x00);
write_radio_reg(pi,
RADIO_2056_TX_TX_SSI_MUX
| jtag_core, 0x06);
- if (NREV_LT(pi->pubpi.phy_rev, 5)) {
-
+ if (NREV_LT(pi->pubpi.phy_rev, 5))
write_radio_reg(pi,
RADIO_2056_TX_TSSIG
| jtag_core,
0x11);
- } else {
-
+ else
write_radio_reg(pi,
RADIO_2056_TX_TSSIG
| jtag_core,
0x1);
- }
} else {
write_radio_reg(pi,
RADIO_2056_TX_TX_SSI_MUX
pi->tx_rx_cal_phy_saveregs[7] = read_phy_reg(pi, 0x91);
pi->tx_rx_cal_phy_saveregs[8] = read_phy_reg(pi, 0x92);
- if (!(pi->use_int_tx_iqlo_cal_nphy)) {
-
+ if (!(pi->use_int_tx_iqlo_cal_nphy))
wlc_phy_rfctrlintc_override_nphy(pi,
NPHY_RfctrlIntc_override_PA,
1,
RADIO_MIMO_CORESEL_CORE1
|
RADIO_MIMO_CORESEL_CORE2);
- } else {
-
+ else
wlc_phy_rfctrlintc_override_nphy(pi,
NPHY_RfctrlIntc_override_PA,
0,
RADIO_MIMO_CORESEL_CORE1
|
RADIO_MIMO_CORESEL_CORE2);
- }
wlc_phy_rfctrlintc_override_nphy(pi,
NPHY_RfctrlIntc_override_TRSW,
0x29b, (0x1 << 0), (0) << 0);
if (NREV_IS(pi->pubpi.phy_rev, 7)
- || NREV_GE(pi->pubpi.phy_rev, 8)) {
+ || NREV_GE(pi->pubpi.phy_rev, 8))
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 7),
wlc_phy_read_lpf_bw_ctl_nphy
(pi, 0), 0, 0,
NPHY_REV7_RFCTRLOVERRIDE_ID1);
- }
if (pi->use_int_tx_iqlo_cal_nphy
&& !(pi->internal_tx_iqlo_cal_tapoff_intpa_nphy)) {
write_phy_reg(pi, 0x29b, pi->tx_rx_cal_phy_saveregs[10]);
if (NREV_IS(pi->pubpi.phy_rev, 7)
- || NREV_GE(pi->pubpi.phy_rev, 8)) {
+ || NREV_GE(pi->pubpi.phy_rev, 8))
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 7), 0, 0,
1,
NPHY_REV7_RFCTRLOVERRIDE_ID1);
- }
wlc_phy_resetcca_nphy(pi);
pwrindex[0] = idle_tssi[0] - tssival[0] + 64;
pwrindex[1] = idle_tssi[1] - tssival[1] + 64;
- if (pwrindex[0] < 0) {
+ if (pwrindex[0] < 0)
pwrindex[0] = 0;
- } else if (pwrindex[0] > 63) {
+ else if (pwrindex[0] > 63)
pwrindex[0] = 63;
- }
- if (pwrindex[1] < 0) {
+ if (pwrindex[1] < 0)
pwrindex[1] = 0;
- } else if (pwrindex[1] > 63) {
+ else if (pwrindex[1] > 63)
pwrindex[1] = 63;
- }
wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_CORE1TXPWRCTL, 1,
(u32) pwrindex[0], 32, &qdBm_pwrbuf[0]);
save_bbmult = true;
}
} else {
-
wlc_phy_internal_cal_txgain_nphy(pi);
save_bbmult = true;
}
} else if (NREV_IS(pi->pubpi.phy_rev, 6)) {
if (PHY_IPA(pi)) {
- if (CHSPEC_IS2G(pi->radio_chanspec)) {
+ if (CHSPEC_IS2G(pi->radio_chanspec))
wlc_phy_cal_txgainctrl_nphy(pi, 12,
false);
- } else {
+ else
wlc_phy_cal_txgainctrl_nphy(pi, 14,
false);
- }
} else {
-
wlc_phy_internal_cal_txgain_nphy(pi);
save_bbmult = true;
}
wlc_phy_cal_txgainctrl_nphy(pi, 10, false);
}
- if (save_bbmult) {
+ if (save_bbmult)
wlc_phy_table_read_nphy(pi, 15, 1, 87, 16,
&pi->nphy_txcal_bbmult);
- }
}
void
uint stepsize;
bool phyhang_avoid_state = false;
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
-
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
stepsize = 2;
- } else {
-
+ else
stepsize = 1;
- }
- if (CHSPEC_IS40(pi->radio_chanspec)) {
+ if (CHSPEC_IS40(pi->radio_chanspec))
freq_test = 5000;
- } else {
+ else
freq_test = 2500;
- }
wlc_phy_txpwr_index_nphy(pi, 1, pi->nphy_cal_orig_pwr_idx[0], true);
wlc_phy_txpwr_index_nphy(pi, 2, pi->nphy_cal_orig_pwr_idx[1], true);
wlc_phy_tx_tone_nphy(pi, freq_test, ampl_test, 0, 0,
false);
- if (core == PHY_CORE_0) {
+ if (core == PHY_CORE_0)
curr_m0m1 = m0m1 & 0xff00;
- } else {
+ else
curr_m0m1 = m0m1 & 0x00ff;
- }
wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &curr_m0m1);
wlc_phy_table_write_nphy(pi, 15, 1, 95, 16, &curr_m0m1);
delta_power = (dBm_targetpower * 4) - qdBm_power[core];
txpwrindex -= stepsize * delta_power;
- if (txpwrindex < 0) {
+ if (txpwrindex < 0)
txpwrindex = 0;
- } else if (txpwrindex > 127) {
+ else if (txpwrindex > 127)
txpwrindex = 127;
- }
if (CHSPEC_IS5G(pi->radio_chanspec)) {
if (NREV_IS(pi->pubpi.phy_rev, 4) &&
(pi->srom_fem5g.extpagain == 3)) {
- if (txpwrindex < 30) {
+ if (txpwrindex < 30)
txpwrindex = 30;
- }
}
} else {
if (NREV_GE(pi->pubpi.phy_rev, 5) &&
(pi->srom_fem2g.extpagain == 3)) {
- if (txpwrindex < 50) {
+ if (txpwrindex < 50)
txpwrindex = 50;
- }
}
}
else if (caltype == PHY_PERICAL_PARTIAL)
fullcal = false;
- if (pi->cal_type_override != PHY_PERICAL_AUTO) {
+ if (pi->cal_type_override != PHY_PERICAL_AUTO)
fullcal =
(pi->cal_type_override == PHY_PERICAL_FULL) ? true : false;
- }
if ((pi->mphase_cal_phase_id > MPHASE_CAL_STATE_INIT)) {
if (pi->nphy_txiqlocal_chanspec != pi->radio_chanspec)
wlc_phy_cal_perical_mphase_restart(pi);
}
- if ((pi->mphase_cal_phase_id == MPHASE_CAL_STATE_RXCAL)) {
+ if ((pi->mphase_cal_phase_id == MPHASE_CAL_STATE_RXCAL))
wlapi_bmac_write_shm(pi->sh->physhim, M_CTS_DURATION, 10000);
- }
wlapi_suspend_mac_and_wait(pi->sh->physhim);
pi->nphy_perical_last = pi->sh->now;
}
}
- if (caltype != PHY_PERICAL_AUTO) {
+ if (caltype != PHY_PERICAL_AUTO)
wlc_phy_rssi_cal_nphy(pi);
- }
if (pi->first_cal_after_assoc
|| (pi->cal_type_override == PHY_PERICAL_FULL)) {
wlc_phy_txpwrctrl_pwr_setup_nphy(pi);
}
- if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 3))
wlc_phy_radio205x_vcocal_nphy(pi);
- }
} else {
switch (pi->mphase_cal_phase_id) {
case MPHASE_CAL_STATE_INIT:
pi->nphy_perical_last = pi->sh->now;
pi->nphy_txiqlocal_chanspec = pi->radio_chanspec;
- if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 3))
wlc_phy_precal_txgain_nphy(pi);
- }
+
pi->nphy_cal_target_gain = wlc_phy_get_tx_gain_nphy(pi);
pi->mphase_cal_phase_id++;
break;
if (NREV_LE(pi->pubpi.phy_rev, 2) &&
(pi->mphase_cal_phase_id ==
- MPHASE_CAL_STATE_TXPHASE4)) {
+ MPHASE_CAL_STATE_TXPHASE4))
pi->mphase_cal_phase_id += 2;
- } else {
+ else
pi->mphase_cal_phase_id++;
- }
break;
case MPHASE_CAL_STATE_PAPDCAL:
if ((pi->radar_percal_mask & 0x2) != 0)
pi->nphy_rxcal_active = true;
- if (PHY_IPA(pi)) {
+ if (PHY_IPA(pi))
wlc_phy_a4(pi, true);
- }
+
pi->mphase_cal_phase_id++;
break;
(pi->first_cal_after_assoc ||
(pi->cal_type_override ==
PHY_PERICAL_FULL)) ? 2 : 0,
- false) == 0) {
+ false) == 0)
wlc_phy_savecal_nphy(pi);
- }
pi->mphase_cal_phase_id++;
break;
wlc_phy_txpwrctrl_coeff_setup_nphy(pi);
wlc_phy_rssi_cal_nphy(pi);
- if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 3))
wlc_phy_radio205x_vcocal_nphy(pi);
- }
+
restore_tx_gain = true;
- if (pi->first_cal_after_assoc) {
+ if (pi->first_cal_after_assoc)
pi->mphase_cal_phase_id++;
- } else {
+ else
wlc_phy_cal_perical_mphase_reset(pi);
- }
break;
pi->phyhang_avoid = false;
}
- if (CHSPEC_IS40(pi->radio_chanspec)) {
+ if (CHSPEC_IS40(pi->radio_chanspec))
phy_bw = 40;
- } else {
+ else
phy_bw = 20;
- }
wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, gain_save);
16, tbl_ptr);
}
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
write_phy_reg(pi, 0xc2, 0x8ad9);
- } else {
+ else
write_phy_reg(pi, 0xc2, 0x8aa9);
- }
max_val = 250;
tone_freq = (phy_bw == 20) ? 2500 : 5000;
if (pi->mphase_cal_phase_id > MPHASE_CAL_STATE_TXPHASE0) {
tbl_ptr = pi->mphase_txcal_bestcoeffs;
tbl_len = ARRAY_SIZE(pi->mphase_txcal_bestcoeffs);
- if (NREV_LT(pi->pubpi.phy_rev, 3)) {
-
+ if (NREV_LT(pi->pubpi.phy_rev, 3))
tbl_len -= 2;
- }
} else {
if ((!fullcal) && (pi->nphy_txiqlocal_coeffsvalid)) {
tbl_ptr = pi->nphy_txiqlocal_bestc;
tbl_len = ARRAY_SIZE(pi->nphy_txiqlocal_bestc);
- if (NREV_LT(pi->pubpi.phy_rev, 3)) {
-
+ if (NREV_LT(pi->pubpi.phy_rev, 3))
tbl_len -= 2;
- }
} else {
fullcal = true;
if (mphase) {
cal_cnt = pi->mphase_txcal_cmdidx;
- if ((cal_cnt + pi->mphase_txcal_numcmds) < max_cal_cmds) {
+ if ((cal_cnt + pi->mphase_txcal_numcmds) < max_cal_cmds)
num_cals = cal_cnt + pi->mphase_txcal_numcmds;
- } else {
+ else
num_cals = max_cal_cmds;
- }
} else {
cal_cnt = 0;
num_cals = max_cal_cmds;
16, tbl_buf);
tbl_len = ARRAY_SIZE(pi->nphy_txiqlocal_bestc);
- if (NREV_LT(pi->pubpi.phy_rev, 3)) {
-
+ if (NREV_LT(pi->pubpi.phy_rev, 3))
tbl_len -= 2;
- }
+
wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL,
tbl_len, 96, 16,
pi->nphy_txiqlocal_bestc);
pi->nphy_txiqlocal_chanspec = pi->radio_chanspec;
} else {
tbl_len = ARRAY_SIZE(pi->mphase_txcal_bestcoeffs);
- if (NREV_LT(pi->pubpi.phy_rev, 3)) {
-
+ if (NREV_LT(pi->pubpi.phy_rev, 3))
tbl_len -= 2;
- }
+
wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL,
tbl_len, 96, 16,
pi->mphase_txcal_bestcoeffs);
wlc_phy_tx_iq_war_nphy(pi);
}
- if (NREV_GE(pi->pubpi.phy_rev, 4)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 4))
pi->phyhang_avoid = phyhang_avoid_state;
- }
wlc_phy_stay_in_carriersearch_nphy(pi, false);
}
if (CHSPEC_IS5G(pi->radio_chanspec)) {
- if (pi->pubpi.radiorev >= 5) {
+ if (pi->pubpi.radiorev >= 5)
write_radio_reg(pi,
RADIO_2056_RX_LNAA_MASTER
| RADIO_2056_RX0,
pi->
tx_rx_cal_radio_saveregs
[4]);
- } else {
+ else
write_radio_reg(pi,
RADIO_2056_RX_LNAA_TUNE
| RADIO_2056_RX0,
pi->
tx_rx_cal_radio_saveregs
[4]);
- }
} else {
- if (pi->pubpi.radiorev >= 5) {
+ if (pi->pubpi.radiorev >= 5)
write_radio_reg(pi,
RADIO_2056_RX_LNAG_MASTER
| RADIO_2056_RX0,
pi->
tx_rx_cal_radio_saveregs
[4]);
- } else {
+ else
write_radio_reg(pi,
RADIO_2056_RX_LNAG_TUNE
| RADIO_2056_RX0,
pi->
tx_rx_cal_radio_saveregs
[4]);
- }
}
} else {
}
if (CHSPEC_IS5G(pi->radio_chanspec)) {
- if (pi->pubpi.radiorev >= 5) {
+ if (pi->pubpi.radiorev >= 5)
write_radio_reg(pi,
RADIO_2056_RX_LNAA_MASTER
| RADIO_2056_RX1,
pi->
tx_rx_cal_radio_saveregs
[4]);
- } else {
+ else
write_radio_reg(pi,
RADIO_2056_RX_LNAA_TUNE
| RADIO_2056_RX1,
pi->
tx_rx_cal_radio_saveregs
[4]);
- }
} else {
- if (pi->pubpi.radiorev >= 5) {
+ if (pi->pubpi.radiorev >= 5)
write_radio_reg(pi,
RADIO_2056_RX_LNAG_MASTER
| RADIO_2056_RX1,
pi->
tx_rx_cal_radio_saveregs
[4]);
- } else {
+ else
write_radio_reg(pi,
RADIO_2056_RX_LNAG_TUNE
| RADIO_2056_RX1,
pi->
tx_rx_cal_radio_saveregs
[4]);
- }
}
}
}
u8 tx_core;
u16 rx_antval, tx_antval;
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
-
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
tx_core = rx_core;
- } else {
+ else
tx_core = (rx_core == PHY_CORE_0) ? 1 : 0;
- }
pi->tx_rx_cal_phy_saveregs[0] = read_phy_reg(pi, 0xa2);
pi->tx_rx_cal_phy_saveregs[1] =
NPHY_REV7_RFCTRLOVERRIDE_ID2);
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 11), 0, 0, 0,
NPHY_REV7_RFCTRLOVERRIDE_ID1);
- if (CHSPEC_IS40(pi->radio_chanspec)) {
+ if (CHSPEC_IS40(pi->radio_chanspec))
wlc_phy_rfctrl_override_nphy_rev7(pi,
(0x1 << 7),
2, 0, 0,
NPHY_REV7_RFCTRLOVERRIDE_ID1);
- } else {
+ else
wlc_phy_rfctrl_override_nphy_rev7(pi,
(0x1 << 7),
0, 0, 0,
NPHY_REV7_RFCTRLOVERRIDE_ID1);
- }
+
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 7),
0, 0, 0,
NPHY_REV7_RFCTRLOVERRIDE_ID1);
s8 txpwrindex;
u16 nphy_rxcal_txgain[2];
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
-
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
tx_core = rx_core;
- } else {
+ else
tx_core = 1 - rx_core;
- }
num_samps = 1024;
desired_log2_pwr = (cal_type == 0) ? 13 : 13;
wlc_phy_rx_iq_coeffs_nphy(pi, 1, &zero_comp);
if (CHSPEC_IS5G(pi->radio_chanspec)) {
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
mix_tia_gain = 3;
- } else if (NREV_GE(pi->pubpi.phy_rev, 4)) {
+ else if (NREV_GE(pi->pubpi.phy_rev, 4))
mix_tia_gain = 4;
- } else {
+ else
mix_tia_gain = 6;
- }
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
nphy_rxcal_gaintbl = nphy_ipa_rxcal_gaintbl_5GHz_rev7;
- } else {
+ else
nphy_rxcal_gaintbl = nphy_ipa_rxcal_gaintbl_5GHz;
- }
} else {
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
nphy_rxcal_gaintbl = nphy_ipa_rxcal_gaintbl_2GHz_rev7;
- } else {
+ else
nphy_rxcal_gaintbl = nphy_ipa_rxcal_gaintbl_2GHz;
- }
}
do {
lna1 = nphy_rxcal_gaintbl[curr_gaintbl_index].lna1;
txpwrindex = nphy_rxcal_gaintbl[curr_gaintbl_index].txpwrindex;
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
wlc_phy_rfctrl_override_1tomany_nphy(pi,
NPHY_REV7_RfctrlOverride_cmd_rxgain,
((lpf_biq1 << 12) |
(mix_tia_gain <<
4) | (lna2 << 2)
| lna1), 0x3, 0);
- } else {
+ else
wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12),
((hpvga << 12) |
(lpf_biq1 << 10) |
(mix_tia_gain << 4) |
(lna2 << 2) | lna1), 0x3,
0);
- }
pi->nphy_rxcal_pwr_idx[tx_core] = txpwrindex;
if (NREV_GE(pi->pubpi.phy_rev, 7)) {
fine_gain_idx = (int)lpf_biq1 + delta_pwr;
- if (fine_gain_idx + (int)lpf_biq0 > 10) {
+ if (fine_gain_idx + (int)lpf_biq0 > 10)
lpf_biq1 = 10 - lpf_biq0;
- } else {
+ else
lpf_biq1 = (u16) max(fine_gain_idx, 0);
- }
+
wlc_phy_rfctrl_override_1tomany_nphy(pi,
NPHY_REV7_RfctrlOverride_cmd_rxgain,
((lpf_biq1 << 12) |
u16 num_samps, log_num_samps = 10;
struct phy_iq_est est[PHY_CORE_MAX];
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
return 0;
- }
num_samps = (1 << log_num_samps);
wlc_phy_rx_iq_est_nphy(pi, est, num_samps, 32, 0);
- if (core_idx == 0) {
+ if (core_idx == 0)
ref_iq_vals =
max_t(u32, (est[0].i_pwr +
est[0].q_pwr) >> (log_num_samps + 1),
1);
- } else {
+ else
ref_iq_vals =
max_t(u32, (est[1].i_pwr +
est[1].q_pwr) >> (log_num_samps + 1),
1);
- }
wlc_phy_tx_tone_nphy(pi, target_bw, NPHY_RXCAL_TONEAMP,
0, 1, false);
wlc_phy_rx_iq_est_nphy(pi, est, num_samps, 32, 0);
- if (core_idx == 0) {
+ if (core_idx == 0)
target_iq_vals =
(est[0].i_pwr + est[0].q_pwr) >> (log_num_samps +
1);
- } else {
+ else
target_iq_vals =
(est[1].i_pwr + est[1].q_pwr) >> (log_num_samps +
1);
- }
+
pwr_ratio = (uint) ((target_iq_vals << 16) / ref_iq_vals);
- if (rccal_stepsize == 0) {
+ if (rccal_stepsize == 0)
rccal_stepsize--;
- } else if (rccal_stepsize == 1) {
+ else if (rccal_stepsize == 1) {
last_rccal_val = rccal_val;
rccal_val += (pwr_ratio > target_pwr_ratio) ? 1 : -1;
last_pwr_ratio = pwr_ratio;
if (CHSPEC_IS40(pi->radio_chanspec)) {
if ((best_rccal_val > 140)
- || (best_rccal_val < 135)) {
+ || (best_rccal_val < 135))
best_rccal_val = 138;
- }
} else {
if ((best_rccal_val > 142)
- || (best_rccal_val < 137)) {
+ || (best_rccal_val < 137))
best_rccal_val = 140;
- }
}
write_radio_reg(pi,
if (rx_core == PHY_CORE_1) {
- if (rxcore_state == 1) {
+ if (rxcore_state == 1)
wlc_phy_rxcore_setstate_nphy(
(struct brcms_phy_pub *) pi, 3);
- }
wlc_phy_rxcal_gainctrl_nphy(pi, rx_core, NULL,
1);
wlc_phy_rc_sweep_nphy(pi, rx_core, 1);
pi->nphy_rccal_value = best_rccal[rx_core];
- if (rxcore_state == 1) {
+ if (rxcore_state == 1)
wlc_phy_rxcore_setstate_nphy(
(struct brcms_phy_pub *) pi,
rxcore_state);
- }
}
}
wlc_phy_resetcca_nphy(pi);
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
wlc_phy_rfctrl_override_1tomany_nphy(pi,
NPHY_REV7_RfctrlOverride_cmd_rxgain,
0, 0x3, 1);
- } else {
+ else
wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), 0, 0x3, 1);
- }
+
wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX);
wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16,
gain_save);
- if (NREV_GE(pi->pubpi.phy_rev, 4)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 4))
pi->phyhang_avoid = phyhang_avoid_state;
- }
wlc_phy_stay_in_carriersearch_nphy(pi, false);
wlc_phy_stay_in_carriersearch_nphy(pi, true);
- if (NREV_LT(pi->pubpi.phy_rev, 2)) {
-
+ if (NREV_LT(pi->pubpi.phy_rev, 2))
wlc_phy_reapply_txcal_coeffs_nphy(pi);
- }
wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, gain_save);
((0x1 << 1) | (0x1 << 2)));
or_phy_reg(pi, 0xa5, ((0x1 << 1) | (0x1 << 2)));
- if (((pi->nphy_rxcalparams) & 0xff000000)) {
-
+ if (((pi->nphy_rxcalparams) & 0xff000000))
write_phy_reg(pi,
(rx_core == PHY_CORE_0) ? 0x91 : 0x92,
(CHSPEC_IS5G(pi->radio_chanspec) ? 0x140 :
0x110));
- } else {
-
+ else
write_phy_reg(pi,
(rx_core == PHY_CORE_0) ? 0x91 : 0x92,
(CHSPEC_IS5G(pi->radio_chanspec) ? 0x180 :
0x120));
- }
write_phy_reg(pi, (tx_core == PHY_CORE_0) ? 0x91 : 0x92,
(CHSPEC_IS5G(pi->radio_chanspec) ? 0x148 :
hpf_change = desired_log2_pwr - actual_log2_pwr;
curr_hpf += hpf_change;
curr_hpf = max(min_t(u16, curr_hpf, 10), 0);
- if (use_hpf_num == 1) {
+ if (use_hpf_num == 1)
curr_hpf1 = curr_hpf;
- } else {
+ else
curr_hpf2 = curr_hpf;
- }
}
wlc_phy_rfctrl_override_nphy(pi, (0x1 << 10),
wlc_phy_cal_rxiq_nphy(struct brcms_phy *pi, struct nphy_txgains target_gain,
u8 cal_type, bool debug)
{
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
-
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
cal_type = 0;
- }
- if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+
+ if (NREV_GE(pi->pubpi.phy_rev, 3))
return wlc_phy_cal_rxiq_nphy_rev3(pi, target_gain, cal_type,
debug);
- } else {
+ else
return wlc_phy_cal_rxiq_nphy_rev2(pi, target_gain, debug);
- }
}
static void wlc_phy_extpa_set_tx_digi_filts_nphy(struct brcms_phy *pi)
int j, type = 2;
u16 addr_offset = 0x2c5;
- for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) {
+ for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++)
write_phy_reg(pi, addr_offset + j,
NPHY_IPA_REV4_txdigi_filtcoeffs[type][j]);
- }
}
static void wlc_phy_ipa_set_tx_digi_filts_nphy(struct brcms_phy *pi)
{
int j, type;
- u16 addr_offset[] = { 0x186, 0x195,
- 0x2c5
- };
+ u16 addr_offset[] = { 0x186, 0x195, 0x2c5};
for (type = 0; type < 3; type++) {
- for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) {
+ for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++)
write_phy_reg(pi, addr_offset[type] + j,
NPHY_IPA_REV4_txdigi_filtcoeffs[type][j]);
- }
}
if (IS40MHZ(pi)) {
- for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) {
+ for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++)
write_phy_reg(pi, 0x186 + j,
NPHY_IPA_REV4_txdigi_filtcoeffs[3][j]);
- }
} else {
if (CHSPEC_IS5G(pi->radio_chanspec)) {
- for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) {
+ for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++)
write_phy_reg(pi, 0x186 + j,
NPHY_IPA_REV4_txdigi_filtcoeffs[5]
[j]);
- }
}
if (CHSPEC_CHANNEL(pi->radio_chanspec) == 14) {
- for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) {
+ for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++)
write_phy_reg(pi, 0x2c5 + j,
NPHY_IPA_REV4_txdigi_filtcoeffs[6]
[j]);
- }
}
}
}
int j;
if (IS40MHZ(pi)) {
- for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) {
+ for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++)
write_phy_reg(pi, 0x195 + j,
NPHY_IPA_REV4_txdigi_filtcoeffs[4][j]);
- }
} else {
- for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) {
+ for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++)
write_phy_reg(pi, 0x186 + j,
NPHY_IPA_REV4_txdigi_filtcoeffs[3][j]);
- }
}
}
u32 *tx_pwrctrl_tbl = NULL;
if (CHSPEC_IS2G(pi->radio_chanspec)) {
-
if (NREV_GE(pi->pubpi.phy_rev, 7)) {
-
if ((pi->pubpi.radiorev == 4)
- || (pi->pubpi.radiorev == 6)) {
-
+ || (pi->pubpi.radiorev == 6))
tx_pwrctrl_tbl =
nphy_tpc_txgain_ipa_2g_2057rev4n6;
- } else if (pi->pubpi.radiorev == 3) {
-
+ else if (pi->pubpi.radiorev == 3)
tx_pwrctrl_tbl =
nphy_tpc_txgain_ipa_2g_2057rev3;
- } else if (pi->pubpi.radiorev == 5) {
-
+ else if (pi->pubpi.radiorev == 5)
tx_pwrctrl_tbl =
nphy_tpc_txgain_ipa_2g_2057rev5;
- } else if ((pi->pubpi.radiorev == 7)
- || (pi->pubpi.radiorev == 8)) {
-
+ else if ((pi->pubpi.radiorev == 7)
+ || (pi->pubpi.radiorev == 8))
tx_pwrctrl_tbl =
nphy_tpc_txgain_ipa_2g_2057rev7;
- }
-
} else if (NREV_IS(pi->pubpi.phy_rev, 6)) {
-
tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev6;
} else if (NREV_IS(pi->pubpi.phy_rev, 5)) {
-
tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev5;
} else {
-
tx_pwrctrl_tbl = nphy_tpc_txgain_ipa;
}
-
} else {
if (NREV_GE(pi->pubpi.phy_rev, 7)) {
if ((pi->pubpi.radiorev == 3) ||
(pi->pubpi.radiorev == 4) ||
- (pi->pubpi.radiorev == 6)) {
-
+ (pi->pubpi.radiorev == 6))
tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_5g_2057;
- } else if ((pi->pubpi.radiorev == 7)
- || (pi->pubpi.radiorev == 8)) {
-
+ else if ((pi->pubpi.radiorev == 7)
+ || (pi->pubpi.radiorev == 8))
tx_pwrctrl_tbl =
nphy_tpc_txgain_ipa_5g_2057rev7;
- }
-
} else {
tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_5g;
}
if (NREV_GE(pi->pubpi.phy_rev, 7)) {
if (NREV_IS(pi->pubpi.phy_rev, 7)
- || NREV_GE(pi->pubpi.phy_rev, 8)) {
+ || NREV_GE(pi->pubpi.phy_rev, 8))
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 7),
wlc_phy_read_lpf_bw_ctl_nphy
(pi, 0), 0, 0,
NPHY_REV7_RFCTRLOVERRIDE_ID1);
- }
if (CHSPEC_IS2G(pi->radio_chanspec)) {
- if (pi->pubpi.radiorev == 5) {
+ if (pi->pubpi.radiorev == 5)
mixgain = (core == 0) ? 0x20 : 0x00;
-
- } else if ((pi->pubpi.radiorev == 7)
- || (pi->pubpi.radiorev == 8)) {
-
+ else if ((pi->pubpi.radiorev == 7)
+ || (pi->pubpi.radiorev == 8))
mixgain = 0x00;
-
- } else if ((pi->pubpi.radiorev <= 4)
- || (pi->pubpi.radiorev == 6)) {
-
+ else if ((pi->pubpi.radiorev <= 4)
+ || (pi->pubpi.radiorev == 6))
mixgain = 0x00;
- }
-
} else {
if ((pi->pubpi.radiorev == 4) ||
- (pi->pubpi.radiorev == 6)) {
-
+ (pi->pubpi.radiorev == 6))
mixgain = 0x50;
- } else if ((pi->pubpi.radiorev == 3)
- || (pi->pubpi.radiorev == 7)
- || (pi->pubpi.radiorev == 8)) {
-
+ else if ((pi->pubpi.radiorev == 3)
+ || (pi->pubpi.radiorev == 7)
+ || (pi->pubpi.radiorev == 8))
mixgain = 0x0;
- }
}
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 11),
if ((pi->pubpi.radiorev == 3) ||
(pi->pubpi.radiorev == 4) ||
- (pi->pubpi.radiorev == 6)) {
-
+ (pi->pubpi.radiorev == 6))
WRITE_RADIO_REG3(pi, RADIO_2057, TX, core,
TXRXCOUPLE_2G_ATTEN, 0xf0);
-
- } else if (pi->pubpi.radiorev == 5) {
-
+ else if (pi->pubpi.radiorev == 5)
WRITE_RADIO_REG3(pi, RADIO_2057, TX, core,
TXRXCOUPLE_2G_ATTEN,
(core == 0) ? 0xf7 : 0xf2);
-
- } else if ((pi->pubpi.radiorev == 7)
- || (pi->pubpi.radiorev == 8)) {
-
+ else if ((pi->pubpi.radiorev == 7)
+ || (pi->pubpi.radiorev == 8))
WRITE_RADIO_REG3(pi, RADIO_2057, TX, core,
TXRXCOUPLE_2G_ATTEN, 0xf0);
- }
-
WRITE_RADIO_REG3(pi, RADIO_2057, TX, off_core,
TXRXCOUPLE_2G_PWRUP, 0x0);
WRITE_RADIO_REG3(pi, RADIO_2057, TX, off_core,
TXRXCOUPLE_2G_ATTEN, 0xff);
-
} else {
state->pwrup[core] =
READ_RADIO_REG3(pi, RADIO_2057, TX, core,
TXRXCOUPLE_5G_PWRUP, 0xc);
if ((pi->pubpi.radiorev == 7)
- || (pi->pubpi.radiorev == 8)) {
-
+ || (pi->pubpi.radiorev == 8))
WRITE_RADIO_REG3(pi, RADIO_2057, TX, core,
TXRXCOUPLE_5G_ATTEN, 0xf4);
- } else {
+ else
WRITE_RADIO_REG3(pi, RADIO_2057, TX, core,
TXRXCOUPLE_5G_ATTEN, 0xf0);
- }
WRITE_RADIO_REG3(pi, RADIO_2057, TX, off_core,
TXRXCOUPLE_5G_PWRUP, 0x0);
}
}
- if ((pi->pubpi.radiorev == 4) || (pi->pubpi.radiorev == 6)) {
+ if ((pi->pubpi.radiorev == 4) || (pi->pubpi.radiorev == 6))
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 2),
1, 0x3, 0,
NPHY_REV7_RFCTRLOVERRIDE_ID0);
- } else {
+ else
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 2),
0, 0x3, 1,
NPHY_REV7_RFCTRLOVERRIDE_ID0);
- }
+
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 1),
0, 0x3, 1,
NPHY_REV7_RFCTRLOVERRIDE_ID1);
(state->mm & 0xff));
if (NREV_IS(pi->pubpi.phy_rev, 7)
- || NREV_GE(pi->pubpi.phy_rev, 8)) {
+ || NREV_GE(pi->pubpi.phy_rev, 8))
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 7), 0, 0,
1,
NPHY_REV7_RFCTRLOVERRIDE_ID1);
- }
} else {
-
wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), 0, 0x3, 1);
wlc_phy_rfctrl_override_nphy(pi, (0x1 << 13), 0, 0x3, 1);
wlc_phy_rfctrl_override_nphy(pi, (0x1 << 0), 0, 0x3, 1);
sz = end - start + 1;
buf = kmalloc(2 * sizeof(u32) * NPHY_PAPD_EPS_TBL_SIZE, GFP_ATOMIC);
- if (NULL == buf) {
+ if (NULL == buf)
return;
- }
src = buf;
dst = buf + NPHY_PAPD_EPS_TBL_SIZE;
phy_a9 = wlc_phy_get_tx_gain_nphy(pi);
- if (CHSPEC_IS2G(pi->radio_chanspec)) {
+ if (CHSPEC_IS2G(pi->radio_chanspec))
phy_a5 = ((phy_a9.txlpf[core] << 15) |
(phy_a9.txgm[core] << 12) |
(phy_a9.pga[core] << 8) |
(txgains->gains.pad[core] << 3) |
(phy_a9.ipa[core]));
- } else {
+ else
phy_a5 = ((phy_a9.txlpf[core] << 15) |
(phy_a9.txgm[core] << 12) |
(txgains->gains.pga[core] << 8) |
(phy_a9.pad[core] << 3) | (phy_a9.ipa[core]));
- }
wlc_phy_rfctrl_override_1tomany_nphy(pi,
NPHY_REV7_RfctrlOverride_cmd_txgain,
if (CHSPEC_IS2G(pi->radio_chanspec)) {
if ((pi->pubpi.radiorev <= 4)
- || (pi->pubpi.radiorev == 6)) {
-
+ || (pi->pubpi.radiorev == 6))
m[core] = IS40MHZ(pi) ? 60 : 79;
- } else {
-
+ else
m[core] = IS40MHZ(pi) ? 45 : 64;
- }
-
} else {
m[core] = IS40MHZ(pi) ? 75 : 107;
}
if (cal_mode == CAL_GCTRL) {
if ((pi->pubpi.radiorev == 5)
- && (CHSPEC_IS2G(pi->radio_chanspec))) {
+ && (CHSPEC_IS2G(pi->radio_chanspec)))
phy_a1 = 55;
- } else if (((pi->pubpi.radiorev == 7) &&
+ else if (((pi->pubpi.radiorev == 7) &&
(CHSPEC_IS2G(pi->radio_chanspec))) ||
((pi->pubpi.radiorev == 8) &&
- (CHSPEC_IS2G(pi->radio_chanspec)))) {
+ (CHSPEC_IS2G(pi->radio_chanspec))))
phy_a1 = 60;
- } else {
+ else
phy_a1 = 63;
- }
} else if ((cal_mode != CAL_FULL) && (cal_mode != CAL_SOFT)) {
32, &phy_a8);
if (cal_mode != CAL_GCTRL) {
- if (CHSPEC_IS5G(pi->radio_chanspec)) {
+ if (CHSPEC_IS5G(pi->radio_chanspec))
wlc_phy_a1_nphy(pi, core, 5, 0, 35);
- }
}
wlc_phy_rfctrl_override_1tomany_nphy(pi,
}
}
- if (CHSPEC_IS2G(pi->radio_chanspec)) {
+ if (CHSPEC_IS2G(pi->radio_chanspec))
m[core] = IS40MHZ(pi) ? 45 : 64;
- } else {
+ else
m[core] = IS40MHZ(pi) ? 75 : 107;
- }
m[phy_a7] = 0;
wlc_phy_ipa_set_bbmult_nphy(pi, m[0], m[1]);
: NPHY_TBL_ID_EPSILONTBL1, 1, phy_a3,
32, &phy_a8);
- if (cal_mode != CAL_GCTRL) {
+ if (cal_mode != CAL_GCTRL)
wlc_phy_a1_nphy(pi, core, 5, 0, 40);
- }
}
}
phy_a14 = 0;
for (phy_a10 = 0; phy_a10 < phy_a2; phy_a10++) {
- if (CHSPEC_IS2G(pi->radio_chanspec)) {
+ if (CHSPEC_IS2G(pi->radio_chanspec))
phy_a4.gains.pad[core] =
(u16) phy_a15[phy_a12];
- } else {
+ else
phy_a4.gains.pga[core] =
(u16) phy_a15[phy_a12];
- }
wlc_phy_a2_nphy(pi, &phy_a4, CAL_GCTRL, core);
(phy_a8 == 4095) || (phy_a8 == -4096));
if (!phy_a6 && (phy_a3 != phy_a5)) {
- if (!phy_a3) {
+ if (!phy_a3)
phy_a12 -= (u8) phy_a1;
- }
+
phy_a11 = true;
break;
}
phy_a12 -= (u8) phy_a1;
if ((phy_a12 < phy_a14) || (phy_a12 > phy_a13)) {
- if (phy_a12 < phy_a14) {
+ if (phy_a12 < phy_a14)
phy_a12 = phy_a14;
- } else {
+ else
phy_a12 = phy_a13;
- }
+
phy_a11 = true;
break;
}
(phy_a8 == 4095) || (phy_a8 == -4096));
if (!phy_a6 && (phy_a3 != phy_a5)) {
- if (!phy_a3) {
+ if (!phy_a3)
phy_a12 -= (u8) phy_a1;
- }
+
phy_a11 = true;
break;
}
phy_a12 -= (u8) phy_a1;
if ((phy_a12 < 0) || (phy_a12 > 127)) {
- if (phy_a12 < 0) {
+ if (phy_a12 < 0)
phy_a12 = 0;
- } else {
+ else
phy_a12 = 127;
- }
+
phy_a11 = true;
break;
}
}
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
return (u8) phy_a15[phy_a12];
- } else {
+ else
return (u8) phy_a12;
- }
}
phy_b3 =
(0 == (R_REG(&pi->regs->maccontrol) & MCTL_EN_MAC));
- if (!phy_b3) {
+ if (!phy_b3)
wlapi_suspend_mac_and_wait(pi->sh->physhim);
- }
wlc_phy_stay_in_carriersearch_nphy(pi, true);
for (phy_b5 = 0; phy_b5 < pi->pubpi.phy_corenum; phy_b5++) {
s32 i, val = 0;
- for (i = 0; i < 64; i++) {
+ for (i = 0; i < 64; i++)
wlc_phy_table_write_nphy(pi,
((phy_b5 ==
PHY_CORE_0) ?
NPHY_TBL_ID_EPSILONTBL0 :
NPHY_TBL_ID_EPSILONTBL1), 1,
i, 32, &val);
- }
}
wlc_phy_ipa_restore_tx_digi_filts_nphy(pi);
if (NREV_GE(pi->pubpi.phy_rev, 7)) {
if (CHSPEC_IS2G(pi->radio_chanspec)) {
-
if ((pi->pubpi.radiorev == 3)
|| (pi->pubpi.radiorev == 4)
|| (pi->pubpi.radiorev == 6)) {
-
pi->nphy_papd_cal_gain_index[phy_b5] =
23;
-
} else if (pi->pubpi.radiorev == 5) {
-
pi->nphy_papd_cal_gain_index[phy_b5] =
0;
pi->nphy_papd_cal_gain_index[phy_b5] =
break;
}
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
wlc_phy_papd_cal_cleanup_nphy(pi, &phy_b2);
- }
}
- if (NREV_LT(pi->pubpi.phy_rev, 7)) {
+ if (NREV_LT(pi->pubpi.phy_rev, 7))
wlc_phy_papd_cal_cleanup_nphy(pi, &phy_b2);
- }
for (phy_b5 = 0; phy_b5 < pi->pubpi.phy_corenum; phy_b5++) {
int eps_offset = 0;
if (NREV_GE(pi->pubpi.phy_rev, 7)) {
if (CHSPEC_IS2G(pi->radio_chanspec)) {
- if (pi->pubpi.radiorev == 3) {
+ if (pi->pubpi.radiorev == 3)
eps_offset = -2;
- } else if (pi->pubpi.radiorev == 5) {
+ else if (pi->pubpi.radiorev == 5)
eps_offset = 3;
- } else {
+ else
eps_offset = -1;
- }
} else {
eps_offset = 2;
}
phy_b7 = phy_b1[phy_b5].gains.pga[phy_b5];
if ((pi->pubpi.radiorev == 3) ||
(pi->pubpi.radiorev == 4) ||
- (pi->pubpi.radiorev == 6)) {
+ (pi->pubpi.radiorev == 6))
phy_b11 =
-(nphy_papd_pgagain_dlt_5g_2057
[phy_b7]
+ 1) / 2;
- } else if ((pi->pubpi.radiorev == 7)
- || (pi->pubpi.radiorev == 8)) {
+ else if ((pi->pubpi.radiorev == 7)
+ || (pi->pubpi.radiorev == 8))
phy_b11 =
-(nphy_papd_pgagain_dlt_5g_2057rev7
[phy_b7]
+ 1) / 2;
- }
phy_b10 = -9;
}
- if (CHSPEC_IS2G(pi->radio_chanspec)) {
+ if (CHSPEC_IS2G(pi->radio_chanspec))
phy_b6 =
-60 + 27 + eps_offset + phy_b12 + phy_b10;
- } else {
+ else
phy_b6 =
-60 + 27 + eps_offset + phy_b11 + phy_b10;
- }
mod_phy_reg(pi, (phy_b5 == PHY_CORE_0) ? 0x298 :
0x29c, (0x1ff << 7), (phy_b6) << 7);
pi->nphy_papd_epsilon_offset[phy_b5] = phy_b6;
} else {
- if (NREV_LT(pi->pubpi.phy_rev, 5)) {
+ if (NREV_LT(pi->pubpi.phy_rev, 5))
eps_offset = 4;
- } else {
+ else
eps_offset = 2;
- }
phy_b7 = 15 - ((phy_b1[phy_b5].index) >> 3);
wlc_phy_stay_in_carriersearch_nphy(pi, false);
- if (!phy_b3) {
+ if (!phy_b3)
wlapi_enable_mac(pi->sh->physhim);
- }
}
void wlc_phy_txpwr_fixpower_nphy(struct brcms_phy *pi)
}
}
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
txpi[0] = txpi[1] = 30;
- } else if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+ else if (NREV_GE(pi->pubpi.phy_rev, 3))
txpi[0] = txpi[1] = 40;
- }
if (NREV_LT(pi->pubpi.phy_rev, 7)) {
bbmult = (txgain >> 0) & ((1 << (7 - 0 + 1)) - 1);
- if (NREV_GE(phyrev, 3)) {
+ if (NREV_GE(phyrev, 3))
mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0x8f :
0xa5), (0x1 << 8), (0x1 << 8));
- } else {
+ else
mod_phy_reg(pi, 0xa5, (0x1 << 14), (0x1 << 14));
- }
+
write_phy_reg(pi, (core == PHY_CORE_0) ? 0xaa : 0xab, dac_gain);
wlc_phy_table_write_nphy(pi, 7, 1, (0x110 + core), 16,
{
u8 rate;
- for (rate = rate_start; rate <= rate_end; rate++) {
+ for (rate = rate_start; rate <= rate_end; rate++)
srom_max[rate] -= 2 * pwr_offset;
- }
}
void
TXP_FIRST_MCS_20_CDD,
TXP_LAST_MCS_20_CDD);
- if (NREV_GE(pi->pubpi.phy_rev, 3)) {
-
+ if (NREV_GE(pi->pubpi.phy_rev, 3))
wlc_phy_txpwr_nphy_po_apply(tx_srom_max_rate, tmp_cddpo,
TXP_FIRST_MCS_20_CDD,
TXP_LAST_MCS_20_CDD);
- }
wlc_phy_mcs_to_ofdm_powers_nphy(tx_srom_max_rate,
TXP_FIRST_OFDM_20_CDD,
TXP_FIRST_MCS_20_STBC,
TXP_LAST_MCS_20_STBC);
- if (NREV_GE(pi->pubpi.phy_rev, 3)) {
-
+ if (NREV_GE(pi->pubpi.phy_rev, 3))
wlc_phy_txpwr_nphy_po_apply(tx_srom_max_rate,
tmp_stbcpo,
TXP_FIRST_MCS_20_STBC,
TXP_LAST_MCS_20_STBC);
- }
wlc_phy_txpwr_nphy_srom_convert(tx_srom_max_rate,
&pwr_offsets2[2], tmp_max_pwr,
tx_srom_max_rate[rate2];
}
- if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 3))
wlc_phy_txpwr_nphy_po_apply(tx_srom_max_rate,
tmp_bw40po,
TXP_FIRST_OFDM_40_SISO,
TXP_LAST_MCS_40_SDM);
- }
tx_srom_max_rate[TXP_MCS_32] =
tx_srom_max_rate[TXP_FIRST_MCS_40_CDD];
u16 bw40po, cddpo, stbcpo, bwduppo;
uint band_num;
- if (pi->sh->sromrev >= 9) {
-
+ if (pi->sh->sromrev >= 9)
return;
- }
bw40po = (u16) PHY_GETINTVAR(pi, "bw40po");
pi->bw402gpo = bw40po & 0xf;
pi->srom_fem5g.extpagain = (u8) PHY_GETINTVAR(pi, "extpagain5g");
pi->srom_fem5g.pdetrange = (u8) PHY_GETINTVAR(pi, "pdetrange5g");
pi->srom_fem5g.triso = (u8) PHY_GETINTVAR(pi, "triso5g");
- if (PHY_GETVAR(pi, "antswctl5g")) {
-
+ if (PHY_GETVAR(pi, "antswctl5g"))
pi->srom_fem5g.antswctrllut =
(u8) PHY_GETINTVAR(pi, "antswctl5g");
- } else {
-
+ else
pi->srom_fem5g.antswctrllut =
(u8) PHY_GETINTVAR(pi, "antswctl2g");
- }
wlc_phy_txpower_ipa_upd(pi);
pi->phy_txcore_disable_temp = (s16) PHY_GETINTVAR(pi, "tempthresh");
- if (pi->phy_txcore_disable_temp == 0) {
+ if (pi->phy_txcore_disable_temp == 0)
pi->phy_txcore_disable_temp = PHY_CHAIN_TX_DISABLE_TEMP;
- }
pi->phy_tempsense_offset = (s8) PHY_GETINTVAR(pi, "tempoffset");
if (pi->phy_tempsense_offset != 0) {
if (pi->phy_tempsense_offset >
- (NPHY_SROM_TEMPSHIFT + NPHY_SROM_MAXTEMPOFFSET)) {
+ (NPHY_SROM_TEMPSHIFT + NPHY_SROM_MAXTEMPOFFSET))
pi->phy_tempsense_offset = NPHY_SROM_MAXTEMPOFFSET;
- } else if (pi->phy_tempsense_offset < (NPHY_SROM_TEMPSHIFT +
- NPHY_SROM_MINTEMPOFFSET)) {
+ else if (pi->phy_tempsense_offset < (NPHY_SROM_TEMPSHIFT +
+ NPHY_SROM_MINTEMPOFFSET))
pi->phy_tempsense_offset = NPHY_SROM_MINTEMPOFFSET;
- } else {
+ else
pi->phy_tempsense_offset -= NPHY_SROM_TEMPSHIFT;
- }
}
pi->phy_txcore_enable_temp =
pi->phy_txcore_disable_temp - PHY_HYSTERESIS_DELTATEMP;
pi->phycal_tempdelta = (u8) PHY_GETINTVAR(pi, "phycal_tempdelta");
- if (pi->phycal_tempdelta > NPHY_CAL_MAXTEMPDELTA) {
+ if (pi->phycal_tempdelta > NPHY_CAL_MAXTEMPDELTA)
pi->phycal_tempdelta = 0;
- }
wlc_phy_txpwr_srom_read_ppr_nphy(pi);
: (((u32) (iqloCalbuf[2] & 0x3ff)) << 10) |
(iqloCalbuf[3] & 0x3ff);
- for (idx = 0; idx < tbl_len; idx++) {
+ for (idx = 0; idx < tbl_len; idx++)
regval[idx] = iqcomp;
- }
wlc_phy_table_write_nphy(pi, tbl_id, tbl_len, tbl_offset, 32,
regval);
}
WRITE_RADIO_REG3(pi, RADIO_2057, TX,
core, TSSIA, 0);
- if (!NREV_IS(pi->pubpi.phy_rev, 7)) {
-
+ if (!NREV_IS(pi->pubpi.phy_rev, 7))
WRITE_RADIO_REG3(pi, RADIO_2057, TX,
core, TSSIG, 0x1);
- } else {
-
+ else
WRITE_RADIO_REG3(pi, RADIO_2057, TX,
core, TSSIG, 0x31);
- }
} else {
WRITE_RADIO_REG3(pi, RADIO_2057, TX, core,
TX_SSI_MASTER, 0x9);
TSSIG, 0);
if (pi->pubpi.radiorev != 5) {
- if (!NREV_IS(pi->pubpi.phy_rev, 7)) {
-
+ if (!NREV_IS(pi->pubpi.phy_rev, 7))
WRITE_RADIO_REG3(pi, RADIO_2057,
TX, core,
TSSIA, 0x1);
- } else {
-
+ else
WRITE_RADIO_REG3(pi, RADIO_2057,
TX, core,
TSSIA, 0x31);
- }
}
}
WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, IQCAL_VCM_HG,
if (pi->pubpi.radiorev != 5)
WRITE_RADIO_REG2(pi, RADIO_2056, TX,
core, TSSIA, 0x0);
- if (NREV_GE(pi->pubpi.phy_rev, 5)) {
-
+ if (NREV_GE(pi->pubpi.phy_rev, 5))
WRITE_RADIO_REG2(pi, RADIO_2056, TX,
core, TSSIG, 0x31);
- } else {
+ else
WRITE_RADIO_REG2(pi, RADIO_2056, TX,
core, TSSIG, 0x11);
- }
WRITE_RADIO_REG2(pi, RADIO_2056, TX, core,
TX_SSI_MUX, 0xe);
} else {
return;
- if (PHY_IPA(pi)) {
+ if (PHY_IPA(pi))
wlc_phy_ipa_internal_tssi_setup_nphy(pi);
- }
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 12),
0, 0x3, 0,
NPHY_REV7_RFCTRLOVERRIDE_ID0);
- } else if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+ else if (NREV_GE(pi->pubpi.phy_rev, 3))
wlc_phy_rfctrl_override_nphy(pi, (0x1 << 13), 0, 3, 0);
- }
wlc_phy_stopplayback_nphy(pi);
wlc_phy_stopplayback_nphy(pi);
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_OFF, 0);
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 12),
0, 0x3, 1,
NPHY_REV7_RFCTRLOVERRIDE_ID0);
- } else if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+ else if (NREV_GE(pi->pubpi.phy_rev, 3))
wlc_phy_rfctrl_override_nphy(pi, (0x1 << 13), 0, 3, 1);
- }
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
or_phy_reg(pi, 0x122, (0x1 << 0));
- if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 3))
and_phy_reg(pi, 0x1e7, (u16) (~(0x1 << 15)));
- } else {
-
+ else
or_phy_reg(pi, 0x1e7, (0x1 << 15));
- }
if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12))
wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, 0);
target_pwr_qtrdbm[1] = (s8) pi->tx_power_max;
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
- if (pi->srom_fem2g.tssipos) {
+ if (pi->srom_fem2g.tssipos)
or_phy_reg(pi, 0x1e9, (0x1 << 14));
- }
if (NREV_GE(pi->pubpi.phy_rev, 7)) {
for (core = 0; core <= 1; core++) {
if (PHY_IPA(pi)) {
-
- if (CHSPEC_IS2G(pi->radio_chanspec)) {
+ if (CHSPEC_IS2G(pi->radio_chanspec))
WRITE_RADIO_REG3(pi, RADIO_2057,
TX, core,
TX_SSI_MUX,
0xe);
- } else {
+ else
WRITE_RADIO_REG3(pi, RADIO_2057,
TX, core,
TX_SSI_MUX,
0xc);
- }
- } else {
}
}
} else {
udelay(1);
}
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
mod_phy_reg(pi, 0x1e7, (0x7f << 0),
(NPHY_TxPwrCtrlCmd_pwrIndex_init_rev7 << 0));
- } else {
+ else
mod_phy_reg(pi, 0x1e7, (0x7f << 0),
(NPHY_TxPwrCtrlCmd_pwrIndex_init << 0));
- }
- if (NREV_GE(pi->pubpi.phy_rev, 7)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 7))
mod_phy_reg(pi, 0x222, (0xff << 0),
(NPHY_TxPwrCtrlCmd_pwrIndex_init_rev7 << 0));
- } else if (NREV_GT(pi->pubpi.phy_rev, 1)) {
+ else if (NREV_GT(pi->pubpi.phy_rev, 1))
mod_phy_reg(pi, 0x222, (0xff << 0),
(NPHY_TxPwrCtrlCmd_pwrIndex_init << 0));
- }
if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12))
wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, 0);
pi->nphy_papd_tx_gain_at_last_cal[0]) >= 4)
|| ((u32)
ABS(wlc_phy_txpwr_idx_cur_get_nphy(pi, 1) -
- pi->nphy_papd_tx_gain_at_last_cal[1]) >= 4))))) {
+ pi->nphy_papd_tx_gain_at_last_cal[1]) >= 4)))))
wlc_phy_a4(pi, true);
- }
}
void wlc_phy_txpwrctrl_enable_nphy(struct brcms_phy *pi, u8 ctrl_type)
tbl_len = 84;
tbl_offset = 64;
- for (ctr = 0; ctr < tbl_len; ctr++) {
+ for (ctr = 0; ctr < tbl_len; ctr++)
regval[ctr] = 0;
- }
wlc_phy_table_write_nphy(pi, 26, tbl_len, tbl_offset, 16,
regval);
wlc_phy_table_write_nphy(pi, 27, tbl_len, tbl_offset, 16,
regval);
- if (NREV_GE(pi->pubpi.phy_rev, 3)) {
-
+ if (NREV_GE(pi->pubpi.phy_rev, 3))
and_phy_reg(pi, 0x1e7,
(u16) (~((0x1 << 15) |
(0x1 << 14) | (0x1 << 13))));
- } else {
+ else
and_phy_reg(pi, 0x1e7,
(u16) (~((0x1 << 14) | (0x1 << 13))));
- }
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
or_phy_reg(pi, 0x8f, (0x1 << 8));
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
if ((pi->nphy_txpwr_idx[0] != 128)
- && (pi->nphy_txpwr_idx[1] != 128)) {
+ && (pi->nphy_txpwr_idx[1] != 128))
wlc_phy_txpwr_idx_cur_set_nphy(pi,
pi->
nphy_txpwr_idx
pi->
nphy_txpwr_idx
[1]);
- }
}
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
for (core = 0; core < pi->pubpi.phy_corenum; core++) {
- if ((core_mask & (1 << core)) == 0) {
+ if ((core_mask & (1 << core)) == 0)
continue;
- }
txpwrctl_tbl = (core == PHY_CORE_0) ? 26 : 27;
if (txpwrindex < 0) {
- if (pi->nphy_txpwrindex[core].index < 0) {
-
+ if (pi->nphy_txpwrindex[core].index < 0)
continue;
- }
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
mod_phy_reg(pi, 0x8f,
(tx_ind0 + txpwrindex), 32,
&txgain);
- if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 3))
rad_gain =
(txgain >> 16) & ((1 << (32 - 16 + 1)) - 1);
- } else {
+ else
rad_gain =
(txgain >> 16) & ((1 << (28 - 16 + 1)) - 1);
- }
+
dac_gain = (txgain >> 8) & ((1 << (13 - 8 + 1)) - 1);
bbmult = (txgain >> 0) & ((1 << (7 - 0 + 1)) - 1);
- if (NREV_GE(pi->pubpi.phy_rev, 3)) {
+ if (NREV_GE(pi->pubpi.phy_rev, 3))
mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0x8f :
0xa5), (0x1 << 8), (0x1 << 8));
- } else {
+ else
mod_phy_reg(pi, 0xa5, (0x1 << 14), (0x1 << 14));
- }
+
write_phy_reg(pi, (core == PHY_CORE_0) ?
0xaa : 0xab, dac_gain);
wlc_phy_table_read_nphy(pi, txpwrctl_tbl, 1,
(lo_ind0 + txpwrindex), 32,
&locomp);
- if (restore_cals) {
+ if (restore_cals)
wlc_phy_table_write_nphy(pi, 15, 1, (85 + core),
16, &locomp);
- }
if (NREV_IS(pi->pubpi.phy_rev, 1))
wlapi_bmac_phyclk_fgc(pi->sh->physhim, OFF);
if (mode) {
if (pi->nphy_deaf_count == 0)
wlc_phy_stay_in_carriersearch_nphy(pi, true);
- } else {
- if (pi->nphy_deaf_count > 0)
- wlc_phy_stay_in_carriersearch_nphy(pi, false);
+ } else if (pi->nphy_deaf_count > 0) {
+ wlc_phy_stay_in_carriersearch_nphy(pi, false);
}
+
wlapi_enable_mac(pi->sh->physhim);
}