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()
1031 brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) in brcms_b_txstatus() argument
1044 core = wlc_hw->d11core; in brcms_b_txstatus()
1050 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_b_txstatus()
1066 *fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs); in brcms_b_txstatus()
1089 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_mhfdef() local
1096 if (wlc_hw->boardflags & BFL_NOPLLDOWN) in brcms_c_mhfdef()
1099 if (BRCMS_ISNPHY(wlc_hw->band) && NREV_LT(wlc_hw->band->phyrev, 2)) { in brcms_c_mhfdef()
1121 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_attach_dmapio() local
1122 uint unit = wlc_hw->unit; in brcms_b_attach_dmapio()
1127 if (wlc_hw->di[0] == NULL) { /* Init FIFOs */ in brcms_b_attach_dmapio()
1135 wlc_hw->di[0] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1141 dma_attach_err |= (NULL == wlc_hw->di[0]); in brcms_b_attach_dmapio()
1149 wlc_hw->di[1] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1152 dma_attach_err |= (NULL == wlc_hw->di[1]); in brcms_b_attach_dmapio()
1159 wlc_hw->di[2] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1162 dma_attach_err |= (NULL == wlc_hw->di[2]); in brcms_b_attach_dmapio()
1168 wlc_hw->di[3] = dma_attach(name, wlc, in brcms_b_attach_dmapio()
1172 dma_attach_err |= (NULL == wlc_hw->di[3]); in brcms_b_attach_dmapio()
1176 brcms_err(wlc_hw->d11core, in brcms_b_attach_dmapio()
1184 if (wlc_hw->di[i]) in brcms_b_attach_dmapio()
1185 wlc_hw->txavail[i] = in brcms_b_attach_dmapio()
1186 (uint *) dma_getvar(wlc_hw->di[i], in brcms_b_attach_dmapio()
1191 brcms_c_mhfdef(wlc, wlc_hw->band->mhfs, pio_mhf2); in brcms_b_attach_dmapio()
1196 static void brcms_b_detach_dmapio(struct brcms_hardware *wlc_hw) in brcms_b_detach_dmapio() argument
1201 if (wlc_hw->di[j]) { in brcms_b_detach_dmapio()
1202 dma_detach(wlc_hw->di[j]); in brcms_b_detach_dmapio()
1203 wlc_hw->di[j] = NULL; in brcms_b_detach_dmapio()
1213 static void brcms_b_info_init(struct brcms_hardware *wlc_hw) in brcms_b_info_init() argument
1215 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_info_init()
1221 wlc_hw->shortslot = false; in brcms_b_info_init()
1223 wlc_hw->SFBL = RETRY_SHORT_FB; in brcms_b_info_init()
1224 wlc_hw->LFBL = RETRY_LONG_FB; in brcms_b_info_init()
1227 wlc_hw->SRL = RETRY_SHORT_DEF; in brcms_b_info_init()
1228 wlc_hw->LRL = RETRY_LONG_DEF; in brcms_b_info_init()
1229 wlc_hw->chanspec = ch20mhz_chspec(1); in brcms_b_info_init()
1232 static void brcms_b_wait_for_wake(struct brcms_hardware *wlc_hw) in brcms_b_wait_for_wake() argument
1238 SPINWAIT((brcms_b_read_shm(wlc_hw, M_UCODE_DBGST) == in brcms_b_wait_for_wake()
1239 DBGST_ASLEEP), wlc_hw->wlc->fastpwrup_dly); in brcms_b_wait_for_wake()
1243 static void brcms_b_clkctl_clk(struct brcms_hardware *wlc_hw, enum bcma_clkmode mode) in brcms_b_clkctl_clk() argument
1245 if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU) { in brcms_b_clkctl_clk()
1252 if (wlc_hw->clk) { in brcms_b_clkctl_clk()
1254 bcma_set32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1261 ((bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1265 WARN_ON(!(bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1269 if ((ai_get_pmurev(wlc_hw->sih) == 0) && in brcms_b_clkctl_clk()
1270 (bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1274 ((bcma_read32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1279 bcma_mask32(wlc_hw->d11core, in brcms_b_clkctl_clk()
1284 wlc_hw->forcefastclk = (mode == BCMA_CLKMODE_FAST); in brcms_b_clkctl_clk()
1291 wlc_hw->forcefastclk = ai_clkctl_cc(wlc_hw->sih, mode); in brcms_b_clkctl_clk()
1294 if (wlc_hw->forcefastclk && wlc_hw->clk) in brcms_b_clkctl_clk()
1295 WARN_ON(!(bcma_aread32(wlc_hw->d11core, BCMA_IOST) & in brcms_b_clkctl_clk()
1308 if (wlc_hw->forcefastclk) in brcms_b_clkctl_clk()
1309 mboolset(wlc_hw->wake_override, in brcms_b_clkctl_clk()
1312 mboolclr(wlc_hw->wake_override, in brcms_b_clkctl_clk()
1329 brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, u16 val, in brcms_b_mhf() argument
1348 band = wlc_hw->band; in brcms_b_mhf()
1351 band = wlc_hw->bandstate[BAND_5G_INDEX]; in brcms_b_mhf()
1354 band = wlc_hw->bandstate[BAND_2G_INDEX]; in brcms_b_mhf()
1367 if (wlc_hw->clk && (band->mhfs[idx] != save) in brcms_b_mhf()
1368 && (band == wlc_hw->band)) in brcms_b_mhf()
1369 brcms_b_write_shm(wlc_hw, addr[idx], in brcms_b_mhf()
1374 wlc_hw->bandstate[0]->mhfs[idx] = in brcms_b_mhf()
1375 (wlc_hw->bandstate[0]->mhfs[idx] & ~mask) | val; in brcms_b_mhf()
1376 wlc_hw->bandstate[1]->mhfs[idx] = in brcms_b_mhf()
1377 (wlc_hw->bandstate[1]->mhfs[idx] & ~mask) | val; in brcms_b_mhf()
1384 static void brcms_c_mctrl_reset(struct brcms_hardware *wlc_hw) in brcms_c_mctrl_reset() argument
1387 wlc_hw->maccontrol = 0; in brcms_c_mctrl_reset()
1388 wlc_hw->suspended_fifos = 0; in brcms_c_mctrl_reset()
1389 wlc_hw->wake_override = 0; in brcms_c_mctrl_reset()
1390 wlc_hw->mute_override = 0; in brcms_c_mctrl_reset()
1391 brcms_b_mctrl(wlc_hw, ~0, MCTL_IHR_EN | MCTL_WAKE); in brcms_c_mctrl_reset()
1398 static void brcms_c_mctrl_write(struct brcms_hardware *wlc_hw) in brcms_c_mctrl_write() argument
1400 u32 maccontrol = wlc_hw->maccontrol; in brcms_c_mctrl_write()
1403 if (wlc_hw->wake_override) in brcms_c_mctrl_write()
1407 if (wlc_hw->mute_override) { in brcms_c_mctrl_write()
1412 bcma_write32(wlc_hw->d11core, D11REGOFFS(maccontrol), in brcms_c_mctrl_write()
1417 void brcms_b_mctrl(struct brcms_hardware *wlc_hw, u32 mask, u32 val) in brcms_b_mctrl() argument
1424 maccontrol = wlc_hw->maccontrol; in brcms_b_mctrl()
1432 wlc_hw->maccontrol = new_maccontrol; in brcms_b_mctrl()
1435 brcms_c_mctrl_write(wlc_hw); in brcms_b_mctrl()
1438 void brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw, in brcms_c_ucode_wake_override_set() argument
1441 if (wlc_hw->wake_override || (wlc_hw->maccontrol & MCTL_WAKE)) { in brcms_c_ucode_wake_override_set()
1442 mboolset(wlc_hw->wake_override, override_bit); in brcms_c_ucode_wake_override_set()
1446 mboolset(wlc_hw->wake_override, override_bit); in brcms_c_ucode_wake_override_set()
1448 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_wake_override_set()
1449 brcms_b_wait_for_wake(wlc_hw); in brcms_c_ucode_wake_override_set()
1452 void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw, in brcms_c_ucode_wake_override_clear() argument
1455 mboolclr(wlc_hw->wake_override, override_bit); in brcms_c_ucode_wake_override_clear()
1457 if (wlc_hw->wake_override || (wlc_hw->maccontrol & MCTL_WAKE)) in brcms_c_ucode_wake_override_clear()
1460 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_wake_override_clear()
1470 static void brcms_c_ucode_mute_override_set(struct brcms_hardware *wlc_hw) in brcms_c_ucode_mute_override_set() argument
1472 wlc_hw->mute_override = 1; in brcms_c_ucode_mute_override_set()
1477 if ((wlc_hw->maccontrol & (MCTL_AP | MCTL_INFRA)) == MCTL_INFRA) in brcms_c_ucode_mute_override_set()
1480 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_mute_override_set()
1484 static void brcms_c_ucode_mute_override_clear(struct brcms_hardware *wlc_hw) in brcms_c_ucode_mute_override_clear() argument
1486 if (wlc_hw->mute_override == 0) in brcms_c_ucode_mute_override_clear()
1489 wlc_hw->mute_override = 0; in brcms_c_ucode_mute_override_clear()
1494 if ((wlc_hw->maccontrol & (MCTL_AP | MCTL_INFRA)) == MCTL_INFRA) in brcms_c_ucode_mute_override_clear()
1497 brcms_c_mctrl_write(wlc_hw); in brcms_c_ucode_mute_override_clear()
1504 brcms_b_set_addrmatch(struct brcms_hardware *wlc_hw, int match_reg_offset, in brcms_b_set_addrmatch() argument
1507 struct bcma_device *core = wlc_hw->d11core; in brcms_b_set_addrmatch()
1512 brcms_dbg_rx(core, "wl%d: brcms_b_set_addrmatch\n", wlc_hw->unit); in brcms_b_set_addrmatch()
1527 brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, int offset, int len, in brcms_b_write_template_ram() argument
1530 struct bcma_device *core = wlc_hw->d11core; in brcms_b_write_template_ram()
1535 brcms_dbg_info(core, "wl%d\n", wlc_hw->unit); in brcms_b_write_template_ram()
1563 static void brcms_b_set_cwmin(struct brcms_hardware *wlc_hw, u16 newmin) in brcms_b_set_cwmin() argument
1565 wlc_hw->band->CWmin = newmin; in brcms_b_set_cwmin()
1567 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_set_cwmin()
1569 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_set_cwmin()
1570 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), newmin); in brcms_b_set_cwmin()
1573 static void brcms_b_set_cwmax(struct brcms_hardware *wlc_hw, u16 newmax) in brcms_b_set_cwmax() argument
1575 wlc_hw->band->CWmax = newmax; in brcms_b_set_cwmax()
1577 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_set_cwmax()
1579 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_set_cwmax()
1580 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), newmax); in brcms_b_set_cwmax()
1583 void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw) in brcms_b_bw_set() argument
1588 fastclk = wlc_hw->forcefastclk; in brcms_b_bw_set()
1590 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_bw_set()
1592 wlc_phy_bw_state_set(wlc_hw->band->pi, bw); in brcms_b_bw_set()
1594 brcms_b_phy_reset(wlc_hw); in brcms_b_bw_set()
1595 wlc_phy_init(wlc_hw->band->pi, wlc_phy_chanspec_get(wlc_hw->band->pi)); in brcms_b_bw_set()
1599 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_bw_set()
1602 static void brcms_b_upd_synthpu(struct brcms_hardware *wlc_hw) in brcms_b_upd_synthpu() argument
1605 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_upd_synthpu()
1615 brcms_b_write_shm(wlc_hw, M_SYNTHPU_DLY, v); in brcms_b_upd_synthpu()
1618 static void brcms_c_ucode_txant_set(struct brcms_hardware *wlc_hw) in brcms_c_ucode_txant_set() argument
1621 u16 phytxant = wlc_hw->bmac_phytxant; in brcms_c_ucode_txant_set()
1625 phyctl = brcms_b_read_shm(wlc_hw, M_CTXPRS_BLK + C_CTX_PCTLWD_POS); in brcms_c_ucode_txant_set()
1627 brcms_b_write_shm(wlc_hw, M_CTXPRS_BLK + C_CTX_PCTLWD_POS, phyctl); in brcms_c_ucode_txant_set()
1630 phyctl = brcms_b_read_shm(wlc_hw, M_RSP_PCTLWD); in brcms_c_ucode_txant_set()
1632 brcms_b_write_shm(wlc_hw, M_RSP_PCTLWD, phyctl); in brcms_c_ucode_txant_set()
1635 static u16 brcms_b_ofdm_ratetable_offset(struct brcms_hardware *wlc_hw, in brcms_b_ofdm_ratetable_offset() argument
1666 return 2 * brcms_b_read_shm(wlc_hw, M_RT_DIRMAP_A + (plcp_rate * 2)); in brcms_b_ofdm_ratetable_offset()
1669 static void brcms_upd_ofdm_pctl1_table(struct brcms_hardware *wlc_hw) in brcms_upd_ofdm_pctl1_table() argument
1680 if (!BRCMS_PHY_11N_CAP(wlc_hw->band)) in brcms_upd_ofdm_pctl1_table()
1687 entry_ptr = brcms_b_ofdm_ratetable_offset(wlc_hw, rate); in brcms_upd_ofdm_pctl1_table()
1691 brcms_b_read_shm(wlc_hw, entry_ptr + M_RT_OFDM_PCTL1_POS); in brcms_upd_ofdm_pctl1_table()
1695 pctl1 |= (wlc_hw->hw_stf_ss_opmode << PHY_TXC1_MODE_SHIFT); in brcms_upd_ofdm_pctl1_table()
1698 brcms_b_write_shm(wlc_hw, entry_ptr + M_RT_OFDM_PCTL1_POS, in brcms_upd_ofdm_pctl1_table()
1706 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_bsinit() local
1708 brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: bandunit %d\n", wlc_hw->unit, in brcms_b_bsinit()
1709 wlc_hw->band->bandunit); in brcms_b_bsinit()
1711 brcms_c_ucode_bsinit(wlc_hw); in brcms_b_bsinit()
1713 wlc_phy_init(wlc_hw->band->pi, chanspec); in brcms_b_bsinit()
1715 brcms_c_ucode_txant_set(wlc_hw); in brcms_b_bsinit()
1721 brcms_b_set_cwmin(wlc_hw, wlc_hw->band->CWmin); in brcms_b_bsinit()
1722 brcms_b_set_cwmax(wlc_hw, wlc_hw->band->CWmax); in brcms_b_bsinit()
1724 brcms_b_update_slot_timing(wlc_hw, in brcms_b_bsinit()
1725 wlc_hw->band->bandtype == BRCM_BAND_5G ? in brcms_b_bsinit()
1726 true : wlc_hw->shortslot); in brcms_b_bsinit()
1729 brcms_b_write_shm(wlc_hw, M_PHYTYPE, (u16) wlc_hw->band->phytype); in brcms_b_bsinit()
1730 brcms_b_write_shm(wlc_hw, M_PHYVER, (u16) wlc_hw->band->phyrev); in brcms_b_bsinit()
1736 brcms_upd_ofdm_pctl1_table(wlc_hw); in brcms_b_bsinit()
1738 brcms_b_upd_synthpu(wlc_hw); in brcms_b_bsinit()
1742 void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw) in brcms_b_core_phypll_reset() argument
1744 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_addr), in brcms_b_core_phypll_reset()
1747 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), in brcms_b_core_phypll_reset()
1750 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), in brcms_b_core_phypll_reset()
1753 ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), in brcms_b_core_phypll_reset()
1761 void brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk) in brcms_b_phyclk_fgc() argument
1764 if (!BRCMS_ISNPHY(wlc_hw->band)) in brcms_b_phyclk_fgc()
1768 brcms_b_core_ioctl(wlc_hw, SICF_FGC, SICF_FGC); in brcms_b_phyclk_fgc()
1770 brcms_b_core_ioctl(wlc_hw, SICF_FGC, 0); in brcms_b_phyclk_fgc()
1774 void brcms_b_macphyclk_set(struct brcms_hardware *wlc_hw, bool clk) in brcms_b_macphyclk_set() argument
1777 brcms_b_core_ioctl(wlc_hw, SICF_MPCLKE, SICF_MPCLKE); in brcms_b_macphyclk_set()
1779 brcms_b_core_ioctl(wlc_hw, SICF_MPCLKE, 0); in brcms_b_macphyclk_set()
1782 void brcms_b_phy_reset(struct brcms_hardware *wlc_hw) in brcms_b_phy_reset() argument
1784 struct brcms_phy_pub *pih = wlc_hw->band->pi; in brcms_b_phy_reset()
1788 brcms_dbg_info(wlc_hw->d11core, "wl%d: reset phy\n", wlc_hw->unit); in brcms_b_phy_reset()
1793 phy_bw_clkbits = wlc_phy_clk_bwbits(wlc_hw->band->pi); in brcms_b_phy_reset()
1796 if (BRCMS_ISNPHY(wlc_hw->band) && NREV_GE(wlc_hw->band->phyrev, 3) && in brcms_b_phy_reset()
1797 NREV_LE(wlc_hw->band->phyrev, 4)) { in brcms_b_phy_reset()
1799 brcms_b_core_ioctl(wlc_hw, SICF_BWMASK, phy_bw_clkbits); in brcms_b_phy_reset()
1804 brcms_b_core_phypll_reset(wlc_hw); in brcms_b_phy_reset()
1807 brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_PCLKE), in brcms_b_phy_reset()
1811 brcms_b_core_ioctl(wlc_hw, in brcms_b_phy_reset()
1817 brcms_b_core_phy_clk(wlc_hw, ON); in brcms_b_phy_reset()
1824 static void brcms_b_setband(struct brcms_hardware *wlc_hw, uint bandunit, in brcms_b_setband() argument
1826 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_setband()
1830 if (!bcma_core_is_enabled(wlc_hw->d11core)) { in brcms_b_setband()
1831 bcma_core_enable(wlc_hw->d11core, 0); in brcms_b_setband()
1832 brcms_c_mctrl_reset(wlc_hw); in brcms_b_setband()
1837 if (!wlc_hw->up) in brcms_b_setband()
1840 brcms_b_core_phy_clk(wlc_hw, ON); in brcms_b_setband()
1857 WARN_ON((bcma_read32(wlc_hw->d11core, D11REGOFFS(maccontrol)) & in brcms_b_setband()
1861 static bool brcms_c_isgoodchip(struct brcms_hardware *wlc_hw) in brcms_c_isgoodchip() argument
1865 if (!CONF_HAS(D11CONF, wlc_hw->corerev)) { in brcms_c_isgoodchip()
1866 wiphy_err(wlc_hw->wlc->wiphy, "unsupported core rev %d\n", in brcms_c_isgoodchip()
1867 wlc_hw->corerev); in brcms_c_isgoodchip()
1875 static bool brcms_c_validboardtype(struct brcms_hardware *wlc_hw) in brcms_c_validboardtype() argument
1877 uint boardrev = wlc_hw->boardrev; in brcms_c_validboardtype()
1886 if (ai_get_boardvendor(wlc_hw->sih) != PCI_VENDOR_ID_BROADCOM) in brcms_c_validboardtype()
1903 static void brcms_c_get_macaddr(struct brcms_hardware *wlc_hw, u8 etheraddr[ETH_ALEN]) in brcms_c_get_macaddr() argument
1905 struct ssb_sprom *sprom = &wlc_hw->d11core->bus->sprom; in brcms_c_get_macaddr()
1913 if (wlc_hw->_nbands > 1) in brcms_c_get_macaddr()
1920 static void brcms_b_xtal(struct brcms_hardware *wlc_hw, bool want) in brcms_b_xtal() argument
1922 brcms_dbg_info(wlc_hw->d11core, "wl%d: want %d\n", wlc_hw->unit, want); in brcms_b_xtal()
1928 if (!want && wlc_hw->pllreq) in brcms_b_xtal()
1931 wlc_hw->sbclk = want; in brcms_b_xtal()
1932 if (!wlc_hw->sbclk) { in brcms_b_xtal()
1933 wlc_hw->clk = false; in brcms_b_xtal()
1934 if (wlc_hw->band && wlc_hw->band->pi) in brcms_b_xtal()
1935 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); in brcms_b_xtal()
1945 static bool brcms_b_radio_read_hwdisabled(struct brcms_hardware *wlc_hw) in brcms_b_radio_read_hwdisabled() argument
1950 xtal = wlc_hw->sbclk; in brcms_b_radio_read_hwdisabled()
1952 brcms_b_xtal(wlc_hw, ON); in brcms_b_radio_read_hwdisabled()
1955 clk = wlc_hw->clk; in brcms_b_radio_read_hwdisabled()
1962 if (D11REV_GE(wlc_hw->corerev, 18)) in brcms_b_radio_read_hwdisabled()
1972 bcma_core_enable(wlc_hw->d11core, flags); in brcms_b_radio_read_hwdisabled()
1973 brcms_c_mctrl_reset(wlc_hw); in brcms_b_radio_read_hwdisabled()
1976 v = ((bcma_read32(wlc_hw->d11core, in brcms_b_radio_read_hwdisabled()
1981 bcma_core_disable(wlc_hw->d11core, 0); in brcms_b_radio_read_hwdisabled()
1984 brcms_b_xtal(wlc_hw, OFF); in brcms_b_radio_read_hwdisabled()
1989 static bool wlc_dma_rxreset(struct brcms_hardware *wlc_hw, uint fifo) in wlc_dma_rxreset() argument
1991 struct dma_pub *di = wlc_hw->di[fifo]; in wlc_dma_rxreset()
2003 void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags) in brcms_b_corereset() argument
2009 flags = (wlc_hw->band->pi ? wlc_hw->band->core_flags : 0); in brcms_b_corereset()
2011 brcms_dbg_info(wlc_hw->d11core, "wl%d: core reset\n", wlc_hw->unit); in brcms_b_corereset()
2014 fastclk = wlc_hw->forcefastclk; in brcms_b_corereset()
2016 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_corereset()
2019 if (bcma_core_is_enabled(wlc_hw->d11core)) { in brcms_b_corereset()
2021 if ((wlc_hw->di[i]) && (!dma_txreset(wlc_hw->di[i]))) in brcms_b_corereset()
2022 brcms_err(wlc_hw->d11core, "wl%d: %s: " in brcms_b_corereset()
2024 wlc_hw->unit, __func__, i); in brcms_b_corereset()
2026 if ((wlc_hw->di[RX_FIFO]) in brcms_b_corereset()
2027 && (!wlc_dma_rxreset(wlc_hw, RX_FIFO))) in brcms_b_corereset()
2028 brcms_err(wlc_hw->d11core, "wl%d: %s: dma_rxreset" in brcms_b_corereset()
2030 wlc_hw->unit, __func__, RX_FIFO); in brcms_b_corereset()
2033 if (wlc_hw->noreset) { in brcms_b_corereset()
2034 wlc_hw->wlc->macintstatus = 0; /* skip wl_dpc after down */ in brcms_b_corereset()
2035 brcms_b_mctrl(wlc_hw, MCTL_PSM_RUN | MCTL_EN_MAC, 0); in brcms_b_corereset()
2044 if (D11REV_GE(wlc_hw->corerev, 18)) in brcms_b_corereset()
2057 wlc_hw->clk = false; in brcms_b_corereset()
2058 bcma_core_enable(wlc_hw->d11core, flags); in brcms_b_corereset()
2059 wlc_hw->clk = true; in brcms_b_corereset()
2060 if (wlc_hw->band && wlc_hw->band->pi) in brcms_b_corereset()
2061 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, true); in brcms_b_corereset()
2063 brcms_c_mctrl_reset(wlc_hw); in brcms_b_corereset()
2065 if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU) in brcms_b_corereset()
2066 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_corereset()
2068 brcms_b_phy_reset(wlc_hw); in brcms_b_corereset()
2071 brcms_b_core_phypll_ctl(wlc_hw, true); in brcms_b_corereset()
2074 wlc_hw->wlc->macintstatus = 0; in brcms_b_corereset()
2078 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_corereset()
2084 static void brcms_b_corerev_fifofixup(struct brcms_hardware *wlc_hw) in brcms_b_corerev_fifofixup() argument
2086 struct bcma_device *core = wlc_hw->d11core; in brcms_b_corerev_fifofixup()
2098 txfifo_endblk = txfifo_startblk + wlc_hw->xmtfifo_sz[fifo_nu]; in brcms_b_corerev_fifofixup()
2113 txfifo_startblk += wlc_hw->xmtfifo_sz[fifo_nu]; in brcms_b_corerev_fifofixup()
2119 brcms_b_write_shm(wlc_hw, M_FIFOSIZE0, in brcms_b_corerev_fifofixup()
2120 wlc_hw->xmtfifo_sz[TX_AC_BE_FIFO]); in brcms_b_corerev_fifofixup()
2121 brcms_b_write_shm(wlc_hw, M_FIFOSIZE1, in brcms_b_corerev_fifofixup()
2122 wlc_hw->xmtfifo_sz[TX_AC_VI_FIFO]); in brcms_b_corerev_fifofixup()
2123 brcms_b_write_shm(wlc_hw, M_FIFOSIZE2, in brcms_b_corerev_fifofixup()
2124 ((wlc_hw->xmtfifo_sz[TX_AC_VO_FIFO] << 8) | wlc_hw-> in brcms_b_corerev_fifofixup()
2126 brcms_b_write_shm(wlc_hw, M_FIFOSIZE3, in brcms_b_corerev_fifofixup()
2127 ((wlc_hw->xmtfifo_sz[TX_ATIM_FIFO] << 8) | wlc_hw-> in brcms_b_corerev_fifofixup()
2144 void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode) in brcms_b_switch_macfreq() argument
2146 struct bcma_device *core = wlc_hw->d11core; in brcms_b_switch_macfreq()
2148 if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43224) || in brcms_b_switch_macfreq()
2149 (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225)) { in brcms_b_switch_macfreq()
2160 } else if (BRCMS_ISLCNPHY(wlc_hw->band)) { in brcms_b_switch_macfreq()
2200 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_gpio_init() local
2204 brcms_b_mctrl(wlc_hw, MCTL_GPOUT_SEL_MASK, 0); in brcms_c_gpio_init()
2217 if (wlc_hw->antsel_type == ANTSEL_2x3) { in brcms_c_gpio_init()
2219 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN, in brcms_c_gpio_init()
2221 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE, in brcms_c_gpio_init()
2225 wlc_phy_antsel_init(wlc_hw->band->pi, false); in brcms_c_gpio_init()
2227 } else if (wlc_hw->antsel_type == ANTSEL_2x4) { in brcms_c_gpio_init()
2233 bcma_set16(wlc_hw->d11core, D11REGOFFS(psm_gpio_oe), in brcms_c_gpio_init()
2235 bcma_set16(wlc_hw->d11core, D11REGOFFS(psm_gpio_out), in brcms_c_gpio_init()
2239 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN, in brcms_c_gpio_init()
2241 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE, 0, in brcms_c_gpio_init()
2245 brcms_b_write_shm(wlc_hw, M_ANTSEL_CLKDIV, in brcms_c_gpio_init()
2253 if (wlc_hw->boardflags & BFL_PACTRL) in brcms_c_gpio_init()
2257 bcma_chipco_gpio_control(&wlc_hw->d11core->bus->drv_cc, gm, gc); in brcms_c_gpio_init()
2260 static void brcms_ucode_write(struct brcms_hardware *wlc_hw, in brcms_ucode_write() argument
2263 struct bcma_device *core = wlc_hw->d11core; in brcms_ucode_write()
2267 brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_ucode_write()
2279 static void brcms_ucode_download(struct brcms_hardware *wlc_hw) in brcms_ucode_download() argument
2282 struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; in brcms_ucode_download()
2284 wlc = wlc_hw->wlc; in brcms_ucode_download()
2286 if (wlc_hw->ucode_loaded) in brcms_ucode_download()
2289 if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { in brcms_ucode_download()
2290 if (BRCMS_ISNPHY(wlc_hw->band)) { in brcms_ucode_download()
2291 brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo, in brcms_ucode_download()
2293 wlc_hw->ucode_loaded = true; in brcms_ucode_download()
2295 brcms_err(wlc_hw->d11core, in brcms_ucode_download()
2297 __func__, wlc_hw->unit, wlc_hw->corerev); in brcms_ucode_download()
2298 } else if (D11REV_IS(wlc_hw->corerev, 24)) { in brcms_ucode_download()
2299 if (BRCMS_ISLCNPHY(wlc_hw->band)) { in brcms_ucode_download()
2300 brcms_ucode_write(wlc_hw, ucode->bcm43xx_24_lcn, in brcms_ucode_download()
2302 wlc_hw->ucode_loaded = true; in brcms_ucode_download()
2304 brcms_err(wlc_hw->d11core, in brcms_ucode_download()
2306 __func__, wlc_hw->unit, wlc_hw->corerev); in brcms_ucode_download()
2311 void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant) in brcms_b_txant_set() argument
2314 wlc_hw->bmac_phytxant = phytxant; in brcms_b_txant_set()
2317 if (!wlc_hw->up) in brcms_b_txant_set()
2319 brcms_c_ucode_txant_set(wlc_hw); in brcms_b_txant_set()
2323 u16 brcms_b_get_txant(struct brcms_hardware *wlc_hw) in brcms_b_get_txant() argument
2325 return (u16) wlc_hw->wlc->stf->txant; in brcms_b_get_txant()
2328 void brcms_b_antsel_type_set(struct brcms_hardware *wlc_hw, u8 antsel_type) in brcms_b_antsel_type_set() argument
2330 wlc_hw->antsel_type = antsel_type; in brcms_b_antsel_type_set()
2333 wlc_phy_antsel_type_set(wlc_hw->band->pi, antsel_type); in brcms_b_antsel_type_set()
2336 static void brcms_b_fifoerrors(struct brcms_hardware *wlc_hw) in brcms_b_fifoerrors() argument
2341 struct bcma_device *core = wlc_hw->d11core; in brcms_b_fifoerrors()
2343 unit = wlc_hw->unit; in brcms_b_fifoerrors()
2392 brcms_fatal_error(wlc_hw->wlc->wl); /* big hammer */ in brcms_b_fifoerrors()
2403 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_intrson() local
2405 bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), wlc->macintmask); in brcms_c_intrson()
2410 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_intrsoff() local
2413 if (!wlc_hw->clk) in brcms_c_intrsoff()
2418 bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), 0); in brcms_c_intrsoff()
2419 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(macintmask)); in brcms_c_intrsoff()
2429 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_intrsrestore() local
2430 if (!wlc_hw->clk) in brcms_c_intrsrestore()
2434 bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), wlc->macintmask); in brcms_c_intrsrestore()
2438 static void brcms_b_tx_fifo_suspend(struct brcms_hardware *wlc_hw, in brcms_b_tx_fifo_suspend() argument
2446 if ((wlc_hw->suspended_fifos & fifo) == fifo) in brcms_b_tx_fifo_suspend()
2450 if (wlc_hw->suspended_fifos == 0) in brcms_b_tx_fifo_suspend()
2451 brcms_c_ucode_wake_override_set(wlc_hw, in brcms_b_tx_fifo_suspend()
2454 wlc_hw->suspended_fifos |= fifo; in brcms_b_tx_fifo_suspend()
2456 if (wlc_hw->di[tx_fifo]) { in brcms_b_tx_fifo_suspend()
2462 if (BRCMS_PHY_11N_CAP(wlc_hw->band)) in brcms_b_tx_fifo_suspend()
2463 brcms_c_suspend_mac_and_wait(wlc_hw->wlc); in brcms_b_tx_fifo_suspend()
2465 dma_txsuspend(wlc_hw->di[tx_fifo]); in brcms_b_tx_fifo_suspend()
2467 if (BRCMS_PHY_11N_CAP(wlc_hw->band)) in brcms_b_tx_fifo_suspend()
2468 brcms_c_enable_mac(wlc_hw->wlc); in brcms_b_tx_fifo_suspend()
2472 static void brcms_b_tx_fifo_resume(struct brcms_hardware *wlc_hw, in brcms_b_tx_fifo_resume() argument
2480 if (wlc_hw->di[tx_fifo]) in brcms_b_tx_fifo_resume()
2481 dma_txresume(wlc_hw->di[tx_fifo]); in brcms_b_tx_fifo_resume()
2484 if (wlc_hw->suspended_fifos == 0) in brcms_b_tx_fifo_resume()
2487 wlc_hw->suspended_fifos &= ~(1 << tx_fifo); in brcms_b_tx_fifo_resume()
2488 if (wlc_hw->suspended_fifos == 0) in brcms_b_tx_fifo_resume()
2489 brcms_c_ucode_wake_override_clear(wlc_hw, in brcms_b_tx_fifo_resume()
2495 static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool mute_tx) in brcms_b_mute() argument
2498 u8 *ethaddr = wlc_hw->wlc->pub->cur_etheraddr; in brcms_b_mute()
2502 brcms_b_tx_fifo_suspend(wlc_hw, TX_DATA_FIFO); in brcms_b_mute()
2503 brcms_b_tx_fifo_suspend(wlc_hw, TX_CTL_FIFO); in brcms_b_mute()
2504 brcms_b_tx_fifo_suspend(wlc_hw, TX_AC_BK_FIFO); in brcms_b_mute()
2505 brcms_b_tx_fifo_suspend(wlc_hw, TX_AC_VI_FIFO); in brcms_b_mute()
2508 brcms_b_set_addrmatch(wlc_hw, RCM_MAC_OFFSET, null_ether_addr); in brcms_b_mute()
2511 brcms_b_tx_fifo_resume(wlc_hw, TX_DATA_FIFO); in brcms_b_mute()
2512 brcms_b_tx_fifo_resume(wlc_hw, TX_CTL_FIFO); in brcms_b_mute()
2513 brcms_b_tx_fifo_resume(wlc_hw, TX_AC_BK_FIFO); in brcms_b_mute()
2514 brcms_b_tx_fifo_resume(wlc_hw, TX_AC_VI_FIFO); in brcms_b_mute()
2517 brcms_b_set_addrmatch(wlc_hw, RCM_MAC_OFFSET, ethaddr); in brcms_b_mute()
2520 wlc_phy_mute_upd(wlc_hw->band->pi, mute_tx, 0); in brcms_b_mute()
2523 brcms_c_ucode_mute_override_set(wlc_hw); in brcms_b_mute()
2525 brcms_c_ucode_mute_override_clear(wlc_hw); in brcms_b_mute()
2544 struct brcms_hardware *wlc_hw = wlc->hw; in wlc_intstatus() local
2545 struct bcma_device *core = wlc_hw->d11core; in wlc_intstatus()
2619 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_isr() local
2622 if (!wlc_hw->up || !wlc->macintmask) in brcms_c_isr()
2629 brcms_err(wlc_hw->d11core, in brcms_c_isr()
2647 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_suspend_mac_and_wait() local
2648 struct bcma_device *core = wlc_hw->d11core; in brcms_c_suspend_mac_and_wait()
2651 brcms_dbg_mac80211(core, "wl%d: bandunit %d\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2652 wlc_hw->band->bandunit); in brcms_c_suspend_mac_and_wait()
2657 wlc_hw->mac_suspend_depth++; in brcms_c_suspend_mac_and_wait()
2658 if (wlc_hw->mac_suspend_depth > 1) in brcms_c_suspend_mac_and_wait()
2662 brcms_c_ucode_wake_override_set(wlc_hw, BRCMS_WAKE_OVERRIDE_MACSUSPEND); in brcms_c_suspend_mac_and_wait()
2667 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2678 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2685 brcms_b_mctrl(wlc_hw, MCTL_EN_MAC, 0); in brcms_c_suspend_mac_and_wait()
2693 wlc_hw->unit, BRCMS_MAX_MAC_SUSPEND); in brcms_c_suspend_mac_and_wait()
2695 "psm_brc 0x%04x\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2703 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_suspend_mac_and_wait()
2715 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_enable_mac() local
2716 struct bcma_device *core = wlc_hw->d11core; in brcms_c_enable_mac()
2719 brcms_dbg_mac80211(core, "wl%d: bandunit %d\n", wlc_hw->unit, in brcms_c_enable_mac()
2725 wlc_hw->mac_suspend_depth--; in brcms_c_enable_mac()
2726 if (wlc_hw->mac_suspend_depth > 0) in brcms_c_enable_mac()
2734 brcms_b_mctrl(wlc_hw, MCTL_EN_MAC, MCTL_EN_MAC); in brcms_c_enable_mac()
2745 brcms_c_ucode_wake_override_clear(wlc_hw, in brcms_c_enable_mac()
2749 void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw, u8 stf_mode) in brcms_b_band_stf_ss_set() argument
2751 wlc_hw->hw_stf_ss_opmode = stf_mode; in brcms_b_band_stf_ss_set()
2753 if (wlc_hw->clk) in brcms_b_band_stf_ss_set()
2754 brcms_upd_ofdm_pctl1_table(wlc_hw); in brcms_b_band_stf_ss_set()
2757 static bool brcms_b_validate_chip_access(struct brcms_hardware *wlc_hw) in brcms_b_validate_chip_access() argument
2759 struct bcma_device *core = wlc_hw->d11core; in brcms_b_validate_chip_access()
2761 struct wiphy *wiphy = wlc_hw->wlc->wiphy; in brcms_b_validate_chip_access()
2779 "expected 0xaa5555aa\n", wlc_hw->unit, val); in brcms_b_validate_chip_access()
2792 "expected 0x55aaaa55\n", wlc_hw->unit, val); in brcms_b_validate_chip_access()
2807 "0x%x, expected 0x%x or 0x%x\n", wlc_hw->unit, w, in brcms_b_validate_chip_access()
2818 void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on) in brcms_b_core_phypll_ctl() argument
2820 struct bcma_device *core = wlc_hw->d11core; in brcms_b_core_phypll_ctl()
2823 brcms_dbg_info(core, "wl%d\n", wlc_hw->unit); in brcms_b_core_phypll_ctl()
2828 if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) { in brcms_b_core_phypll_ctl()
2871 static void brcms_c_coredisable(struct brcms_hardware *wlc_hw) in brcms_c_coredisable() argument
2875 brcms_dbg_info(wlc_hw->d11core, "wl%d: disable core\n", wlc_hw->unit); in brcms_c_coredisable()
2877 dev_gone = brcms_deviceremoved(wlc_hw->wlc); in brcms_c_coredisable()
2882 if (wlc_hw->noreset) in brcms_c_coredisable()
2886 wlc_phy_switch_radio(wlc_hw->band->pi, OFF); in brcms_c_coredisable()
2889 wlc_phy_anacore(wlc_hw->band->pi, OFF); in brcms_c_coredisable()
2892 brcms_b_core_phypll_ctl(wlc_hw, false); in brcms_c_coredisable()
2894 wlc_hw->clk = false; in brcms_c_coredisable()
2895 bcma_core_disable(wlc_hw->d11core, 0); in brcms_c_coredisable()
2896 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); in brcms_c_coredisable()
2901 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_flushqueues() local
2906 if (wlc_hw->di[i]) { in brcms_c_flushqueues()
2907 dma_txreclaim(wlc_hw->di[i], DMA_RANGE_ALL); in brcms_c_flushqueues()
2915 dma_rxreclaim(wlc_hw->di[RX_FIFO]); in brcms_c_flushqueues()
2919 brcms_b_read_objmem(struct brcms_hardware *wlc_hw, uint offset, u32 sel) in brcms_b_read_objmem() argument
2921 struct bcma_device *core = wlc_hw->d11core; in brcms_b_read_objmem()
2933 brcms_b_write_objmem(struct brcms_hardware *wlc_hw, uint offset, u16 v, in brcms_b_write_objmem() argument
2936 struct bcma_device *core = wlc_hw->d11core; in brcms_b_write_objmem()
2951 u16 brcms_b_read_shm(struct brcms_hardware *wlc_hw, uint offset) in brcms_b_read_shm() argument
2953 return brcms_b_read_objmem(wlc_hw, offset, OBJADDR_SHM_SEL); in brcms_b_read_shm()
2960 void brcms_b_write_shm(struct brcms_hardware *wlc_hw, uint offset, u16 v) in brcms_b_write_shm() argument
2962 brcms_b_write_objmem(wlc_hw, offset, v, OBJADDR_SHM_SEL); in brcms_b_write_shm()
2972 brcms_b_copyto_objmem(struct brcms_hardware *wlc_hw, uint offset, in brcms_b_copyto_objmem() argument
2984 brcms_b_write_objmem(wlc_hw, offset + i, v, sel); in brcms_b_copyto_objmem()
2995 brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset, void *buf, in brcms_b_copyfrom_objmem() argument
3006 v = brcms_b_read_objmem(wlc_hw, offset + i, sel); in brcms_b_copyfrom_objmem()
3022 static void brcms_b_retrylimit_upd(struct brcms_hardware *wlc_hw, in brcms_b_retrylimit_upd() argument
3025 wlc_hw->SRL = SRL; in brcms_b_retrylimit_upd()
3026 wlc_hw->LRL = LRL; in brcms_b_retrylimit_upd()
3029 if (wlc_hw->up) { in brcms_b_retrylimit_upd()
3030 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_retrylimit_upd()
3032 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_retrylimit_upd()
3033 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), wlc_hw->SRL); in brcms_b_retrylimit_upd()
3034 bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), in brcms_b_retrylimit_upd()
3036 (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); in brcms_b_retrylimit_upd()
3037 bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), wlc_hw->LRL); in brcms_b_retrylimit_upd()
3041 static void brcms_b_pllreq(struct brcms_hardware *wlc_hw, bool set, u32 req_bit) in brcms_b_pllreq() argument
3044 if (mboolisset(wlc_hw->pllreq, req_bit)) in brcms_b_pllreq()
3047 mboolset(wlc_hw->pllreq, req_bit); in brcms_b_pllreq()
3049 if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) { in brcms_b_pllreq()
3050 if (!wlc_hw->sbclk) in brcms_b_pllreq()
3051 brcms_b_xtal(wlc_hw, ON); in brcms_b_pllreq()
3054 if (!mboolisset(wlc_hw->pllreq, req_bit)) in brcms_b_pllreq()
3057 mboolclr(wlc_hw->pllreq, req_bit); in brcms_b_pllreq()
3059 if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) { in brcms_b_pllreq()
3060 if (wlc_hw->sbclk) in brcms_b_pllreq()
3061 brcms_b_xtal(wlc_hw, OFF); in brcms_b_pllreq()
3066 static void brcms_b_antsel_set(struct brcms_hardware *wlc_hw, u32 antsel_avail) in brcms_b_antsel_set() argument
3068 wlc_hw->antsel_avail = antsel_avail; in brcms_b_antsel_set()
3134 static void brcms_b_reset(struct brcms_hardware *wlc_hw) in brcms_b_reset() argument
3137 if (!brcms_deviceremoved(wlc_hw->wlc)) in brcms_b_reset()
3138 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); in brcms_b_reset()
3141 brcms_c_flushqueues(wlc_hw->wlc); in brcms_b_reset()
3182 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_coreinit() local
3183 struct bcma_device *core = wlc_hw->d11core; in brcms_b_coreinit()
3190 struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; in brcms_b_coreinit()
3192 brcms_dbg_info(core, "wl%d: core init\n", wlc_hw->unit); in brcms_b_coreinit()
3195 brcms_b_mctrl(wlc_hw, ~0, (MCTL_IHR_EN | MCTL_PSM_JMP_0 | MCTL_WAKE)); in brcms_b_coreinit()
3197 brcms_ucode_download(wlc_hw); in brcms_b_coreinit()
3205 brcms_b_mctrl(wlc_hw, ~0, in brcms_b_coreinit()
3213 "suspend!\n", wlc_hw->unit); in brcms_b_coreinit()
3219 if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { in brcms_b_coreinit()
3220 if (BRCMS_ISNPHY(wlc_hw->band)) in brcms_b_coreinit()
3221 brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16); in brcms_b_coreinit()
3224 " %d\n", __func__, wlc_hw->unit, in brcms_b_coreinit()
3225 wlc_hw->corerev); in brcms_b_coreinit()
3226 } else if (D11REV_IS(wlc_hw->corerev, 24)) { in brcms_b_coreinit()
3227 if (BRCMS_ISLCNPHY(wlc_hw->band)) in brcms_b_coreinit()
3228 brcms_c_write_inits(wlc_hw, ucode->d11lcn0initvals24); in brcms_b_coreinit()
3231 " %d\n", __func__, wlc_hw->unit, in brcms_b_coreinit()
3232 wlc_hw->corerev); in brcms_b_coreinit()
3235 __func__, wlc_hw->unit, wlc_hw->corerev); in brcms_b_coreinit()
3240 brcms_b_corerev_fifofixup(wlc_hw); in brcms_b_coreinit()
3243 buf[TX_AC_BE_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE0); in brcms_b_coreinit()
3244 if (buf[TX_AC_BE_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_BE_FIFO]) { in brcms_b_coreinit()
3248 buf[TX_AC_VI_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE1); in brcms_b_coreinit()
3249 if (buf[TX_AC_VI_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_VI_FIFO]) { in brcms_b_coreinit()
3253 buf[TX_AC_BK_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE2); in brcms_b_coreinit()
3256 if (buf[TX_AC_BK_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_BK_FIFO]) { in brcms_b_coreinit()
3260 if (buf[TX_AC_VO_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_VO_FIFO]) { in brcms_b_coreinit()
3264 buf[TX_BCMC_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE3); in brcms_b_coreinit()
3267 if (buf[TX_BCMC_FIFO] != wlc_hw->xmtfifo_sz[TX_BCMC_FIFO]) { in brcms_b_coreinit()
3271 if (buf[TX_ATIM_FIFO] != wlc_hw->xmtfifo_sz[TX_ATIM_FIFO]) { in brcms_b_coreinit()
3278 wlc_hw->xmtfifo_sz[i], i); in brcms_b_coreinit()
3286 brcms_b_write_shm(wlc_hw, M_MBURST_SIZE, MAXTXFRAMEBURST); in brcms_b_coreinit()
3287 brcms_b_write_shm(wlc_hw, M_MAX_ANTCNT, ANTCNT); in brcms_b_coreinit()
3293 brcms_b_mctrl(wlc_hw, in brcms_b_coreinit()
3309 brcms_b_macphyclk_set(wlc_hw, ON); in brcms_b_coreinit()
3312 wlc->fastpwrup_dly = ai_clkctl_fast_pwrup_delay(wlc_hw->sih); in brcms_b_coreinit()
3316 brcms_b_write_shm(wlc_hw, M_MACHW_VER, (u16) wlc_hw->corerev); in brcms_b_coreinit()
3319 brcms_b_write_shm(wlc_hw, M_MACHW_CAP_L, in brcms_b_coreinit()
3320 (u16) (wlc_hw->machwcap & 0xffff)); in brcms_b_coreinit()
3321 brcms_b_write_shm(wlc_hw, M_MACHW_CAP_H, in brcms_b_coreinit()
3322 (u16) ((wlc_hw-> in brcms_b_coreinit()
3329 bcma_write32(core, D11REGOFFS(objdata), wlc_hw->SRL); in brcms_b_coreinit()
3333 bcma_write32(core, D11REGOFFS(objdata), wlc_hw->LRL); in brcms_b_coreinit()
3336 brcms_b_write_shm(wlc_hw, M_SFRMTXCNTFBRTHSD, wlc_hw->SFBL); in brcms_b_coreinit()
3337 brcms_b_write_shm(wlc_hw, M_LFRMTXCNTFBRTHSD, wlc_hw->LFBL); in brcms_b_coreinit()
3344 if (wlc_hw->di[i]) in brcms_b_coreinit()
3345 dma_txinit(wlc_hw->di[i]); in brcms_b_coreinit()
3349 dma_rxinit(wlc_hw->di[RX_FIFO]); in brcms_b_coreinit()
3350 dma_rxfill(wlc_hw->di[RX_FIFO]); in brcms_b_coreinit()
3353 static void brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec) in brcms_b_init() argument
3357 struct brcms_c_info *wlc = wlc_hw->wlc; in brcms_b_init()
3360 fastclk = wlc_hw->forcefastclk; in brcms_b_init()
3362 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_init()
3368 brcms_c_setxband(wlc_hw, chspec_bandunit(chanspec)); in brcms_b_init()
3369 wlc_phy_chanspec_radio_set(wlc_hw->band->pi, chanspec); in brcms_b_init()
3372 wlc_phy_cal_init(wlc_hw->band->pi); in brcms_b_init()
3386 mboolset(wlc_hw->wake_override, BRCMS_WAKE_OVERRIDE_MACSUSPEND); in brcms_b_init()
3392 wlc_hw->mac_suspend_depth = 1; in brcms_b_init()
3396 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_init()
3810 static void brcms_b_set_shortslot(struct brcms_hardware *wlc_hw, bool shortslot) in brcms_b_set_shortslot() argument
3812 wlc_hw->shortslot = shortslot; in brcms_b_set_shortslot()
3814 if (wlc_hw->band->bandtype == BRCM_BAND_2G && wlc_hw->up) { in brcms_b_set_shortslot()
3815 brcms_c_suspend_mac_and_wait(wlc_hw->wlc); in brcms_b_set_shortslot()
3816 brcms_b_update_slot_timing(wlc_hw, shortslot); in brcms_b_set_shortslot()
3817 brcms_c_enable_mac(wlc_hw->wlc); in brcms_b_set_shortslot()
3850 brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec, in brcms_b_set_chanspec() argument
3855 brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: 0x%x\n", wlc_hw->unit, in brcms_b_set_chanspec()
3858 wlc_hw->chanspec = chanspec; in brcms_b_set_chanspec()
3861 if (wlc_hw->_nbands > 1) { in brcms_b_set_chanspec()
3863 if (wlc_hw->band->bandunit != bandunit) { in brcms_b_set_chanspec()
3867 if (wlc_hw->up) { in brcms_b_set_chanspec()
3868 wlc_phy_chanspec_radio_set(wlc_hw-> in brcms_b_set_chanspec()
3871 brcms_b_setband(wlc_hw, bandunit, chanspec); in brcms_b_set_chanspec()
3873 brcms_c_setxband(wlc_hw, bandunit); in brcms_b_set_chanspec()
3878 wlc_phy_initcal_enable(wlc_hw->band->pi, !mute_tx); in brcms_b_set_chanspec()
3880 if (!wlc_hw->up) { in brcms_b_set_chanspec()
3881 if (wlc_hw->clk) in brcms_b_set_chanspec()
3882 wlc_phy_txpower_limit_set(wlc_hw->band->pi, txpwr, in brcms_b_set_chanspec()
3884 wlc_phy_chanspec_radio_set(wlc_hw->band->pi, chanspec); in brcms_b_set_chanspec()
3886 wlc_phy_chanspec_set(wlc_hw->band->pi, chanspec); in brcms_b_set_chanspec()
3887 wlc_phy_txpower_limit_set(wlc_hw->band->pi, txpwr, chanspec); in brcms_b_set_chanspec()
3890 brcms_b_mute(wlc_hw, mute_tx); in brcms_b_set_chanspec()
4219 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_watchdog() local
4221 if (!wlc_hw->up) in brcms_b_watchdog()
4225 wlc_hw->now++; in brcms_b_watchdog()
4228 brcms_b_fifoerrors(wlc_hw); in brcms_b_watchdog()
4233 wlc_phy_watchdog(wlc_hw->band->pi); in brcms_b_watchdog()
4407 struct brcms_hardware *wlc_hw; in brcms_b_attach() local
4427 wlc_hw = wlc->hw; in brcms_b_attach()
4428 wlc_hw->wlc = wlc; in brcms_b_attach()
4429 wlc_hw->unit = unit; in brcms_b_attach()
4430 wlc_hw->band = wlc_hw->bandstate[0]; in brcms_b_attach()
4431 wlc_hw->_piomode = piomode; in brcms_b_attach()
4434 brcms_b_info_init(wlc_hw); in brcms_b_attach()
4440 wlc_hw->sih = ai_attach(core->bus); in brcms_b_attach()
4441 if (wlc_hw->sih == NULL) { in brcms_b_attach()
4457 wlc_hw->vendorid = pcidev->vendor; in brcms_b_attach()
4458 wlc_hw->deviceid = pcidev->device; in brcms_b_attach()
4460 wlc_hw->vendorid = core->bus->boardinfo.vendor; in brcms_b_attach()
4461 wlc_hw->deviceid = core->bus->boardinfo.type; in brcms_b_attach()
4464 wlc_hw->d11core = core; in brcms_b_attach()
4465 wlc_hw->corerev = core->id.rev; in brcms_b_attach()
4468 if (!brcms_c_isgoodchip(wlc_hw)) { in brcms_b_attach()
4474 ai_clkctl_init(wlc_hw->sih); in brcms_b_attach()
4482 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_attach()
4483 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); in brcms_b_attach()
4485 if (!brcms_b_validate_chip_access(wlc_hw)) { in brcms_b_attach()
4497 wlc_hw->boardrev = (u16) j; in brcms_b_attach()
4498 if (!brcms_c_validboardtype(wlc_hw)) { in brcms_b_attach()
4501 unit, ai_get_boardtype(wlc_hw->sih), in brcms_b_attach()
4502 wlc_hw->boardrev); in brcms_b_attach()
4506 wlc_hw->sromrev = sprom->revision; in brcms_b_attach()
4507 wlc_hw->boardflags = sprom->boardflags_lo + (sprom->boardflags_hi << 16); in brcms_b_attach()
4508 wlc_hw->boardflags2 = sprom->boardflags2_lo + (sprom->boardflags2_hi << 16); in brcms_b_attach()
4510 if (wlc_hw->boardflags & BFL_NOPLLDOWN) in brcms_b_attach()
4511 brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED); in brcms_b_attach()
4514 if (wlc_hw->deviceid == BCM43224_D11N_ID || in brcms_b_attach()
4515 wlc_hw->deviceid == BCM43224_D11N_ID_VEN1 || in brcms_b_attach()
4516 wlc_hw->deviceid == BCM43224_CHIP_ID) in brcms_b_attach()
4518 wlc_hw->_nbands = 2; in brcms_b_attach()
4520 wlc_hw->_nbands = 1; in brcms_b_attach()
4522 if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225)) in brcms_b_attach()
4523 wlc_hw->_nbands = 1; in brcms_b_attach()
4528 wlc->vendorid = wlc_hw->vendorid; in brcms_b_attach()
4529 wlc->deviceid = wlc_hw->deviceid; in brcms_b_attach()
4530 wlc->pub->sih = wlc_hw->sih; in brcms_b_attach()
4531 wlc->pub->corerev = wlc_hw->corerev; in brcms_b_attach()
4532 wlc->pub->sromrev = wlc_hw->sromrev; in brcms_b_attach()
4533 wlc->pub->boardrev = wlc_hw->boardrev; in brcms_b_attach()
4534 wlc->pub->boardflags = wlc_hw->boardflags; in brcms_b_attach()
4535 wlc->pub->boardflags2 = wlc_hw->boardflags2; in brcms_b_attach()
4536 wlc->pub->_nbands = wlc_hw->_nbands; in brcms_b_attach()
4538 wlc_hw->physhim = wlc_phy_shim_attach(wlc_hw, wlc->wl, wlc); in brcms_b_attach()
4540 if (wlc_hw->physhim == NULL) { in brcms_b_attach()
4548 sha_params.sih = wlc_hw->sih; in brcms_b_attach()
4549 sha_params.physhim = wlc_hw->physhim; in brcms_b_attach()
4551 sha_params.corerev = wlc_hw->corerev; in brcms_b_attach()
4552 sha_params.vid = wlc_hw->vendorid; in brcms_b_attach()
4553 sha_params.did = wlc_hw->deviceid; in brcms_b_attach()
4554 sha_params.chip = ai_get_chip_id(wlc_hw->sih); in brcms_b_attach()
4555 sha_params.chiprev = ai_get_chiprev(wlc_hw->sih); in brcms_b_attach()
4556 sha_params.chippkg = ai_get_chippkg(wlc_hw->sih); in brcms_b_attach()
4557 sha_params.sromrev = wlc_hw->sromrev; in brcms_b_attach()
4558 sha_params.boardtype = ai_get_boardtype(wlc_hw->sih); in brcms_b_attach()
4559 sha_params.boardrev = wlc_hw->boardrev; in brcms_b_attach()
4560 sha_params.boardflags = wlc_hw->boardflags; in brcms_b_attach()
4561 sha_params.boardflags2 = wlc_hw->boardflags2; in brcms_b_attach()
4564 wlc_hw->phy_sh = wlc_phy_shared_attach(&sha_params); in brcms_b_attach()
4565 if (!wlc_hw->phy_sh) { in brcms_b_attach()
4571 for (j = 0; j < wlc_hw->_nbands; j++) { in brcms_b_attach()
4577 brcms_c_setxband(wlc_hw, j); in brcms_b_attach()
4579 wlc_hw->band->bandunit = j; in brcms_b_attach()
4580 wlc_hw->band->bandtype = j ? BRCM_BAND_5G : BRCM_BAND_2G; in brcms_b_attach()
4585 wlc_hw->machwcap = bcma_read32(core, D11REGOFFS(machwcap)); in brcms_b_attach()
4586 wlc_hw->machwcap_backup = wlc_hw->machwcap; in brcms_b_attach()
4589 WARN_ON(wlc_hw->corerev < XMTFIFOTBL_STARTREV || in brcms_b_attach()
4590 (wlc_hw->corerev - XMTFIFOTBL_STARTREV) > in brcms_b_attach()
4592 wlc_hw->xmtfifo_sz = in brcms_b_attach()
4593 xmtfifo_sz[(wlc_hw->corerev - XMTFIFOTBL_STARTREV)]; in brcms_b_attach()
4594 WARN_ON(!wlc_hw->xmtfifo_sz[0]); in brcms_b_attach()
4597 wlc_hw->band->pi = in brcms_b_attach()
4598 wlc_phy_attach(wlc_hw->phy_sh, core, in brcms_b_attach()
4599 wlc_hw->band->bandtype, in brcms_b_attach()
4601 if (wlc_hw->band->pi == NULL) { in brcms_b_attach()
4608 wlc_phy_machwcap_set(wlc_hw->band->pi, wlc_hw->machwcap); in brcms_b_attach()
4610 wlc_phy_get_phyversion(wlc_hw->band->pi, &wlc_hw->band->phytype, in brcms_b_attach()
4611 &wlc_hw->band->phyrev, in brcms_b_attach()
4612 &wlc_hw->band->radioid, in brcms_b_attach()
4613 &wlc_hw->band->radiorev); in brcms_b_attach()
4614 wlc_hw->band->abgphy_encore = in brcms_b_attach()
4615 wlc_phy_get_encore(wlc_hw->band->pi); in brcms_b_attach()
4616 wlc->band->abgphy_encore = wlc_phy_get_encore(wlc_hw->band->pi); in brcms_b_attach()
4617 wlc_hw->band->core_flags = in brcms_b_attach()
4618 wlc_phy_get_coreflags(wlc_hw->band->pi); in brcms_b_attach()
4621 if (BRCMS_ISNPHY(wlc_hw->band)) { in brcms_b_attach()
4622 if (NCONF_HAS(wlc_hw->band->phyrev)) in brcms_b_attach()
4626 } else if (BRCMS_ISLCNPHY(wlc_hw->band)) { in brcms_b_attach()
4627 if (LCNCONF_HAS(wlc_hw->band->phyrev)) in brcms_b_attach()
4635 wlc_hw->band->phytype, wlc_hw->band->phyrev); in brcms_b_attach()
4650 wlc->band->pi = wlc_hw->band->pi; in brcms_b_attach()
4651 wlc->band->phytype = wlc_hw->band->phytype; in brcms_b_attach()
4652 wlc->band->phyrev = wlc_hw->band->phyrev; in brcms_b_attach()
4653 wlc->band->radioid = wlc_hw->band->radioid; in brcms_b_attach()
4654 wlc->band->radiorev = wlc_hw->band->radiorev; in brcms_b_attach()
4659 wlc_hw->band->CWmin = APHY_CWMIN; in brcms_b_attach()
4660 wlc_hw->band->CWmax = PHY_CWMAX; in brcms_b_attach()
4669 brcms_c_coredisable(wlc_hw); in brcms_b_attach()
4672 bcma_host_pci_down(wlc_hw->d11core->bus); in brcms_b_attach()
4675 brcms_b_xtal(wlc_hw, OFF); in brcms_b_attach()
4688 brcms_c_get_macaddr(wlc_hw, wlc_hw->etheraddr); in brcms_b_attach()
4690 if (is_broadcast_ether_addr(wlc_hw->etheraddr) || in brcms_b_attach()
4691 is_zero_ether_addr(wlc_hw->etheraddr)) { in brcms_b_attach()
4698 brcms_dbg_info(wlc_hw->d11core, "deviceid 0x%x nbands %d board 0x%x\n", in brcms_b_attach()
4699 wlc_hw->deviceid, wlc_hw->_nbands, in brcms_b_attach()
4700 ai_get_boardtype(wlc_hw->sih)); in brcms_b_attach()
4840 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_b_detach() local
4842 brcms_b_detach_dmapio(wlc_hw); in brcms_b_detach()
4844 band = wlc_hw->band; in brcms_b_detach()
4845 for (i = 0; i < wlc_hw->_nbands; i++) { in brcms_b_detach()
4851 band = wlc_hw->bandstate[OTHERBANDUNIT(wlc)]; in brcms_b_detach()
4855 kfree(wlc_hw->phy_sh); in brcms_b_detach()
4857 wlc_phy_shim_detach(wlc_hw->physhim); in brcms_b_detach()
4859 if (wlc_hw->sih) { in brcms_b_detach()
4860 ai_detach(wlc_hw->sih); in brcms_b_detach()
4861 wlc_hw->sih = NULL; in brcms_b_detach()
4907 static void brcms_b_hw_up(struct brcms_hardware *wlc_hw) in brcms_b_hw_up() argument
4909 if (wlc_hw->wlc->pub->hw_up) in brcms_b_hw_up()
4912 brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_b_hw_up()
4918 brcms_b_xtal(wlc_hw, ON); in brcms_b_hw_up()
4919 ai_clkctl_init(wlc_hw->sih); in brcms_b_hw_up()
4920 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_hw_up()
4933 wlc_phy_por_inform(wlc_hw->band->pi); in brcms_b_hw_up()
4935 wlc_hw->ucode_loaded = false; in brcms_b_hw_up()
4936 wlc_hw->wlc->pub->hw_up = true; in brcms_b_hw_up()
4938 if ((wlc_hw->boardflags & BFL_FEM) in brcms_b_hw_up()
4939 && (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) { in brcms_b_hw_up()
4941 (wlc_hw->boardrev >= 0x1250 in brcms_b_hw_up()
4942 && (wlc_hw->boardflags & BFL_FEM_BT))) in brcms_b_hw_up()
4943 ai_epa_4313war(wlc_hw->sih); in brcms_b_hw_up()
4947 static int brcms_b_up_prep(struct brcms_hardware *wlc_hw) in brcms_b_up_prep() argument
4949 brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); in brcms_b_up_prep()
4955 brcms_b_xtal(wlc_hw, ON); in brcms_b_up_prep()
4956 ai_clkctl_init(wlc_hw->sih); in brcms_b_up_prep()
4957 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_up_prep()
4963 bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core, in brcms_b_up_prep()
4971 if (brcms_b_radio_read_hwdisabled(wlc_hw)) { in brcms_b_up_prep()
4973 bcma_host_pci_down(wlc_hw->d11core->bus); in brcms_b_up_prep()
4974 brcms_b_xtal(wlc_hw, OFF); in brcms_b_up_prep()
4978 bcma_host_pci_up(wlc_hw->d11core->bus); in brcms_b_up_prep()
4981 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); in brcms_b_up_prep()
4986 static int brcms_b_up_finish(struct brcms_hardware *wlc_hw) in brcms_b_up_finish() argument
4988 wlc_hw->up = true; in brcms_b_up_finish()
4989 wlc_phy_hw_state_upd(wlc_hw->band->pi, true); in brcms_b_up_finish()
4992 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); in brcms_b_up_finish()
4993 brcms_intrson(wlc_hw->wlc->wl); in brcms_b_up_finish()
5116 static int brcms_b_bmac_down_prep(struct brcms_hardware *wlc_hw) in brcms_b_bmac_down_prep() argument
5121 if (!wlc_hw->up) in brcms_b_bmac_down_prep()
5124 dev_gone = brcms_deviceremoved(wlc_hw->wlc); in brcms_b_bmac_down_prep()
5128 wlc_hw->wlc->macintmask = 0; in brcms_b_bmac_down_prep()
5131 brcms_intrsoff(wlc_hw->wlc->wl); in brcms_b_bmac_down_prep()
5134 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); in brcms_b_bmac_down_prep()
5137 callbacks += wlc_phy_down(wlc_hw->band->pi); in brcms_b_bmac_down_prep()
5142 static int brcms_b_down_finish(struct brcms_hardware *wlc_hw) in brcms_b_down_finish() argument
5147 if (!wlc_hw->up) in brcms_b_down_finish()
5150 wlc_hw->up = false; in brcms_b_down_finish()
5151 wlc_phy_hw_state_upd(wlc_hw->band->pi, false); in brcms_b_down_finish()
5153 dev_gone = brcms_deviceremoved(wlc_hw->wlc); in brcms_b_down_finish()
5156 wlc_hw->sbclk = false; in brcms_b_down_finish()
5157 wlc_hw->clk = false; in brcms_b_down_finish()
5158 wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); in brcms_b_down_finish()
5161 brcms_c_flushqueues(wlc_hw->wlc); in brcms_b_down_finish()
5165 if (bcma_core_is_enabled(wlc_hw->d11core)) { in brcms_b_down_finish()
5166 if (bcma_read32(wlc_hw->d11core, in brcms_b_down_finish()
5168 brcms_c_suspend_mac_and_wait(wlc_hw->wlc); in brcms_b_down_finish()
5169 callbacks += brcms_reset(wlc_hw->wlc->wl); in brcms_b_down_finish()
5170 brcms_c_coredisable(wlc_hw); in brcms_b_down_finish()
5174 if (!wlc_hw->noreset) { in brcms_b_down_finish()
5175 bcma_host_pci_down(wlc_hw->d11core->bus); in brcms_b_down_finish()
5176 brcms_b_xtal(wlc_hw, OFF); in brcms_b_down_finish()
5689 u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate) in brcms_b_rate_shm_offset() argument
5709 return 2 * brcms_b_read_shm(wlc_hw, table_ptr + (index * 2)); in brcms_b_rate_shm_offset()
7016 brcms_b_read_tsf(struct brcms_hardware *wlc_hw, u32 *tsf_l_ptr, in brcms_b_read_tsf() argument
7019 struct bcma_device *core = wlc_hw->d11core; in brcms_b_read_tsf()
7310 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_beacon_write() local
7328 brcms_b_write_template_ram(wlc_hw, T_BCN0_TPL_BASE, in brcms_c_beacon_write()
7332 brcms_b_write_shm(wlc_hw, M_BCN0_FRM_BYTESZ, (u16) len); in brcms_c_beacon_write()
7336 brcms_b_write_template_ram(wlc_hw, T_BCN1_TPL_BASE, in brcms_c_beacon_write()
7340 brcms_b_write_shm(wlc_hw, M_BCN1_FRM_BYTESZ, (u16) len); in brcms_c_beacon_write()
7344 brcms_b_write_shm(wlc_hw, M_TIMBPOS_INBEACON, in brcms_c_beacon_write()
7346 brcms_b_write_shm(wlc_hw, M_DOT11_DTIMPERIOD, dtim_period); in brcms_c_beacon_write()
7348 brcms_b_write_shm(wlc_hw, M_TIMBPOS_INBEACON, in brcms_c_beacon_write()
7350 brcms_b_write_shm(wlc_hw, M_DOT11_DTIMPERIOD, 0); in brcms_c_beacon_write()
7358 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_update_beacon_hw() local
7359 struct bcma_device *core = wlc_hw->d11core; in brcms_c_update_beacon_hw()
7531 int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, in brcms_b_xmtfifo_sz_get() argument
7537 *blocks = wlc_hw->xmtfifo_sz[fifo]; in brcms_b_xmtfifo_sz_get()
7720 brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) in brcms_b_recv() argument
7738 morepending = dma_rx(wlc_hw->di[fifo], &recv_frames); in brcms_b_recv()
7743 dma_rxfill(wlc_hw->di[fifo]); in brcms_b_recv()
7767 brcms_c_recv(wlc_hw->wlc, p); in brcms_b_recv()
7780 struct brcms_hardware *wlc_hw = wlc->hw; in brcms_c_dpc() local
7781 struct bcma_device *core = wlc_hw->d11core; in brcms_c_dpc()
7784 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, in brcms_c_dpc()
7795 wlc_hw->unit, macintstatus); in brcms_c_dpc()
7825 if (brcms_b_recv(wlc_hw, RX_FIFO, bounded)) in brcms_c_dpc()
7830 wlc_phy_noise_sample_intr(wlc_hw->band->pi); in brcms_c_dpc()
7834 "(seconds). Resetting.\n", wlc_hw->unit, wlc_hw->now); in brcms_c_dpc()
7837 __func__, ai_get_chip_id(wlc_hw->sih), in brcms_c_dpc()
7838 ai_get_chiprev(wlc_hw->sih)); in brcms_c_dpc()
7839 brcms_fatal_error(wlc_hw->wlc->wl); in brcms_c_dpc()
7848 " RF Disable Input\n", wlc_hw->unit); in brcms_c_dpc()
7860 brcms_fatal_error(wlc_hw->wlc->wl); in brcms_c_dpc()