Lines Matching refs:wlc_hw

595 static void brcms_b_update_slot_timing(struct brcms_hardware *wlc_hw,  in brcms_b_update_slot_timing()  argument
598 struct bcma_device *core = wlc_hw->d11core; in brcms_b_update_slot_timing()
603 brcms_b_write_shm(wlc_hw, M_DOT11_SLOT, APHY_SLOT_TIME); in brcms_b_update_slot_timing()
607 brcms_b_write_shm(wlc_hw, M_DOT11_SLOT, BPHY_SLOT_TIME); in brcms_b_update_slot_timing()
680 static void brcms_c_write_inits(struct brcms_hardware *wlc_hw, in brcms_c_write_inits() argument
683 struct bcma_device *core = wlc_hw->d11core; in brcms_c_write_inits()
689 brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_c_write_inits()
704 static void brcms_c_write_mhf(struct brcms_hardware *wlc_hw, u16 *mhfs) in brcms_c_write_mhf() argument
713 brcms_b_write_shm(wlc_hw, addr[idx], mhfs[idx]); in brcms_c_write_mhf()
716 static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw) in brcms_c_ucode_bsinit() argument
718 struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; in brcms_c_ucode_bsinit()
721 brcms_c_write_mhf(wlc_hw, wlc_hw->band->mhfs); in brcms_c_ucode_bsinit()
724 if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { in brcms_c_ucode_bsinit()
725 if (BRCMS_ISNPHY(wlc_hw->band)) in brcms_c_ucode_bsinit()
726 brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16); in brcms_c_ucode_bsinit()
728 brcms_err(wlc_hw->d11core, in brcms_c_ucode_bsinit()
730 __func__, wlc_hw->unit, in brcms_c_ucode_bsinit()
731 wlc_hw->corerev); in brcms_c_ucode_bsinit()
733 if (D11REV_IS(wlc_hw->corerev, 24)) { in brcms_c_ucode_bsinit()
734 if (BRCMS_ISLCNPHY(wlc_hw->band)) in brcms_c_ucode_bsinit()
735 brcms_c_write_inits(wlc_hw, in brcms_c_ucode_bsinit()
738 brcms_err(wlc_hw->d11core, in brcms_c_ucode_bsinit()
740 __func__, wlc_hw->unit, in brcms_c_ucode_bsinit()
741 wlc_hw->corerev); in brcms_c_ucode_bsinit()
743 brcms_err(wlc_hw->d11core, in brcms_c_ucode_bsinit()
745 __func__, wlc_hw->unit, wlc_hw->corerev); in brcms_c_ucode_bsinit()
750 static void brcms_b_core_ioctl(struct brcms_hardware *wlc_hw, u32 m, u32 v) in brcms_b_core_ioctl() argument
752 struct bcma_device *core = wlc_hw->d11core; in brcms_b_core_ioctl()
758 static void brcms_b_core_phy_clk(struct brcms_hardware *wlc_hw, bool clk) in brcms_b_core_phy_clk() argument
760 brcms_dbg_info(wlc_hw->d11core, "wl%d: clk %d\n", wlc_hw->unit, clk); in brcms_b_core_phy_clk()
762 wlc_hw->phyclk = clk; in brcms_b_core_phy_clk()
766 brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_FGC | SICF_GMODE), in brcms_b_core_phy_clk()
769 brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_FGC), SICF_PRST); in brcms_b_core_phy_clk()
774 brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_FGC), SICF_FGC); in brcms_b_core_phy_clk()
776 brcms_b_core_ioctl(wlc_hw, SICF_FGC, 0); in brcms_b_core_phy_clk()
783 static void brcms_c_setxband(struct brcms_hardware *wlc_hw, uint bandunit) in brcms_c_setxband() argument
785 brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: bandunit %d\n", wlc_hw->unit, in brcms_c_setxband()
788 wlc_hw->band = wlc_hw->bandstate[bandunit]; in brcms_c_setxband()
794 wlc_hw->wlc->band = wlc_hw->wlc->bandstate[bandunit]; in brcms_c_setxband()
797 if (wlc_hw->sbclk && !wlc_hw->noreset) { in brcms_c_setxband()
803 brcms_b_core_ioctl(wlc_hw, SICF_GMODE, gmode); in brcms_c_setxband()
810 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_setband_inact() local
814 brcms_dbg_mac80211(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_c_setband_inact()
815 macctrl = bcma_read32(wlc_hw->d11core, in brcms_c_setband_inact()
823 wlc_phy_switch_radio(wlc_hw->band->pi, OFF); in brcms_c_setband_inact()
825 brcms_b_core_phy_clk(wlc_hw, OFF); in brcms_c_setband_inact()
827 brcms_c_setxband(wlc_hw, bandunit); in brcms_c_setband_inact()
1022 brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) in brcms_b_txstatus() argument
1035 core = wlc_hw->d11core; in brcms_b_txstatus()
1041 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_b_txstatus()
1057 *fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs); in brcms_b_txstatus()
1080 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_mhfdef() local
1087 if (wlc_hw->boardflags & BFL_NOPLLDOWN) in brcms_c_mhfdef()
1090 if (BRCMS_ISNPHY(wlc_hw->band) && NREV_LT(wlc_hw->band->phyrev, 2)) { in brcms_c_mhfdef()
1112 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_attach_dmapio() local
1113 uint unit = wlc_hw->unit; in brcms_b_attach_dmapio()
1118 if (wlc_hw->di[0] == NULL) { /* Init FIFOs */ in brcms_b_attach_dmapio()
1126 wlc_hw->di[0] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1132 dma_attach_err |= (NULL == wlc_hw->di[0]); in brcms_b_attach_dmapio()
1140 wlc_hw->di[1] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1143 dma_attach_err |= (NULL == wlc_hw->di[1]); in brcms_b_attach_dmapio()
1150 wlc_hw->di[2] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1153 dma_attach_err |= (NULL == wlc_hw->di[2]); in brcms_b_attach_dmapio()
1159 wlc_hw->di[3] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1163 dma_attach_err |= (NULL == wlc_hw->di[3]); in brcms_b_attach_dmapio()
1167 brcms_err(wlc_hw->d11core, in brcms_b_attach_dmapio()
1175 if (wlc_hw->di[i]) in brcms_b_attach_dmapio()
1176 wlc_hw->txavail[i] = in brcms_b_attach_dmapio()
1177 (uint *) dma_getvar(wlc_hw->di[i], in brcms_b_attach_dmapio()
1182 brcms_c_mhfdef(wlc, wlc_hw->band->mhfs, pio_mhf2); in brcms_b_attach_dmapio()
1187 static void brcms_b_detach_dmapio(struct brcms_hardware *wlc_hw) in brcms_b_detach_dmapio() argument
1192 if (wlc_hw->di[j]) { in brcms_b_detach_dmapio()
1193 dma_detach(wlc_hw->di[j]); in brcms_b_detach_dmapio()
1194 wlc_hw->di[j] = NULL; in brcms_b_detach_dmapio()
1204 static void brcms_b_info_init(struct brcms_hardware *wlc_hw) in brcms_b_info_init() argument
1206 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_info_init()
1212 wlc_hw->shortslot = false; in brcms_b_info_init()
1214 wlc_hw->SFBL = RETRY_SHORT_FB; in brcms_b_info_init()
1215 wlc_hw->LFBL = RETRY_LONG_FB; in brcms_b_info_init()
1218 wlc_hw->SRL = RETRY_SHORT_DEF; in brcms_b_info_init()
1219 wlc_hw->LRL = RETRY_LONG_DEF; in brcms_b_info_init()
1220 wlc_hw->chanspec = ch20mhz_chspec(1); in brcms_b_info_init()
1223 static void brcms_b_wait_for_wake(struct brcms_hardware *wlc_hw) in brcms_b_wait_for_wake() argument
1229 SPINWAIT((brcms_b_read_shm(wlc_hw, M_UCODE_DBGST) == in brcms_b_wait_for_wake()
1230 DBGST_ASLEEP), wlc_hw->wlc->fastpwrup_dly); in brcms_b_wait_for_wake()
1234 static void brcms_b_clkctl_clk(struct brcms_hardware *wlc_hw, enum bcma_clkmode mode) in brcms_b_clkctl_clk() argument
1236 if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU) { in brcms_b_clkctl_clk()
1243 if (wlc_hw->clk) { in brcms_b_clkctl_clk()
1245 bcma_set32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1252 ((bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1256 WARN_ON(!(bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1260 if ((ai_get_pmurev(wlc_hw->sih) == 0) && in brcms_b_clkctl_clk()
1261 (bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1265 ((bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1270 bcma_mask32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1275 wlc_hw->forcefastclk = (mode == BCMA_CLKMODE_FAST); in brcms_b_clkctl_clk()
1282 wlc_hw->forcefastclk = ai_clkctl_cc(wlc_hw->sih, mode); in brcms_b_clkctl_clk()
1285 if (wlc_hw->forcefastclk && wlc_hw->clk) in brcms_b_clkctl_clk()
1286 WARN_ON(!(bcma_aread32(wlc_hw->d11core, BCMA_IOST) & in brcms_b_clkctl_clk()
1299 if (wlc_hw->forcefastclk) in brcms_b_clkctl_clk()
1300 mboolset(wlc_hw->wake_override, in brcms_b_clkctl_clk()
1303 mboolclr(wlc_hw->wake_override, in brcms_b_clkctl_clk()
1320 brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, u16 val, in brcms_b_mhf() argument
1339 band = wlc_hw->band; in brcms_b_mhf()
1342 band = wlc_hw->bandstate[BAND_5G_INDEX]; in brcms_b_mhf()
1345 band = wlc_hw->bandstate[BAND_2G_INDEX]; in brcms_b_mhf()
1358 if (wlc_hw->clk && (band->mhfs[idx] != save) in brcms_b_mhf()
1359 && (band == wlc_hw->band)) in brcms_b_mhf()
1360 brcms_b_write_shm(wlc_hw, addr[idx], in brcms_b_mhf()
1365 wlc_hw->bandstate[0]->mhfs[idx] = in brcms_b_mhf()
1366 (wlc_hw->bandstate[0]->mhfs[idx] & ~mask) | val; in brcms_b_mhf()
1367 wlc_hw->bandstate[1]->mhfs[idx] = in brcms_b_mhf()
1368 (wlc_hw->bandstate[1]->mhfs[idx] & ~mask) | val; in brcms_b_mhf()
1375 static void brcms_c_mctrl_reset(struct brcms_hardware *wlc_hw) in brcms_c_mctrl_reset() argument
1378 wlc_hw->maccontrol = 0; in brcms_c_mctrl_reset()
1379 wlc_hw->suspended_fifos = 0; in brcms_c_mctrl_reset()
1380 wlc_hw->wake_override = 0; in brcms_c_mctrl_reset()
1381 wlc_hw->mute_override = 0; in brcms_c_mctrl_reset()
1382 brcms_b_mctrl(wlc_hw, ~0, MCTL_IHR_EN | MCTL_WAKE); in brcms_c_mctrl_reset()
1389 static void brcms_c_mctrl_write(struct brcms_hardware *wlc_hw) in brcms_c_mctrl_write() argument
1391 u32 maccontrol = wlc_hw->maccontrol; in brcms_c_mctrl_write()
1394 if (wlc_hw->wake_override) in brcms_c_mctrl_write()
1398 if (wlc_hw->mute_override) { in brcms_c_mctrl_write()
1403 bcma_write32(wlc_hw->d11core, D11REGOFFS(maccontrol), in brcms_c_mctrl_write()
1408 void brcms_b_mctrl(struct brcms_hardware *wlc_hw, u32 mask, u32 val) in brcms_b_mctrl() argument
1415 maccontrol = wlc_hw->maccontrol; in brcms_b_mctrl()
1423 wlc_hw->maccontrol = new_maccontrol; in brcms_b_mctrl()
1426 brcms_c_mctrl_write(wlc_hw); in brcms_b_mctrl()
1429 void brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw, in brcms_c_ucode_wake_override_set() argument
1432 if (wlc_hw->wake_override || (wlc_hw->maccontrol & MCTL_WAKE)) { in brcms_c_ucode_wake_override_set()
1433 mboolset(wlc_hw->wake_override, override_bit); in brcms_c_ucode_wake_override_set()
1437 mboolset(wlc_hw->wake_override, override_bit); in brcms_c_ucode_wake_override_set()
1439 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_wake_override_set()
1440 brcms_b_wait_for_wake(wlc_hw); in brcms_c_ucode_wake_override_set()
1443 void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw, in brcms_c_ucode_wake_override_clear() argument
1446 mboolclr(wlc_hw->wake_override, override_bit); in brcms_c_ucode_wake_override_clear()
1448 if (wlc_hw->wake_override || (wlc_hw->maccontrol & MCTL_WAKE)) in brcms_c_ucode_wake_override_clear()
1451 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_wake_override_clear()
1461 static void brcms_c_ucode_mute_override_set(struct brcms_hardware *wlc_hw) in brcms_c_ucode_mute_override_set() argument
1463 wlc_hw->mute_override = 1; in brcms_c_ucode_mute_override_set()
1468 if ((wlc_hw->maccontrol & (MCTL_AP | MCTL_INFRA)) == MCTL_INFRA) in brcms_c_ucode_mute_override_set()
1471 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_mute_override_set()
1475 static void brcms_c_ucode_mute_override_clear(struct brcms_hardware *wlc_hw) in brcms_c_ucode_mute_override_clear() argument
1477 if (wlc_hw->mute_override == 0) in brcms_c_ucode_mute_override_clear()
1480 wlc_hw->mute_override = 0; in brcms_c_ucode_mute_override_clear()
1485 if ((wlc_hw->maccontrol & (MCTL_AP | MCTL_INFRA)) == MCTL_INFRA) in brcms_c_ucode_mute_override_clear()
1488 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_mute_override_clear()
1495 brcms_b_set_addrmatch(struct brcms_hardware *wlc_hw, int match_reg_offset, in brcms_b_set_addrmatch() argument
1498 struct bcma_device *core = wlc_hw->d11core; in brcms_b_set_addrmatch()
1503 brcms_dbg_rx(core, "wl%d: brcms_b_set_addrmatch\n", wlc_hw->unit); in brcms_b_set_addrmatch()
1518 brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, int offset, int len, in brcms_b_write_template_ram() argument
1521 struct bcma_device *core = wlc_hw->d11core; in brcms_b_write_template_ram()
1526 brcms_dbg_info(core, "wl%d\n", wlc_hw->unit); in brcms_b_write_template_ram()
1554 static void brcms_b_set_cwmin(struct brcms_hardware *wlc_hw, u16 newmin) in brcms_b_set_cwmin() argument
1556 wlc_hw->band->CWmin = newmin; in brcms_b_set_cwmin()
1558 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_set_cwmin()
1560 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_set_cwmin()
1561 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), newmin); in brcms_b_set_cwmin()
1564 static void brcms_b_set_cwmax(struct brcms_hardware *wlc_hw, u16 newmax) in brcms_b_set_cwmax() argument
1566 wlc_hw->band->CWmax = newmax; in brcms_b_set_cwmax()
1568 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_set_cwmax()
1570 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_set_cwmax()
1571 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), newmax); in brcms_b_set_cwmax()
1574 void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw) in brcms_b_bw_set() argument
1579 fastclk = wlc_hw->forcefastclk; in brcms_b_bw_set()
1581 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_bw_set()
1583 wlc_phy_bw_state_set(wlc_hw->band->pi, bw); in brcms_b_bw_set()
1585 brcms_b_phy_reset(wlc_hw); in brcms_b_bw_set()
1586 wlc_phy_init(wlc_hw->band->pi, wlc_phy_chanspec_get(wlc_hw->band->pi)); in brcms_b_bw_set()
1590 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_bw_set()
1593 static void brcms_b_upd_synthpu(struct brcms_hardware *wlc_hw) in brcms_b_upd_synthpu() argument
1596 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_upd_synthpu()
1606 brcms_b_write_shm(wlc_hw, M_SYNTHPU_DLY, v); in brcms_b_upd_synthpu()
1609 static void brcms_c_ucode_txant_set(struct brcms_hardware *wlc_hw) in brcms_c_ucode_txant_set() argument
1612 u16 phytxant = wlc_hw->bmac_phytxant; in brcms_c_ucode_txant_set()
1616 phyctl = brcms_b_read_shm(wlc_hw, M_CTXPRS_BLK + C_CTX_PCTLWD_POS); in brcms_c_ucode_txant_set()
1618 brcms_b_write_shm(wlc_hw, M_CTXPRS_BLK + C_CTX_PCTLWD_POS, phyctl); in brcms_c_ucode_txant_set()
1621 phyctl = brcms_b_read_shm(wlc_hw, M_RSP_PCTLWD); in brcms_c_ucode_txant_set()
1623 brcms_b_write_shm(wlc_hw, M_RSP_PCTLWD, phyctl); in brcms_c_ucode_txant_set()
1626 static u16 brcms_b_ofdm_ratetable_offset(struct brcms_hardware *wlc_hw, in brcms_b_ofdm_ratetable_offset() argument
1657 return 2 * brcms_b_read_shm(wlc_hw, M_RT_DIRMAP_A + (plcp_rate * 2)); in brcms_b_ofdm_ratetable_offset()
1660 static void brcms_upd_ofdm_pctl1_table(struct brcms_hardware *wlc_hw) in brcms_upd_ofdm_pctl1_table() argument
1671 if (!BRCMS_PHY_11N_CAP(wlc_hw->band)) in brcms_upd_ofdm_pctl1_table()
1678 entry_ptr = brcms_b_ofdm_ratetable_offset(wlc_hw, rate); in brcms_upd_ofdm_pctl1_table()
1682 brcms_b_read_shm(wlc_hw, entry_ptr + M_RT_OFDM_PCTL1_POS); in brcms_upd_ofdm_pctl1_table()
1686 pctl1 |= (wlc_hw->hw_stf_ss_opmode << PHY_TXC1_MODE_SHIFT); in brcms_upd_ofdm_pctl1_table()
1689 brcms_b_write_shm(wlc_hw, entry_ptr + M_RT_OFDM_PCTL1_POS, in brcms_upd_ofdm_pctl1_table()
1697 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_bsinit() local
1699 brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: bandunit %d\n", wlc_hw->unit, in brcms_b_bsinit()
1700 wlc_hw->band->bandunit); in brcms_b_bsinit()
1702 brcms_c_ucode_bsinit(wlc_hw); in brcms_b_bsinit()
1704 wlc_phy_init(wlc_hw->band->pi, chanspec); in brcms_b_bsinit()
1706 brcms_c_ucode_txant_set(wlc_hw); in brcms_b_bsinit()
1712 brcms_b_set_cwmin(wlc_hw, wlc_hw->band->CWmin); in brcms_b_bsinit()
1713 brcms_b_set_cwmax(wlc_hw, wlc_hw->band->CWmax); in brcms_b_bsinit()
1715 brcms_b_update_slot_timing(wlc_hw, in brcms_b_bsinit()
1716 wlc_hw->band->bandtype == BRCM_BAND_5G ? in brcms_b_bsinit()
1717 true : wlc_hw->shortslot); in brcms_b_bsinit()
1720 brcms_b_write_shm(wlc_hw, M_PHYTYPE, (u16) wlc_hw->band->phytype); in brcms_b_bsinit()
1721 brcms_b_write_shm(wlc_hw, M_PHYVER, (u16) wlc_hw->band->phyrev); in brcms_b_bsinit()
1727 brcms_upd_ofdm_pctl1_table(wlc_hw); in brcms_b_bsinit()
1729 brcms_b_upd_synthpu(wlc_hw); in brcms_b_bsinit()
1733 void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw) in brcms_b_core_phypll_reset() argument
1735 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_addr), in brcms_b_core_phypll_reset()
1738 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), in brcms_b_core_phypll_reset()
1741 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), in brcms_b_core_phypll_reset()
1744 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), in brcms_b_core_phypll_reset()
1752 void brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk) in brcms_b_phyclk_fgc() argument
1755 if (!BRCMS_ISNPHY(wlc_hw->band)) in brcms_b_phyclk_fgc()
1759 brcms_b_core_ioctl(wlc_hw, SICF_FGC, SICF_FGC); in brcms_b_phyclk_fgc()
1761 brcms_b_core_ioctl(wlc_hw, SICF_FGC, 0); in brcms_b_phyclk_fgc()
1765 void brcms_b_macphyclk_set(struct brcms_hardware *wlc_hw, bool clk) in brcms_b_macphyclk_set() argument
1768 brcms_b_core_ioctl(wlc_hw, SICF_MPCLKE, SICF_MPCLKE); in brcms_b_macphyclk_set()
1770 brcms_b_core_ioctl(wlc_hw, SICF_MPCLKE, 0); in brcms_b_macphyclk_set()
1773 void brcms_b_phy_reset(struct brcms_hardware *wlc_hw) in brcms_b_phy_reset() argument
1775 struct brcms_phy_pub *pih = wlc_hw->band->pi; in brcms_b_phy_reset()
1778 brcms_dbg_info(wlc_hw->d11core, "wl%d: reset phy\n", wlc_hw->unit); in brcms_b_phy_reset()
1783 phy_bw_clkbits = wlc_phy_clk_bwbits(wlc_hw->band->pi); in brcms_b_phy_reset()
1786 if (BRCMS_ISNPHY(wlc_hw->band) && NREV_GE(wlc_hw->band->phyrev, 3) && in brcms_b_phy_reset()
1787 NREV_LE(wlc_hw->band->phyrev, 4)) { in brcms_b_phy_reset()
1789 brcms_b_core_ioctl(wlc_hw, SICF_BWMASK, phy_bw_clkbits); in brcms_b_phy_reset()
1794 brcms_b_core_phypll_reset(wlc_hw); in brcms_b_phy_reset()
1797 brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_PCLKE), in brcms_b_phy_reset()
1800 brcms_b_core_ioctl(wlc_hw, in brcms_b_phy_reset()
1806 brcms_b_core_phy_clk(wlc_hw, ON); in brcms_b_phy_reset()
1812 static void brcms_b_setband(struct brcms_hardware *wlc_hw, uint bandunit, in brcms_b_setband() argument
1814 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_setband()
1818 if (!bcma_core_is_enabled(wlc_hw->d11core)) { in brcms_b_setband()
1819 bcma_core_enable(wlc_hw->d11core, 0); in brcms_b_setband()
1820 brcms_c_mctrl_reset(wlc_hw); in brcms_b_setband()
1825 if (!wlc_hw->up) in brcms_b_setband()
1828 brcms_b_core_phy_clk(wlc_hw, ON); in brcms_b_setband()
1845 WARN_ON((bcma_read32(wlc_hw->d11core, D11REGOFFS(maccontrol)) & in brcms_b_setband()
1849 static bool brcms_c_isgoodchip(struct brcms_hardware *wlc_hw) in brcms_c_isgoodchip() argument
1853 if (!CONF_HAS(D11CONF, wlc_hw->corerev)) { in brcms_c_isgoodchip()
1854 wiphy_err(wlc_hw->wlc->wiphy, "unsupported core rev %d\n", in brcms_c_isgoodchip()
1855 wlc_hw->corerev); in brcms_c_isgoodchip()
1863 static bool brcms_c_validboardtype(struct brcms_hardware *wlc_hw) in brcms_c_validboardtype() argument
1865 uint boardrev = wlc_hw->boardrev; in brcms_c_validboardtype()
1874 if (ai_get_boardvendor(wlc_hw->sih) != PCI_VENDOR_ID_BROADCOM) in brcms_c_validboardtype()
1891 static void brcms_c_get_macaddr(struct brcms_hardware *wlc_hw, u8 etheraddr[ETH_ALEN]) in brcms_c_get_macaddr() argument
1893 struct ssb_sprom *sprom = &wlc_hw->d11core->bus->sprom; in brcms_c_get_macaddr()
1901 if (wlc_hw->_nbands > 1) in brcms_c_get_macaddr()
1908 static void brcms_b_xtal(struct brcms_hardware *wlc_hw, bool want) in brcms_b_xtal() argument
1910 brcms_dbg_info(wlc_hw->d11core, "wl%d: want %d\n", wlc_hw->unit, want); in brcms_b_xtal()
1916 if (!want && wlc_hw->pllreq) in brcms_b_xtal()
1919 wlc_hw->sbclk = want; in brcms_b_xtal()
1920 if (!wlc_hw->sbclk) { in brcms_b_xtal()
1921 wlc_hw->clk = false; in brcms_b_xtal()
1922 if (wlc_hw->band && wlc_hw->band->pi) in brcms_b_xtal()
1923 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); in brcms_b_xtal()
1933 static bool brcms_b_radio_read_hwdisabled(struct brcms_hardware *wlc_hw) in brcms_b_radio_read_hwdisabled() argument
1938 xtal = wlc_hw->sbclk; in brcms_b_radio_read_hwdisabled()
1940 brcms_b_xtal(wlc_hw, ON); in brcms_b_radio_read_hwdisabled()
1943 clk = wlc_hw->clk; in brcms_b_radio_read_hwdisabled()
1950 if (D11REV_GE(wlc_hw->corerev, 18)) in brcms_b_radio_read_hwdisabled()
1960 bcma_core_enable(wlc_hw->d11core, flags); in brcms_b_radio_read_hwdisabled()
1961 brcms_c_mctrl_reset(wlc_hw); in brcms_b_radio_read_hwdisabled()
1964 v = ((bcma_read32(wlc_hw->d11core, in brcms_b_radio_read_hwdisabled()
1969 bcma_core_disable(wlc_hw->d11core, 0); in brcms_b_radio_read_hwdisabled()
1972 brcms_b_xtal(wlc_hw, OFF); in brcms_b_radio_read_hwdisabled()
1977 static bool wlc_dma_rxreset(struct brcms_hardware *wlc_hw, uint fifo) in wlc_dma_rxreset() argument
1979 struct dma_pub *di = wlc_hw->di[fifo]; in wlc_dma_rxreset()
1991 void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags) in brcms_b_corereset() argument
1997 flags = (wlc_hw->band->pi ? wlc_hw->band->core_flags : 0); in brcms_b_corereset()
1999 brcms_dbg_info(wlc_hw->d11core, "wl%d: core reset\n", wlc_hw->unit); in brcms_b_corereset()
2002 fastclk = wlc_hw->forcefastclk; in brcms_b_corereset()
2004 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_corereset()
2007 if (bcma_core_is_enabled(wlc_hw->d11core)) { in brcms_b_corereset()
2009 if ((wlc_hw->di[i]) && (!dma_txreset(wlc_hw->di[i]))) in brcms_b_corereset()
2010 brcms_err(wlc_hw->d11core, "wl%d: %s: " in brcms_b_corereset()
2012 wlc_hw->unit, __func__, i); in brcms_b_corereset()
2014 if ((wlc_hw->di[RX_FIFO]) in brcms_b_corereset()
2015 && (!wlc_dma_rxreset(wlc_hw, RX_FIFO))) in brcms_b_corereset()
2016 brcms_err(wlc_hw->d11core, "wl%d: %s: dma_rxreset" in brcms_b_corereset()
2018 wlc_hw->unit, __func__, RX_FIFO); in brcms_b_corereset()
2021 if (wlc_hw->noreset) { in brcms_b_corereset()
2022 wlc_hw->wlc->macintstatus = 0; /* skip wl_dpc after down */ in brcms_b_corereset()
2023 brcms_b_mctrl(wlc_hw, MCTL_PSM_RUN | MCTL_EN_MAC, 0); in brcms_b_corereset()
2032 if (D11REV_GE(wlc_hw->corerev, 18)) in brcms_b_corereset()
2045 wlc_hw->clk = false; in brcms_b_corereset()
2046 bcma_core_enable(wlc_hw->d11core, flags); in brcms_b_corereset()
2047 wlc_hw->clk = true; in brcms_b_corereset()
2048 if (wlc_hw->band && wlc_hw->band->pi) in brcms_b_corereset()
2049 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, true); in brcms_b_corereset()
2051 brcms_c_mctrl_reset(wlc_hw); in brcms_b_corereset()
2053 if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU) in brcms_b_corereset()
2054 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_corereset()
2056 brcms_b_phy_reset(wlc_hw); in brcms_b_corereset()
2059 brcms_b_core_phypll_ctl(wlc_hw, true); in brcms_b_corereset()
2062 wlc_hw->wlc->macintstatus = 0; in brcms_b_corereset()
2066 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_corereset()
2072 static void brcms_b_corerev_fifofixup(struct brcms_hardware *wlc_hw) in brcms_b_corerev_fifofixup() argument
2074 struct bcma_device *core = wlc_hw->d11core; in brcms_b_corerev_fifofixup()
2086 txfifo_endblk = txfifo_startblk + wlc_hw->xmtfifo_sz[fifo_nu]; in brcms_b_corerev_fifofixup()
2101 txfifo_startblk += wlc_hw->xmtfifo_sz[fifo_nu]; in brcms_b_corerev_fifofixup()
2107 brcms_b_write_shm(wlc_hw, M_FIFOSIZE0, in brcms_b_corerev_fifofixup()
2108 wlc_hw->xmtfifo_sz[TX_AC_BE_FIFO]); in brcms_b_corerev_fifofixup()
2109 brcms_b_write_shm(wlc_hw, M_FIFOSIZE1, in brcms_b_corerev_fifofixup()
2110 wlc_hw->xmtfifo_sz[TX_AC_VI_FIFO]); in brcms_b_corerev_fifofixup()
2111 brcms_b_write_shm(wlc_hw, M_FIFOSIZE2, in brcms_b_corerev_fifofixup()
2112 ((wlc_hw->xmtfifo_sz[TX_AC_VO_FIFO] << 8) | wlc_hw-> in brcms_b_corerev_fifofixup()
2114 brcms_b_write_shm(wlc_hw, M_FIFOSIZE3, in brcms_b_corerev_fifofixup()
2115 ((wlc_hw->xmtfifo_sz[TX_ATIM_FIFO] << 8) | wlc_hw-> in brcms_b_corerev_fifofixup()
2132 void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode) in brcms_b_switch_macfreq() argument
2134 struct bcma_device *core = wlc_hw->d11core; in brcms_b_switch_macfreq()
2136 if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43224) || in brcms_b_switch_macfreq()
2137 (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225)) { in brcms_b_switch_macfreq()
2148 } else if (BRCMS_ISLCNPHY(wlc_hw->band)) { in brcms_b_switch_macfreq()
2188 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_gpio_init() local
2192 brcms_b_mctrl(wlc_hw, MCTL_GPOUT_SEL_MASK, 0); in brcms_c_gpio_init()
2205 if (wlc_hw->antsel_type == ANTSEL_2x3) { in brcms_c_gpio_init()
2207 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN, in brcms_c_gpio_init()
2209 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE, in brcms_c_gpio_init()
2213 wlc_phy_antsel_init(wlc_hw->band->pi, false); in brcms_c_gpio_init()
2215 } else if (wlc_hw->antsel_type == ANTSEL_2x4) { in brcms_c_gpio_init()
2221 bcma_set16(wlc_hw->d11core, D11REGOFFS(psm_gpio_oe), in brcms_c_gpio_init()
2223 bcma_set16(wlc_hw->d11core, D11REGOFFS(psm_gpio_out), in brcms_c_gpio_init()
2227 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN, in brcms_c_gpio_init()
2229 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE, 0, in brcms_c_gpio_init()
2233 brcms_b_write_shm(wlc_hw, M_ANTSEL_CLKDIV, in brcms_c_gpio_init()
2241 if (wlc_hw->boardflags & BFL_PACTRL) in brcms_c_gpio_init()
2245 bcma_chipco_gpio_control(&wlc_hw->d11core->bus->drv_cc, gm, gc); in brcms_c_gpio_init()
2248 static void brcms_ucode_write(struct brcms_hardware *wlc_hw, in brcms_ucode_write() argument
2251 struct bcma_device *core = wlc_hw->d11core; in brcms_ucode_write()
2255 brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_ucode_write()
2267 static void brcms_ucode_download(struct brcms_hardware *wlc_hw) in brcms_ucode_download() argument
2269 struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; in brcms_ucode_download()
2271 if (wlc_hw->ucode_loaded) in brcms_ucode_download()
2274 if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { in brcms_ucode_download()
2275 if (BRCMS_ISNPHY(wlc_hw->band)) { in brcms_ucode_download()
2276 brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo, in brcms_ucode_download()
2278 wlc_hw->ucode_loaded = true; in brcms_ucode_download()
2280 brcms_err(wlc_hw->d11core, in brcms_ucode_download()
2282 __func__, wlc_hw->unit, wlc_hw->corerev); in brcms_ucode_download()
2283 } else if (D11REV_IS(wlc_hw->corerev, 24)) { in brcms_ucode_download()
2284 if (BRCMS_ISLCNPHY(wlc_hw->band)) { in brcms_ucode_download()
2285 brcms_ucode_write(wlc_hw, ucode->bcm43xx_24_lcn, in brcms_ucode_download()
2287 wlc_hw->ucode_loaded = true; in brcms_ucode_download()
2289 brcms_err(wlc_hw->d11core, in brcms_ucode_download()
2291 __func__, wlc_hw->unit, wlc_hw->corerev); in brcms_ucode_download()
2296 void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant) in brcms_b_txant_set() argument
2299 wlc_hw->bmac_phytxant = phytxant; in brcms_b_txant_set()
2302 if (!wlc_hw->up) in brcms_b_txant_set()
2304 brcms_c_ucode_txant_set(wlc_hw); in brcms_b_txant_set()
2308 u16 brcms_b_get_txant(struct brcms_hardware *wlc_hw) in brcms_b_get_txant() argument
2310 return (u16) wlc_hw->wlc->stf->txant; in brcms_b_get_txant()
2313 void brcms_b_antsel_type_set(struct brcms_hardware *wlc_hw, u8 antsel_type) in brcms_b_antsel_type_set() argument
2315 wlc_hw->antsel_type = antsel_type; in brcms_b_antsel_type_set()
2318 wlc_phy_antsel_type_set(wlc_hw->band->pi, antsel_type); in brcms_b_antsel_type_set()
2321 static void brcms_b_fifoerrors(struct brcms_hardware *wlc_hw) in brcms_b_fifoerrors() argument
2326 struct bcma_device *core = wlc_hw->d11core; in brcms_b_fifoerrors()
2328 unit = wlc_hw->unit; in brcms_b_fifoerrors()
2377 brcms_fatal_error(wlc_hw->wlc->wl); /* big hammer */ in brcms_b_fifoerrors()
2388 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_intrson() local
2390 bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), wlc->macintmask); in brcms_c_intrson()
2395 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_intrsoff() local
2398 if (!wlc_hw->clk) in brcms_c_intrsoff()
2403 bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), 0); in brcms_c_intrsoff()
2404 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(macintmask)); in brcms_c_intrsoff()
2414 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_intrsrestore() local
2415 if (!wlc_hw->clk) in brcms_c_intrsrestore()
2419 bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), wlc->macintmask); in brcms_c_intrsrestore()
2423 static void brcms_b_tx_fifo_suspend(struct brcms_hardware *wlc_hw, in brcms_b_tx_fifo_suspend() argument
2431 if ((wlc_hw->suspended_fifos & fifo) == fifo) in brcms_b_tx_fifo_suspend()
2435 if (wlc_hw->suspended_fifos == 0) in brcms_b_tx_fifo_suspend()
2436 brcms_c_ucode_wake_override_set(wlc_hw, in brcms_b_tx_fifo_suspend()
2439 wlc_hw->suspended_fifos |= fifo; in brcms_b_tx_fifo_suspend()
2441 if (wlc_hw->di[tx_fifo]) { in brcms_b_tx_fifo_suspend()
2447 if (BRCMS_PHY_11N_CAP(wlc_hw->band)) in brcms_b_tx_fifo_suspend()
2448 brcms_c_suspend_mac_and_wait(wlc_hw->wlc); in brcms_b_tx_fifo_suspend()
2450 dma_txsuspend(wlc_hw->di[tx_fifo]); in brcms_b_tx_fifo_suspend()
2452 if (BRCMS_PHY_11N_CAP(wlc_hw->band)) in brcms_b_tx_fifo_suspend()
2453 brcms_c_enable_mac(wlc_hw->wlc); in brcms_b_tx_fifo_suspend()
2457 static void brcms_b_tx_fifo_resume(struct brcms_hardware *wlc_hw, in brcms_b_tx_fifo_resume() argument
2465 if (wlc_hw->di[tx_fifo]) in brcms_b_tx_fifo_resume()
2466 dma_txresume(wlc_hw->di[tx_fifo]); in brcms_b_tx_fifo_resume()
2469 if (wlc_hw->suspended_fifos == 0) in brcms_b_tx_fifo_resume()
2472 wlc_hw->suspended_fifos &= ~(1 << tx_fifo); in brcms_b_tx_fifo_resume()
2473 if (wlc_hw->suspended_fifos == 0) in brcms_b_tx_fifo_resume()
2474 brcms_c_ucode_wake_override_clear(wlc_hw, in brcms_b_tx_fifo_resume()
2480 static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool mute_tx) in brcms_b_mute() argument
2483 u8 *ethaddr = wlc_hw->wlc->pub->cur_etheraddr; in brcms_b_mute()
2487 brcms_b_tx_fifo_suspend(wlc_hw, TX_DATA_FIFO); in brcms_b_mute()
2488 brcms_b_tx_fifo_suspend(wlc_hw, TX_CTL_FIFO); in brcms_b_mute()
2489 brcms_b_tx_fifo_suspend(wlc_hw, TX_AC_BK_FIFO); in brcms_b_mute()
2490 brcms_b_tx_fifo_suspend(wlc_hw, TX_AC_VI_FIFO); in brcms_b_mute()
2493 brcms_b_set_addrmatch(wlc_hw, RCM_MAC_OFFSET, null_ether_addr); in brcms_b_mute()
2496 brcms_b_tx_fifo_resume(wlc_hw, TX_DATA_FIFO); in brcms_b_mute()
2497 brcms_b_tx_fifo_resume(wlc_hw, TX_CTL_FIFO); in brcms_b_mute()
2498 brcms_b_tx_fifo_resume(wlc_hw, TX_AC_BK_FIFO); in brcms_b_mute()
2499 brcms_b_tx_fifo_resume(wlc_hw, TX_AC_VI_FIFO); in brcms_b_mute()
2502 brcms_b_set_addrmatch(wlc_hw, RCM_MAC_OFFSET, ethaddr); in brcms_b_mute()
2505 wlc_phy_mute_upd(wlc_hw->band->pi, mute_tx, 0); in brcms_b_mute()
2508 brcms_c_ucode_mute_override_set(wlc_hw); in brcms_b_mute()
2510 brcms_c_ucode_mute_override_clear(wlc_hw); in brcms_b_mute()
2529 struct brcms_hardware *wlc_hw = wlc->hw; in wlc_intstatus() local
2530 struct bcma_device *core = wlc_hw->d11core; in wlc_intstatus()
2604 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_isr() local
2607 if (!wlc_hw->up || !wlc->macintmask) in brcms_c_isr()
2614 brcms_err(wlc_hw->d11core, in brcms_c_isr()
2632 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_suspend_mac_and_wait() local
2633 struct bcma_device *core = wlc_hw->d11core; in brcms_c_suspend_mac_and_wait()
2636 brcms_dbg_mac80211(core, "wl%d: bandunit %d\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2637 wlc_hw->band->bandunit); in brcms_c_suspend_mac_and_wait()
2642 wlc_hw->mac_suspend_depth++; in brcms_c_suspend_mac_and_wait()
2643 if (wlc_hw->mac_suspend_depth > 1) in brcms_c_suspend_mac_and_wait()
2647 brcms_c_ucode_wake_override_set(wlc_hw, BRCMS_WAKE_OVERRIDE_MACSUSPEND); in brcms_c_suspend_mac_and_wait()
2652 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2663 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2670 brcms_b_mctrl(wlc_hw, MCTL_EN_MAC, 0); in brcms_c_suspend_mac_and_wait()
2678 wlc_hw->unit, BRCMS_MAX_MAC_SUSPEND); in brcms_c_suspend_mac_and_wait()
2680 "psm_brc 0x%04x\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2688 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2700 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_enable_mac() local
2701 struct bcma_device *core = wlc_hw->d11core; in brcms_c_enable_mac()
2704 brcms_dbg_mac80211(core, "wl%d: bandunit %d\n", wlc_hw->unit, in brcms_c_enable_mac()
2710 wlc_hw->mac_suspend_depth--; in brcms_c_enable_mac()
2711 if (wlc_hw->mac_suspend_depth > 0) in brcms_c_enable_mac()
2719 brcms_b_mctrl(wlc_hw, MCTL_EN_MAC, MCTL_EN_MAC); in brcms_c_enable_mac()
2730 brcms_c_ucode_wake_override_clear(wlc_hw, in brcms_c_enable_mac()
2734 void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw, u8 stf_mode) in brcms_b_band_stf_ss_set() argument
2736 wlc_hw->hw_stf_ss_opmode = stf_mode; in brcms_b_band_stf_ss_set()
2738 if (wlc_hw->clk) in brcms_b_band_stf_ss_set()
2739 brcms_upd_ofdm_pctl1_table(wlc_hw); in brcms_b_band_stf_ss_set()
2742 static bool brcms_b_validate_chip_access(struct brcms_hardware *wlc_hw) in brcms_b_validate_chip_access() argument
2744 struct bcma_device *core = wlc_hw->d11core; in brcms_b_validate_chip_access()
2746 struct wiphy *wiphy = wlc_hw->wlc->wiphy; in brcms_b_validate_chip_access()
2764 "expected 0xaa5555aa\n", wlc_hw->unit, val); in brcms_b_validate_chip_access()
2777 "expected 0x55aaaa55\n", wlc_hw->unit, val); in brcms_b_validate_chip_access()
2792 "0x%x, expected 0x%x or 0x%x\n", wlc_hw->unit, w, in brcms_b_validate_chip_access()
2803 void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on) in brcms_b_core_phypll_ctl() argument
2805 struct bcma_device *core = wlc_hw->d11core; in brcms_b_core_phypll_ctl()
2808 brcms_dbg_info(core, "wl%d\n", wlc_hw->unit); in brcms_b_core_phypll_ctl()
2813 if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) { in brcms_b_core_phypll_ctl()
2856 static void brcms_c_coredisable(struct brcms_hardware *wlc_hw) in brcms_c_coredisable() argument
2860 brcms_dbg_info(wlc_hw->d11core, "wl%d: disable core\n", wlc_hw->unit); in brcms_c_coredisable()
2862 dev_gone = brcms_deviceremoved(wlc_hw->wlc); in brcms_c_coredisable()
2867 if (wlc_hw->noreset) in brcms_c_coredisable()
2871 wlc_phy_switch_radio(wlc_hw->band->pi, OFF); in brcms_c_coredisable()
2874 wlc_phy_anacore(wlc_hw->band->pi, OFF); in brcms_c_coredisable()
2877 brcms_b_core_phypll_ctl(wlc_hw, false); in brcms_c_coredisable()
2879 wlc_hw->clk = false; in brcms_c_coredisable()
2880 bcma_core_disable(wlc_hw->d11core, 0); in brcms_c_coredisable()
2881 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); in brcms_c_coredisable()
2886 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_flushqueues() local
2891 if (wlc_hw->di[i]) { in brcms_c_flushqueues()
2892 dma_txreclaim(wlc_hw->di[i], DMA_RANGE_ALL); in brcms_c_flushqueues()
2900 dma_rxreclaim(wlc_hw->di[RX_FIFO]); in brcms_c_flushqueues()
2904 brcms_b_read_objmem(struct brcms_hardware *wlc_hw, uint offset, u32 sel) in brcms_b_read_objmem() argument
2906 struct bcma_device *core = wlc_hw->d11core; in brcms_b_read_objmem()
2918 brcms_b_write_objmem(struct brcms_hardware *wlc_hw, uint offset, u16 v, in brcms_b_write_objmem() argument
2921 struct bcma_device *core = wlc_hw->d11core; in brcms_b_write_objmem()
2936 u16 brcms_b_read_shm(struct brcms_hardware *wlc_hw, uint offset) in brcms_b_read_shm() argument
2938 return brcms_b_read_objmem(wlc_hw, offset, OBJADDR_SHM_SEL); in brcms_b_read_shm()
2945 void brcms_b_write_shm(struct brcms_hardware *wlc_hw, uint offset, u16 v) in brcms_b_write_shm() argument
2947 brcms_b_write_objmem(wlc_hw, offset, v, OBJADDR_SHM_SEL); in brcms_b_write_shm()
2957 brcms_b_copyto_objmem(struct brcms_hardware *wlc_hw, uint offset, in brcms_b_copyto_objmem() argument
2969 brcms_b_write_objmem(wlc_hw, offset + i, v, sel); in brcms_b_copyto_objmem()
2980 brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset, void *buf, in brcms_b_copyfrom_objmem() argument
2991 v = brcms_b_read_objmem(wlc_hw, offset + i, sel); in brcms_b_copyfrom_objmem()
3007 static void brcms_b_retrylimit_upd(struct brcms_hardware *wlc_hw, in brcms_b_retrylimit_upd() argument
3010 wlc_hw->SRL = SRL; in brcms_b_retrylimit_upd()
3011 wlc_hw->LRL = LRL; in brcms_b_retrylimit_upd()
3014 if (wlc_hw->up) { in brcms_b_retrylimit_upd()
3015 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_retrylimit_upd()
3017 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_retrylimit_upd()
3018 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), wlc_hw->SRL); in brcms_b_retrylimit_upd()
3019 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_retrylimit_upd()
3021 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_retrylimit_upd()
3022 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), wlc_hw->LRL); in brcms_b_retrylimit_upd()
3026 static void brcms_b_pllreq(struct brcms_hardware *wlc_hw, bool set, u32 req_bit) in brcms_b_pllreq() argument
3029 if (mboolisset(wlc_hw->pllreq, req_bit)) in brcms_b_pllreq()
3032 mboolset(wlc_hw->pllreq, req_bit); in brcms_b_pllreq()
3034 if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) { in brcms_b_pllreq()
3035 if (!wlc_hw->sbclk) in brcms_b_pllreq()
3036 brcms_b_xtal(wlc_hw, ON); in brcms_b_pllreq()
3039 if (!mboolisset(wlc_hw->pllreq, req_bit)) in brcms_b_pllreq()
3042 mboolclr(wlc_hw->pllreq, req_bit); in brcms_b_pllreq()
3044 if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) { in brcms_b_pllreq()
3045 if (wlc_hw->sbclk) in brcms_b_pllreq()
3046 brcms_b_xtal(wlc_hw, OFF); in brcms_b_pllreq()
3051 static void brcms_b_antsel_set(struct brcms_hardware *wlc_hw, u32 antsel_avail) in brcms_b_antsel_set() argument
3053 wlc_hw->antsel_avail = antsel_avail; in brcms_b_antsel_set()
3119 static void brcms_b_reset(struct brcms_hardware *wlc_hw) in brcms_b_reset() argument
3122 if (!brcms_deviceremoved(wlc_hw->wlc)) in brcms_b_reset()
3123 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); in brcms_b_reset()
3126 brcms_c_flushqueues(wlc_hw->wlc); in brcms_b_reset()
3167 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_coreinit() local
3168 struct bcma_device *core = wlc_hw->d11core; in brcms_b_coreinit()
3174 struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; in brcms_b_coreinit()
3176 brcms_dbg_info(core, "wl%d: core init\n", wlc_hw->unit); in brcms_b_coreinit()
3179 brcms_b_mctrl(wlc_hw, ~0, (MCTL_IHR_EN | MCTL_PSM_JMP_0 | MCTL_WAKE)); in brcms_b_coreinit()
3181 brcms_ucode_download(wlc_hw); in brcms_b_coreinit()
3189 brcms_b_mctrl(wlc_hw, ~0, in brcms_b_coreinit()
3197 "suspend!\n", wlc_hw->unit); in brcms_b_coreinit()
3203 if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { in brcms_b_coreinit()
3204 if (BRCMS_ISNPHY(wlc_hw->band)) in brcms_b_coreinit()
3205 brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16); in brcms_b_coreinit()
3208 " %d\n", __func__, wlc_hw->unit, in brcms_b_coreinit()
3209 wlc_hw->corerev); in brcms_b_coreinit()
3210 } else if (D11REV_IS(wlc_hw->corerev, 24)) { in brcms_b_coreinit()
3211 if (BRCMS_ISLCNPHY(wlc_hw->band)) in brcms_b_coreinit()
3212 brcms_c_write_inits(wlc_hw, ucode->d11lcn0initvals24); in brcms_b_coreinit()
3215 " %d\n", __func__, wlc_hw->unit, in brcms_b_coreinit()
3216 wlc_hw->corerev); in brcms_b_coreinit()
3219 __func__, wlc_hw->unit, wlc_hw->corerev); in brcms_b_coreinit()
3224 brcms_b_corerev_fifofixup(wlc_hw); in brcms_b_coreinit()
3227 buf[TX_AC_BE_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE0); in brcms_b_coreinit()
3228 if (buf[TX_AC_BE_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_BE_FIFO]) { in brcms_b_coreinit()
3232 buf[TX_AC_VI_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE1); in brcms_b_coreinit()
3233 if (buf[TX_AC_VI_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_VI_FIFO]) { in brcms_b_coreinit()
3237 buf[TX_AC_BK_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE2); in brcms_b_coreinit()
3240 if (buf[TX_AC_BK_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_BK_FIFO]) { in brcms_b_coreinit()
3244 if (buf[TX_AC_VO_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_VO_FIFO]) { in brcms_b_coreinit()
3248 buf[TX_BCMC_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE3); in brcms_b_coreinit()
3251 if (buf[TX_BCMC_FIFO] != wlc_hw->xmtfifo_sz[TX_BCMC_FIFO]) { in brcms_b_coreinit()
3255 if (buf[TX_ATIM_FIFO] != wlc_hw->xmtfifo_sz[TX_ATIM_FIFO]) { in brcms_b_coreinit()
3262 wlc_hw->xmtfifo_sz[i], i); in brcms_b_coreinit()
3270 brcms_b_write_shm(wlc_hw, M_MBURST_SIZE, MAXTXFRAMEBURST); in brcms_b_coreinit()
3271 brcms_b_write_shm(wlc_hw, M_MAX_ANTCNT, ANTCNT); in brcms_b_coreinit()
3277 brcms_b_mctrl(wlc_hw, in brcms_b_coreinit()
3293 brcms_b_macphyclk_set(wlc_hw, ON); in brcms_b_coreinit()
3296 wlc->fastpwrup_dly = ai_clkctl_fast_pwrup_delay(wlc_hw->sih); in brcms_b_coreinit()
3300 brcms_b_write_shm(wlc_hw, M_MACHW_VER, (u16) wlc_hw->corerev); in brcms_b_coreinit()
3303 brcms_b_write_shm(wlc_hw, M_MACHW_CAP_L, in brcms_b_coreinit()
3304 (u16) (wlc_hw->machwcap & 0xffff)); in brcms_b_coreinit()
3305 brcms_b_write_shm(wlc_hw, M_MACHW_CAP_H, in brcms_b_coreinit()
3306 (u16) ((wlc_hw-> in brcms_b_coreinit()
3313 bcma_write32(core, D11REGOFFS(objdata), wlc_hw->SRL); in brcms_b_coreinit()
3317 bcma_write32(core, D11REGOFFS(objdata), wlc_hw->LRL); in brcms_b_coreinit()
3320 brcms_b_write_shm(wlc_hw, M_SFRMTXCNTFBRTHSD, wlc_hw->SFBL); in brcms_b_coreinit()
3321 brcms_b_write_shm(wlc_hw, M_LFRMTXCNTFBRTHSD, wlc_hw->LFBL); in brcms_b_coreinit()
3328 if (wlc_hw->di[i]) in brcms_b_coreinit()
3329 dma_txinit(wlc_hw->di[i]); in brcms_b_coreinit()
3333 dma_rxinit(wlc_hw->di[RX_FIFO]); in brcms_b_coreinit()
3334 dma_rxfill(wlc_hw->di[RX_FIFO]); in brcms_b_coreinit()
3337 static void brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec) in brcms_b_init() argument
3341 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_init()
3344 fastclk = wlc_hw->forcefastclk; in brcms_b_init()
3346 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_init()
3352 brcms_c_setxband(wlc_hw, chspec_bandunit(chanspec)); in brcms_b_init()
3353 wlc_phy_chanspec_radio_set(wlc_hw->band->pi, chanspec); in brcms_b_init()
3356 wlc_phy_cal_init(wlc_hw->band->pi); in brcms_b_init()
3370 mboolset(wlc_hw->wake_override, BRCMS_WAKE_OVERRIDE_MACSUSPEND); in brcms_b_init()
3376 wlc_hw->mac_suspend_depth = 1; in brcms_b_init()
3380 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_init()
3791 static void brcms_b_set_shortslot(struct brcms_hardware *wlc_hw, bool shortslot) in brcms_b_set_shortslot() argument
3793 wlc_hw->shortslot = shortslot; in brcms_b_set_shortslot()
3795 if (wlc_hw->band->bandtype == BRCM_BAND_2G && wlc_hw->up) { in brcms_b_set_shortslot()
3796 brcms_c_suspend_mac_and_wait(wlc_hw->wlc); in brcms_b_set_shortslot()
3797 brcms_b_update_slot_timing(wlc_hw, shortslot); in brcms_b_set_shortslot()
3798 brcms_c_enable_mac(wlc_hw->wlc); in brcms_b_set_shortslot()
3831 brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec, in brcms_b_set_chanspec() argument
3836 brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: 0x%x\n", wlc_hw->unit, in brcms_b_set_chanspec()
3839 wlc_hw->chanspec = chanspec; in brcms_b_set_chanspec()
3842 if (wlc_hw->_nbands > 1) { in brcms_b_set_chanspec()
3844 if (wlc_hw->band->bandunit != bandunit) { in brcms_b_set_chanspec()
3848 if (wlc_hw->up) { in brcms_b_set_chanspec()
3849 wlc_phy_chanspec_radio_set(wlc_hw-> in brcms_b_set_chanspec()
3852 brcms_b_setband(wlc_hw, bandunit, chanspec); in brcms_b_set_chanspec()
3854 brcms_c_setxband(wlc_hw, bandunit); in brcms_b_set_chanspec()
3859 wlc_phy_initcal_enable(wlc_hw->band->pi, !mute_tx); in brcms_b_set_chanspec()
3861 if (!wlc_hw->up) { in brcms_b_set_chanspec()
3862 if (wlc_hw->clk) in brcms_b_set_chanspec()
3863 wlc_phy_txpower_limit_set(wlc_hw->band->pi, txpwr, in brcms_b_set_chanspec()
3865 wlc_phy_chanspec_radio_set(wlc_hw->band->pi, chanspec); in brcms_b_set_chanspec()
3867 wlc_phy_chanspec_set(wlc_hw->band->pi, chanspec); in brcms_b_set_chanspec()
3868 wlc_phy_txpower_limit_set(wlc_hw->band->pi, txpwr, chanspec); in brcms_b_set_chanspec()
3871 brcms_b_mute(wlc_hw, mute_tx); in brcms_b_set_chanspec()
4198 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_watchdog() local
4200 if (!wlc_hw->up) in brcms_b_watchdog()
4204 wlc_hw->now++; in brcms_b_watchdog()
4207 brcms_b_fifoerrors(wlc_hw); in brcms_b_watchdog()
4212 wlc_phy_watchdog(wlc_hw->band->pi); in brcms_b_watchdog()
4386 struct brcms_hardware *wlc_hw; in brcms_b_attach() local
4406 wlc_hw = wlc->hw; in brcms_b_attach()
4407 wlc_hw->wlc = wlc; in brcms_b_attach()
4408 wlc_hw->unit = unit; in brcms_b_attach()
4409 wlc_hw->band = wlc_hw->bandstate[0]; in brcms_b_attach()
4410 wlc_hw->_piomode = piomode; in brcms_b_attach()
4413 brcms_b_info_init(wlc_hw); in brcms_b_attach()
4419 wlc_hw->sih = ai_attach(core->bus); in brcms_b_attach()
4420 if (wlc_hw->sih == NULL) { in brcms_b_attach()
4436 wlc_hw->vendorid = pcidev->vendor; in brcms_b_attach()
4437 wlc_hw->deviceid = pcidev->device; in brcms_b_attach()
4439 wlc_hw->vendorid = core->bus->boardinfo.vendor; in brcms_b_attach()
4440 wlc_hw->deviceid = core->bus->boardinfo.type; in brcms_b_attach()
4443 wlc_hw->d11core = core; in brcms_b_attach()
4444 wlc_hw->corerev = core->id.rev; in brcms_b_attach()
4447 if (!brcms_c_isgoodchip(wlc_hw)) { in brcms_b_attach()
4453 ai_clkctl_init(wlc_hw->sih); in brcms_b_attach()
4461 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_attach()
4462 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); in brcms_b_attach()
4464 if (!brcms_b_validate_chip_access(wlc_hw)) { in brcms_b_attach()
4476 wlc_hw->boardrev = (u16) j; in brcms_b_attach()
4477 if (!brcms_c_validboardtype(wlc_hw)) { in brcms_b_attach()
4480 unit, ai_get_boardtype(wlc_hw->sih), in brcms_b_attach()
4481 wlc_hw->boardrev); in brcms_b_attach()
4485 wlc_hw->sromrev = sprom->revision; in brcms_b_attach()
4486 wlc_hw->boardflags = sprom->boardflags_lo + (sprom->boardflags_hi << 16); in brcms_b_attach()
4487 wlc_hw->boardflags2 = sprom->boardflags2_lo + (sprom->boardflags2_hi << 16); in brcms_b_attach()
4489 if (wlc_hw->boardflags & BFL_NOPLLDOWN) in brcms_b_attach()
4490 brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED); in brcms_b_attach()
4493 if (wlc_hw->deviceid == BCM43224_D11N_ID || in brcms_b_attach()
4494 wlc_hw->deviceid == BCM43224_D11N_ID_VEN1 || in brcms_b_attach()
4495 wlc_hw->deviceid == BCM43224_CHIP_ID) in brcms_b_attach()
4497 wlc_hw->_nbands = 2; in brcms_b_attach()
4499 wlc_hw->_nbands = 1; in brcms_b_attach()
4501 if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225)) in brcms_b_attach()
4502 wlc_hw->_nbands = 1; in brcms_b_attach()
4507 wlc->vendorid = wlc_hw->vendorid; in brcms_b_attach()
4508 wlc->deviceid = wlc_hw->deviceid; in brcms_b_attach()
4509 wlc->pub->sih = wlc_hw->sih; in brcms_b_attach()
4510 wlc->pub->corerev = wlc_hw->corerev; in brcms_b_attach()
4511 wlc->pub->sromrev = wlc_hw->sromrev; in brcms_b_attach()
4512 wlc->pub->boardrev = wlc_hw->boardrev; in brcms_b_attach()
4513 wlc->pub->boardflags = wlc_hw->boardflags; in brcms_b_attach()
4514 wlc->pub->boardflags2 = wlc_hw->boardflags2; in brcms_b_attach()
4515 wlc->pub->_nbands = wlc_hw->_nbands; in brcms_b_attach()
4517 wlc_hw->physhim = wlc_phy_shim_attach(wlc_hw, wlc->wl, wlc); in brcms_b_attach()
4519 if (wlc_hw->physhim == NULL) { in brcms_b_attach()
4527 sha_params.sih = wlc_hw->sih; in brcms_b_attach()
4528 sha_params.physhim = wlc_hw->physhim; in brcms_b_attach()
4530 sha_params.corerev = wlc_hw->corerev; in brcms_b_attach()
4531 sha_params.vid = wlc_hw->vendorid; in brcms_b_attach()
4532 sha_params.did = wlc_hw->deviceid; in brcms_b_attach()
4533 sha_params.chip = ai_get_chip_id(wlc_hw->sih); in brcms_b_attach()
4534 sha_params.chiprev = ai_get_chiprev(wlc_hw->sih); in brcms_b_attach()
4535 sha_params.chippkg = ai_get_chippkg(wlc_hw->sih); in brcms_b_attach()
4536 sha_params.sromrev = wlc_hw->sromrev; in brcms_b_attach()
4537 sha_params.boardtype = ai_get_boardtype(wlc_hw->sih); in brcms_b_attach()
4538 sha_params.boardrev = wlc_hw->boardrev; in brcms_b_attach()
4539 sha_params.boardflags = wlc_hw->boardflags; in brcms_b_attach()
4540 sha_params.boardflags2 = wlc_hw->boardflags2; in brcms_b_attach()
4543 wlc_hw->phy_sh = wlc_phy_shared_attach(&sha_params); in brcms_b_attach()
4544 if (!wlc_hw->phy_sh) { in brcms_b_attach()
4550 for (j = 0; j < wlc_hw->_nbands; j++) { in brcms_b_attach()
4556 brcms_c_setxband(wlc_hw, j); in brcms_b_attach()
4558 wlc_hw->band->bandunit = j; in brcms_b_attach()
4559 wlc_hw->band->bandtype = j ? BRCM_BAND_5G : BRCM_BAND_2G; in brcms_b_attach()
4564 wlc_hw->machwcap = bcma_read32(core, D11REGOFFS(machwcap)); in brcms_b_attach()
4565 wlc_hw->machwcap_backup = wlc_hw->machwcap; in brcms_b_attach()
4568 WARN_ON(wlc_hw->corerev < XMTFIFOTBL_STARTREV || in brcms_b_attach()
4569 (wlc_hw->corerev - XMTFIFOTBL_STARTREV) > in brcms_b_attach()
4571 wlc_hw->xmtfifo_sz = in brcms_b_attach()
4572 xmtfifo_sz[(wlc_hw->corerev - XMTFIFOTBL_STARTREV)]; in brcms_b_attach()
4573 WARN_ON(!wlc_hw->xmtfifo_sz[0]); in brcms_b_attach()
4576 wlc_hw->band->pi = in brcms_b_attach()
4577 wlc_phy_attach(wlc_hw->phy_sh, core, in brcms_b_attach()
4578 wlc_hw->band->bandtype, in brcms_b_attach()
4580 if (wlc_hw->band->pi == NULL) { in brcms_b_attach()
4587 wlc_phy_machwcap_set(wlc_hw->band->pi, wlc_hw->machwcap); in brcms_b_attach()
4589 wlc_phy_get_phyversion(wlc_hw->band->pi, &wlc_hw->band->phytype, in brcms_b_attach()
4590 &wlc_hw->band->phyrev, in brcms_b_attach()
4591 &wlc_hw->band->radioid, in brcms_b_attach()
4592 &wlc_hw->band->radiorev); in brcms_b_attach()
4593 wlc_hw->band->abgphy_encore = in brcms_b_attach()
4594 wlc_phy_get_encore(wlc_hw->band->pi); in brcms_b_attach()
4595 wlc->band->abgphy_encore = wlc_phy_get_encore(wlc_hw->band->pi); in brcms_b_attach()
4596 wlc_hw->band->core_flags = in brcms_b_attach()
4597 wlc_phy_get_coreflags(wlc_hw->band->pi); in brcms_b_attach()
4600 if (BRCMS_ISNPHY(wlc_hw->band)) { in brcms_b_attach()
4601 if (NCONF_HAS(wlc_hw->band->phyrev)) in brcms_b_attach()
4605 } else if (BRCMS_ISLCNPHY(wlc_hw->band)) { in brcms_b_attach()
4606 if (LCNCONF_HAS(wlc_hw->band->phyrev)) in brcms_b_attach()
4614 wlc_hw->band->phytype, wlc_hw->band->phyrev); in brcms_b_attach()
4629 wlc->band->pi = wlc_hw->band->pi; in brcms_b_attach()
4630 wlc->band->phytype = wlc_hw->band->phytype; in brcms_b_attach()
4631 wlc->band->phyrev = wlc_hw->band->phyrev; in brcms_b_attach()
4632 wlc->band->radioid = wlc_hw->band->radioid; in brcms_b_attach()
4633 wlc->band->radiorev = wlc_hw->band->radiorev; in brcms_b_attach()
4638 wlc_hw->band->CWmin = APHY_CWMIN; in brcms_b_attach()
4639 wlc_hw->band->CWmax = PHY_CWMAX; in brcms_b_attach()
4648 brcms_c_coredisable(wlc_hw); in brcms_b_attach()
4651 bcma_host_pci_down(wlc_hw->d11core->bus); in brcms_b_attach()
4654 brcms_b_xtal(wlc_hw, OFF); in brcms_b_attach()
4667 brcms_c_get_macaddr(wlc_hw, wlc_hw->etheraddr); in brcms_b_attach()
4669 if (is_broadcast_ether_addr(wlc_hw->etheraddr) || in brcms_b_attach()
4670 is_zero_ether_addr(wlc_hw->etheraddr)) { in brcms_b_attach()
4677 brcms_dbg_info(wlc_hw->d11core, "deviceid 0x%x nbands %d board 0x%x\n", in brcms_b_attach()
4678 wlc_hw->deviceid, wlc_hw->_nbands, in brcms_b_attach()
4679 ai_get_boardtype(wlc_hw->sih)); in brcms_b_attach()
4819 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_detach() local
4821 brcms_b_detach_dmapio(wlc_hw); in brcms_b_detach()
4823 band = wlc_hw->band; in brcms_b_detach()
4824 for (i = 0; i < wlc_hw->_nbands; i++) { in brcms_b_detach()
4830 band = wlc_hw->bandstate[OTHERBANDUNIT(wlc)]; in brcms_b_detach()
4834 kfree(wlc_hw->phy_sh); in brcms_b_detach()
4836 wlc_phy_shim_detach(wlc_hw->physhim); in brcms_b_detach()
4838 if (wlc_hw->sih) { in brcms_b_detach()
4839 ai_detach(wlc_hw->sih); in brcms_b_detach()
4840 wlc_hw->sih = NULL; in brcms_b_detach()
4886 static void brcms_b_hw_up(struct brcms_hardware *wlc_hw) in brcms_b_hw_up() argument
4888 if (wlc_hw->wlc->pub->hw_up) in brcms_b_hw_up()
4891 brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_b_hw_up()
4897 brcms_b_xtal(wlc_hw, ON); in brcms_b_hw_up()
4898 ai_clkctl_init(wlc_hw->sih); in brcms_b_hw_up()
4899 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_hw_up()
4912 wlc_phy_por_inform(wlc_hw->band->pi); in brcms_b_hw_up()
4914 wlc_hw->ucode_loaded = false; in brcms_b_hw_up()
4915 wlc_hw->wlc->pub->hw_up = true; in brcms_b_hw_up()
4917 if ((wlc_hw->boardflags & BFL_FEM) in brcms_b_hw_up()
4918 && (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) { in brcms_b_hw_up()
4920 (wlc_hw->boardrev >= 0x1250 in brcms_b_hw_up()
4921 && (wlc_hw->boardflags & BFL_FEM_BT))) in brcms_b_hw_up()
4922 ai_epa_4313war(wlc_hw->sih); in brcms_b_hw_up()
4926 static int brcms_b_up_prep(struct brcms_hardware *wlc_hw) in brcms_b_up_prep() argument
4928 brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_b_up_prep()
4934 brcms_b_xtal(wlc_hw, ON); in brcms_b_up_prep()
4935 ai_clkctl_init(wlc_hw->sih); in brcms_b_up_prep()
4936 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_up_prep()
4942 bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core, in brcms_b_up_prep()
4950 if (brcms_b_radio_read_hwdisabled(wlc_hw)) { in brcms_b_up_prep()
4952 bcma_host_pci_down(wlc_hw->d11core->bus); in brcms_b_up_prep()
4953 brcms_b_xtal(wlc_hw, OFF); in brcms_b_up_prep()
4957 bcma_host_pci_up(wlc_hw->d11core->bus); in brcms_b_up_prep()
4960 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); in brcms_b_up_prep()
4965 static int brcms_b_up_finish(struct brcms_hardware *wlc_hw) in brcms_b_up_finish() argument
4967 wlc_hw->up = true; in brcms_b_up_finish()
4968 wlc_phy_hw_state_upd(wlc_hw->band->pi, true); in brcms_b_up_finish()
4971 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_up_finish()
4972 brcms_intrson(wlc_hw->wlc->wl); in brcms_b_up_finish()
5088 static int brcms_b_bmac_down_prep(struct brcms_hardware *wlc_hw) in brcms_b_bmac_down_prep() argument
5093 if (!wlc_hw->up) in brcms_b_bmac_down_prep()
5096 dev_gone = brcms_deviceremoved(wlc_hw->wlc); in brcms_b_bmac_down_prep()
5100 wlc_hw->wlc->macintmask = 0; in brcms_b_bmac_down_prep()
5103 brcms_intrsoff(wlc_hw->wlc->wl); in brcms_b_bmac_down_prep()
5106 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_bmac_down_prep()
5109 callbacks += wlc_phy_down(wlc_hw->band->pi); in brcms_b_bmac_down_prep()
5114 static int brcms_b_down_finish(struct brcms_hardware *wlc_hw) in brcms_b_down_finish() argument
5119 if (!wlc_hw->up) in brcms_b_down_finish()
5122 wlc_hw->up = false; in brcms_b_down_finish()
5123 wlc_phy_hw_state_upd(wlc_hw->band->pi, false); in brcms_b_down_finish()
5125 dev_gone = brcms_deviceremoved(wlc_hw->wlc); in brcms_b_down_finish()
5128 wlc_hw->sbclk = false; in brcms_b_down_finish()
5129 wlc_hw->clk = false; in brcms_b_down_finish()
5130 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); in brcms_b_down_finish()
5133 brcms_c_flushqueues(wlc_hw->wlc); in brcms_b_down_finish()
5137 if (bcma_core_is_enabled(wlc_hw->d11core)) { in brcms_b_down_finish()
5138 if (bcma_read32(wlc_hw->d11core, in brcms_b_down_finish()
5140 brcms_c_suspend_mac_and_wait(wlc_hw->wlc); in brcms_b_down_finish()
5141 callbacks += brcms_reset(wlc_hw->wlc->wl); in brcms_b_down_finish()
5142 brcms_c_coredisable(wlc_hw); in brcms_b_down_finish()
5146 if (!wlc_hw->noreset) { in brcms_b_down_finish()
5147 bcma_host_pci_down(wlc_hw->d11core->bus); in brcms_b_down_finish()
5148 brcms_b_xtal(wlc_hw, OFF); in brcms_b_down_finish()
5637 u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate) in brcms_b_rate_shm_offset() argument
5657 return 2 * brcms_b_read_shm(wlc_hw, table_ptr + (index * 2)); in brcms_b_rate_shm_offset()
6952 brcms_b_read_tsf(struct brcms_hardware *wlc_hw, u32 *tsf_l_ptr, in brcms_b_read_tsf() argument
6955 struct bcma_device *core = wlc_hw->d11core; in brcms_b_read_tsf()
7246 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_beacon_write() local
7264 brcms_b_write_template_ram(wlc_hw, T_BCN0_TPL_BASE, in brcms_c_beacon_write()
7268 brcms_b_write_shm(wlc_hw, M_BCN0_FRM_BYTESZ, (u16) len); in brcms_c_beacon_write()
7272 brcms_b_write_template_ram(wlc_hw, T_BCN1_TPL_BASE, in brcms_c_beacon_write()
7276 brcms_b_write_shm(wlc_hw, M_BCN1_FRM_BYTESZ, (u16) len); in brcms_c_beacon_write()
7280 brcms_b_write_shm(wlc_hw, M_TIMBPOS_INBEACON, in brcms_c_beacon_write()
7282 brcms_b_write_shm(wlc_hw, M_DOT11_DTIMPERIOD, dtim_period); in brcms_c_beacon_write()
7284 brcms_b_write_shm(wlc_hw, M_TIMBPOS_INBEACON, in brcms_c_beacon_write()
7286 brcms_b_write_shm(wlc_hw, M_DOT11_DTIMPERIOD, 0); in brcms_c_beacon_write()
7294 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_update_beacon_hw() local
7295 struct bcma_device *core = wlc_hw->d11core; in brcms_c_update_beacon_hw()
7465 int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, in brcms_b_xmtfifo_sz_get() argument
7471 *blocks = wlc_hw->xmtfifo_sz[fifo]; in brcms_b_xmtfifo_sz_get()
7654 brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) in brcms_b_recv() argument
7672 morepending = dma_rx(wlc_hw->di[fifo], &recv_frames); in brcms_b_recv()
7677 dma_rxfill(wlc_hw->di[fifo]); in brcms_b_recv()
7701 brcms_c_recv(wlc_hw->wlc, p); in brcms_b_recv()
7714 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_dpc() local
7715 struct bcma_device *core = wlc_hw->d11core; in brcms_c_dpc()
7718 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_dpc()
7729 wlc_hw->unit, macintstatus); in brcms_c_dpc()
7759 if (brcms_b_recv(wlc_hw, RX_FIFO, bounded)) in brcms_c_dpc()
7764 wlc_phy_noise_sample_intr(wlc_hw->band->pi); in brcms_c_dpc()
7768 "(seconds). Resetting.\n", wlc_hw->unit, wlc_hw->now); in brcms_c_dpc()
7771 __func__, ai_get_chip_id(wlc_hw->sih), in brcms_c_dpc()
7772 ai_get_chiprev(wlc_hw->sih)); in brcms_c_dpc()
7773 brcms_fatal_error(wlc_hw->wlc->wl); in brcms_c_dpc()
7782 " RF Disable Input\n", wlc_hw->unit); in brcms_c_dpc()
7794 brcms_fatal_error(wlc_hw->wlc->wl); in brcms_c_dpc()