Lines Matching refs:wlc_hw

588 static void brcms_b_update_slot_timing(struct brcms_hardware *wlc_hw,  in brcms_b_update_slot_timing()  argument
591 struct bcma_device *core = wlc_hw->d11core; in brcms_b_update_slot_timing()
596 brcms_b_write_shm(wlc_hw, M_DOT11_SLOT, APHY_SLOT_TIME); in brcms_b_update_slot_timing()
600 brcms_b_write_shm(wlc_hw, M_DOT11_SLOT, BPHY_SLOT_TIME); in brcms_b_update_slot_timing()
673 static void brcms_c_write_inits(struct brcms_hardware *wlc_hw, in brcms_c_write_inits() argument
676 struct bcma_device *core = wlc_hw->d11core; in brcms_c_write_inits()
682 brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_c_write_inits()
697 static void brcms_c_write_mhf(struct brcms_hardware *wlc_hw, u16 *mhfs) in brcms_c_write_mhf() argument
706 brcms_b_write_shm(wlc_hw, addr[idx], mhfs[idx]); in brcms_c_write_mhf()
709 static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw) in brcms_c_ucode_bsinit() argument
711 struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; in brcms_c_ucode_bsinit()
714 brcms_c_write_mhf(wlc_hw, wlc_hw->band->mhfs); in brcms_c_ucode_bsinit()
717 if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { in brcms_c_ucode_bsinit()
718 if (BRCMS_ISNPHY(wlc_hw->band)) in brcms_c_ucode_bsinit()
719 brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16); in brcms_c_ucode_bsinit()
721 brcms_err(wlc_hw->d11core, in brcms_c_ucode_bsinit()
723 __func__, wlc_hw->unit, in brcms_c_ucode_bsinit()
724 wlc_hw->corerev); in brcms_c_ucode_bsinit()
726 if (D11REV_IS(wlc_hw->corerev, 24)) { in brcms_c_ucode_bsinit()
727 if (BRCMS_ISLCNPHY(wlc_hw->band)) in brcms_c_ucode_bsinit()
728 brcms_c_write_inits(wlc_hw, in brcms_c_ucode_bsinit()
731 brcms_err(wlc_hw->d11core, in brcms_c_ucode_bsinit()
733 __func__, wlc_hw->unit, in brcms_c_ucode_bsinit()
734 wlc_hw->corerev); in brcms_c_ucode_bsinit()
736 brcms_err(wlc_hw->d11core, in brcms_c_ucode_bsinit()
738 __func__, wlc_hw->unit, wlc_hw->corerev); in brcms_c_ucode_bsinit()
743 static void brcms_b_core_ioctl(struct brcms_hardware *wlc_hw, u32 m, u32 v) in brcms_b_core_ioctl() argument
745 struct bcma_device *core = wlc_hw->d11core; in brcms_b_core_ioctl()
751 static void brcms_b_core_phy_clk(struct brcms_hardware *wlc_hw, bool clk) in brcms_b_core_phy_clk() argument
753 brcms_dbg_info(wlc_hw->d11core, "wl%d: clk %d\n", wlc_hw->unit, clk); in brcms_b_core_phy_clk()
755 wlc_hw->phyclk = clk; in brcms_b_core_phy_clk()
759 brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_FGC | SICF_GMODE), in brcms_b_core_phy_clk()
762 brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_FGC), SICF_PRST); in brcms_b_core_phy_clk()
767 brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_FGC), SICF_FGC); in brcms_b_core_phy_clk()
769 brcms_b_core_ioctl(wlc_hw, SICF_FGC, 0); in brcms_b_core_phy_clk()
776 static void brcms_c_setxband(struct brcms_hardware *wlc_hw, uint bandunit) in brcms_c_setxband() argument
778 brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: bandunit %d\n", wlc_hw->unit, in brcms_c_setxband()
781 wlc_hw->band = wlc_hw->bandstate[bandunit]; in brcms_c_setxband()
787 wlc_hw->wlc->band = wlc_hw->wlc->bandstate[bandunit]; in brcms_c_setxband()
790 if (wlc_hw->sbclk && !wlc_hw->noreset) { in brcms_c_setxband()
796 brcms_b_core_ioctl(wlc_hw, SICF_GMODE, gmode); in brcms_c_setxband()
803 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_setband_inact() local
807 brcms_dbg_mac80211(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_c_setband_inact()
808 macctrl = bcma_read32(wlc_hw->d11core, in brcms_c_setband_inact()
816 wlc_phy_switch_radio(wlc_hw->band->pi, OFF); in brcms_c_setband_inact()
818 brcms_b_core_phy_clk(wlc_hw, OFF); in brcms_c_setband_inact()
820 brcms_c_setxband(wlc_hw, bandunit); in brcms_c_setband_inact()
1015 brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) in brcms_b_txstatus() argument
1028 core = wlc_hw->d11core; in brcms_b_txstatus()
1034 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_b_txstatus()
1050 *fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs); in brcms_b_txstatus()
1073 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_mhfdef() local
1080 if (wlc_hw->boardflags & BFL_NOPLLDOWN) in brcms_c_mhfdef()
1083 if (BRCMS_ISNPHY(wlc_hw->band) && NREV_LT(wlc_hw->band->phyrev, 2)) { in brcms_c_mhfdef()
1105 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_attach_dmapio() local
1106 uint unit = wlc_hw->unit; in brcms_b_attach_dmapio()
1111 if (wlc_hw->di[0] == NULL) { /* Init FIFOs */ in brcms_b_attach_dmapio()
1119 wlc_hw->di[0] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1125 dma_attach_err |= (NULL == wlc_hw->di[0]); in brcms_b_attach_dmapio()
1133 wlc_hw->di[1] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1136 dma_attach_err |= (NULL == wlc_hw->di[1]); in brcms_b_attach_dmapio()
1143 wlc_hw->di[2] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1146 dma_attach_err |= (NULL == wlc_hw->di[2]); in brcms_b_attach_dmapio()
1152 wlc_hw->di[3] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1156 dma_attach_err |= (NULL == wlc_hw->di[3]); in brcms_b_attach_dmapio()
1160 brcms_err(wlc_hw->d11core, in brcms_b_attach_dmapio()
1168 if (wlc_hw->di[i]) in brcms_b_attach_dmapio()
1169 wlc_hw->txavail[i] = in brcms_b_attach_dmapio()
1170 (uint *) dma_getvar(wlc_hw->di[i], in brcms_b_attach_dmapio()
1175 brcms_c_mhfdef(wlc, wlc_hw->band->mhfs, pio_mhf2); in brcms_b_attach_dmapio()
1180 static void brcms_b_detach_dmapio(struct brcms_hardware *wlc_hw) in brcms_b_detach_dmapio() argument
1185 if (wlc_hw->di[j]) { in brcms_b_detach_dmapio()
1186 dma_detach(wlc_hw->di[j]); in brcms_b_detach_dmapio()
1187 wlc_hw->di[j] = NULL; in brcms_b_detach_dmapio()
1197 static void brcms_b_info_init(struct brcms_hardware *wlc_hw) in brcms_b_info_init() argument
1199 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_info_init()
1205 wlc_hw->shortslot = false; in brcms_b_info_init()
1207 wlc_hw->SFBL = RETRY_SHORT_FB; in brcms_b_info_init()
1208 wlc_hw->LFBL = RETRY_LONG_FB; in brcms_b_info_init()
1211 wlc_hw->SRL = RETRY_SHORT_DEF; in brcms_b_info_init()
1212 wlc_hw->LRL = RETRY_LONG_DEF; in brcms_b_info_init()
1213 wlc_hw->chanspec = ch20mhz_chspec(1); in brcms_b_info_init()
1216 static void brcms_b_wait_for_wake(struct brcms_hardware *wlc_hw) in brcms_b_wait_for_wake() argument
1222 SPINWAIT((brcms_b_read_shm(wlc_hw, M_UCODE_DBGST) == in brcms_b_wait_for_wake()
1223 DBGST_ASLEEP), wlc_hw->wlc->fastpwrup_dly); in brcms_b_wait_for_wake()
1227 static void brcms_b_clkctl_clk(struct brcms_hardware *wlc_hw, enum bcma_clkmode mode) in brcms_b_clkctl_clk() argument
1229 if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU) { in brcms_b_clkctl_clk()
1236 if (wlc_hw->clk) { in brcms_b_clkctl_clk()
1238 bcma_set32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1245 ((bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1249 WARN_ON(!(bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1253 if ((ai_get_pmurev(wlc_hw->sih) == 0) && in brcms_b_clkctl_clk()
1254 (bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1258 ((bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1263 bcma_mask32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1268 wlc_hw->forcefastclk = (mode == BCMA_CLKMODE_FAST); in brcms_b_clkctl_clk()
1275 wlc_hw->forcefastclk = ai_clkctl_cc(wlc_hw->sih, mode); in brcms_b_clkctl_clk()
1278 if (wlc_hw->forcefastclk && wlc_hw->clk) in brcms_b_clkctl_clk()
1279 WARN_ON(!(bcma_aread32(wlc_hw->d11core, BCMA_IOST) & in brcms_b_clkctl_clk()
1292 if (wlc_hw->forcefastclk) in brcms_b_clkctl_clk()
1293 mboolset(wlc_hw->wake_override, in brcms_b_clkctl_clk()
1296 mboolclr(wlc_hw->wake_override, in brcms_b_clkctl_clk()
1313 brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, u16 val, in brcms_b_mhf() argument
1332 band = wlc_hw->band; in brcms_b_mhf()
1335 band = wlc_hw->bandstate[BAND_5G_INDEX]; in brcms_b_mhf()
1338 band = wlc_hw->bandstate[BAND_2G_INDEX]; in brcms_b_mhf()
1351 if (wlc_hw->clk && (band->mhfs[idx] != save) in brcms_b_mhf()
1352 && (band == wlc_hw->band)) in brcms_b_mhf()
1353 brcms_b_write_shm(wlc_hw, addr[idx], in brcms_b_mhf()
1358 wlc_hw->bandstate[0]->mhfs[idx] = in brcms_b_mhf()
1359 (wlc_hw->bandstate[0]->mhfs[idx] & ~mask) | val; in brcms_b_mhf()
1360 wlc_hw->bandstate[1]->mhfs[idx] = in brcms_b_mhf()
1361 (wlc_hw->bandstate[1]->mhfs[idx] & ~mask) | val; in brcms_b_mhf()
1368 static void brcms_c_mctrl_reset(struct brcms_hardware *wlc_hw) in brcms_c_mctrl_reset() argument
1371 wlc_hw->maccontrol = 0; in brcms_c_mctrl_reset()
1372 wlc_hw->suspended_fifos = 0; in brcms_c_mctrl_reset()
1373 wlc_hw->wake_override = 0; in brcms_c_mctrl_reset()
1374 wlc_hw->mute_override = 0; in brcms_c_mctrl_reset()
1375 brcms_b_mctrl(wlc_hw, ~0, MCTL_IHR_EN | MCTL_WAKE); in brcms_c_mctrl_reset()
1382 static void brcms_c_mctrl_write(struct brcms_hardware *wlc_hw) in brcms_c_mctrl_write() argument
1384 u32 maccontrol = wlc_hw->maccontrol; in brcms_c_mctrl_write()
1387 if (wlc_hw->wake_override) in brcms_c_mctrl_write()
1391 if (wlc_hw->mute_override) { in brcms_c_mctrl_write()
1396 bcma_write32(wlc_hw->d11core, D11REGOFFS(maccontrol), in brcms_c_mctrl_write()
1401 void brcms_b_mctrl(struct brcms_hardware *wlc_hw, u32 mask, u32 val) in brcms_b_mctrl() argument
1408 maccontrol = wlc_hw->maccontrol; in brcms_b_mctrl()
1416 wlc_hw->maccontrol = new_maccontrol; in brcms_b_mctrl()
1419 brcms_c_mctrl_write(wlc_hw); in brcms_b_mctrl()
1422 void brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw, in brcms_c_ucode_wake_override_set() argument
1425 if (wlc_hw->wake_override || (wlc_hw->maccontrol & MCTL_WAKE)) { in brcms_c_ucode_wake_override_set()
1426 mboolset(wlc_hw->wake_override, override_bit); in brcms_c_ucode_wake_override_set()
1430 mboolset(wlc_hw->wake_override, override_bit); in brcms_c_ucode_wake_override_set()
1432 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_wake_override_set()
1433 brcms_b_wait_for_wake(wlc_hw); in brcms_c_ucode_wake_override_set()
1436 void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw, in brcms_c_ucode_wake_override_clear() argument
1439 mboolclr(wlc_hw->wake_override, override_bit); in brcms_c_ucode_wake_override_clear()
1441 if (wlc_hw->wake_override || (wlc_hw->maccontrol & MCTL_WAKE)) in brcms_c_ucode_wake_override_clear()
1444 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_wake_override_clear()
1454 static void brcms_c_ucode_mute_override_set(struct brcms_hardware *wlc_hw) in brcms_c_ucode_mute_override_set() argument
1456 wlc_hw->mute_override = 1; in brcms_c_ucode_mute_override_set()
1461 if ((wlc_hw->maccontrol & (MCTL_AP | MCTL_INFRA)) == MCTL_INFRA) in brcms_c_ucode_mute_override_set()
1464 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_mute_override_set()
1468 static void brcms_c_ucode_mute_override_clear(struct brcms_hardware *wlc_hw) in brcms_c_ucode_mute_override_clear() argument
1470 if (wlc_hw->mute_override == 0) in brcms_c_ucode_mute_override_clear()
1473 wlc_hw->mute_override = 0; in brcms_c_ucode_mute_override_clear()
1478 if ((wlc_hw->maccontrol & (MCTL_AP | MCTL_INFRA)) == MCTL_INFRA) in brcms_c_ucode_mute_override_clear()
1481 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_mute_override_clear()
1488 brcms_b_set_addrmatch(struct brcms_hardware *wlc_hw, int match_reg_offset, in brcms_b_set_addrmatch() argument
1491 struct bcma_device *core = wlc_hw->d11core; in brcms_b_set_addrmatch()
1496 brcms_dbg_rx(core, "wl%d: brcms_b_set_addrmatch\n", wlc_hw->unit); in brcms_b_set_addrmatch()
1511 brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, int offset, int len, in brcms_b_write_template_ram() argument
1514 struct bcma_device *core = wlc_hw->d11core; in brcms_b_write_template_ram()
1519 brcms_dbg_info(core, "wl%d\n", wlc_hw->unit); in brcms_b_write_template_ram()
1547 static void brcms_b_set_cwmin(struct brcms_hardware *wlc_hw, u16 newmin) in brcms_b_set_cwmin() argument
1549 wlc_hw->band->CWmin = newmin; in brcms_b_set_cwmin()
1551 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_set_cwmin()
1553 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_set_cwmin()
1554 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), newmin); in brcms_b_set_cwmin()
1557 static void brcms_b_set_cwmax(struct brcms_hardware *wlc_hw, u16 newmax) in brcms_b_set_cwmax() argument
1559 wlc_hw->band->CWmax = newmax; in brcms_b_set_cwmax()
1561 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_set_cwmax()
1563 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_set_cwmax()
1564 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), newmax); in brcms_b_set_cwmax()
1567 void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw) in brcms_b_bw_set() argument
1572 fastclk = wlc_hw->forcefastclk; in brcms_b_bw_set()
1574 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_bw_set()
1576 wlc_phy_bw_state_set(wlc_hw->band->pi, bw); in brcms_b_bw_set()
1578 brcms_b_phy_reset(wlc_hw); in brcms_b_bw_set()
1579 wlc_phy_init(wlc_hw->band->pi, wlc_phy_chanspec_get(wlc_hw->band->pi)); in brcms_b_bw_set()
1583 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_bw_set()
1586 static void brcms_b_upd_synthpu(struct brcms_hardware *wlc_hw) in brcms_b_upd_synthpu() argument
1589 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_upd_synthpu()
1599 brcms_b_write_shm(wlc_hw, M_SYNTHPU_DLY, v); in brcms_b_upd_synthpu()
1602 static void brcms_c_ucode_txant_set(struct brcms_hardware *wlc_hw) in brcms_c_ucode_txant_set() argument
1605 u16 phytxant = wlc_hw->bmac_phytxant; in brcms_c_ucode_txant_set()
1609 phyctl = brcms_b_read_shm(wlc_hw, M_CTXPRS_BLK + C_CTX_PCTLWD_POS); in brcms_c_ucode_txant_set()
1611 brcms_b_write_shm(wlc_hw, M_CTXPRS_BLK + C_CTX_PCTLWD_POS, phyctl); in brcms_c_ucode_txant_set()
1614 phyctl = brcms_b_read_shm(wlc_hw, M_RSP_PCTLWD); in brcms_c_ucode_txant_set()
1616 brcms_b_write_shm(wlc_hw, M_RSP_PCTLWD, phyctl); in brcms_c_ucode_txant_set()
1619 static u16 brcms_b_ofdm_ratetable_offset(struct brcms_hardware *wlc_hw, in brcms_b_ofdm_ratetable_offset() argument
1650 return 2 * brcms_b_read_shm(wlc_hw, M_RT_DIRMAP_A + (plcp_rate * 2)); in brcms_b_ofdm_ratetable_offset()
1653 static void brcms_upd_ofdm_pctl1_table(struct brcms_hardware *wlc_hw) in brcms_upd_ofdm_pctl1_table() argument
1664 if (!BRCMS_PHY_11N_CAP(wlc_hw->band)) in brcms_upd_ofdm_pctl1_table()
1671 entry_ptr = brcms_b_ofdm_ratetable_offset(wlc_hw, rate); in brcms_upd_ofdm_pctl1_table()
1675 brcms_b_read_shm(wlc_hw, entry_ptr + M_RT_OFDM_PCTL1_POS); in brcms_upd_ofdm_pctl1_table()
1679 pctl1 |= (wlc_hw->hw_stf_ss_opmode << PHY_TXC1_MODE_SHIFT); in brcms_upd_ofdm_pctl1_table()
1682 brcms_b_write_shm(wlc_hw, entry_ptr + M_RT_OFDM_PCTL1_POS, in brcms_upd_ofdm_pctl1_table()
1690 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_bsinit() local
1692 brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: bandunit %d\n", wlc_hw->unit, in brcms_b_bsinit()
1693 wlc_hw->band->bandunit); in brcms_b_bsinit()
1695 brcms_c_ucode_bsinit(wlc_hw); in brcms_b_bsinit()
1697 wlc_phy_init(wlc_hw->band->pi, chanspec); in brcms_b_bsinit()
1699 brcms_c_ucode_txant_set(wlc_hw); in brcms_b_bsinit()
1705 brcms_b_set_cwmin(wlc_hw, wlc_hw->band->CWmin); in brcms_b_bsinit()
1706 brcms_b_set_cwmax(wlc_hw, wlc_hw->band->CWmax); in brcms_b_bsinit()
1708 brcms_b_update_slot_timing(wlc_hw, in brcms_b_bsinit()
1709 wlc_hw->band->bandtype == BRCM_BAND_5G ? in brcms_b_bsinit()
1710 true : wlc_hw->shortslot); in brcms_b_bsinit()
1713 brcms_b_write_shm(wlc_hw, M_PHYTYPE, (u16) wlc_hw->band->phytype); in brcms_b_bsinit()
1714 brcms_b_write_shm(wlc_hw, M_PHYVER, (u16) wlc_hw->band->phyrev); in brcms_b_bsinit()
1720 brcms_upd_ofdm_pctl1_table(wlc_hw); in brcms_b_bsinit()
1722 brcms_b_upd_synthpu(wlc_hw); in brcms_b_bsinit()
1726 void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw) in brcms_b_core_phypll_reset() argument
1728 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_addr), in brcms_b_core_phypll_reset()
1731 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), in brcms_b_core_phypll_reset()
1734 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), in brcms_b_core_phypll_reset()
1737 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), in brcms_b_core_phypll_reset()
1745 void brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk) in brcms_b_phyclk_fgc() argument
1748 if (!BRCMS_ISNPHY(wlc_hw->band)) in brcms_b_phyclk_fgc()
1752 brcms_b_core_ioctl(wlc_hw, SICF_FGC, SICF_FGC); in brcms_b_phyclk_fgc()
1754 brcms_b_core_ioctl(wlc_hw, SICF_FGC, 0); in brcms_b_phyclk_fgc()
1758 void brcms_b_macphyclk_set(struct brcms_hardware *wlc_hw, bool clk) in brcms_b_macphyclk_set() argument
1761 brcms_b_core_ioctl(wlc_hw, SICF_MPCLKE, SICF_MPCLKE); in brcms_b_macphyclk_set()
1763 brcms_b_core_ioctl(wlc_hw, SICF_MPCLKE, 0); in brcms_b_macphyclk_set()
1766 void brcms_b_phy_reset(struct brcms_hardware *wlc_hw) in brcms_b_phy_reset() argument
1768 struct brcms_phy_pub *pih = wlc_hw->band->pi; in brcms_b_phy_reset()
1771 brcms_dbg_info(wlc_hw->d11core, "wl%d: reset phy\n", wlc_hw->unit); in brcms_b_phy_reset()
1776 phy_bw_clkbits = wlc_phy_clk_bwbits(wlc_hw->band->pi); in brcms_b_phy_reset()
1779 if (BRCMS_ISNPHY(wlc_hw->band) && NREV_GE(wlc_hw->band->phyrev, 3) && in brcms_b_phy_reset()
1780 NREV_LE(wlc_hw->band->phyrev, 4)) { in brcms_b_phy_reset()
1782 brcms_b_core_ioctl(wlc_hw, SICF_BWMASK, phy_bw_clkbits); in brcms_b_phy_reset()
1787 brcms_b_core_phypll_reset(wlc_hw); in brcms_b_phy_reset()
1790 brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_PCLKE), in brcms_b_phy_reset()
1793 brcms_b_core_ioctl(wlc_hw, in brcms_b_phy_reset()
1799 brcms_b_core_phy_clk(wlc_hw, ON); in brcms_b_phy_reset()
1805 static void brcms_b_setband(struct brcms_hardware *wlc_hw, uint bandunit, in brcms_b_setband() argument
1807 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_setband()
1811 if (!bcma_core_is_enabled(wlc_hw->d11core)) { in brcms_b_setband()
1812 bcma_core_enable(wlc_hw->d11core, 0); in brcms_b_setband()
1813 brcms_c_mctrl_reset(wlc_hw); in brcms_b_setband()
1818 if (!wlc_hw->up) in brcms_b_setband()
1821 brcms_b_core_phy_clk(wlc_hw, ON); in brcms_b_setband()
1838 WARN_ON((bcma_read32(wlc_hw->d11core, D11REGOFFS(maccontrol)) & in brcms_b_setband()
1842 static bool brcms_c_isgoodchip(struct brcms_hardware *wlc_hw) in brcms_c_isgoodchip() argument
1846 if (!CONF_HAS(D11CONF, wlc_hw->corerev)) { in brcms_c_isgoodchip()
1847 wiphy_err(wlc_hw->wlc->wiphy, "unsupported core rev %d\n", in brcms_c_isgoodchip()
1848 wlc_hw->corerev); in brcms_c_isgoodchip()
1856 static bool brcms_c_validboardtype(struct brcms_hardware *wlc_hw) in brcms_c_validboardtype() argument
1858 uint boardrev = wlc_hw->boardrev; in brcms_c_validboardtype()
1867 if (ai_get_boardvendor(wlc_hw->sih) != PCI_VENDOR_ID_BROADCOM) in brcms_c_validboardtype()
1884 static void brcms_c_get_macaddr(struct brcms_hardware *wlc_hw, u8 etheraddr[ETH_ALEN]) in brcms_c_get_macaddr() argument
1886 struct ssb_sprom *sprom = &wlc_hw->d11core->bus->sprom; in brcms_c_get_macaddr()
1894 if (wlc_hw->_nbands > 1) in brcms_c_get_macaddr()
1901 static void brcms_b_xtal(struct brcms_hardware *wlc_hw, bool want) in brcms_b_xtal() argument
1903 brcms_dbg_info(wlc_hw->d11core, "wl%d: want %d\n", wlc_hw->unit, want); in brcms_b_xtal()
1909 if (!want && wlc_hw->pllreq) in brcms_b_xtal()
1912 wlc_hw->sbclk = want; in brcms_b_xtal()
1913 if (!wlc_hw->sbclk) { in brcms_b_xtal()
1914 wlc_hw->clk = false; in brcms_b_xtal()
1915 if (wlc_hw->band && wlc_hw->band->pi) in brcms_b_xtal()
1916 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); in brcms_b_xtal()
1926 static bool brcms_b_radio_read_hwdisabled(struct brcms_hardware *wlc_hw) in brcms_b_radio_read_hwdisabled() argument
1931 xtal = wlc_hw->sbclk; in brcms_b_radio_read_hwdisabled()
1933 brcms_b_xtal(wlc_hw, ON); in brcms_b_radio_read_hwdisabled()
1936 clk = wlc_hw->clk; in brcms_b_radio_read_hwdisabled()
1943 if (D11REV_GE(wlc_hw->corerev, 18)) in brcms_b_radio_read_hwdisabled()
1953 bcma_core_enable(wlc_hw->d11core, flags); in brcms_b_radio_read_hwdisabled()
1954 brcms_c_mctrl_reset(wlc_hw); in brcms_b_radio_read_hwdisabled()
1957 v = ((bcma_read32(wlc_hw->d11core, in brcms_b_radio_read_hwdisabled()
1962 bcma_core_disable(wlc_hw->d11core, 0); in brcms_b_radio_read_hwdisabled()
1965 brcms_b_xtal(wlc_hw, OFF); in brcms_b_radio_read_hwdisabled()
1970 static bool wlc_dma_rxreset(struct brcms_hardware *wlc_hw, uint fifo) in wlc_dma_rxreset() argument
1972 struct dma_pub *di = wlc_hw->di[fifo]; in wlc_dma_rxreset()
1984 void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags) in brcms_b_corereset() argument
1990 flags = (wlc_hw->band->pi ? wlc_hw->band->core_flags : 0); in brcms_b_corereset()
1992 brcms_dbg_info(wlc_hw->d11core, "wl%d: core reset\n", wlc_hw->unit); in brcms_b_corereset()
1995 fastclk = wlc_hw->forcefastclk; in brcms_b_corereset()
1997 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_corereset()
2000 if (bcma_core_is_enabled(wlc_hw->d11core)) { in brcms_b_corereset()
2002 if ((wlc_hw->di[i]) && (!dma_txreset(wlc_hw->di[i]))) in brcms_b_corereset()
2003 brcms_err(wlc_hw->d11core, "wl%d: %s: " in brcms_b_corereset()
2005 wlc_hw->unit, __func__, i); in brcms_b_corereset()
2007 if ((wlc_hw->di[RX_FIFO]) in brcms_b_corereset()
2008 && (!wlc_dma_rxreset(wlc_hw, RX_FIFO))) in brcms_b_corereset()
2009 brcms_err(wlc_hw->d11core, "wl%d: %s: dma_rxreset" in brcms_b_corereset()
2011 wlc_hw->unit, __func__, RX_FIFO); in brcms_b_corereset()
2014 if (wlc_hw->noreset) { in brcms_b_corereset()
2015 wlc_hw->wlc->macintstatus = 0; /* skip wl_dpc after down */ in brcms_b_corereset()
2016 brcms_b_mctrl(wlc_hw, MCTL_PSM_RUN | MCTL_EN_MAC, 0); in brcms_b_corereset()
2025 if (D11REV_GE(wlc_hw->corerev, 18)) in brcms_b_corereset()
2038 wlc_hw->clk = false; in brcms_b_corereset()
2039 bcma_core_enable(wlc_hw->d11core, flags); in brcms_b_corereset()
2040 wlc_hw->clk = true; in brcms_b_corereset()
2041 if (wlc_hw->band && wlc_hw->band->pi) in brcms_b_corereset()
2042 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, true); in brcms_b_corereset()
2044 brcms_c_mctrl_reset(wlc_hw); in brcms_b_corereset()
2046 if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU) in brcms_b_corereset()
2047 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_corereset()
2049 brcms_b_phy_reset(wlc_hw); in brcms_b_corereset()
2052 brcms_b_core_phypll_ctl(wlc_hw, true); in brcms_b_corereset()
2055 wlc_hw->wlc->macintstatus = 0; in brcms_b_corereset()
2059 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_corereset()
2065 static void brcms_b_corerev_fifofixup(struct brcms_hardware *wlc_hw) in brcms_b_corerev_fifofixup() argument
2067 struct bcma_device *core = wlc_hw->d11core; in brcms_b_corerev_fifofixup()
2079 txfifo_endblk = txfifo_startblk + wlc_hw->xmtfifo_sz[fifo_nu]; in brcms_b_corerev_fifofixup()
2094 txfifo_startblk += wlc_hw->xmtfifo_sz[fifo_nu]; in brcms_b_corerev_fifofixup()
2100 brcms_b_write_shm(wlc_hw, M_FIFOSIZE0, in brcms_b_corerev_fifofixup()
2101 wlc_hw->xmtfifo_sz[TX_AC_BE_FIFO]); in brcms_b_corerev_fifofixup()
2102 brcms_b_write_shm(wlc_hw, M_FIFOSIZE1, in brcms_b_corerev_fifofixup()
2103 wlc_hw->xmtfifo_sz[TX_AC_VI_FIFO]); in brcms_b_corerev_fifofixup()
2104 brcms_b_write_shm(wlc_hw, M_FIFOSIZE2, in brcms_b_corerev_fifofixup()
2105 ((wlc_hw->xmtfifo_sz[TX_AC_VO_FIFO] << 8) | wlc_hw-> in brcms_b_corerev_fifofixup()
2107 brcms_b_write_shm(wlc_hw, M_FIFOSIZE3, in brcms_b_corerev_fifofixup()
2108 ((wlc_hw->xmtfifo_sz[TX_ATIM_FIFO] << 8) | wlc_hw-> in brcms_b_corerev_fifofixup()
2125 void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode) in brcms_b_switch_macfreq() argument
2127 struct bcma_device *core = wlc_hw->d11core; in brcms_b_switch_macfreq()
2129 if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43224) || in brcms_b_switch_macfreq()
2130 (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225)) { in brcms_b_switch_macfreq()
2141 } else if (BRCMS_ISLCNPHY(wlc_hw->band)) { in brcms_b_switch_macfreq()
2181 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_gpio_init() local
2185 brcms_b_mctrl(wlc_hw, MCTL_GPOUT_SEL_MASK, 0); in brcms_c_gpio_init()
2198 if (wlc_hw->antsel_type == ANTSEL_2x3) { in brcms_c_gpio_init()
2200 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN, in brcms_c_gpio_init()
2202 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE, in brcms_c_gpio_init()
2206 wlc_phy_antsel_init(wlc_hw->band->pi, false); in brcms_c_gpio_init()
2208 } else if (wlc_hw->antsel_type == ANTSEL_2x4) { in brcms_c_gpio_init()
2214 bcma_set16(wlc_hw->d11core, D11REGOFFS(psm_gpio_oe), in brcms_c_gpio_init()
2216 bcma_set16(wlc_hw->d11core, D11REGOFFS(psm_gpio_out), in brcms_c_gpio_init()
2220 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN, in brcms_c_gpio_init()
2222 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE, 0, in brcms_c_gpio_init()
2226 brcms_b_write_shm(wlc_hw, M_ANTSEL_CLKDIV, in brcms_c_gpio_init()
2234 if (wlc_hw->boardflags & BFL_PACTRL) in brcms_c_gpio_init()
2238 bcma_chipco_gpio_control(&wlc_hw->d11core->bus->drv_cc, gm, gc); in brcms_c_gpio_init()
2241 static void brcms_ucode_write(struct brcms_hardware *wlc_hw, in brcms_ucode_write() argument
2244 struct bcma_device *core = wlc_hw->d11core; in brcms_ucode_write()
2248 brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_ucode_write()
2260 static void brcms_ucode_download(struct brcms_hardware *wlc_hw) in brcms_ucode_download() argument
2262 struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; in brcms_ucode_download()
2264 if (wlc_hw->ucode_loaded) in brcms_ucode_download()
2267 if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { in brcms_ucode_download()
2268 if (BRCMS_ISNPHY(wlc_hw->band)) { in brcms_ucode_download()
2269 brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo, in brcms_ucode_download()
2271 wlc_hw->ucode_loaded = true; in brcms_ucode_download()
2273 brcms_err(wlc_hw->d11core, in brcms_ucode_download()
2275 __func__, wlc_hw->unit, wlc_hw->corerev); in brcms_ucode_download()
2276 } else if (D11REV_IS(wlc_hw->corerev, 24)) { in brcms_ucode_download()
2277 if (BRCMS_ISLCNPHY(wlc_hw->band)) { in brcms_ucode_download()
2278 brcms_ucode_write(wlc_hw, ucode->bcm43xx_24_lcn, in brcms_ucode_download()
2280 wlc_hw->ucode_loaded = true; in brcms_ucode_download()
2282 brcms_err(wlc_hw->d11core, in brcms_ucode_download()
2284 __func__, wlc_hw->unit, wlc_hw->corerev); in brcms_ucode_download()
2289 void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant) in brcms_b_txant_set() argument
2292 wlc_hw->bmac_phytxant = phytxant; in brcms_b_txant_set()
2295 if (!wlc_hw->up) in brcms_b_txant_set()
2297 brcms_c_ucode_txant_set(wlc_hw); in brcms_b_txant_set()
2301 u16 brcms_b_get_txant(struct brcms_hardware *wlc_hw) in brcms_b_get_txant() argument
2303 return (u16) wlc_hw->wlc->stf->txant; in brcms_b_get_txant()
2306 void brcms_b_antsel_type_set(struct brcms_hardware *wlc_hw, u8 antsel_type) in brcms_b_antsel_type_set() argument
2308 wlc_hw->antsel_type = antsel_type; in brcms_b_antsel_type_set()
2311 wlc_phy_antsel_type_set(wlc_hw->band->pi, antsel_type); in brcms_b_antsel_type_set()
2314 static void brcms_b_fifoerrors(struct brcms_hardware *wlc_hw) in brcms_b_fifoerrors() argument
2319 struct bcma_device *core = wlc_hw->d11core; in brcms_b_fifoerrors()
2321 unit = wlc_hw->unit; in brcms_b_fifoerrors()
2370 brcms_fatal_error(wlc_hw->wlc->wl); /* big hammer */ in brcms_b_fifoerrors()
2381 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_intrson() local
2383 bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), wlc->macintmask); in brcms_c_intrson()
2388 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_intrsoff() local
2391 if (!wlc_hw->clk) in brcms_c_intrsoff()
2396 bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), 0); in brcms_c_intrsoff()
2397 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(macintmask)); in brcms_c_intrsoff()
2407 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_intrsrestore() local
2408 if (!wlc_hw->clk) in brcms_c_intrsrestore()
2412 bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), wlc->macintmask); in brcms_c_intrsrestore()
2416 static void brcms_b_tx_fifo_suspend(struct brcms_hardware *wlc_hw, in brcms_b_tx_fifo_suspend() argument
2424 if ((wlc_hw->suspended_fifos & fifo) == fifo) in brcms_b_tx_fifo_suspend()
2428 if (wlc_hw->suspended_fifos == 0) in brcms_b_tx_fifo_suspend()
2429 brcms_c_ucode_wake_override_set(wlc_hw, in brcms_b_tx_fifo_suspend()
2432 wlc_hw->suspended_fifos |= fifo; in brcms_b_tx_fifo_suspend()
2434 if (wlc_hw->di[tx_fifo]) { in brcms_b_tx_fifo_suspend()
2440 if (BRCMS_PHY_11N_CAP(wlc_hw->band)) in brcms_b_tx_fifo_suspend()
2441 brcms_c_suspend_mac_and_wait(wlc_hw->wlc); in brcms_b_tx_fifo_suspend()
2443 dma_txsuspend(wlc_hw->di[tx_fifo]); in brcms_b_tx_fifo_suspend()
2445 if (BRCMS_PHY_11N_CAP(wlc_hw->band)) in brcms_b_tx_fifo_suspend()
2446 brcms_c_enable_mac(wlc_hw->wlc); in brcms_b_tx_fifo_suspend()
2450 static void brcms_b_tx_fifo_resume(struct brcms_hardware *wlc_hw, in brcms_b_tx_fifo_resume() argument
2458 if (wlc_hw->di[tx_fifo]) in brcms_b_tx_fifo_resume()
2459 dma_txresume(wlc_hw->di[tx_fifo]); in brcms_b_tx_fifo_resume()
2462 if (wlc_hw->suspended_fifos == 0) in brcms_b_tx_fifo_resume()
2465 wlc_hw->suspended_fifos &= ~(1 << tx_fifo); in brcms_b_tx_fifo_resume()
2466 if (wlc_hw->suspended_fifos == 0) in brcms_b_tx_fifo_resume()
2467 brcms_c_ucode_wake_override_clear(wlc_hw, in brcms_b_tx_fifo_resume()
2473 static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool mute_tx) in brcms_b_mute() argument
2476 u8 *ethaddr = wlc_hw->wlc->pub->cur_etheraddr; in brcms_b_mute()
2480 brcms_b_tx_fifo_suspend(wlc_hw, TX_DATA_FIFO); in brcms_b_mute()
2481 brcms_b_tx_fifo_suspend(wlc_hw, TX_CTL_FIFO); in brcms_b_mute()
2482 brcms_b_tx_fifo_suspend(wlc_hw, TX_AC_BK_FIFO); in brcms_b_mute()
2483 brcms_b_tx_fifo_suspend(wlc_hw, TX_AC_VI_FIFO); in brcms_b_mute()
2486 brcms_b_set_addrmatch(wlc_hw, RCM_MAC_OFFSET, null_ether_addr); in brcms_b_mute()
2489 brcms_b_tx_fifo_resume(wlc_hw, TX_DATA_FIFO); in brcms_b_mute()
2490 brcms_b_tx_fifo_resume(wlc_hw, TX_CTL_FIFO); in brcms_b_mute()
2491 brcms_b_tx_fifo_resume(wlc_hw, TX_AC_BK_FIFO); in brcms_b_mute()
2492 brcms_b_tx_fifo_resume(wlc_hw, TX_AC_VI_FIFO); in brcms_b_mute()
2495 brcms_b_set_addrmatch(wlc_hw, RCM_MAC_OFFSET, ethaddr); in brcms_b_mute()
2498 wlc_phy_mute_upd(wlc_hw->band->pi, mute_tx, 0); in brcms_b_mute()
2501 brcms_c_ucode_mute_override_set(wlc_hw); in brcms_b_mute()
2503 brcms_c_ucode_mute_override_clear(wlc_hw); in brcms_b_mute()
2522 struct brcms_hardware *wlc_hw = wlc->hw; in wlc_intstatus() local
2523 struct bcma_device *core = wlc_hw->d11core; in wlc_intstatus()
2597 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_isr() local
2600 if (!wlc_hw->up || !wlc->macintmask) in brcms_c_isr()
2607 brcms_err(wlc_hw->d11core, in brcms_c_isr()
2625 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_suspend_mac_and_wait() local
2626 struct bcma_device *core = wlc_hw->d11core; in brcms_c_suspend_mac_and_wait()
2629 brcms_dbg_mac80211(core, "wl%d: bandunit %d\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2630 wlc_hw->band->bandunit); in brcms_c_suspend_mac_and_wait()
2635 wlc_hw->mac_suspend_depth++; in brcms_c_suspend_mac_and_wait()
2636 if (wlc_hw->mac_suspend_depth > 1) in brcms_c_suspend_mac_and_wait()
2640 brcms_c_ucode_wake_override_set(wlc_hw, BRCMS_WAKE_OVERRIDE_MACSUSPEND); in brcms_c_suspend_mac_and_wait()
2645 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2656 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2663 brcms_b_mctrl(wlc_hw, MCTL_EN_MAC, 0); in brcms_c_suspend_mac_and_wait()
2671 wlc_hw->unit, BRCMS_MAX_MAC_SUSPEND); in brcms_c_suspend_mac_and_wait()
2673 "psm_brc 0x%04x\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2681 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2693 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_enable_mac() local
2694 struct bcma_device *core = wlc_hw->d11core; in brcms_c_enable_mac()
2697 brcms_dbg_mac80211(core, "wl%d: bandunit %d\n", wlc_hw->unit, in brcms_c_enable_mac()
2703 wlc_hw->mac_suspend_depth--; in brcms_c_enable_mac()
2704 if (wlc_hw->mac_suspend_depth > 0) in brcms_c_enable_mac()
2712 brcms_b_mctrl(wlc_hw, MCTL_EN_MAC, MCTL_EN_MAC); in brcms_c_enable_mac()
2723 brcms_c_ucode_wake_override_clear(wlc_hw, in brcms_c_enable_mac()
2727 void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw, u8 stf_mode) in brcms_b_band_stf_ss_set() argument
2729 wlc_hw->hw_stf_ss_opmode = stf_mode; in brcms_b_band_stf_ss_set()
2731 if (wlc_hw->clk) in brcms_b_band_stf_ss_set()
2732 brcms_upd_ofdm_pctl1_table(wlc_hw); in brcms_b_band_stf_ss_set()
2735 static bool brcms_b_validate_chip_access(struct brcms_hardware *wlc_hw) in brcms_b_validate_chip_access() argument
2737 struct bcma_device *core = wlc_hw->d11core; in brcms_b_validate_chip_access()
2739 struct wiphy *wiphy = wlc_hw->wlc->wiphy; in brcms_b_validate_chip_access()
2757 "expected 0xaa5555aa\n", wlc_hw->unit, val); in brcms_b_validate_chip_access()
2770 "expected 0x55aaaa55\n", wlc_hw->unit, val); in brcms_b_validate_chip_access()
2785 "0x%x, expected 0x%x or 0x%x\n", wlc_hw->unit, w, in brcms_b_validate_chip_access()
2796 void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on) in brcms_b_core_phypll_ctl() argument
2798 struct bcma_device *core = wlc_hw->d11core; in brcms_b_core_phypll_ctl()
2801 brcms_dbg_info(core, "wl%d\n", wlc_hw->unit); in brcms_b_core_phypll_ctl()
2806 if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) { in brcms_b_core_phypll_ctl()
2849 static void brcms_c_coredisable(struct brcms_hardware *wlc_hw) in brcms_c_coredisable() argument
2853 brcms_dbg_info(wlc_hw->d11core, "wl%d: disable core\n", wlc_hw->unit); in brcms_c_coredisable()
2855 dev_gone = brcms_deviceremoved(wlc_hw->wlc); in brcms_c_coredisable()
2860 if (wlc_hw->noreset) in brcms_c_coredisable()
2864 wlc_phy_switch_radio(wlc_hw->band->pi, OFF); in brcms_c_coredisable()
2867 wlc_phy_anacore(wlc_hw->band->pi, OFF); in brcms_c_coredisable()
2870 brcms_b_core_phypll_ctl(wlc_hw, false); in brcms_c_coredisable()
2872 wlc_hw->clk = false; in brcms_c_coredisable()
2873 bcma_core_disable(wlc_hw->d11core, 0); in brcms_c_coredisable()
2874 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); in brcms_c_coredisable()
2879 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_flushqueues() local
2884 if (wlc_hw->di[i]) { in brcms_c_flushqueues()
2885 dma_txreclaim(wlc_hw->di[i], DMA_RANGE_ALL); in brcms_c_flushqueues()
2893 dma_rxreclaim(wlc_hw->di[RX_FIFO]); in brcms_c_flushqueues()
2897 brcms_b_read_objmem(struct brcms_hardware *wlc_hw, uint offset, u32 sel) in brcms_b_read_objmem() argument
2899 struct bcma_device *core = wlc_hw->d11core; in brcms_b_read_objmem()
2911 brcms_b_write_objmem(struct brcms_hardware *wlc_hw, uint offset, u16 v, in brcms_b_write_objmem() argument
2914 struct bcma_device *core = wlc_hw->d11core; in brcms_b_write_objmem()
2929 u16 brcms_b_read_shm(struct brcms_hardware *wlc_hw, uint offset) in brcms_b_read_shm() argument
2931 return brcms_b_read_objmem(wlc_hw, offset, OBJADDR_SHM_SEL); in brcms_b_read_shm()
2938 void brcms_b_write_shm(struct brcms_hardware *wlc_hw, uint offset, u16 v) in brcms_b_write_shm() argument
2940 brcms_b_write_objmem(wlc_hw, offset, v, OBJADDR_SHM_SEL); in brcms_b_write_shm()
2950 brcms_b_copyto_objmem(struct brcms_hardware *wlc_hw, uint offset, in brcms_b_copyto_objmem() argument
2962 brcms_b_write_objmem(wlc_hw, offset + i, v, sel); in brcms_b_copyto_objmem()
2973 brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset, void *buf, in brcms_b_copyfrom_objmem() argument
2984 v = brcms_b_read_objmem(wlc_hw, offset + i, sel); in brcms_b_copyfrom_objmem()
3000 static void brcms_b_retrylimit_upd(struct brcms_hardware *wlc_hw, in brcms_b_retrylimit_upd() argument
3003 wlc_hw->SRL = SRL; in brcms_b_retrylimit_upd()
3004 wlc_hw->LRL = LRL; in brcms_b_retrylimit_upd()
3007 if (wlc_hw->up) { in brcms_b_retrylimit_upd()
3008 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_retrylimit_upd()
3010 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_retrylimit_upd()
3011 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), wlc_hw->SRL); in brcms_b_retrylimit_upd()
3012 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_retrylimit_upd()
3014 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_retrylimit_upd()
3015 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), wlc_hw->LRL); in brcms_b_retrylimit_upd()
3019 static void brcms_b_pllreq(struct brcms_hardware *wlc_hw, bool set, u32 req_bit) in brcms_b_pllreq() argument
3022 if (mboolisset(wlc_hw->pllreq, req_bit)) in brcms_b_pllreq()
3025 mboolset(wlc_hw->pllreq, req_bit); in brcms_b_pllreq()
3027 if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) { in brcms_b_pllreq()
3028 if (!wlc_hw->sbclk) in brcms_b_pllreq()
3029 brcms_b_xtal(wlc_hw, ON); in brcms_b_pllreq()
3032 if (!mboolisset(wlc_hw->pllreq, req_bit)) in brcms_b_pllreq()
3035 mboolclr(wlc_hw->pllreq, req_bit); in brcms_b_pllreq()
3037 if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) { in brcms_b_pllreq()
3038 if (wlc_hw->sbclk) in brcms_b_pllreq()
3039 brcms_b_xtal(wlc_hw, OFF); in brcms_b_pllreq()
3044 static void brcms_b_antsel_set(struct brcms_hardware *wlc_hw, u32 antsel_avail) in brcms_b_antsel_set() argument
3046 wlc_hw->antsel_avail = antsel_avail; in brcms_b_antsel_set()
3112 static void brcms_b_reset(struct brcms_hardware *wlc_hw) in brcms_b_reset() argument
3115 if (!brcms_deviceremoved(wlc_hw->wlc)) in brcms_b_reset()
3116 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); in brcms_b_reset()
3119 brcms_c_flushqueues(wlc_hw->wlc); in brcms_b_reset()
3158 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_coreinit() local
3159 struct bcma_device *core = wlc_hw->d11core; in brcms_b_coreinit()
3165 struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; in brcms_b_coreinit()
3167 brcms_dbg_info(core, "wl%d: core init\n", wlc_hw->unit); in brcms_b_coreinit()
3170 brcms_b_mctrl(wlc_hw, ~0, (MCTL_IHR_EN | MCTL_PSM_JMP_0 | MCTL_WAKE)); in brcms_b_coreinit()
3172 brcms_ucode_download(wlc_hw); in brcms_b_coreinit()
3180 brcms_b_mctrl(wlc_hw, ~0, in brcms_b_coreinit()
3188 "suspend!\n", wlc_hw->unit); in brcms_b_coreinit()
3194 if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { in brcms_b_coreinit()
3195 if (BRCMS_ISNPHY(wlc_hw->band)) in brcms_b_coreinit()
3196 brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16); in brcms_b_coreinit()
3199 " %d\n", __func__, wlc_hw->unit, in brcms_b_coreinit()
3200 wlc_hw->corerev); in brcms_b_coreinit()
3201 } else if (D11REV_IS(wlc_hw->corerev, 24)) { in brcms_b_coreinit()
3202 if (BRCMS_ISLCNPHY(wlc_hw->band)) in brcms_b_coreinit()
3203 brcms_c_write_inits(wlc_hw, ucode->d11lcn0initvals24); in brcms_b_coreinit()
3206 " %d\n", __func__, wlc_hw->unit, in brcms_b_coreinit()
3207 wlc_hw->corerev); in brcms_b_coreinit()
3210 __func__, wlc_hw->unit, wlc_hw->corerev); in brcms_b_coreinit()
3215 brcms_b_corerev_fifofixup(wlc_hw); in brcms_b_coreinit()
3218 buf[TX_AC_BE_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE0); in brcms_b_coreinit()
3219 if (buf[TX_AC_BE_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_BE_FIFO]) { in brcms_b_coreinit()
3223 buf[TX_AC_VI_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE1); in brcms_b_coreinit()
3224 if (buf[TX_AC_VI_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_VI_FIFO]) { in brcms_b_coreinit()
3228 buf[TX_AC_BK_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE2); in brcms_b_coreinit()
3231 if (buf[TX_AC_BK_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_BK_FIFO]) { in brcms_b_coreinit()
3235 if (buf[TX_AC_VO_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_VO_FIFO]) { in brcms_b_coreinit()
3239 buf[TX_BCMC_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE3); in brcms_b_coreinit()
3242 if (buf[TX_BCMC_FIFO] != wlc_hw->xmtfifo_sz[TX_BCMC_FIFO]) { in brcms_b_coreinit()
3246 if (buf[TX_ATIM_FIFO] != wlc_hw->xmtfifo_sz[TX_ATIM_FIFO]) { in brcms_b_coreinit()
3253 wlc_hw->xmtfifo_sz[i], i); in brcms_b_coreinit()
3261 brcms_b_write_shm(wlc_hw, M_MBURST_SIZE, MAXTXFRAMEBURST); in brcms_b_coreinit()
3262 brcms_b_write_shm(wlc_hw, M_MAX_ANTCNT, ANTCNT); in brcms_b_coreinit()
3268 brcms_b_mctrl(wlc_hw, in brcms_b_coreinit()
3284 brcms_b_macphyclk_set(wlc_hw, ON); in brcms_b_coreinit()
3287 wlc->fastpwrup_dly = ai_clkctl_fast_pwrup_delay(wlc_hw->sih); in brcms_b_coreinit()
3291 brcms_b_write_shm(wlc_hw, M_MACHW_VER, (u16) wlc_hw->corerev); in brcms_b_coreinit()
3294 brcms_b_write_shm(wlc_hw, M_MACHW_CAP_L, in brcms_b_coreinit()
3295 (u16) (wlc_hw->machwcap & 0xffff)); in brcms_b_coreinit()
3296 brcms_b_write_shm(wlc_hw, M_MACHW_CAP_H, in brcms_b_coreinit()
3297 (u16) ((wlc_hw-> in brcms_b_coreinit()
3304 bcma_write32(core, D11REGOFFS(objdata), wlc_hw->SRL); in brcms_b_coreinit()
3308 bcma_write32(core, D11REGOFFS(objdata), wlc_hw->LRL); in brcms_b_coreinit()
3311 brcms_b_write_shm(wlc_hw, M_SFRMTXCNTFBRTHSD, wlc_hw->SFBL); in brcms_b_coreinit()
3312 brcms_b_write_shm(wlc_hw, M_LFRMTXCNTFBRTHSD, wlc_hw->LFBL); in brcms_b_coreinit()
3319 if (wlc_hw->di[i]) in brcms_b_coreinit()
3320 dma_txinit(wlc_hw->di[i]); in brcms_b_coreinit()
3324 dma_rxinit(wlc_hw->di[RX_FIFO]); in brcms_b_coreinit()
3325 dma_rxfill(wlc_hw->di[RX_FIFO]); in brcms_b_coreinit()
3328 static void brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec) in brcms_b_init() argument
3332 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_init()
3335 fastclk = wlc_hw->forcefastclk; in brcms_b_init()
3337 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_init()
3343 brcms_c_setxband(wlc_hw, chspec_bandunit(chanspec)); in brcms_b_init()
3344 wlc_phy_chanspec_radio_set(wlc_hw->band->pi, chanspec); in brcms_b_init()
3347 wlc_phy_cal_init(wlc_hw->band->pi); in brcms_b_init()
3361 mboolset(wlc_hw->wake_override, BRCMS_WAKE_OVERRIDE_MACSUSPEND); in brcms_b_init()
3367 wlc_hw->mac_suspend_depth = 1; in brcms_b_init()
3371 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_init()
3782 static void brcms_b_set_shortslot(struct brcms_hardware *wlc_hw, bool shortslot) in brcms_b_set_shortslot() argument
3784 wlc_hw->shortslot = shortslot; in brcms_b_set_shortslot()
3786 if (wlc_hw->band->bandtype == BRCM_BAND_2G && wlc_hw->up) { in brcms_b_set_shortslot()
3787 brcms_c_suspend_mac_and_wait(wlc_hw->wlc); in brcms_b_set_shortslot()
3788 brcms_b_update_slot_timing(wlc_hw, shortslot); in brcms_b_set_shortslot()
3789 brcms_c_enable_mac(wlc_hw->wlc); in brcms_b_set_shortslot()
3822 brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec, in brcms_b_set_chanspec() argument
3827 brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: 0x%x\n", wlc_hw->unit, in brcms_b_set_chanspec()
3830 wlc_hw->chanspec = chanspec; in brcms_b_set_chanspec()
3833 if (wlc_hw->_nbands > 1) { in brcms_b_set_chanspec()
3835 if (wlc_hw->band->bandunit != bandunit) { in brcms_b_set_chanspec()
3839 if (wlc_hw->up) { in brcms_b_set_chanspec()
3840 wlc_phy_chanspec_radio_set(wlc_hw-> in brcms_b_set_chanspec()
3843 brcms_b_setband(wlc_hw, bandunit, chanspec); in brcms_b_set_chanspec()
3845 brcms_c_setxband(wlc_hw, bandunit); in brcms_b_set_chanspec()
3850 wlc_phy_initcal_enable(wlc_hw->band->pi, !mute_tx); in brcms_b_set_chanspec()
3852 if (!wlc_hw->up) { in brcms_b_set_chanspec()
3853 if (wlc_hw->clk) in brcms_b_set_chanspec()
3854 wlc_phy_txpower_limit_set(wlc_hw->band->pi, txpwr, in brcms_b_set_chanspec()
3856 wlc_phy_chanspec_radio_set(wlc_hw->band->pi, chanspec); in brcms_b_set_chanspec()
3858 wlc_phy_chanspec_set(wlc_hw->band->pi, chanspec); in brcms_b_set_chanspec()
3859 wlc_phy_txpower_limit_set(wlc_hw->band->pi, txpwr, chanspec); in brcms_b_set_chanspec()
3862 brcms_b_mute(wlc_hw, mute_tx); in brcms_b_set_chanspec()
4189 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_watchdog() local
4191 if (!wlc_hw->up) in brcms_b_watchdog()
4195 wlc_hw->now++; in brcms_b_watchdog()
4198 brcms_b_fifoerrors(wlc_hw); in brcms_b_watchdog()
4203 wlc_phy_watchdog(wlc_hw->band->pi); in brcms_b_watchdog()
4377 struct brcms_hardware *wlc_hw; in brcms_b_attach() local
4397 wlc_hw = wlc->hw; in brcms_b_attach()
4398 wlc_hw->wlc = wlc; in brcms_b_attach()
4399 wlc_hw->unit = unit; in brcms_b_attach()
4400 wlc_hw->band = wlc_hw->bandstate[0]; in brcms_b_attach()
4401 wlc_hw->_piomode = piomode; in brcms_b_attach()
4404 brcms_b_info_init(wlc_hw); in brcms_b_attach()
4410 wlc_hw->sih = ai_attach(core->bus); in brcms_b_attach()
4411 if (wlc_hw->sih == NULL) { in brcms_b_attach()
4427 wlc_hw->vendorid = pcidev->vendor; in brcms_b_attach()
4428 wlc_hw->deviceid = pcidev->device; in brcms_b_attach()
4430 wlc_hw->vendorid = core->bus->boardinfo.vendor; in brcms_b_attach()
4431 wlc_hw->deviceid = core->bus->boardinfo.type; in brcms_b_attach()
4434 wlc_hw->d11core = core; in brcms_b_attach()
4435 wlc_hw->corerev = core->id.rev; in brcms_b_attach()
4438 if (!brcms_c_isgoodchip(wlc_hw)) { in brcms_b_attach()
4444 ai_clkctl_init(wlc_hw->sih); in brcms_b_attach()
4452 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_attach()
4453 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); in brcms_b_attach()
4455 if (!brcms_b_validate_chip_access(wlc_hw)) { in brcms_b_attach()
4467 wlc_hw->boardrev = (u16) j; in brcms_b_attach()
4468 if (!brcms_c_validboardtype(wlc_hw)) { in brcms_b_attach()
4471 unit, ai_get_boardtype(wlc_hw->sih), in brcms_b_attach()
4472 wlc_hw->boardrev); in brcms_b_attach()
4476 wlc_hw->sromrev = sprom->revision; in brcms_b_attach()
4477 wlc_hw->boardflags = sprom->boardflags_lo + (sprom->boardflags_hi << 16); in brcms_b_attach()
4478 wlc_hw->boardflags2 = sprom->boardflags2_lo + (sprom->boardflags2_hi << 16); in brcms_b_attach()
4480 if (wlc_hw->boardflags & BFL_NOPLLDOWN) in brcms_b_attach()
4481 brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED); in brcms_b_attach()
4484 if (wlc_hw->deviceid == BCM43224_D11N_ID || in brcms_b_attach()
4485 wlc_hw->deviceid == BCM43224_D11N_ID_VEN1 || in brcms_b_attach()
4486 wlc_hw->deviceid == BCM43224_CHIP_ID) in brcms_b_attach()
4488 wlc_hw->_nbands = 2; in brcms_b_attach()
4490 wlc_hw->_nbands = 1; in brcms_b_attach()
4492 if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225)) in brcms_b_attach()
4493 wlc_hw->_nbands = 1; in brcms_b_attach()
4498 wlc->vendorid = wlc_hw->vendorid; in brcms_b_attach()
4499 wlc->deviceid = wlc_hw->deviceid; in brcms_b_attach()
4500 wlc->pub->sih = wlc_hw->sih; in brcms_b_attach()
4501 wlc->pub->corerev = wlc_hw->corerev; in brcms_b_attach()
4502 wlc->pub->sromrev = wlc_hw->sromrev; in brcms_b_attach()
4503 wlc->pub->boardrev = wlc_hw->boardrev; in brcms_b_attach()
4504 wlc->pub->boardflags = wlc_hw->boardflags; in brcms_b_attach()
4505 wlc->pub->boardflags2 = wlc_hw->boardflags2; in brcms_b_attach()
4506 wlc->pub->_nbands = wlc_hw->_nbands; in brcms_b_attach()
4508 wlc_hw->physhim = wlc_phy_shim_attach(wlc_hw, wlc->wl, wlc); in brcms_b_attach()
4510 if (wlc_hw->physhim == NULL) { in brcms_b_attach()
4518 sha_params.sih = wlc_hw->sih; in brcms_b_attach()
4519 sha_params.physhim = wlc_hw->physhim; in brcms_b_attach()
4521 sha_params.corerev = wlc_hw->corerev; in brcms_b_attach()
4522 sha_params.vid = wlc_hw->vendorid; in brcms_b_attach()
4523 sha_params.did = wlc_hw->deviceid; in brcms_b_attach()
4524 sha_params.chip = ai_get_chip_id(wlc_hw->sih); in brcms_b_attach()
4525 sha_params.chiprev = ai_get_chiprev(wlc_hw->sih); in brcms_b_attach()
4526 sha_params.chippkg = ai_get_chippkg(wlc_hw->sih); in brcms_b_attach()
4527 sha_params.sromrev = wlc_hw->sromrev; in brcms_b_attach()
4528 sha_params.boardtype = ai_get_boardtype(wlc_hw->sih); in brcms_b_attach()
4529 sha_params.boardrev = wlc_hw->boardrev; in brcms_b_attach()
4530 sha_params.boardflags = wlc_hw->boardflags; in brcms_b_attach()
4531 sha_params.boardflags2 = wlc_hw->boardflags2; in brcms_b_attach()
4534 wlc_hw->phy_sh = wlc_phy_shared_attach(&sha_params); in brcms_b_attach()
4535 if (!wlc_hw->phy_sh) { in brcms_b_attach()
4541 for (j = 0; j < wlc_hw->_nbands; j++) { in brcms_b_attach()
4547 brcms_c_setxband(wlc_hw, j); in brcms_b_attach()
4549 wlc_hw->band->bandunit = j; in brcms_b_attach()
4550 wlc_hw->band->bandtype = j ? BRCM_BAND_5G : BRCM_BAND_2G; in brcms_b_attach()
4555 wlc_hw->machwcap = bcma_read32(core, D11REGOFFS(machwcap)); in brcms_b_attach()
4556 wlc_hw->machwcap_backup = wlc_hw->machwcap; in brcms_b_attach()
4559 WARN_ON(wlc_hw->corerev < XMTFIFOTBL_STARTREV || in brcms_b_attach()
4560 (wlc_hw->corerev - XMTFIFOTBL_STARTREV) > in brcms_b_attach()
4562 wlc_hw->xmtfifo_sz = in brcms_b_attach()
4563 xmtfifo_sz[(wlc_hw->corerev - XMTFIFOTBL_STARTREV)]; in brcms_b_attach()
4564 WARN_ON(!wlc_hw->xmtfifo_sz[0]); in brcms_b_attach()
4567 wlc_hw->band->pi = in brcms_b_attach()
4568 wlc_phy_attach(wlc_hw->phy_sh, core, in brcms_b_attach()
4569 wlc_hw->band->bandtype, in brcms_b_attach()
4571 if (wlc_hw->band->pi == NULL) { in brcms_b_attach()
4578 wlc_phy_machwcap_set(wlc_hw->band->pi, wlc_hw->machwcap); in brcms_b_attach()
4580 wlc_phy_get_phyversion(wlc_hw->band->pi, &wlc_hw->band->phytype, in brcms_b_attach()
4581 &wlc_hw->band->phyrev, in brcms_b_attach()
4582 &wlc_hw->band->radioid, in brcms_b_attach()
4583 &wlc_hw->band->radiorev); in brcms_b_attach()
4584 wlc_hw->band->abgphy_encore = in brcms_b_attach()
4585 wlc_phy_get_encore(wlc_hw->band->pi); in brcms_b_attach()
4586 wlc->band->abgphy_encore = wlc_phy_get_encore(wlc_hw->band->pi); in brcms_b_attach()
4587 wlc_hw->band->core_flags = in brcms_b_attach()
4588 wlc_phy_get_coreflags(wlc_hw->band->pi); in brcms_b_attach()
4591 if (BRCMS_ISNPHY(wlc_hw->band)) { in brcms_b_attach()
4592 if (NCONF_HAS(wlc_hw->band->phyrev)) in brcms_b_attach()
4596 } else if (BRCMS_ISLCNPHY(wlc_hw->band)) { in brcms_b_attach()
4597 if (LCNCONF_HAS(wlc_hw->band->phyrev)) in brcms_b_attach()
4605 wlc_hw->band->phytype, wlc_hw->band->phyrev); in brcms_b_attach()
4620 wlc->band->pi = wlc_hw->band->pi; in brcms_b_attach()
4621 wlc->band->phytype = wlc_hw->band->phytype; in brcms_b_attach()
4622 wlc->band->phyrev = wlc_hw->band->phyrev; in brcms_b_attach()
4623 wlc->band->radioid = wlc_hw->band->radioid; in brcms_b_attach()
4624 wlc->band->radiorev = wlc_hw->band->radiorev; in brcms_b_attach()
4629 wlc_hw->band->CWmin = APHY_CWMIN; in brcms_b_attach()
4630 wlc_hw->band->CWmax = PHY_CWMAX; in brcms_b_attach()
4639 brcms_c_coredisable(wlc_hw); in brcms_b_attach()
4642 bcma_host_pci_down(wlc_hw->d11core->bus); in brcms_b_attach()
4645 brcms_b_xtal(wlc_hw, OFF); in brcms_b_attach()
4658 brcms_c_get_macaddr(wlc_hw, wlc_hw->etheraddr); in brcms_b_attach()
4660 if (is_broadcast_ether_addr(wlc_hw->etheraddr) || in brcms_b_attach()
4661 is_zero_ether_addr(wlc_hw->etheraddr)) { in brcms_b_attach()
4668 brcms_dbg_info(wlc_hw->d11core, "deviceid 0x%x nbands %d board 0x%x\n", in brcms_b_attach()
4669 wlc_hw->deviceid, wlc_hw->_nbands, in brcms_b_attach()
4670 ai_get_boardtype(wlc_hw->sih)); in brcms_b_attach()
4810 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_detach() local
4812 brcms_b_detach_dmapio(wlc_hw); in brcms_b_detach()
4814 band = wlc_hw->band; in brcms_b_detach()
4815 for (i = 0; i < wlc_hw->_nbands; i++) { in brcms_b_detach()
4821 band = wlc_hw->bandstate[OTHERBANDUNIT(wlc)]; in brcms_b_detach()
4825 kfree(wlc_hw->phy_sh); in brcms_b_detach()
4827 wlc_phy_shim_detach(wlc_hw->physhim); in brcms_b_detach()
4829 if (wlc_hw->sih) { in brcms_b_detach()
4830 ai_detach(wlc_hw->sih); in brcms_b_detach()
4831 wlc_hw->sih = NULL; in brcms_b_detach()
4877 static void brcms_b_hw_up(struct brcms_hardware *wlc_hw) in brcms_b_hw_up() argument
4879 if (wlc_hw->wlc->pub->hw_up) in brcms_b_hw_up()
4882 brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_b_hw_up()
4888 brcms_b_xtal(wlc_hw, ON); in brcms_b_hw_up()
4889 ai_clkctl_init(wlc_hw->sih); in brcms_b_hw_up()
4890 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_hw_up()
4903 wlc_phy_por_inform(wlc_hw->band->pi); in brcms_b_hw_up()
4905 wlc_hw->ucode_loaded = false; in brcms_b_hw_up()
4906 wlc_hw->wlc->pub->hw_up = true; in brcms_b_hw_up()
4908 if ((wlc_hw->boardflags & BFL_FEM) in brcms_b_hw_up()
4909 && (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) { in brcms_b_hw_up()
4911 (wlc_hw->boardrev >= 0x1250 in brcms_b_hw_up()
4912 && (wlc_hw->boardflags & BFL_FEM_BT))) in brcms_b_hw_up()
4913 ai_epa_4313war(wlc_hw->sih); in brcms_b_hw_up()
4917 static int brcms_b_up_prep(struct brcms_hardware *wlc_hw) in brcms_b_up_prep() argument
4919 brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_b_up_prep()
4925 brcms_b_xtal(wlc_hw, ON); in brcms_b_up_prep()
4926 ai_clkctl_init(wlc_hw->sih); in brcms_b_up_prep()
4927 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_up_prep()
4933 bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core, in brcms_b_up_prep()
4941 if (brcms_b_radio_read_hwdisabled(wlc_hw)) { in brcms_b_up_prep()
4943 bcma_host_pci_down(wlc_hw->d11core->bus); in brcms_b_up_prep()
4944 brcms_b_xtal(wlc_hw, OFF); in brcms_b_up_prep()
4948 bcma_host_pci_up(wlc_hw->d11core->bus); in brcms_b_up_prep()
4951 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); in brcms_b_up_prep()
4956 static int brcms_b_up_finish(struct brcms_hardware *wlc_hw) in brcms_b_up_finish() argument
4958 wlc_hw->up = true; in brcms_b_up_finish()
4959 wlc_phy_hw_state_upd(wlc_hw->band->pi, true); in brcms_b_up_finish()
4962 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_up_finish()
4963 brcms_intrson(wlc_hw->wlc->wl); in brcms_b_up_finish()
5079 static int brcms_b_bmac_down_prep(struct brcms_hardware *wlc_hw) in brcms_b_bmac_down_prep() argument
5084 if (!wlc_hw->up) in brcms_b_bmac_down_prep()
5087 dev_gone = brcms_deviceremoved(wlc_hw->wlc); in brcms_b_bmac_down_prep()
5091 wlc_hw->wlc->macintmask = 0; in brcms_b_bmac_down_prep()
5094 brcms_intrsoff(wlc_hw->wlc->wl); in brcms_b_bmac_down_prep()
5097 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_bmac_down_prep()
5100 callbacks += wlc_phy_down(wlc_hw->band->pi); in brcms_b_bmac_down_prep()
5105 static int brcms_b_down_finish(struct brcms_hardware *wlc_hw) in brcms_b_down_finish() argument
5110 if (!wlc_hw->up) in brcms_b_down_finish()
5113 wlc_hw->up = false; in brcms_b_down_finish()
5114 wlc_phy_hw_state_upd(wlc_hw->band->pi, false); in brcms_b_down_finish()
5116 dev_gone = brcms_deviceremoved(wlc_hw->wlc); in brcms_b_down_finish()
5119 wlc_hw->sbclk = false; in brcms_b_down_finish()
5120 wlc_hw->clk = false; in brcms_b_down_finish()
5121 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); in brcms_b_down_finish()
5124 brcms_c_flushqueues(wlc_hw->wlc); in brcms_b_down_finish()
5128 if (bcma_core_is_enabled(wlc_hw->d11core)) { in brcms_b_down_finish()
5129 if (bcma_read32(wlc_hw->d11core, in brcms_b_down_finish()
5131 brcms_c_suspend_mac_and_wait(wlc_hw->wlc); in brcms_b_down_finish()
5132 callbacks += brcms_reset(wlc_hw->wlc->wl); in brcms_b_down_finish()
5133 brcms_c_coredisable(wlc_hw); in brcms_b_down_finish()
5137 if (!wlc_hw->noreset) { in brcms_b_down_finish()
5138 bcma_host_pci_down(wlc_hw->d11core->bus); in brcms_b_down_finish()
5139 brcms_b_xtal(wlc_hw, OFF); in brcms_b_down_finish()
5628 u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate) in brcms_b_rate_shm_offset() argument
5648 return 2 * brcms_b_read_shm(wlc_hw, table_ptr + (index * 2)); in brcms_b_rate_shm_offset()
6943 brcms_b_read_tsf(struct brcms_hardware *wlc_hw, u32 *tsf_l_ptr, in brcms_b_read_tsf() argument
6946 struct bcma_device *core = wlc_hw->d11core; in brcms_b_read_tsf()
7237 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_beacon_write() local
7255 brcms_b_write_template_ram(wlc_hw, T_BCN0_TPL_BASE, in brcms_c_beacon_write()
7259 brcms_b_write_shm(wlc_hw, M_BCN0_FRM_BYTESZ, (u16) len); in brcms_c_beacon_write()
7263 brcms_b_write_template_ram(wlc_hw, T_BCN1_TPL_BASE, in brcms_c_beacon_write()
7267 brcms_b_write_shm(wlc_hw, M_BCN1_FRM_BYTESZ, (u16) len); in brcms_c_beacon_write()
7271 brcms_b_write_shm(wlc_hw, M_TIMBPOS_INBEACON, in brcms_c_beacon_write()
7273 brcms_b_write_shm(wlc_hw, M_DOT11_DTIMPERIOD, dtim_period); in brcms_c_beacon_write()
7275 brcms_b_write_shm(wlc_hw, M_TIMBPOS_INBEACON, in brcms_c_beacon_write()
7277 brcms_b_write_shm(wlc_hw, M_DOT11_DTIMPERIOD, 0); in brcms_c_beacon_write()
7285 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_update_beacon_hw() local
7286 struct bcma_device *core = wlc_hw->d11core; in brcms_c_update_beacon_hw()
7456 int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, in brcms_b_xmtfifo_sz_get() argument
7462 *blocks = wlc_hw->xmtfifo_sz[fifo]; in brcms_b_xmtfifo_sz_get()
7645 brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) in brcms_b_recv() argument
7663 morepending = dma_rx(wlc_hw->di[fifo], &recv_frames); in brcms_b_recv()
7668 dma_rxfill(wlc_hw->di[fifo]); in brcms_b_recv()
7692 brcms_c_recv(wlc_hw->wlc, p); in brcms_b_recv()
7705 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_dpc() local
7706 struct bcma_device *core = wlc_hw->d11core; in brcms_c_dpc()
7709 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_dpc()
7720 wlc_hw->unit, macintstatus); in brcms_c_dpc()
7750 if (brcms_b_recv(wlc_hw, RX_FIFO, bounded)) in brcms_c_dpc()
7755 wlc_phy_noise_sample_intr(wlc_hw->band->pi); in brcms_c_dpc()
7759 "(seconds). Resetting.\n", wlc_hw->unit, wlc_hw->now); in brcms_c_dpc()
7762 __func__, ai_get_chip_id(wlc_hw->sih), in brcms_c_dpc()
7763 ai_get_chiprev(wlc_hw->sih)); in brcms_c_dpc()
7764 brcms_fatal_error(wlc_hw->wlc->wl); in brcms_c_dpc()
7773 " RF Disable Input\n", wlc_hw->unit); in brcms_c_dpc()
7785 brcms_fatal_error(wlc_hw->wlc->wl); in brcms_c_dpc()