Lines Matching refs:wlc

31 #define BRCMS_STF_SS_STBC_RX(wlc) (BRCMS_ISNPHY(wlc->band) && \  argument
32 NREV_GT(wlc->band->phyrev, 3) && NREV_LE(wlc->band->phyrev, 6))
47 static void brcms_c_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val) in brcms_c_stf_stbc_rx_ht_update() argument
50 if (BRCMS_STF_SS_STBC_RX(wlc)) { in brcms_c_stf_stbc_rx_ht_update()
51 if ((wlc->stf->rxstreams == 1) && (val != HT_CAP_RX_STBC_NO)) in brcms_c_stf_stbc_rx_ht_update()
55 if (wlc->pub->up) { in brcms_c_stf_stbc_rx_ht_update()
56 brcms_c_update_beacon(wlc); in brcms_c_stf_stbc_rx_ht_update()
57 brcms_c_update_probe_resp(wlc, true); in brcms_c_stf_stbc_rx_ht_update()
65 void brcms_c_tempsense_upd(struct brcms_c_info *wlc) in brcms_c_tempsense_upd() argument
67 struct brcms_phy_pub *pi = wlc->band->pi; in brcms_c_tempsense_upd()
75 if (wlc->stf->txchain == wlc->stf->hw_txchain) { in brcms_c_tempsense_upd()
76 if (txchain && (txchain < wlc->stf->hw_txchain)) in brcms_c_tempsense_upd()
78 brcms_c_stf_txchain_set(wlc, txchain, true); in brcms_c_tempsense_upd()
79 } else if (wlc->stf->txchain < wlc->stf->hw_txchain) { in brcms_c_tempsense_upd()
80 if (txchain == wlc->stf->hw_txchain) in brcms_c_tempsense_upd()
82 brcms_c_stf_txchain_set(wlc, txchain, true); in brcms_c_tempsense_upd()
87 brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel, in brcms_c_stf_ss_algo_channel_get() argument
96 if (!wlc->pub->up) { in brcms_c_stf_ss_algo_channel_get()
101 wlc_phy_txpower_get_current(wlc->band->pi, &power, in brcms_c_stf_ss_algo_channel_get()
131 static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val) in brcms_c_stf_stbc_tx_set() argument
136 if ((int_val == ON) && (wlc->stf->txstreams == 1)) in brcms_c_stf_stbc_tx_set()
139 wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = (s8) int_val; in brcms_c_stf_stbc_tx_set()
140 wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = (s8) int_val; in brcms_c_stf_stbc_tx_set()
145 bool brcms_c_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val) in brcms_c_stf_stbc_rx_set() argument
151 if (BRCMS_STF_SS_STBC_RX(wlc)) { in brcms_c_stf_stbc_rx_set()
153 && (wlc->stf->rxstreams == 1)) in brcms_c_stf_stbc_rx_set()
157 brcms_c_stf_stbc_rx_ht_update(wlc, int_val); in brcms_c_stf_stbc_rx_set()
161 static int brcms_c_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts, in brcms_c_stf_txcore_set() argument
164 brcms_dbg_ht(wlc->hw->d11core, "wl%d: Nsts %d core_mask %x\n", in brcms_c_stf_txcore_set()
165 wlc->pub->unit, Nsts, core_mask); in brcms_c_stf_txcore_set()
167 if (hweight8(core_mask) > wlc->stf->txstreams) in brcms_c_stf_txcore_set()
170 if ((hweight8(core_mask) == wlc->stf->txstreams) && in brcms_c_stf_txcore_set()
171 ((core_mask & ~wlc->stf->txchain) in brcms_c_stf_txcore_set()
172 || !(core_mask & wlc->stf->txchain))) in brcms_c_stf_txcore_set()
173 core_mask = wlc->stf->txchain; in brcms_c_stf_txcore_set()
175 wlc->stf->txcore[Nsts] = core_mask; in brcms_c_stf_txcore_set()
181 wlc->stf->phytxant = core_mask << PHY_TXC_ANT_SHIFT; in brcms_c_stf_txcore_set()
182 brcms_b_txant_set(wlc->hw, wlc->stf->phytxant); in brcms_c_stf_txcore_set()
183 if (wlc->clk) { in brcms_c_stf_txcore_set()
184 brcms_c_suspend_mac_and_wait(wlc); in brcms_c_stf_txcore_set()
185 brcms_c_beacon_phytxctl_txant_upd(wlc, wlc->bcn_rspec); in brcms_c_stf_txcore_set()
186 brcms_c_enable_mac(wlc); in brcms_c_stf_txcore_set()
193 static int brcms_c_stf_spatial_policy_set(struct brcms_c_info *wlc, int val) in brcms_c_stf_spatial_policy_set() argument
198 brcms_dbg_ht(wlc->hw->d11core, "wl%d: val %x\n", wlc->pub->unit, in brcms_c_stf_spatial_policy_set()
201 wlc->stf->spatial_policy = (s8) val; in brcms_c_stf_spatial_policy_set()
204 wlc->stf->txchain : txcore_default[i]; in brcms_c_stf_spatial_policy_set()
205 brcms_c_stf_txcore_set(wlc, (u8) i, core_mask); in brcms_c_stf_spatial_policy_set()
226 static void _brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc) in _brcms_c_stf_phy_txant_upd() argument
230 txant = (s8) wlc->stf->txant; in _brcms_c_stf_phy_txant_upd()
231 if (BRCMS_PHY_11N_CAP(wlc->band)) { in _brcms_c_stf_phy_txant_upd()
233 wlc->stf->phytxant = PHY_TXC_ANT_0; in _brcms_c_stf_phy_txant_upd()
235 wlc->stf->phytxant = PHY_TXC_ANT_1; in _brcms_c_stf_phy_txant_upd()
237 if (BRCMS_ISNPHY(wlc->band) && in _brcms_c_stf_phy_txant_upd()
238 NREV_GE(wlc->band->phyrev, 3) in _brcms_c_stf_phy_txant_upd()
239 && NREV_LT(wlc->band->phyrev, 7)) in _brcms_c_stf_phy_txant_upd()
240 wlc->stf->phytxant = PHY_TXC_ANT_2; in _brcms_c_stf_phy_txant_upd()
242 if (BRCMS_ISLCNPHY(wlc->band) || in _brcms_c_stf_phy_txant_upd()
243 BRCMS_ISSSLPNPHY(wlc->band)) in _brcms_c_stf_phy_txant_upd()
244 wlc->stf->phytxant = PHY_TXC_LCNPHY_ANT_LAST; in _brcms_c_stf_phy_txant_upd()
247 WARN_ON(wlc->stf->txchain <= 0); in _brcms_c_stf_phy_txant_upd()
248 wlc->stf->phytxant = in _brcms_c_stf_phy_txant_upd()
249 wlc->stf->txchain << PHY_TXC_ANT_SHIFT; in _brcms_c_stf_phy_txant_upd()
254 wlc->stf->phytxant = PHY_TXC_OLD_ANT_0; in _brcms_c_stf_phy_txant_upd()
256 wlc->stf->phytxant = PHY_TXC_OLD_ANT_1; in _brcms_c_stf_phy_txant_upd()
258 wlc->stf->phytxant = PHY_TXC_OLD_ANT_LAST; in _brcms_c_stf_phy_txant_upd()
261 brcms_b_txant_set(wlc->hw, wlc->stf->phytxant); in _brcms_c_stf_phy_txant_upd()
264 int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force) in brcms_c_stf_txchain_set() argument
270 if (wlc->stf->txchain == txchain) in brcms_c_stf_txchain_set()
273 if ((txchain & ~wlc->stf->hw_txchain) in brcms_c_stf_txchain_set()
274 || !(txchain & wlc->stf->hw_txchain)) in brcms_c_stf_txchain_set()
285 wlc->stf->txchain = txchain; in brcms_c_stf_txchain_set()
286 wlc->stf->txstreams = txstreams; in brcms_c_stf_txchain_set()
287 brcms_c_stf_stbc_tx_set(wlc, wlc->band->band_stf_stbc_tx); in brcms_c_stf_txchain_set()
288 brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); in brcms_c_stf_txchain_set()
289 brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); in brcms_c_stf_txchain_set()
290 wlc->stf->txant = in brcms_c_stf_txchain_set()
291 (wlc->stf->txstreams == 1) ? ANT_TX_FORCE_0 : ANT_TX_DEF; in brcms_c_stf_txchain_set()
292 _brcms_c_stf_phy_txant_upd(wlc); in brcms_c_stf_txchain_set()
294 wlc_phy_stf_chain_set(wlc->band->pi, wlc->stf->txchain, in brcms_c_stf_txchain_set()
295 wlc->stf->rxchain); in brcms_c_stf_txchain_set()
298 brcms_c_stf_txcore_set(wlc, (u8) i, txcore_default[i]); in brcms_c_stf_txchain_set()
307 void brcms_c_stf_ss_update(struct brcms_c_info *wlc, struct brcms_band *band) in brcms_c_stf_ss_update() argument
312 prev_stf_ss = wlc->stf->ss_opmode; in brcms_c_stf_ss_update()
318 if (BRCMS_STBC_CAP_PHY(wlc) && in brcms_c_stf_ss_update()
319 wlc->stf->ss_algosel_auto in brcms_c_stf_ss_update()
320 && (wlc->stf->ss_algo_channel != (u16) -1)) { in brcms_c_stf_ss_update()
321 upd_stf_ss = (wlc->stf->txstreams == 1 || in brcms_c_stf_ss_update()
322 isset(&wlc->stf->ss_algo_channel, in brcms_c_stf_ss_update()
326 if (wlc->band != band) in brcms_c_stf_ss_update()
328 upd_stf_ss = (wlc->stf->txstreams == 1) ? in brcms_c_stf_ss_update()
332 wlc->stf->ss_opmode = upd_stf_ss; in brcms_c_stf_ss_update()
333 brcms_b_band_stf_ss_set(wlc->hw, upd_stf_ss); in brcms_c_stf_ss_update()
337 int brcms_c_stf_attach(struct brcms_c_info *wlc) in brcms_c_stf_attach() argument
339 wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_SISO; in brcms_c_stf_attach()
340 wlc->bandstate[BAND_5G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_CDD; in brcms_c_stf_attach()
342 if (BRCMS_ISNPHY(wlc->band) && in brcms_c_stf_attach()
343 (wlc_phy_txpower_hw_ctrl_get(wlc->band->pi) != PHY_TPC_HW_ON)) in brcms_c_stf_attach()
344 wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = in brcms_c_stf_attach()
346 brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); in brcms_c_stf_attach()
347 brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); in brcms_c_stf_attach()
349 brcms_c_stf_stbc_rx_ht_update(wlc, HT_CAP_RX_STBC_NO); in brcms_c_stf_attach()
350 wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = OFF; in brcms_c_stf_attach()
351 wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = OFF; in brcms_c_stf_attach()
353 if (BRCMS_STBC_CAP_PHY(wlc)) { in brcms_c_stf_attach()
354 wlc->stf->ss_algosel_auto = true; in brcms_c_stf_attach()
356 wlc->stf->ss_algo_channel = (u16) -1; in brcms_c_stf_attach()
361 void brcms_c_stf_detach(struct brcms_c_info *wlc) in brcms_c_stf_detach() argument
365 void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc) in brcms_c_stf_phy_txant_upd() argument
367 _brcms_c_stf_phy_txant_upd(wlc); in brcms_c_stf_phy_txant_upd()
370 void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc) in brcms_c_stf_phy_chain_calc() argument
372 struct ssb_sprom *sprom = &wlc->hw->d11core->bus->sprom; in brcms_c_stf_phy_chain_calc()
375 wlc->stf->hw_txchain = sprom->txchain; in brcms_c_stf_phy_chain_calc()
376 wlc->stf->hw_rxchain = sprom->rxchain; in brcms_c_stf_phy_chain_calc()
379 if (wlc->stf->hw_txchain == 0 || wlc->stf->hw_txchain == 0xf) { in brcms_c_stf_phy_chain_calc()
380 if (BRCMS_ISNPHY(wlc->band)) in brcms_c_stf_phy_chain_calc()
381 wlc->stf->hw_txchain = TXCHAIN_DEF_NPHY; in brcms_c_stf_phy_chain_calc()
383 wlc->stf->hw_txchain = TXCHAIN_DEF; in brcms_c_stf_phy_chain_calc()
386 wlc->stf->txchain = wlc->stf->hw_txchain; in brcms_c_stf_phy_chain_calc()
387 wlc->stf->txstreams = (u8) hweight8(wlc->stf->hw_txchain); in brcms_c_stf_phy_chain_calc()
389 if (wlc->stf->hw_rxchain == 0 || wlc->stf->hw_rxchain == 0xf) { in brcms_c_stf_phy_chain_calc()
390 if (BRCMS_ISNPHY(wlc->band)) in brcms_c_stf_phy_chain_calc()
391 wlc->stf->hw_rxchain = RXCHAIN_DEF_NPHY; in brcms_c_stf_phy_chain_calc()
393 wlc->stf->hw_rxchain = RXCHAIN_DEF; in brcms_c_stf_phy_chain_calc()
396 wlc->stf->rxchain = wlc->stf->hw_rxchain; in brcms_c_stf_phy_chain_calc()
397 wlc->stf->rxstreams = (u8) hweight8(wlc->stf->hw_rxchain); in brcms_c_stf_phy_chain_calc()
400 memcpy(wlc->stf->txcore, txcore_default, sizeof(wlc->stf->txcore)); in brcms_c_stf_phy_chain_calc()
403 wlc->stf->spatial_policy = MIN_SPATIAL_EXPANSION; in brcms_c_stf_phy_chain_calc()
404 brcms_c_stf_spatial_policy_set(wlc, MIN_SPATIAL_EXPANSION); in brcms_c_stf_phy_chain_calc()
407 static u16 _brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc, in _brcms_c_stf_phytxchain_sel() argument
410 u16 phytxant = wlc->stf->phytxant; in _brcms_c_stf_phytxchain_sel()
413 phytxant = wlc->stf->txchain << PHY_TXC_ANT_SHIFT; in _brcms_c_stf_phytxchain_sel()
414 else if (wlc->stf->txant == ANT_TX_DEF) in _brcms_c_stf_phytxchain_sel()
415 phytxant = wlc->stf->txchain << PHY_TXC_ANT_SHIFT; in _brcms_c_stf_phytxchain_sel()
420 u16 brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc, u32 rspec) in brcms_c_stf_phytxchain_sel() argument
422 return _brcms_c_stf_phytxchain_sel(wlc, rspec); in brcms_c_stf_phytxchain_sel()
425 u16 brcms_c_stf_d11hdrs_phyctl_txant(struct brcms_c_info *wlc, u32 rspec) in brcms_c_stf_d11hdrs_phyctl_txant() argument
427 u16 phytxant = wlc->stf->phytxant; in brcms_c_stf_d11hdrs_phyctl_txant()
431 if (BRCMS_ISNPHY(wlc->band)) { in brcms_c_stf_d11hdrs_phyctl_txant()
432 phytxant = _brcms_c_stf_phytxchain_sel(wlc, rspec); in brcms_c_stf_d11hdrs_phyctl_txant()