14Srgrimes/* 24Srgrimes * Copyright (c) 2010 Broadcom Corporation 34Srgrimes * 44Srgrimes * Permission to use, copy, modify, and/or distribute this software for any 54Srgrimes * purpose with or without fee is hereby granted, provided that the above 64Srgrimes * copyright notice and this permission notice appear in all copies. 74Srgrimes * 84Srgrimes * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 94Srgrimes * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 104Srgrimes * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 114Srgrimes * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 124Srgrimes * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 134Srgrimes * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 144Srgrimes * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 154Srgrimes */ 164Srgrimes 174Srgrimes#include <net/mac80211.h> 184Srgrimes 194Srgrimes#include "types.h" 204Srgrimes#include "d11.h" 214Srgrimes#include "rate.h" 224Srgrimes#include "phy/phy_hal.h" 234Srgrimes#include "channel.h" 244Srgrimes#include "main.h" 254Srgrimes#include "stf.h" 264Srgrimes#include "debug.h" 274Srgrimes 284Srgrimes#define MIN_SPATIAL_EXPANSION 0 294Srgrimes#define MAX_SPATIAL_EXPANSION 1 304Srgrimes 314Srgrimes#define BRCMS_STF_SS_STBC_RX(wlc) (BRCMS_ISNPHY(wlc->band) && \ 324Srgrimes NREV_GT(wlc->band->phyrev, 3) && NREV_LE(wlc->band->phyrev, 6)) 334Srgrimes 344Srgrimes#define NSTS_1 1 354Srgrimes#define NSTS_2 2 36619Srgrimes#define NSTS_3 3 3750477Speter#define NSTS_4 4 384Srgrimes 394Srgrimesstatic const u8 txcore_default[5] = { 403185Ssos (0), /* bitmap of the core enabled */ 4119173Sbde (0x01), /* For Nsts = 1, enable core 1 */ 4219173Sbde (0x03), /* For Nsts = 2, enable core 1 & 2 */ 4319173Sbde (0x07), /* For Nsts = 3, enable core 1, 2 & 3 */ 4419173Sbde (0x0f) /* For Nsts = 4, enable all cores */ 453185Ssos}; 463185Ssos 473185Ssosstatic void brcms_c_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val) 483185Ssos{ 492913Sache /* MIMOPHYs rev3-6 cannot receive STBC with only one rx core active */ 502913Sache if (BRCMS_STF_SS_STBC_RX(wlc)) { 5116299Spst if ((wlc->stf->rxstreams == 1) && (val != HT_CAP_RX_STBC_NO)) 5289980Sbde return; 5371797Speter } 5413228Swollman 552056Swollman if (wlc->pub->up) { 562056Swollman brcms_c_update_beacon(wlc); 5761994Smsmith brcms_c_update_probe_resp(wlc, true); 5874914Sjhb } 5967356Sjhb} 6065557Sjasone 612056Swollman/* 6258377Sphk * every WLC_TEMPSENSE_PERIOD seconds temperature check to decide whether to 632056Swollman * turn on/off txchain. 6415508Sbde */ 6549558Sphkvoid brcms_c_tempsense_upd(struct brcms_c_info *wlc) 6685835Siwasaki{ 6715508Sbde struct brcms_phy_pub *pi = wlc->band->pi; 684180Sbde uint active_chains, txchain; 6915508Sbde 7015508Sbde /* Check if the chip is too hot. Disable one Tx chain, if it is */ 7130805Sbde /* high 4 bits are for Rx chain, low 4 bits are for Tx chain */ 722056Swollman active_chains = wlc_phy_stf_chain_active_get(pi); 7328551Sbde txchain = active_chains & 0xf; 7432054Sphk 7547588Sbde if (wlc->stf->txchain == wlc->stf->hw_txchain) { 7630805Sbde if (txchain && (txchain < wlc->stf->hw_txchain)) 7730805Sbde /* turn off 1 tx chain */ 7830805Sbde brcms_c_stf_txchain_set(wlc, txchain, true); 7928921Sfsmp } else if (wlc->stf->txchain < wlc->stf->hw_txchain) { 8026949Sfsmp if (txchain == wlc->stf->hw_txchain) 8128921Sfsmp /* turn back on txchain */ 8232054Sphk brcms_c_stf_txchain_set(wlc, txchain, true); 8315508Sbde } 842056Swollman} 852056Swollman 8647642Sdfrvoid 8789980Sbdebrcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel, 8861994Smsmith u16 chanspec) 8989980Sbde{ 902056Swollman struct tx_power power = { }; 914Srgrimes u8 siso_mcs_id, cdd_mcs_id, stbc_mcs_id; 9245897Speter 9328487Sfsmp /* Clear previous settings */ 9471797Speter *ss_algo_channel = 0; 9550823Smdodd 9650823Smdodd if (!wlc->pub->up) { 9750823Smdodd *ss_algo_channel = (u16) -1; 9834571Stegge return; 9934571Stegge } 10034058Stegge 10134058Stegge wlc_phy_txpower_get_current(wlc->band->pi, &power, 10234571Stegge CHSPEC_CHANNEL(chanspec)); 10334571Stegge 10434571Stegge siso_mcs_id = (CHSPEC_IS40(chanspec)) ? 10528921Sfsmp WL_TX_POWER_MCS40_SISO_FIRST : WL_TX_POWER_MCS20_SISO_FIRST; 1062873Sbde cdd_mcs_id = (CHSPEC_IS40(chanspec)) ? 1072873Sbde WL_TX_POWER_MCS40_CDD_FIRST : WL_TX_POWER_MCS20_CDD_FIRST; 1082873Sbde stbc_mcs_id = (CHSPEC_IS40(chanspec)) ? 1092873Sbde WL_TX_POWER_MCS40_STBC_FIRST : WL_TX_POWER_MCS20_STBC_FIRST; 1102873Sbde 1112913Sache /* criteria to choose stf mode */ 1122873Sbde 11315508Sbde /* 1144Srgrimes * the "+3dbm (12 0.25db units)" is to account for the fact that with 1154180Sbde * CDD, tx occurs on both chains 1164180Sbde */ 1174180Sbde if (power.target[siso_mcs_id] > (power.target[cdd_mcs_id] + 12)) 1184180Sbde setbit(ss_algo_channel, PHY_TXC1_MODE_SISO); 1194180Sbde else 1204180Sbde setbit(ss_algo_channel, PHY_TXC1_MODE_CDD); 1214180Sbde 1224180Sbde /* 1234180Sbde * STBC is ORed into to algo channel as STBC requires per-packet SCB 1244180Sbde * capability check so cannot be default mode of operation. One of 12517236Sjoerg * SISO, CDD have to be set 12617231Sjoerg */ 12733690Sphk if (power.target[siso_mcs_id] <= (power.target[stbc_mcs_id] + 12)) 1284180Sbde setbit(ss_algo_channel, PHY_TXC1_MODE_STBC); 12917231Sjoerg} 1304180Sbde 13141787Smckaystatic bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val) 13247588Sbde{ 13315045Sache if ((int_val != AUTO) && (int_val != OFF) && (int_val != ON)) 13432052Sphk return false; 13533690Sphk 13633690Sphk if ((int_val == ON) && (wlc->stf->txstreams == 1)) 13733690Sphk return false; 13832052Sphk 13932052Sphk wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = (s8) int_val; 14032005Sphk wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = (s8) int_val; 14147592Sphk 14272678Sbde return true; 14341787Smckay} 14471320Sjasone 1451390Ssosbool brcms_c_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val) 1464180Sbde{ 1474180Sbde if ((int_val != HT_CAP_RX_STBC_NO) 14819173Sbde && (int_val != HT_CAP_RX_STBC_ONE_STREAM)) 14933690Sphk return false; 15033690Sphk 15133690Sphk if (BRCMS_STF_SS_STBC_RX(wlc)) { 1524180Sbde if ((int_val != HT_CAP_RX_STBC_NO) 1534180Sbde && (wlc->stf->rxstreams == 1)) 1544180Sbde return false; 15554890Speter } 1564180Sbde 1574180Sbde brcms_c_stf_stbc_rx_ht_update(wlc, int_val); 15819173Sbde return true; 15919173Sbde} 1604180Sbde 16115345Snatestatic int brcms_c_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts, 16233690Sphk u8 core_mask) 16317231Sjoerg{ 16417231Sjoerg brcms_dbg_ht(wlc->hw->d11core, "wl%d: Nsts %d core_mask %x\n", 16517236Sjoerg wlc->pub->unit, Nsts, core_mask); 16617236Sjoerg 16717236Sjoerg if (hweight8(core_mask) > wlc->stf->txstreams) 16817236Sjoerg core_mask = 0; 16917231Sjoerg 17017231Sjoerg if ((hweight8(core_mask) == wlc->stf->txstreams) && 17117231Sjoerg ((core_mask & ~wlc->stf->txchain) 17219173Sbde || !(core_mask & wlc->stf->txchain))) 1734180Sbde core_mask = wlc->stf->txchain; 17436719Sphk 17536719Sphk wlc->stf->txcore[Nsts] = core_mask; 17621783Sbde /* Nsts = 1..4, txcore index = 1..4 */ 17717353Sbde if (Nsts == 1) { 17840610Sphk /* Needs to update beacon and ucode generated response 17933690Sphk * frames when 1 stream core map changed 18036741Sphk */ 18136198Sphk wlc->stf->phytxant = core_mask << PHY_TXC_ANT_SHIFT; 18233690Sphk brcms_b_txant_set(wlc->hw, wlc->stf->phytxant); 18333690Sphk if (wlc->clk) { 18433690Sphk brcms_c_suspend_mac_and_wait(wlc); 18533690Sphk brcms_c_beacon_phytxctl_txant_upd(wlc, wlc->bcn_rspec); 18633690Sphk brcms_c_enable_mac(wlc); 18740610Sphk } 18833690Sphk } 18940610Sphk 19033690Sphk return 0; 19136741Sphk} 19267759Sphk 19333690Sphkstatic int brcms_c_stf_spatial_policy_set(struct brcms_c_info *wlc, int val) 19433690Sphk{ 19533690Sphk int i; 19633690Sphk u8 core_mask = 0; 19733690Sphk 19840610Sphk brcms_dbg_ht(wlc->hw->d11core, "wl%d: val %x\n", wlc->pub->unit, 19933690Sphk val); 20012724Sphk 2013185Ssos wlc->stf->spatial_policy = (s8) val; 2022074Swollman for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) { 20365557Sjasone core_mask = (val == MAX_SPATIAL_EXPANSION) ? 20439503Sbde wlc->stf->txchain : txcore_default[i]; 20572200Sbmilekic brcms_c_stf_txcore_set(wlc, (u8) i, core_mask); 20647588Sbde } 20739503Sbde return 0; 20847588Sbde} 20939503Sbde 21039503Sbde/* 21139503Sbde * Centralized txant update function. call it whenever wlc->stf->txant and/or 21247588Sbde * wlc->stf->txchain change. 21372200Sbmilekic * 21439503Sbde * Antennas are controlled by ucode indirectly, which drives PHY or GPIO to 2151549Srgrimes * achieve various tx/rx antenna selection schemes 21676078Sjhb * 21776078Sjhb * legacy phy, bit 6 and bit 7 means antenna 0 and 1 respectively, bit6+bit7 21876078Sjhb * means auto(last rx). 21976078Sjhb * for NREV<3, bit 6 and bit 7 means antenna 0 and 1 respectively, bit6+bit7 2201442Ssos * means last rx and do tx-antenna selection for SISO transmissions 22117236Sjoerg * for NREV=3, bit 6 and bit _8_ means antenna 0 and 1 respectively, bit6+bit7 22217231Sjoerg * means last rx and do tx-antenna selection for SISO transmissions 2231442Ssos * for NREV>=7, bit 6 and bit 7 mean antenna 0 and 1 respectively, nit6+bit7 22417236Sjoerg * means both cores active 22517231Sjoerg*/ 2264180Sbdestatic void _brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc) 2274180Sbde{ 22833309Sbde s8 txant; 2291549Srgrimes 23076089Sjhb txant = (s8) wlc->stf->txant; 23176089Sjhb if (BRCMS_PHY_11N_CAP(wlc->band)) { 23276089Sjhb if (txant == ANT_TX_FORCE_0) { 2331390Ssos wlc->stf->phytxant = PHY_TXC_ANT_0; 2341442Ssos } else if (txant == ANT_TX_FORCE_1) { 23517236Sjoerg wlc->stf->phytxant = PHY_TXC_ANT_1; 23617231Sjoerg 23772200Sbmilekic if (BRCMS_ISNPHY(wlc->band) && 23848889Sbde NREV_GE(wlc->band->phyrev, 3) 23948889Sbde && NREV_LT(wlc->band->phyrev, 7)) 2404180Sbde wlc->stf->phytxant = PHY_TXC_ANT_2; 2414180Sbde } else { 2424180Sbde if (BRCMS_ISLCNPHY(wlc->band) || 2434180Sbde BRCMS_ISSSLPNPHY(wlc->band)) 24472200Sbmilekic wlc->stf->phytxant = PHY_TXC_LCNPHY_ANT_LAST; 2451442Ssos else { 24617231Sjoerg /* catch out of sync wlc->stf->txcore */ 2471442Ssos WARN_ON(wlc->stf->txchain <= 0); 24817236Sjoerg wlc->stf->phytxant = 24917231Sjoerg wlc->stf->txchain << PHY_TXC_ANT_SHIFT; 2504180Sbde } 2514180Sbde } 25272200Sbmilekic } else { 25348889Sbde if (txant == ANT_TX_FORCE_0) 25448889Sbde wlc->stf->phytxant = PHY_TXC_OLD_ANT_0; 2555291Sbde else if (txant == ANT_TX_FORCE_1) 2564180Sbde wlc->stf->phytxant = PHY_TXC_OLD_ANT_1; 2574180Sbde else 2584180Sbde wlc->stf->phytxant = PHY_TXC_OLD_ANT_LAST; 2594180Sbde } 26072200Sbmilekic 2614180Sbde brcms_b_txant_set(wlc->hw, wlc->stf->phytxant); 26217231Sjoerg} 26317231Sjoerg 26448889Sbdeint brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force) 26576078Sjhb{ 26676078Sjhb u8 txchain = (u8) int_val; 26776078Sjhb u8 txstreams; 2681442Ssos uint i; 2691442Ssos 2701442Ssos if (wlc->stf->txchain == txchain) 27171797Speter return 0; 27250823Smdodd 27350823Smdodd if ((txchain & ~wlc->stf->hw_txchain) 27450823Smdodd || !(txchain & wlc->stf->hw_txchain)) 27550823Smdodd return -EINVAL; 2761390Ssos 2771390Ssos /* 27817231Sjoerg * if nrate override is configured to be non-SISO STF mode, reject 27917236Sjoerg * reducing txchain to 1 28017231Sjoerg */ 2811390Ssos txstreams = (u8) hweight8(txchain); 2824180Sbde if (txstreams > MAX_STREAMS_SUPPORTED) 2831390Ssos return -EINVAL; 28417231Sjoerg 28517231Sjoerg wlc->stf->txchain = txchain; 28617231Sjoerg wlc->stf->txstreams = txstreams; 28717231Sjoerg brcms_c_stf_stbc_tx_set(wlc, wlc->band->band_stf_stbc_tx); 28817231Sjoerg brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); 28917231Sjoerg brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); 29017236Sjoerg wlc->stf->txant = 29117236Sjoerg (wlc->stf->txstreams == 1) ? ANT_TX_FORCE_0 : ANT_TX_DEF; 29217236Sjoerg _brcms_c_stf_phy_txant_upd(wlc); 29317231Sjoerg 29417236Sjoerg wlc_phy_stf_chain_set(wlc->band->pi, wlc->stf->txchain, 29517236Sjoerg wlc->stf->rxchain); 29617236Sjoerg 29717236Sjoerg for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) 29817236Sjoerg brcms_c_stf_txcore_set(wlc, (u8) i, txcore_default[i]); 29917236Sjoerg 30017236Sjoerg return 0; 30117236Sjoerg} 30217236Sjoerg 30317236Sjoerg/* 30417236Sjoerg * update wlc->stf->ss_opmode which represents the operational stf_ss mode 30517236Sjoerg * we're using 30617236Sjoerg */ 30717236Sjoergvoid brcms_c_stf_ss_update(struct brcms_c_info *wlc, struct brcms_band *band) 30817231Sjoerg{ 3091442Ssos u8 prev_stf_ss; 31017231Sjoerg u8 upd_stf_ss; 31117231Sjoerg 3121390Ssos prev_stf_ss = wlc->stf->ss_opmode; 3131390Ssos 3141390Ssos /* 3151390Ssos * NOTE: opmode can only be SISO or CDD as STBC is decided on a 3161390Ssos * per-packet basis 31717231Sjoerg */ 31817231Sjoerg if (BRCMS_STBC_CAP_PHY(wlc) && 31917231Sjoerg wlc->stf->ss_algosel_auto 32017231Sjoerg && (wlc->stf->ss_algo_channel != (u16) -1)) { 32117236Sjoerg upd_stf_ss = (wlc->stf->txstreams == 1 || 32217236Sjoerg isset(&wlc->stf->ss_algo_channel, 32317236Sjoerg PHY_TXC1_MODE_SISO)) ? 32417236Sjoerg PHY_TXC1_MODE_SISO : PHY_TXC1_MODE_CDD; 32517236Sjoerg } else { 32617236Sjoerg if (wlc->band != band) 32717236Sjoerg return; 32817236Sjoerg upd_stf_ss = (wlc->stf->txstreams == 1) ? 32917236Sjoerg PHY_TXC1_MODE_SISO : band->band_stf_ss_mode; 33017236Sjoerg } 33117231Sjoerg if (prev_stf_ss != upd_stf_ss) { 3321390Ssos wlc->stf->ss_opmode = upd_stf_ss; 3331390Ssos brcms_b_band_stf_ss_set(wlc->hw, upd_stf_ss); 3341390Ssos } 3351390Ssos} 3361390Ssos 33717231Sjoergint brcms_c_stf_attach(struct brcms_c_info *wlc) 33817231Sjoerg{ 33917236Sjoerg wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_SISO; 34017236Sjoerg wlc->bandstate[BAND_5G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_CDD; 34117236Sjoerg 34217231Sjoerg if (BRCMS_ISNPHY(wlc->band) && 34317236Sjoerg (wlc_phy_txpower_hw_ctrl_get(wlc->band->pi) != PHY_TPC_HW_ON)) 34417236Sjoerg wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = 34517236Sjoerg PHY_TXC1_MODE_CDD; 34617236Sjoerg brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); 34717236Sjoerg brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); 34817236Sjoerg 34917236Sjoerg brcms_c_stf_stbc_rx_ht_update(wlc, HT_CAP_RX_STBC_NO); 35017231Sjoerg wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = OFF; 35117231Sjoerg wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = OFF; 3521390Ssos 3531390Ssos if (BRCMS_STBC_CAP_PHY(wlc)) { 3541390Ssos wlc->stf->ss_algosel_auto = true; 3551390Ssos /* Init the default value */ 3561390Ssos wlc->stf->ss_algo_channel = (u16) -1; 35717231Sjoerg } 35817231Sjoerg return 0; 35917231Sjoerg} 36017231Sjoerg 36117236Sjoergvoid brcms_c_stf_detach(struct brcms_c_info *wlc) 36217231Sjoerg{ 3631390Ssos} 3641390Ssos 3653185Ssosvoid brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc) 3663185Ssos{ 3673185Ssos _brcms_c_stf_phy_txant_upd(wlc); 3683185Ssos} 3693185Ssos 3703185Ssosvoid brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc) 3713185Ssos{ 3723185Ssos struct ssb_sprom *sprom = &wlc->hw->d11core->bus->sprom; 3733185Ssos 3743185Ssos /* get available rx/tx chains */ 3753185Ssos wlc->stf->hw_txchain = sprom->txchain; 3763185Ssos wlc->stf->hw_rxchain = sprom->rxchain; 37724676Smckay 37824676Smckay /* these parameter are intended to be used for all PHY types */ 37924676Smckay if (wlc->stf->hw_txchain == 0 || wlc->stf->hw_txchain == 0xf) { 38024676Smckay if (BRCMS_ISNPHY(wlc->band)) 38124676Smckay wlc->stf->hw_txchain = TXCHAIN_DEF_NPHY; 38224676Smckay else 38324676Smckay wlc->stf->hw_txchain = TXCHAIN_DEF; 38424676Smckay } 3853185Ssos 38612724Sphk wlc->stf->txchain = wlc->stf->hw_txchain; 3873185Ssos wlc->stf->txstreams = (u8) hweight8(wlc->stf->hw_txchain); 3883185Ssos 38976078Sjhb if (wlc->stf->hw_rxchain == 0 || wlc->stf->hw_rxchain == 0xf) { 3903185Ssos if (BRCMS_ISNPHY(wlc->band)) 39176078Sjhb wlc->stf->hw_rxchain = RXCHAIN_DEF_NPHY; 39276078Sjhb else 39376078Sjhb wlc->stf->hw_rxchain = RXCHAIN_DEF; 39476078Sjhb } 3953185Ssos 3961390Ssos wlc->stf->rxchain = wlc->stf->hw_rxchain; 39718297Sbde wlc->stf->rxstreams = (u8) hweight8(wlc->stf->hw_rxchain); 3985291Sbde 39918297Sbde /* initialize the txcore table */ 40018297Sbde memcpy(wlc->stf->txcore, txcore_default, sizeof(wlc->stf->txcore)); 40118297Sbde 4023185Ssos /* default spatial_policy */ 4035291Sbde wlc->stf->spatial_policy = MIN_SPATIAL_EXPANSION; 4045291Sbde brcms_c_stf_spatial_policy_set(wlc, MIN_SPATIAL_EXPANSION); 4055291Sbde} 4065291Sbde 4073185Ssosstatic u16 _brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc, 40818297Sbde u32 rspec) 4093185Ssos{ 4101390Ssos u16 phytxant = wlc->stf->phytxant; 41110268Sbde 4121390Ssos if (rspec_stf(rspec) != PHY_TXC1_MODE_SISO) 41366716Sjhb phytxant = wlc->stf->txchain << PHY_TXC_ANT_SHIFT; 4141390Ssos else if (wlc->stf->txant == ANT_TX_DEF) 41572200Sbmilekic phytxant = wlc->stf->txchain << PHY_TXC_ANT_SHIFT; 41616428Sbde phytxant &= PHY_TXC_ANT_MASK; 41716428Sbde return phytxant; 41819173Sbde} 41916428Sbde 4201390Ssosu16 brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc, u32 rspec) 4211390Ssos{ 42216428Sbde return _brcms_c_stf_phytxchain_sel(wlc, rspec); 42372200Sbmilekic} 4241390Ssos 4251390Ssosu16 brcms_c_stf_d11hdrs_phyctl_txant(struct brcms_c_info *wlc, u32 rspec) 4261390Ssos{ 4272017Swollman u16 phytxant = wlc->stf->phytxant; 4281390Ssos u16 mask = PHY_TXC_ANT_MASK; 42915508Sbde 4301390Ssos /* for non-siso rates or default setting, use the available chains */ 4311390Ssos if (BRCMS_ISNPHY(wlc->band)) { 4321390Ssos phytxant = _brcms_c_stf_phytxchain_sel(wlc, rspec); 4331390Ssos mask = PHY_TXC_HTANT_MASK; 4341390Ssos } 43522106Sbde phytxant |= phytxant & mask; 4361390Ssos return phytxant; 4371390Ssos} 4381390Ssos