Commit f52a0ad0 authored by Roland Vossen's avatar Roland Vossen Committed by Greg Kroah-Hartman

staging: brcm80211: further replaced wlc_ by brcmsmac_c_

Code cleanup. Renamed functions.
Signed-off-by: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent bddf5b14
...@@ -126,7 +126,7 @@ static void wlc_bsscfg_ID_assign(struct brcms_c_info *wlc, ...@@ -126,7 +126,7 @@ static void wlc_bsscfg_ID_assign(struct brcms_c_info *wlc,
/* /*
* The common driver entry routine. Error codes should be unique * The common driver entry routine. Error codes should be unique
*/ */
struct brcms_c_info *wlc_attach_malloc(uint unit, uint *err, uint devid) struct brcms_c_info *brcms_c_attach_malloc(uint unit, uint *err, uint devid)
{ {
struct brcms_c_info *wlc; struct brcms_c_info *wlc;
...@@ -246,11 +246,11 @@ struct brcms_c_info *wlc_attach_malloc(uint unit, uint *err, uint devid) ...@@ -246,11 +246,11 @@ struct brcms_c_info *wlc_attach_malloc(uint unit, uint *err, uint devid)
return wlc; return wlc;
fail: fail:
wlc_detach_mfree(wlc); brcms_c_detach_mfree(wlc);
return NULL; return NULL;
} }
void wlc_detach_mfree(struct brcms_c_info *wlc) void brcms_c_detach_mfree(struct brcms_c_info *wlc)
{ {
if (wlc == NULL) if (wlc == NULL)
return; return;
......
...@@ -14,5 +14,6 @@ ...@@ -14,5 +14,6 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
extern struct brcms_c_info *wlc_attach_malloc(uint unit, uint *err, uint devid); extern struct brcms_c_info *brcms_c_attach_malloc(uint unit, uint *err,
extern void wlc_detach_mfree(struct brcms_c_info *wlc); uint devid);
extern void brcms_c_detach_mfree(struct brcms_c_info *wlc);
...@@ -110,35 +110,37 @@ struct cb_del_ampdu_pars { ...@@ -110,35 +110,37 @@ struct cb_del_ampdu_pars {
#define SCB_AMPDU_CUBBY(ampdu, scb) (&(scb->scb_ampdu)) #define SCB_AMPDU_CUBBY(ampdu, scb) (&(scb->scb_ampdu))
#define SCB_AMPDU_INI(scb_ampdu, tid) (&(scb_ampdu->ini[tid])) #define SCB_AMPDU_INI(scb_ampdu, tid) (&(scb_ampdu->ini[tid]))
static void wlc_ffpld_init(struct ampdu_info *ampdu); static void brcms_c_ffpld_init(struct ampdu_info *ampdu);
static int wlc_ffpld_check_txfunfl(struct brcms_c_info *wlc, int f); static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int f);
static void wlc_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f); static void brcms_c_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f);
static scb_ampdu_tid_ini_t *wlc_ampdu_init_tid_ini(struct ampdu_info *ampdu, static scb_ampdu_tid_ini_t *brcms_c_ampdu_init_tid_ini(struct ampdu_info *ampdu,
scb_ampdu_t *scb_ampdu, scb_ampdu_t *scb_ampdu,
u8 tid, bool override); u8 tid, bool override);
static void ampdu_update_max_txlen(struct ampdu_info *ampdu, u8 dur); static void brcms_c_scb_ampdu_update_max_txlen(struct ampdu_info *ampdu,
static void scb_ampdu_update_config(struct ampdu_info *ampdu, struct scb *scb); u8 dur);
static void scb_ampdu_update_config_all(struct ampdu_info *ampdu); static void brcms_c_scb_ampdu_update_config(struct ampdu_info *ampdu,
struct scb *scb);
static void brcms_c_scb_ampdu_update_config_all(struct ampdu_info *ampdu);
#define wlc_ampdu_txflowcontrol(a, b, c) do {} while (0) #define brcms_c_ampdu_txflowcontrol(a, b, c) do {} while (0)
static void wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, static void brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu,
struct scb *scb, struct scb *scb,
struct sk_buff *p, tx_status_t *txs, struct sk_buff *p, tx_status_t *txs,
u32 frmtxstatus, u32 frmtxstatus2); u32 frmtxstatus, u32 frmtxstatus2);
static bool wlc_ampdu_cap(struct ampdu_info *ampdu); static bool brcms_c_ampdu_cap(struct ampdu_info *ampdu);
static int wlc_ampdu_set(struct ampdu_info *ampdu, bool on); static int brcms_c_ampdu_set(struct ampdu_info *ampdu, bool on);
struct ampdu_info *wlc_ampdu_attach(struct brcms_c_info *wlc) struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc)
{ {
struct ampdu_info *ampdu; struct ampdu_info *ampdu;
int i; int i;
ampdu = kzalloc(sizeof(struct ampdu_info), GFP_ATOMIC); ampdu = kzalloc(sizeof(struct ampdu_info), GFP_ATOMIC);
if (!ampdu) { if (!ampdu) {
wiphy_err(wlc->wiphy, "wl%d: wlc_ampdu_attach: out of mem\n", wiphy_err(wlc->wiphy, "wl%d: brcms_c_ampdu_attach: out of mem"
wlc->pub->unit); "\n", wlc->pub->unit);
return NULL; return NULL;
} }
ampdu->wlc = wlc; ampdu->wlc = wlc;
...@@ -174,18 +176,18 @@ struct ampdu_info *wlc_ampdu_attach(struct brcms_c_info *wlc) ...@@ -174,18 +176,18 @@ struct ampdu_info *wlc_ampdu_attach(struct brcms_c_info *wlc)
ampdu->rr_retry_limit_tid[i] = ampdu->rr_retry_limit; ampdu->rr_retry_limit_tid[i] = ampdu->rr_retry_limit;
} }
ampdu_update_max_txlen(ampdu, ampdu->dur); brcms_c_scb_ampdu_update_max_txlen(ampdu, ampdu->dur);
ampdu->mfbr = false; ampdu->mfbr = false;
/* try to set ampdu to the default value */ /* try to set ampdu to the default value */
wlc_ampdu_set(ampdu, wlc->pub->_ampdu); brcms_c_ampdu_set(ampdu, wlc->pub->_ampdu);
ampdu->tx_max_funl = FFPLD_TX_MAX_UNFL; ampdu->tx_max_funl = FFPLD_TX_MAX_UNFL;
wlc_ffpld_init(ampdu); brcms_c_ffpld_init(ampdu);
return ampdu; return ampdu;
} }
void wlc_ampdu_detach(struct ampdu_info *ampdu) void brcms_c_ampdu_detach(struct ampdu_info *ampdu)
{ {
int i; int i;
...@@ -201,7 +203,8 @@ void wlc_ampdu_detach(struct ampdu_info *ampdu) ...@@ -201,7 +203,8 @@ void wlc_ampdu_detach(struct ampdu_info *ampdu)
kfree(ampdu); kfree(ampdu);
} }
static void scb_ampdu_update_config(struct ampdu_info *ampdu, struct scb *scb) static void brcms_c_scb_ampdu_update_config(struct ampdu_info *ampdu,
struct scb *scb)
{ {
scb_ampdu_t *scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb); scb_ampdu_t *scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb);
int i; int i;
...@@ -229,12 +232,12 @@ static void scb_ampdu_update_config(struct ampdu_info *ampdu, struct scb *scb) ...@@ -229,12 +232,12 @@ static void scb_ampdu_update_config(struct ampdu_info *ampdu, struct scb *scb)
mcs2ampdu_table[FFPLD_MAX_MCS]); mcs2ampdu_table[FFPLD_MAX_MCS]);
} }
static void scb_ampdu_update_config_all(struct ampdu_info *ampdu) static void brcms_c_scb_ampdu_update_config_all(struct ampdu_info *ampdu)
{ {
scb_ampdu_update_config(ampdu, ampdu->wlc->pub->global_scb); brcms_c_scb_ampdu_update_config(ampdu, ampdu->wlc->pub->global_scb);
} }
static void wlc_ffpld_init(struct ampdu_info *ampdu) static void brcms_c_ffpld_init(struct ampdu_info *ampdu)
{ {
int i, j; int i, j;
wlc_fifo_info_t *fifo; wlc_fifo_info_t *fifo;
...@@ -258,7 +261,7 @@ static void wlc_ffpld_init(struct ampdu_info *ampdu) ...@@ -258,7 +261,7 @@ static void wlc_ffpld_init(struct ampdu_info *ampdu)
* Return 1 if pre-loading not active, -1 if not an underflow event, * Return 1 if pre-loading not active, -1 if not an underflow event,
* 0 if pre-loading module took care of the event. * 0 if pre-loading module took care of the event.
*/ */
static int wlc_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid) static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid)
{ {
struct ampdu_info *ampdu = wlc->ampdu; struct ampdu_info *ampdu = wlc->ampdu;
u32 phy_rate = MCS_RATE(FFPLD_MAX_MCS, true, false); u32 phy_rate = MCS_RATE(FFPLD_MAX_MCS, true, false);
...@@ -339,7 +342,7 @@ static int wlc_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid) ...@@ -339,7 +342,7 @@ static int wlc_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid)
fifo->ampdu_pld_size = max_pld_size; fifo->ampdu_pld_size = max_pld_size;
/* update scb release size */ /* update scb release size */
scb_ampdu_update_config_all(ampdu); brcms_c_scb_ampdu_update_config_all(ampdu);
/* /*
compute a new dma xfer rate for max_mpdu @ max mcs. compute a new dma xfer rate for max_mpdu @ max mcs.
...@@ -366,17 +369,17 @@ static int wlc_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid) ...@@ -366,17 +369,17 @@ static int wlc_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid)
fifo->mcs2ampdu_table[FFPLD_MAX_MCS] -= 1; fifo->mcs2ampdu_table[FFPLD_MAX_MCS] -= 1;
/* recompute the table */ /* recompute the table */
wlc_ffpld_calc_mcs2ampdu_table(ampdu, fid); brcms_c_ffpld_calc_mcs2ampdu_table(ampdu, fid);
/* update scb release size */ /* update scb release size */
scb_ampdu_update_config_all(ampdu); brcms_c_scb_ampdu_update_config_all(ampdu);
} }
} }
fifo->accum_txfunfl = 0; fifo->accum_txfunfl = 0;
return 0; return 0;
} }
static void wlc_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f) static void brcms_c_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f)
{ {
int i; int i;
u32 phy_rate, dma_rate, tmp; u32 phy_rate, dma_rate, tmp;
...@@ -409,7 +412,7 @@ static void wlc_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f) ...@@ -409,7 +412,7 @@ static void wlc_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f)
} }
static void static void
wlc_ampdu_agg(struct ampdu_info *ampdu, struct scb *scb, struct sk_buff *p, brcms_c_ampdu_agg(struct ampdu_info *ampdu, struct scb *scb, struct sk_buff *p,
uint prec) uint prec)
{ {
scb_ampdu_t *scb_ampdu; scb_ampdu_t *scb_ampdu;
...@@ -421,13 +424,13 @@ wlc_ampdu_agg(struct ampdu_info *ampdu, struct scb *scb, struct sk_buff *p, ...@@ -421,13 +424,13 @@ wlc_ampdu_agg(struct ampdu_info *ampdu, struct scb *scb, struct sk_buff *p,
/* initialize initiator on first packet; sends addba req */ /* initialize initiator on first packet; sends addba req */
ini = SCB_AMPDU_INI(scb_ampdu, tid); ini = SCB_AMPDU_INI(scb_ampdu, tid);
if (ini->magic != INI_MAGIC) { if (ini->magic != INI_MAGIC) {
ini = wlc_ampdu_init_tid_ini(ampdu, scb_ampdu, tid, false); ini = brcms_c_ampdu_init_tid_ini(ampdu, scb_ampdu, tid, false);
} }
return; return;
} }
int int
wlc_sendampdu(struct ampdu_info *ampdu, struct brcms_c_txq_info *qi, brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_c_txq_info *qi,
struct sk_buff **pdu, int prec) struct sk_buff **pdu, int prec)
{ {
struct brcms_c_info *wlc; struct brcms_c_info *wlc;
...@@ -480,7 +483,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, struct brcms_c_txq_info *qi, ...@@ -480,7 +483,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, struct brcms_c_txq_info *qi,
return -EBUSY; return -EBUSY;
} }
wlc_ampdu_agg(ampdu, scb, p, tid); brcms_c_ampdu_agg(ampdu, scb, p, tid);
rr_retry_limit = ampdu->rr_retry_limit_tid[tid]; rr_retry_limit = ampdu->rr_retry_limit_tid[tid];
ampdu_len = 0; ampdu_len = 0;
...@@ -808,7 +811,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, struct brcms_c_txq_info *qi, ...@@ -808,7 +811,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, struct brcms_c_txq_info *qi,
} }
void void
wlc_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,
struct sk_buff *p, tx_status_t *txs) struct sk_buff *p, tx_status_t *txs)
{ {
scb_ampdu_t *scb_ampdu; scb_ampdu_t *scb_ampdu;
...@@ -841,7 +844,7 @@ wlc_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, ...@@ -841,7 +844,7 @@ wlc_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,
if (likely(scb)) { if (likely(scb)) {
scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb); scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb);
ini = SCB_AMPDU_INI(scb_ampdu, p->priority); ini = SCB_AMPDU_INI(scb_ampdu, p->priority);
wlc_ampdu_dotxstatus_complete(ampdu, scb, p, txs, s1, s2); brcms_c_ampdu_dotxstatus_complete(ampdu, scb, p, txs, s1, s2);
} else { } else {
/* loop through all pkts and free */ /* loop through all pkts and free */
u8 queue = txs->frameid & TXFID_QUEUE_MASK; u8 queue = txs->frameid & TXFID_QUEUE_MASK;
...@@ -860,11 +863,12 @@ wlc_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, ...@@ -860,11 +863,12 @@ wlc_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,
} }
brcms_c_txfifo_complete(wlc, queue, ampdu->txpkt_weight); brcms_c_txfifo_complete(wlc, queue, ampdu->txpkt_weight);
} }
wlc_ampdu_txflowcontrol(wlc, scb_ampdu, ini); brcms_c_ampdu_txflowcontrol(wlc, scb_ampdu, ini);
} }
static void static void
rate_status(struct brcms_c_info *wlc, struct ieee80211_tx_info *tx_info, brcms_c_ampdu_rate_status(struct brcms_c_info *wlc,
struct ieee80211_tx_info *tx_info,
tx_status_t *txs, u8 mcs) tx_status_t *txs, u8 mcs)
{ {
struct ieee80211_tx_rate *txrate = tx_info->status.rates; struct ieee80211_tx_rate *txrate = tx_info->status.rates;
...@@ -880,7 +884,7 @@ rate_status(struct brcms_c_info *wlc, struct ieee80211_tx_info *tx_info, ...@@ -880,7 +884,7 @@ rate_status(struct brcms_c_info *wlc, struct ieee80211_tx_info *tx_info,
#define SHORTNAME "AMPDU status" #define SHORTNAME "AMPDU status"
static void static void
wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
struct sk_buff *p, tx_status_t *txs, struct sk_buff *p, tx_status_t *txs,
u32 s1, u32 s2) u32 s1, u32 s2)
{ {
...@@ -954,8 +958,8 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, ...@@ -954,8 +958,8 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
wlc->default_bss->chanspec)); wlc->default_bss->chanspec));
} else { } else {
if (supr_status != TX_STATUS_SUPR_FRAG) if (supr_status != TX_STATUS_SUPR_FRAG)
wiphy_err(wiphy, "%s: wlc_ampdu_dotx" wiphy_err(wiphy, "%s:"
"status:supr_status 0x%x\n", "supr_status 0x%x\n",
__func__, supr_status); __func__, supr_status);
} }
/* no need to retry for badch; will fail again */ /* no need to retry for badch; will fail again */
...@@ -968,14 +972,14 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, ...@@ -968,14 +972,14 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
/* if there were underflows, but pre-loading is not active, /* if there were underflows, but pre-loading is not active,
notify rate adaptation. notify rate adaptation.
*/ */
if (wlc_ffpld_check_txfunfl(wlc, prio2fifo[tid]) if (brcms_c_ffpld_check_txfunfl(wlc,
> 0) { prio2fifo[tid]) > 0) {
tx_error = true; tx_error = true;
} }
} }
} else if (txs->phyerr) { } else if (txs->phyerr) {
update_rate = false; update_rate = false;
wiphy_err(wiphy, "wl%d: wlc_ampdu_dotxstatus: tx phy " wiphy_err(wiphy, "wl%d: ampdu tx phy "
"error (0x%x)\n", wlc->pub->unit, "error (0x%x)\n", wlc->pub->unit,
txs->phyerr); txs->phyerr);
...@@ -1017,7 +1021,8 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, ...@@ -1017,7 +1021,8 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
/* ampdu_ack_len: number of acked aggregated frames */ /* ampdu_ack_len: number of acked aggregated frames */
/* ampdu_len: number of aggregated frames */ /* ampdu_len: number of aggregated frames */
rate_status(wlc, tx_info, txs, mcs); brcms_c_ampdu_rate_status(wlc, tx_info, txs,
mcs);
tx_info->flags |= IEEE80211_TX_STAT_ACK; tx_info->flags |= IEEE80211_TX_STAT_ACK;
tx_info->flags |= IEEE80211_TX_STAT_AMPDU; tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
tx_info->status.ampdu_ack_len = tx_info->status.ampdu_ack_len =
...@@ -1073,13 +1078,13 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, ...@@ -1073,13 +1078,13 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
brcms_c_send_q(wlc); brcms_c_send_q(wlc);
/* update rate state */ /* update rate state */
antselid = wlc_antsel_antsel2id(wlc->asi, mimoantsel); antselid = brcms_c_antsel_antsel2id(wlc->asi, mimoantsel);
brcms_c_txfifo_complete(wlc, queue, ampdu->txpkt_weight); brcms_c_txfifo_complete(wlc, queue, ampdu->txpkt_weight);
} }
/* initialize the initiator code for tid */ /* initialize the initiator code for tid */
static scb_ampdu_tid_ini_t *wlc_ampdu_init_tid_ini(struct ampdu_info *ampdu, static scb_ampdu_tid_ini_t *brcms_c_ampdu_init_tid_ini(struct ampdu_info *ampdu,
scb_ampdu_t *scb_ampdu, scb_ampdu_t *scb_ampdu,
u8 tid, bool override) u8 tid, bool override)
{ {
...@@ -1099,7 +1104,7 @@ static scb_ampdu_tid_ini_t *wlc_ampdu_init_tid_ini(struct ampdu_info *ampdu, ...@@ -1099,7 +1104,7 @@ static scb_ampdu_tid_ini_t *wlc_ampdu_init_tid_ini(struct ampdu_info *ampdu,
return ini; return ini;
} }
static int wlc_ampdu_set(struct ampdu_info *ampdu, bool on) static int brcms_c_ampdu_set(struct ampdu_info *ampdu, bool on)
{ {
struct brcms_c_info *wlc = ampdu->wlc; struct brcms_c_info *wlc = ampdu->wlc;
...@@ -1111,7 +1116,7 @@ static int wlc_ampdu_set(struct ampdu_info *ampdu, bool on) ...@@ -1111,7 +1116,7 @@ static int wlc_ampdu_set(struct ampdu_info *ampdu, bool on)
"nmode enabled\n", wlc->pub->unit); "nmode enabled\n", wlc->pub->unit);
return -ENOTSUPP; return -ENOTSUPP;
} }
if (!wlc_ampdu_cap(ampdu)) { if (!brcms_c_ampdu_cap(ampdu)) {
wiphy_err(ampdu->wlc->wiphy, "wl%d: device not " wiphy_err(ampdu->wlc->wiphy, "wl%d: device not "
"ampdu capable\n", wlc->pub->unit); "ampdu capable\n", wlc->pub->unit);
return -ENOTSUPP; return -ENOTSUPP;
...@@ -1122,7 +1127,7 @@ static int wlc_ampdu_set(struct ampdu_info *ampdu, bool on) ...@@ -1122,7 +1127,7 @@ static int wlc_ampdu_set(struct ampdu_info *ampdu, bool on)
return 0; return 0;
} }
static bool wlc_ampdu_cap(struct ampdu_info *ampdu) static bool brcms_c_ampdu_cap(struct ampdu_info *ampdu)
{ {
if (WLC_PHY_11N_CAP(ampdu->wlc->band)) if (WLC_PHY_11N_CAP(ampdu->wlc->band))
return true; return true;
...@@ -1130,7 +1135,7 @@ static bool wlc_ampdu_cap(struct ampdu_info *ampdu) ...@@ -1130,7 +1135,7 @@ static bool wlc_ampdu_cap(struct ampdu_info *ampdu)
return false; return false;
} }
static void ampdu_update_max_txlen(struct ampdu_info *ampdu, u8 dur) static void brcms_c_scb_ampdu_update_max_txlen(struct ampdu_info *ampdu, u8 dur)
{ {
u32 rate, mcs; u32 rate, mcs;
...@@ -1151,7 +1156,7 @@ static void ampdu_update_max_txlen(struct ampdu_info *ampdu, u8 dur) ...@@ -1151,7 +1156,7 @@ static void ampdu_update_max_txlen(struct ampdu_info *ampdu, u8 dur)
} }
} }
void wlc_ampdu_macaddr_upd(struct brcms_c_info *wlc) void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc)
{ {
char template[T_RAM_ACCESS_SZ * 2]; char template[T_RAM_ACCESS_SZ * 2];
...@@ -1168,7 +1173,7 @@ bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid) ...@@ -1168,7 +1173,7 @@ bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid)
return wlc->ampdu->ini_enable[tid]; return wlc->ampdu->ini_enable[tid];
} }
void wlc_ampdu_shm_upd(struct ampdu_info *ampdu) void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu)
{ {
struct brcms_c_info *wlc = ampdu->wlc; struct brcms_c_info *wlc = ampdu->wlc;
...@@ -1217,7 +1222,7 @@ static void dma_cb_fn_ampdu(void *txi, void *arg_a) ...@@ -1217,7 +1222,7 @@ static void dma_cb_fn_ampdu(void *txi, void *arg_a)
* When a remote party is no longer available for ampdu communication, any * When a remote party is no longer available for ampdu communication, any
* pending tx ampdu packets in the driver have to be flushed. * pending tx ampdu packets in the driver have to be flushed.
*/ */
void wlc_ampdu_flush(struct brcms_c_info *wlc, void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
struct ieee80211_sta *sta, u16 tid) struct ieee80211_sta *sta, u16 tid)
{ {
struct brcms_c_txq_info *qi = wlc->pkt_queue; struct brcms_c_txq_info *qi = wlc->pkt_queue;
......
...@@ -17,13 +17,14 @@ ...@@ -17,13 +17,14 @@
#ifndef _BRCM_AMPDU_H_ #ifndef _BRCM_AMPDU_H_
#define _BRCM_AMPDU_H_ #define _BRCM_AMPDU_H_
extern struct ampdu_info *wlc_ampdu_attach(struct brcms_c_info *wlc); extern struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc);
extern void wlc_ampdu_detach(struct ampdu_info *ampdu); extern void brcms_c_ampdu_detach(struct ampdu_info *ampdu);
extern int wlc_sendampdu(struct ampdu_info *ampdu, struct brcms_c_txq_info *qi, extern int brcms_c_sendampdu(struct ampdu_info *ampdu,
struct brcms_c_txq_info *qi,
struct sk_buff **aggp, int prec); struct sk_buff **aggp, int prec);
extern void wlc_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, extern void brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,
struct sk_buff *p, tx_status_t *txs); struct sk_buff *p, tx_status_t *txs);
extern void wlc_ampdu_macaddr_upd(struct brcms_c_info *wlc); extern void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc);
extern void wlc_ampdu_shm_upd(struct ampdu_info *ampdu); extern void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu);
#endif /* _BRCM_AMPDU_H_ */ #endif /* _BRCM_AMPDU_H_ */
...@@ -50,10 +50,11 @@ ...@@ -50,10 +50,11 @@
#define ANT_SELCFG_DEF_2x4 0x02 /* default antenna configuration */ #define ANT_SELCFG_DEF_2x4 0x02 /* default antenna configuration */
/* static functions */ /* static functions */
static int wlc_antsel_cfgupd(struct antsel_info *asi, wlc_antselcfg_t *antsel); static int brcms_c_antsel_cfgupd(struct antsel_info *asi,
static u8 wlc_antsel_id2antcfg(struct antsel_info *asi, u8 id); wlc_antselcfg_t *antsel);
static u16 wlc_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg); static u8 brcms_c_antsel_id2antcfg(struct antsel_info *asi, u8 id);
static void wlc_antsel_init_cfg(struct antsel_info *asi, static u16 brcms_c_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg);
static void brcms_c_antsel_init_cfg(struct antsel_info *asi,
wlc_antselcfg_t *antsel, wlc_antselcfg_t *antsel,
bool auto_sel); bool auto_sel);
...@@ -81,14 +82,14 @@ const u8 mimo_2x3_div_antselid_tbl[16] = { ...@@ -81,14 +82,14 @@ const u8 mimo_2x3_div_antselid_tbl[16] = {
0, 0, 0, 0, 0, 0, 0, 0 /* pat to antselid */ 0, 0, 0, 0, 0, 0, 0, 0 /* pat to antselid */
}; };
struct antsel_info *wlc_antsel_attach(struct brcms_c_info *wlc) struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
{ {
struct antsel_info *asi; struct antsel_info *asi;
asi = kzalloc(sizeof(struct antsel_info), GFP_ATOMIC); asi = kzalloc(sizeof(struct antsel_info), GFP_ATOMIC);
if (!asi) { if (!asi) {
wiphy_err(wlc->wiphy, "wl%d: wlc_antsel_attach: out of mem\n", wiphy_err(wlc->wiphy, "wl%d: brcms_c_antsel_attach: out of "
wlc->pub->unit); "mem\n", wlc->pub->unit);
return NULL; return NULL;
} }
...@@ -117,7 +118,7 @@ struct antsel_info *wlc_antsel_attach(struct brcms_c_info *wlc) ...@@ -117,7 +118,7 @@ struct antsel_info *wlc_antsel_attach(struct brcms_c_info *wlc)
asi->antsel_avail = false; asi->antsel_avail = false;
} else { } else {
asi->antsel_avail = false; asi->antsel_avail = false;
wiphy_err(wlc->wiphy, "wlc_antsel_attach: 2o3 " wiphy_err(wlc->wiphy, "antsel_attach: 2o3 "
"board cfg invalid\n"); "board cfg invalid\n");
} }
break; break;
...@@ -139,27 +140,27 @@ struct antsel_info *wlc_antsel_attach(struct brcms_c_info *wlc) ...@@ -139,27 +140,27 @@ struct antsel_info *wlc_antsel_attach(struct brcms_c_info *wlc)
brcms_b_antsel_type_set(wlc->hw, asi->antsel_type); brcms_b_antsel_type_set(wlc->hw, asi->antsel_type);
/* Init (auto/manual) antenna selection */ /* Init (auto/manual) antenna selection */
wlc_antsel_init_cfg(asi, &asi->antcfg_11n, true); brcms_c_antsel_init_cfg(asi, &asi->antcfg_11n, true);
wlc_antsel_init_cfg(asi, &asi->antcfg_cur, true); brcms_c_antsel_init_cfg(asi, &asi->antcfg_cur, true);
return asi; return asi;
} }
void wlc_antsel_detach(struct antsel_info *asi) void brcms_c_antsel_detach(struct antsel_info *asi)
{ {
kfree(asi); kfree(asi);
} }
void wlc_antsel_init(struct antsel_info *asi) void brcms_c_antsel_init(struct antsel_info *asi)
{ {
if ((asi->antsel_type == ANTSEL_2x3) || if ((asi->antsel_type == ANTSEL_2x3) ||
(asi->antsel_type == ANTSEL_2x4)) (asi->antsel_type == ANTSEL_2x4))
wlc_antsel_cfgupd(asi, &asi->antcfg_11n); brcms_c_antsel_cfgupd(asi, &asi->antcfg_11n);
} }
/* boardlevel antenna selection: init antenna selection structure */ /* boardlevel antenna selection: init antenna selection structure */
static void static void
wlc_antsel_init_cfg(struct antsel_info *asi, wlc_antselcfg_t *antsel, brcms_c_antsel_init_cfg(struct antsel_info *asi, wlc_antselcfg_t *antsel,
bool auto_sel) bool auto_sel)
{ {
if (asi->antsel_type == ANTSEL_2x3) { if (asi->antsel_type == ANTSEL_2x3) {
...@@ -190,7 +191,7 @@ wlc_antsel_init_cfg(struct antsel_info *asi, wlc_antselcfg_t *antsel, ...@@ -190,7 +191,7 @@ wlc_antsel_init_cfg(struct antsel_info *asi, wlc_antselcfg_t *antsel,
} }
void void
wlc_antsel_antcfg_get(struct antsel_info *asi, bool usedef, bool sel, brcms_c_antsel_antcfg_get(struct antsel_info *asi, bool usedef, bool sel,
u8 antselid, u8 fbantselid, u8 *antcfg, u8 antselid, u8 fbantselid, u8 *antcfg,
u8 *fbantcfg) u8 *fbantcfg)
{ {
...@@ -210,8 +211,8 @@ wlc_antsel_antcfg_get(struct antsel_info *asi, bool usedef, bool sel, ...@@ -210,8 +211,8 @@ wlc_antsel_antcfg_get(struct antsel_info *asi, bool usedef, bool sel,
} else { } else {
ant = asi->antcfg_11n.ant_config[ANT_SELCFG_TX_UNICAST]; ant = asi->antcfg_11n.ant_config[ANT_SELCFG_TX_UNICAST];
if ((ant & ANT_SELCFG_AUTO) == ANT_SELCFG_AUTO) { if ((ant & ANT_SELCFG_AUTO) == ANT_SELCFG_AUTO) {
*antcfg = wlc_antsel_id2antcfg(asi, antselid); *antcfg = brcms_c_antsel_id2antcfg(asi, antselid);
*fbantcfg = wlc_antsel_id2antcfg(asi, fbantselid); *fbantcfg = brcms_c_antsel_id2antcfg(asi, fbantselid);
} else { } else {
*antcfg = *antcfg =
asi->antcfg_11n.ant_config[ANT_SELCFG_TX_UNICAST]; asi->antcfg_11n.ant_config[ANT_SELCFG_TX_UNICAST];
...@@ -222,7 +223,7 @@ wlc_antsel_antcfg_get(struct antsel_info *asi, bool usedef, bool sel, ...@@ -222,7 +223,7 @@ wlc_antsel_antcfg_get(struct antsel_info *asi, bool usedef, bool sel,
} }
/* boardlevel antenna selection: convert mimo_antsel (ucode interface) to id */ /* boardlevel antenna selection: convert mimo_antsel (ucode interface) to id */
u8 wlc_antsel_antsel2id(struct antsel_info *asi, u16 antsel) u8 brcms_c_antsel_antsel2id(struct antsel_info *asi, u16 antsel)
{ {
u8 antselid = 0; u8 antselid = 0;
...@@ -241,7 +242,7 @@ u8 wlc_antsel_antsel2id(struct antsel_info *asi, u16 antsel) ...@@ -241,7 +242,7 @@ u8 wlc_antsel_antsel2id(struct antsel_info *asi, u16 antsel)
} }
/* boardlevel antenna selection: convert id to ant_cfg */ /* boardlevel antenna selection: convert id to ant_cfg */
static u8 wlc_antsel_id2antcfg(struct antsel_info *asi, u8 id) static u8 brcms_c_antsel_id2antcfg(struct antsel_info *asi, u8 id)
{ {
u8 antcfg = ANT_SELCFG_DEF_2x2; u8 antcfg = ANT_SELCFG_DEF_2x2;
...@@ -260,7 +261,7 @@ static u8 wlc_antsel_id2antcfg(struct antsel_info *asi, u8 id) ...@@ -260,7 +261,7 @@ static u8 wlc_antsel_id2antcfg(struct antsel_info *asi, u8 id)
} }
/* boardlevel antenna selection: convert ant_cfg to mimo_antsel (ucode interface) */ /* boardlevel antenna selection: convert ant_cfg to mimo_antsel (ucode interface) */
static u16 wlc_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg) static u16 brcms_c_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg)
{ {
u8 idx = WLC_ANTIDX_11N(WLC_ANTSEL_11N(ant_cfg)); u8 idx = WLC_ANTIDX_11N(WLC_ANTSEL_11N(ant_cfg));
u16 mimo_antsel = 0; u16 mimo_antsel = 0;
...@@ -280,7 +281,8 @@ static u16 wlc_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg) ...@@ -280,7 +281,8 @@ static u16 wlc_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg)
} }
/* boardlevel antenna selection: ucode interface control */ /* boardlevel antenna selection: ucode interface control */
static int wlc_antsel_cfgupd(struct antsel_info *asi, wlc_antselcfg_t *antsel) static int brcms_c_antsel_cfgupd(struct antsel_info *asi,
wlc_antselcfg_t *antsel)
{ {
struct brcms_c_info *wlc = asi->wlc; struct brcms_c_info *wlc = asi->wlc;
u8 ant_cfg; u8 ant_cfg;
...@@ -290,7 +292,7 @@ static int wlc_antsel_cfgupd(struct antsel_info *asi, wlc_antselcfg_t *antsel) ...@@ -290,7 +292,7 @@ static int wlc_antsel_cfgupd(struct antsel_info *asi, wlc_antselcfg_t *antsel)
* (aka default TX) * (aka default TX)
*/ */
ant_cfg = antsel->ant_config[ANT_SELCFG_TX_DEF]; ant_cfg = antsel->ant_config[ANT_SELCFG_TX_DEF];
mimo_antsel = wlc_antsel_antcfg2antsel(asi, ant_cfg); mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg);
brcms_c_write_shm(wlc, M_MIMO_ANTSEL_TXDFLT, mimo_antsel); brcms_c_write_shm(wlc, M_MIMO_ANTSEL_TXDFLT, mimo_antsel);
/* Update driver stats for currently selected default tx/rx antenna config */ /* Update driver stats for currently selected default tx/rx antenna config */
asi->antcfg_cur.ant_config[ANT_SELCFG_TX_DEF] = ant_cfg; asi->antcfg_cur.ant_config[ANT_SELCFG_TX_DEF] = ant_cfg;
...@@ -299,7 +301,7 @@ static int wlc_antsel_cfgupd(struct antsel_info *asi, wlc_antselcfg_t *antsel) ...@@ -299,7 +301,7 @@ static int wlc_antsel_cfgupd(struct antsel_info *asi, wlc_antselcfg_t *antsel)
* (aka default RX) * (aka default RX)
*/ */
ant_cfg = antsel->ant_config[ANT_SELCFG_RX_DEF]; ant_cfg = antsel->ant_config[ANT_SELCFG_RX_DEF];
mimo_antsel = wlc_antsel_antcfg2antsel(asi, ant_cfg); mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg);
brcms_c_write_shm(wlc, M_MIMO_ANTSEL_RXDFLT, mimo_antsel); brcms_c_write_shm(wlc, M_MIMO_ANTSEL_RXDFLT, mimo_antsel);
/* Update driver stats for currently selected default tx/rx antenna config */ /* Update driver stats for currently selected default tx/rx antenna config */
asi->antcfg_cur.ant_config[ANT_SELCFG_RX_DEF] = ant_cfg; asi->antcfg_cur.ant_config[ANT_SELCFG_RX_DEF] = ant_cfg;
......
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
#ifndef _BRCM_ANTSEL_H_ #ifndef _BRCM_ANTSEL_H_
#define _BRCM_ANTSEL_H_ #define _BRCM_ANTSEL_H_
extern struct antsel_info *wlc_antsel_attach(struct brcms_c_info *wlc); extern struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc);
extern void wlc_antsel_detach(struct antsel_info *asi); extern void brcms_c_antsel_detach(struct antsel_info *asi);
extern void wlc_antsel_init(struct antsel_info *asi); extern void brcms_c_antsel_init(struct antsel_info *asi);
extern void wlc_antsel_antcfg_get(struct antsel_info *asi, bool usedef, extern void brcms_c_antsel_antcfg_get(struct antsel_info *asi, bool usedef,
bool sel, bool sel,
u8 id, u8 fbid, u8 *antcfg, u8 id, u8 fbid, u8 *antcfg,
u8 *fbantcfg); u8 *fbantcfg);
extern u8 wlc_antsel_antsel2id(struct antsel_info *asi, u16 antsel); extern u8 brcms_c_antsel_antsel2id(struct antsel_info *asi, u16 antsel);
#endif /* _BRCM_ANTSEL_H_ */ #endif /* _BRCM_ANTSEL_H_ */
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
#include "stf.h" #include "stf.h"
#include "channel.h" #include "channel.h"
#define VALID_CHANNEL20_DB(wlc, val) wlc_valid_channel20_db((wlc)->cmi, val) #define VALID_CHANNEL20_DB(wlc, val) brcms_c_valid_channel20_db((wlc)->cmi, val)
#define VALID_CHANNEL20_IN_BAND(wlc, bandunit, val) \ #define VALID_CHANNEL20_IN_BAND(wlc, bandunit, val) \
wlc_valid_channel20_in_band((wlc)->cmi, bandunit, val) brcms_c_valid_channel20_in_band((wlc)->cmi, bandunit, val)
#define VALID_CHANNEL20(wlc, val) wlc_valid_channel20((wlc)->cmi, val) #define VALID_CHANNEL20(wlc, val) brcms_c_valid_channel20((wlc)->cmi, val)
typedef struct wlc_cm_band { typedef struct wlc_cm_band {
u8 locale_flags; /* locale_info_t flags */ u8 locale_flags; /* locale_info_t flags */
...@@ -52,50 +52,47 @@ struct wlc_cm_info { ...@@ -52,50 +52,47 @@ struct wlc_cm_info {
chanvec_t quiet_channels; /* channels on which we cannot transmit */ chanvec_t quiet_channels; /* channels on which we cannot transmit */
}; };
static int wlc_channels_init(wlc_cm_info_t *wlc_cm, static int brcms_c_channels_init(wlc_cm_info_t *wlc_cm,
const country_info_t *country); const country_info_t *country);
static void wlc_set_country_common(wlc_cm_info_t *wlc_cm, static void brcms_c_set_country_common(wlc_cm_info_t *wlc_cm,
const char *country_abbrev, const char *country_abbrev,
const char *ccode, uint regrev, const char *ccode, uint regrev,
const country_info_t *country); const country_info_t *country);
static int wlc_set_countrycode(wlc_cm_info_t *wlc_cm, const char *ccode); static int brcms_c_set_countrycode(wlc_cm_info_t *wlc_cm, const char *ccode);
static int wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm, static int brcms_c_set_countrycode_rev(wlc_cm_info_t *wlc_cm,
const char *country_abbrev, const char *country_abbrev,
const char *ccode, int regrev); const char *ccode, int regrev);
static int wlc_country_aggregate_map(wlc_cm_info_t *wlc_cm, const char *ccode, static int brcms_c_country_aggregate_map(wlc_cm_info_t *wlc_cm,
const char *ccode,
char *mapped_ccode, uint *mapped_regrev); char *mapped_ccode, uint *mapped_regrev);
static const country_info_t *wlc_country_lookup_direct(const char *ccode, static const country_info_t *brcms_c_country_lookup_direct(const char *ccode,
uint regrev); uint regrev);
static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm, static const country_info_t *brcms_c_countrycode_map(wlc_cm_info_t *wlc_cm,
const char *ccode, const char *ccode,
char *mapped_ccode, char *mapped_ccode,
uint *mapped_regrev); uint *mapped_regrev);
static void wlc_channels_commit(wlc_cm_info_t *wlc_cm); static void brcms_c_channels_commit(wlc_cm_info_t *wlc_cm);
static void wlc_quiet_channels_reset(wlc_cm_info_t *wlc_cm); static void brcms_c_quiet_channels_reset(wlc_cm_info_t *wlc_cm);
static bool wlc_quiet_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec); static bool brcms_c_quiet_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec);
static bool wlc_valid_channel20_db(wlc_cm_info_t *wlc_cm, uint val); static bool brcms_c_valid_channel20_db(wlc_cm_info_t *wlc_cm, uint val);
static bool wlc_valid_channel20_in_band(wlc_cm_info_t *wlc_cm, uint bandunit, static bool brcms_c_valid_channel20_in_band(wlc_cm_info_t *wlc_cm,
uint val); uint bandunit, uint val);
static bool wlc_valid_channel20(wlc_cm_info_t *wlc_cm, uint val); static bool brcms_c_valid_channel20(wlc_cm_info_t *wlc_cm, uint val);
static const country_info_t *wlc_country_lookup(struct brcms_c_info *wlc, static const country_info_t *brcms_c_country_lookup(struct brcms_c_info *wlc,
const char *ccode); const char *ccode);
static void wlc_locale_get_channels(const locale_info_t *locale, static void brcms_c_locale_get_channels(const locale_info_t *locale,
chanvec_t *valid_channels); chanvec_t *valid_channels);
static const locale_info_t *wlc_get_locale_2g(u8 locale_idx); static const locale_info_t *brcms_c_get_locale_2g(u8 locale_idx);
static const locale_info_t *wlc_get_locale_5g(u8 locale_idx); static const locale_info_t *brcms_c_get_locale_5g(u8 locale_idx);
static bool wlc_japan(struct brcms_c_info *wlc); static bool brcms_c_japan(struct brcms_c_info *wlc);
static bool wlc_japan_ccode(const char *ccode); static bool brcms_c_japan_ccode(const char *ccode);
static void wlc_channel_min_txpower_limits_with_local_constraint(wlc_cm_info_t * static void brcms_c_channel_min_txpower_limits_with_local_constraint(
wlc_cm, wlc_cm_info_t *wlc_cm, struct txpwr_limits *txpwr,
struct u8 local_constraint_qdbm);
txpwr_limits static void brcms_c_locale_add_channels(chanvec_t *target,
*txpwr,
u8
local_constraint_qdbm);
static void wlc_locale_add_channels(chanvec_t *target,
const chanvec_t *channels); const chanvec_t *channels);
static const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx); static const locale_mimo_info_t *brcms_c_get_mimo_2g(u8 locale_idx);
static const locale_mimo_info_t *wlc_get_mimo_5g(u8 locale_idx); static const locale_mimo_info_t *brcms_c_get_mimo_5g(u8 locale_idx);
/* QDB() macro takes a dB value and converts to a quarter dB value */ /* QDB() macro takes a dB value and converts to a quarter dB value */
#ifdef QDB #ifdef QDB
...@@ -383,7 +380,7 @@ static const chanvec_t *g_table_locale_base[] = { ...@@ -383,7 +380,7 @@ static const chanvec_t *g_table_locale_base[] = {
&locale_5g_HIGH4 &locale_5g_HIGH4
}; };
static void wlc_locale_add_channels(chanvec_t *target, static void brcms_c_locale_add_channels(chanvec_t *target,
const chanvec_t *channels) const chanvec_t *channels)
{ {
u8 i; u8 i;
...@@ -392,7 +389,7 @@ static void wlc_locale_add_channels(chanvec_t *target, ...@@ -392,7 +389,7 @@ static void wlc_locale_add_channels(chanvec_t *target,
} }
} }
static void wlc_locale_get_channels(const locale_info_t *locale, static void brcms_c_locale_get_channels(const locale_info_t *locale,
chanvec_t *channels) chanvec_t *channels)
{ {
u8 i; u8 i;
...@@ -401,7 +398,7 @@ static void wlc_locale_get_channels(const locale_info_t *locale, ...@@ -401,7 +398,7 @@ static void wlc_locale_get_channels(const locale_info_t *locale,
for (i = 0; i < ARRAY_SIZE(g_table_locale_base); i++) { for (i = 0; i < ARRAY_SIZE(g_table_locale_base); i++) {
if (locale->valid_channels & (1 << i)) { if (locale->valid_channels & (1 << i)) {
wlc_locale_add_channels(channels, brcms_c_locale_add_channels(channels,
g_table_locale_base[i]); g_table_locale_base[i]);
} }
} }
...@@ -579,7 +576,7 @@ struct chan20_info chan20_info[] = { ...@@ -579,7 +576,7 @@ struct chan20_info chan20_info[] = {
}; };
#endif /* SUPPORT_40MHZ */ #endif /* SUPPORT_40MHZ */
static const locale_info_t *wlc_get_locale_2g(u8 locale_idx) static const locale_info_t *brcms_c_get_locale_2g(u8 locale_idx)
{ {
if (locale_idx >= ARRAY_SIZE(g_locale_2g_table)) { if (locale_idx >= ARRAY_SIZE(g_locale_2g_table)) {
return NULL; /* error condition */ return NULL; /* error condition */
...@@ -587,7 +584,7 @@ static const locale_info_t *wlc_get_locale_2g(u8 locale_idx) ...@@ -587,7 +584,7 @@ static const locale_info_t *wlc_get_locale_2g(u8 locale_idx)
return g_locale_2g_table[locale_idx]; return g_locale_2g_table[locale_idx];
} }
static const locale_info_t *wlc_get_locale_5g(u8 locale_idx) static const locale_info_t *brcms_c_get_locale_5g(u8 locale_idx)
{ {
if (locale_idx >= ARRAY_SIZE(g_locale_5g_table)) { if (locale_idx >= ARRAY_SIZE(g_locale_5g_table)) {
return NULL; /* error condition */ return NULL; /* error condition */
...@@ -595,7 +592,7 @@ static const locale_info_t *wlc_get_locale_5g(u8 locale_idx) ...@@ -595,7 +592,7 @@ static const locale_info_t *wlc_get_locale_5g(u8 locale_idx)
return g_locale_5g_table[locale_idx]; return g_locale_5g_table[locale_idx];
} }
static const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx) static const locale_mimo_info_t *brcms_c_get_mimo_2g(u8 locale_idx)
{ {
if (locale_idx >= ARRAY_SIZE(g_mimo_2g_table)) { if (locale_idx >= ARRAY_SIZE(g_mimo_2g_table)) {
return NULL; return NULL;
...@@ -603,7 +600,7 @@ static const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx) ...@@ -603,7 +600,7 @@ static const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx)
return g_mimo_2g_table[locale_idx]; return g_mimo_2g_table[locale_idx];
} }
static const locale_mimo_info_t *wlc_get_mimo_5g(u8 locale_idx) static const locale_mimo_info_t *brcms_c_get_mimo_5g(u8 locale_idx)
{ {
if (locale_idx >= ARRAY_SIZE(g_mimo_5g_table)) { if (locale_idx >= ARRAY_SIZE(g_mimo_5g_table)) {
return NULL; return NULL;
...@@ -611,7 +608,7 @@ static const locale_mimo_info_t *wlc_get_mimo_5g(u8 locale_idx) ...@@ -611,7 +608,7 @@ static const locale_mimo_info_t *wlc_get_mimo_5g(u8 locale_idx)
return g_mimo_5g_table[locale_idx]; return g_mimo_5g_table[locale_idx];
} }
wlc_cm_info_t *wlc_channel_mgr_attach(struct brcms_c_info *wlc) wlc_cm_info_t *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc)
{ {
wlc_cm_info_t *wlc_cm; wlc_cm_info_t *wlc_cm;
char country_abbrev[WLC_CNTRY_BUF_SZ]; char country_abbrev[WLC_CNTRY_BUF_SZ];
...@@ -640,7 +637,7 @@ wlc_cm_info_t *wlc_channel_mgr_attach(struct brcms_c_info *wlc) ...@@ -640,7 +637,7 @@ wlc_cm_info_t *wlc_channel_mgr_attach(struct brcms_c_info *wlc)
/* internal country information which must match regulatory constraints in firmware */ /* internal country information which must match regulatory constraints in firmware */
memset(country_abbrev, 0, WLC_CNTRY_BUF_SZ); memset(country_abbrev, 0, WLC_CNTRY_BUF_SZ);
strncpy(country_abbrev, "X2", sizeof(country_abbrev) - 1); strncpy(country_abbrev, "X2", sizeof(country_abbrev) - 1);
country = wlc_country_lookup(wlc, country_abbrev); country = brcms_c_country_lookup(wlc, country_abbrev);
/* save default country for exiting 11d regulatory mode */ /* save default country for exiting 11d regulatory mode */
strncpy(wlc->country_default, country_abbrev, WLC_CNTRY_BUF_SZ - 1); strncpy(wlc->country_default, country_abbrev, WLC_CNTRY_BUF_SZ - 1);
...@@ -648,17 +645,17 @@ wlc_cm_info_t *wlc_channel_mgr_attach(struct brcms_c_info *wlc) ...@@ -648,17 +645,17 @@ wlc_cm_info_t *wlc_channel_mgr_attach(struct brcms_c_info *wlc)
/* initialize autocountry_default to driver default */ /* initialize autocountry_default to driver default */
strncpy(wlc->autocountry_default, "X2", WLC_CNTRY_BUF_SZ - 1); strncpy(wlc->autocountry_default, "X2", WLC_CNTRY_BUF_SZ - 1);
wlc_set_countrycode(wlc_cm, country_abbrev); brcms_c_set_countrycode(wlc_cm, country_abbrev);
return wlc_cm; return wlc_cm;
} }
void wlc_channel_mgr_detach(wlc_cm_info_t *wlc_cm) void brcms_c_channel_mgr_detach(wlc_cm_info_t *wlc_cm)
{ {
kfree(wlc_cm); kfree(wlc_cm);
} }
u8 wlc_channel_locale_flags_in_band(wlc_cm_info_t *wlc_cm, uint bandunit) u8 brcms_c_channel_locale_flags_in_band(wlc_cm_info_t *wlc_cm, uint bandunit)
{ {
return wlc_cm->bandstate[bandunit].locale_flags; return wlc_cm->bandstate[bandunit].locale_flags;
} }
...@@ -666,15 +663,15 @@ u8 wlc_channel_locale_flags_in_band(wlc_cm_info_t *wlc_cm, uint bandunit) ...@@ -666,15 +663,15 @@ u8 wlc_channel_locale_flags_in_band(wlc_cm_info_t *wlc_cm, uint bandunit)
/* set the driver's current country and regulatory information using a country code /* set the driver's current country and regulatory information using a country code
* as the source. Lookup built in country information found with the country code. * as the source. Lookup built in country information found with the country code.
*/ */
static int wlc_set_countrycode(wlc_cm_info_t *wlc_cm, const char *ccode) static int brcms_c_set_countrycode(wlc_cm_info_t *wlc_cm, const char *ccode)
{ {
char country_abbrev[WLC_CNTRY_BUF_SZ]; char country_abbrev[WLC_CNTRY_BUF_SZ];
strncpy(country_abbrev, ccode, WLC_CNTRY_BUF_SZ); strncpy(country_abbrev, ccode, WLC_CNTRY_BUF_SZ);
return wlc_set_countrycode_rev(wlc_cm, country_abbrev, ccode, -1); return brcms_c_set_countrycode_rev(wlc_cm, country_abbrev, ccode, -1);
} }
static int static int
wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm, brcms_c_set_countrycode_rev(wlc_cm_info_t *wlc_cm,
const char *country_abbrev, const char *country_abbrev,
const char *ccode, int regrev) const char *ccode, int regrev)
{ {
...@@ -688,11 +685,11 @@ wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm, ...@@ -688,11 +685,11 @@ wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm,
if (regrev == -1) { if (regrev == -1) {
/* map the country code to a built-in country code, regrev, and country_info */ /* map the country code to a built-in country code, regrev, and country_info */
country = country =
wlc_countrycode_map(wlc_cm, ccode, mapped_ccode, brcms_c_countrycode_map(wlc_cm, ccode, mapped_ccode,
&mapped_regrev); &mapped_regrev);
} else { } else {
/* find the matching built-in country definition */ /* find the matching built-in country definition */
country = wlc_country_lookup_direct(ccode, regrev); country = brcms_c_country_lookup_direct(ccode, regrev);
strncpy(mapped_ccode, ccode, WLC_CNTRY_BUF_SZ); strncpy(mapped_ccode, ccode, WLC_CNTRY_BUF_SZ);
mapped_regrev = regrev; mapped_regrev = regrev;
} }
...@@ -701,7 +698,7 @@ wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm, ...@@ -701,7 +698,7 @@ wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm,
return -EINVAL; return -EINVAL;
/* set the driver state for the country */ /* set the driver state for the country */
wlc_set_country_common(wlc_cm, country_abbrev, mapped_ccode, brcms_c_set_country_common(wlc_cm, country_abbrev, mapped_ccode,
mapped_regrev, country); mapped_regrev, country);
return 0; return 0;
...@@ -711,7 +708,7 @@ wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm, ...@@ -711,7 +708,7 @@ wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm,
* as the source. Look up built in country information found with the country code. * as the source. Look up built in country information found with the country code.
*/ */
static void static void
wlc_set_country_common(wlc_cm_info_t *wlc_cm, brcms_c_set_country_common(wlc_cm_info_t *wlc_cm,
const char *country_abbrev, const char *country_abbrev,
const char *ccode, uint regrev, const char *ccode, uint regrev,
const country_info_t *country) const country_info_t *country)
...@@ -733,7 +730,7 @@ wlc_set_country_common(wlc_cm_info_t *wlc_cm, ...@@ -733,7 +730,7 @@ wlc_set_country_common(wlc_cm_info_t *wlc_cm,
wlc_cm->regrev = regrev; wlc_cm->regrev = regrev;
/* disable/restore nmode based on country regulations */ /* disable/restore nmode based on country regulations */
li_mimo = wlc_get_mimo_2g(country->locale_mimo_2G); li_mimo = brcms_c_get_mimo_2g(country->locale_mimo_2G);
if (li_mimo && (li_mimo->flags & WLC_NO_MIMO)) { if (li_mimo && (li_mimo->flags & WLC_NO_MIMO)) {
brcms_c_set_nmode(wlc, OFF); brcms_c_set_nmode(wlc, OFF);
wlc->stf->no_cddstbc = true; wlc->stf->no_cddstbc = true;
...@@ -743,17 +740,17 @@ wlc_set_country_common(wlc_cm_info_t *wlc_cm, ...@@ -743,17 +740,17 @@ wlc_set_country_common(wlc_cm_info_t *wlc_cm,
brcms_c_set_nmode(wlc, wlc->protection->nmode_user); brcms_c_set_nmode(wlc, wlc->protection->nmode_user);
} }
wlc_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]);
wlc_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]);
/* set or restore gmode as required by regulatory */ /* set or restore gmode as required by regulatory */
locale = wlc_get_locale_2g(country->locale_2G); locale = brcms_c_get_locale_2g(country->locale_2G);
if (locale && (locale->flags & WLC_NO_OFDM)) { if (locale && (locale->flags & WLC_NO_OFDM)) {
brcms_c_set_gmode(wlc, GMODE_LEGACY_B, false); brcms_c_set_gmode(wlc, GMODE_LEGACY_B, false);
} else { } else {
brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false); brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false);
} }
wlc_channels_init(wlc_cm, country); brcms_c_channels_init(wlc_cm, country);
return; return;
} }
...@@ -761,7 +758,7 @@ wlc_set_country_common(wlc_cm_info_t *wlc_cm, ...@@ -761,7 +758,7 @@ wlc_set_country_common(wlc_cm_info_t *wlc_cm,
/* Lookup a country info structure from a null terminated country code /* Lookup a country info structure from a null terminated country code
* The lookup is case sensitive. * The lookup is case sensitive.
*/ */
static const country_info_t *wlc_country_lookup(struct brcms_c_info *wlc, static const country_info_t *brcms_c_country_lookup(struct brcms_c_info *wlc,
const char *ccode) const char *ccode)
{ {
const country_info_t *country; const country_info_t *country;
...@@ -769,13 +766,13 @@ static const country_info_t *wlc_country_lookup(struct brcms_c_info *wlc, ...@@ -769,13 +766,13 @@ static const country_info_t *wlc_country_lookup(struct brcms_c_info *wlc,
uint mapped_regrev; uint mapped_regrev;
/* map the country code to a built-in country code, regrev, and country_info struct */ /* map the country code to a built-in country code, regrev, and country_info struct */
country = country = brcms_c_countrycode_map(wlc->cmi, ccode, mapped_ccode,
wlc_countrycode_map(wlc->cmi, ccode, mapped_ccode, &mapped_regrev); &mapped_regrev);
return country; return country;
} }
static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm, static const country_info_t *brcms_c_countrycode_map(wlc_cm_info_t *wlc_cm,
const char *ccode, const char *ccode,
char *mapped_ccode, char *mapped_ccode,
uint *mapped_regrev) uint *mapped_regrev)
...@@ -807,25 +804,25 @@ static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm, ...@@ -807,25 +804,25 @@ static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm,
wiphy_err(wlc->wiphy, "srom_code == ccode %s\n", __func__); wiphy_err(wlc->wiphy, "srom_code == ccode %s\n", __func__);
} else { } else {
mapped = mapped =
wlc_country_aggregate_map(wlc_cm, ccode, mapped_ccode, brcms_c_country_aggregate_map(wlc_cm, ccode, mapped_ccode,
mapped_regrev); mapped_regrev);
} }
/* find the matching built-in country definition */ /* find the matching built-in country definition */
country = wlc_country_lookup_direct(mapped_ccode, *mapped_regrev); country = brcms_c_country_lookup_direct(mapped_ccode, *mapped_regrev);
/* if there is not an exact rev match, default to rev zero */ /* if there is not an exact rev match, default to rev zero */
if (country == NULL && *mapped_regrev != 0) { if (country == NULL && *mapped_regrev != 0) {
*mapped_regrev = 0; *mapped_regrev = 0;
country = country =
wlc_country_lookup_direct(mapped_ccode, *mapped_regrev); brcms_c_country_lookup_direct(mapped_ccode, *mapped_regrev);
} }
return country; return country;
} }
static int static int
wlc_country_aggregate_map(wlc_cm_info_t *wlc_cm, const char *ccode, brcms_c_country_aggregate_map(wlc_cm_info_t *wlc_cm, const char *ccode,
char *mapped_ccode, uint *mapped_regrev) char *mapped_ccode, uint *mapped_regrev)
{ {
return false; return false;
...@@ -834,7 +831,7 @@ wlc_country_aggregate_map(wlc_cm_info_t *wlc_cm, const char *ccode, ...@@ -834,7 +831,7 @@ wlc_country_aggregate_map(wlc_cm_info_t *wlc_cm, const char *ccode,
/* Lookup a country info structure from a null terminated country /* Lookup a country info structure from a null terminated country
* abbreviation and regrev directly with no translation. * abbreviation and regrev directly with no translation.
*/ */
static const country_info_t *wlc_country_lookup_direct(const char *ccode, static const country_info_t *brcms_c_country_lookup_direct(const char *ccode,
uint regrev) uint regrev)
{ {
uint size, i; uint size, i;
...@@ -857,7 +854,7 @@ static const country_info_t *wlc_country_lookup_direct(const char *ccode, ...@@ -857,7 +854,7 @@ static const country_info_t *wlc_country_lookup_direct(const char *ccode,
} }
static int static int
wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country) brcms_c_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country)
{ {
struct brcms_c_info *wlc = wlc_cm->wlc; struct brcms_c_info *wlc = wlc_cm->wlc;
uint i, j; uint i, j;
...@@ -871,12 +868,12 @@ wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country) ...@@ -871,12 +868,12 @@ wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country)
i++, band = wlc->bandstate[OTHERBANDUNIT(wlc)]) { i++, band = wlc->bandstate[OTHERBANDUNIT(wlc)]) {
li = BAND_5G(band->bandtype) ? li = BAND_5G(band->bandtype) ?
wlc_get_locale_5g(country->locale_5G) : brcms_c_get_locale_5g(country->locale_5G) :
wlc_get_locale_2g(country->locale_2G); brcms_c_get_locale_2g(country->locale_2G);
wlc_cm->bandstate[band->bandunit].locale_flags = li->flags; wlc_cm->bandstate[band->bandunit].locale_flags = li->flags;
li_mimo = BAND_5G(band->bandtype) ? li_mimo = BAND_5G(band->bandtype) ?
wlc_get_mimo_5g(country->locale_mimo_5G) : brcms_c_get_mimo_5g(country->locale_mimo_5G) :
wlc_get_mimo_2g(country->locale_mimo_2G); brcms_c_get_mimo_2g(country->locale_mimo_2G);
/* merge the mimo non-mimo locale flags */ /* merge the mimo non-mimo locale flags */
wlc_cm->bandstate[band->bandunit].locale_flags |= wlc_cm->bandstate[band->bandunit].locale_flags |=
...@@ -892,7 +889,7 @@ wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country) ...@@ -892,7 +889,7 @@ wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country)
*/ */
wlc_phy_chanspec_band_validch(band->pi, band->bandtype, wlc_phy_chanspec_band_validch(band->pi, band->bandtype,
&sup_chan); &sup_chan);
wlc_locale_get_channels(li, brcms_c_locale_get_channels(li,
&wlc_cm->bandstate[band->bandunit]. &wlc_cm->bandstate[band->bandunit].
valid_channels); valid_channels);
for (j = 0; j < sizeof(chanvec_t); j++) for (j = 0; j < sizeof(chanvec_t); j++)
...@@ -900,8 +897,8 @@ wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country) ...@@ -900,8 +897,8 @@ wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country)
vec[j] &= sup_chan.vec[j]; vec[j] &= sup_chan.vec[j];
} }
wlc_quiet_channels_reset(wlc_cm); brcms_c_quiet_channels_reset(wlc_cm);
wlc_channels_commit(wlc_cm); brcms_c_channels_commit(wlc_cm);
return 0; return 0;
} }
...@@ -909,7 +906,7 @@ wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country) ...@@ -909,7 +906,7 @@ wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country)
/* Update the radio state (enable/disable) and tx power targets /* Update the radio state (enable/disable) and tx power targets
* based on a new set of channel/regulatory information * based on a new set of channel/regulatory information
*/ */
static void wlc_channels_commit(wlc_cm_info_t *wlc_cm) static void brcms_c_channels_commit(wlc_cm_info_t *wlc_cm)
{ {
struct brcms_c_info *wlc = wlc_cm->wlc; struct brcms_c_info *wlc = wlc_cm->wlc;
uint chan; uint chan;
...@@ -944,13 +941,13 @@ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm) ...@@ -944,13 +941,13 @@ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm)
*/ */
if (NBANDS(wlc) > 1 || BAND_2G(wlc->band->bandtype)) { if (NBANDS(wlc) > 1 || BAND_2G(wlc->band->bandtype)) {
wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi, wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi,
wlc_japan(wlc) ? true : brcms_c_japan(wlc) ? true :
false); false);
} }
if (wlc->pub->up && chan != INVCHANNEL) { if (wlc->pub->up && chan != INVCHANNEL) {
wlc_channel_reg_limits(wlc_cm, wlc->chanspec, &txpwr); brcms_c_channel_reg_limits(wlc_cm, wlc->chanspec, &txpwr);
wlc_channel_min_txpower_limits_with_local_constraint(wlc_cm, brcms_c_channel_min_txpower_limits_with_local_constraint(wlc_cm,
&txpwr, &txpwr,
WLC_TXPWR_MAX); WLC_TXPWR_MAX);
wlc_phy_txpower_limit_set(wlc->band->pi, &txpwr, wlc->chanspec); wlc_phy_txpower_limit_set(wlc->band->pi, &txpwr, wlc->chanspec);
...@@ -958,7 +955,7 @@ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm) ...@@ -958,7 +955,7 @@ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm)
} }
/* reset the quiet channels vector to the union of the restricted and radar channel sets */ /* reset the quiet channels vector to the union of the restricted and radar channel sets */
static void wlc_quiet_channels_reset(wlc_cm_info_t *wlc_cm) static void brcms_c_quiet_channels_reset(wlc_cm_info_t *wlc_cm)
{ {
struct brcms_c_info *wlc = wlc_cm->wlc; struct brcms_c_info *wlc = wlc_cm->wlc;
uint i, j; uint i, j;
...@@ -979,7 +976,7 @@ static void wlc_quiet_channels_reset(wlc_cm_info_t *wlc_cm) ...@@ -979,7 +976,7 @@ static void wlc_quiet_channels_reset(wlc_cm_info_t *wlc_cm)
} }
} }
static bool wlc_quiet_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec) static bool brcms_c_quiet_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec)
{ {
return N_ENAB(wlc_cm->wlc->pub) && CHSPEC_IS40(chspec) ? return N_ENAB(wlc_cm->wlc->pub) && CHSPEC_IS40(chspec) ?
(isset (isset
...@@ -996,7 +993,7 @@ static bool wlc_quiet_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec) ...@@ -996,7 +993,7 @@ static bool wlc_quiet_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec)
/* Is the channel valid for the current locale? (but don't consider channels not /* Is the channel valid for the current locale? (but don't consider channels not
* available due to bandlocking) * available due to bandlocking)
*/ */
static bool wlc_valid_channel20_db(wlc_cm_info_t *wlc_cm, uint val) static bool brcms_c_valid_channel20_db(wlc_cm_info_t *wlc_cm, uint val)
{ {
struct brcms_c_info *wlc = wlc_cm->wlc; struct brcms_c_info *wlc = wlc_cm->wlc;
...@@ -1007,14 +1004,14 @@ static bool wlc_valid_channel20_db(wlc_cm_info_t *wlc_cm, uint val) ...@@ -1007,14 +1004,14 @@ static bool wlc_valid_channel20_db(wlc_cm_info_t *wlc_cm, uint val)
/* Is the channel valid for the current locale and specified band? */ /* Is the channel valid for the current locale and specified band? */
static bool static bool
wlc_valid_channel20_in_band(wlc_cm_info_t *wlc_cm, uint bandunit, uint val) brcms_c_valid_channel20_in_band(wlc_cm_info_t *wlc_cm, uint bandunit, uint val)
{ {
return ((val < MAXCHANNEL) return ((val < MAXCHANNEL)
&& isset(wlc_cm->bandstate[bandunit].valid_channels.vec, val)); && isset(wlc_cm->bandstate[bandunit].valid_channels.vec, val));
} }
/* Is the channel valid for the current locale and current band? */ /* Is the channel valid for the current locale and current band? */
static bool wlc_valid_channel20(wlc_cm_info_t *wlc_cm, uint val) static bool brcms_c_valid_channel20(wlc_cm_info_t *wlc_cm, uint val)
{ {
struct brcms_c_info *wlc = wlc_cm->wlc; struct brcms_c_info *wlc = wlc_cm->wlc;
...@@ -1024,7 +1021,7 @@ static bool wlc_valid_channel20(wlc_cm_info_t *wlc_cm, uint val) ...@@ -1024,7 +1021,7 @@ static bool wlc_valid_channel20(wlc_cm_info_t *wlc_cm, uint val)
} }
static void static void
wlc_channel_min_txpower_limits_with_local_constraint(wlc_cm_info_t *wlc_cm, brcms_c_channel_min_txpower_limits_with_local_constraint(wlc_cm_info_t *wlc_cm,
struct txpwr_limits *txpwr, struct txpwr_limits *txpwr,
u8 u8
local_constraint_qdbm) local_constraint_qdbm)
...@@ -1111,19 +1108,19 @@ wlc_channel_min_txpower_limits_with_local_constraint(wlc_cm_info_t *wlc_cm, ...@@ -1111,19 +1108,19 @@ wlc_channel_min_txpower_limits_with_local_constraint(wlc_cm_info_t *wlc_cm,
} }
void void
wlc_channel_set_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, brcms_c_channel_set_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chanspec,
u8 local_constraint_qdbm) u8 local_constraint_qdbm)
{ {
struct brcms_c_info *wlc = wlc_cm->wlc; struct brcms_c_info *wlc = wlc_cm->wlc;
struct txpwr_limits txpwr; struct txpwr_limits txpwr;
wlc_channel_reg_limits(wlc_cm, chanspec, &txpwr); brcms_c_channel_reg_limits(wlc_cm, chanspec, &txpwr);
wlc_channel_min_txpower_limits_with_local_constraint(wlc_cm, &txpwr, brcms_c_channel_min_txpower_limits_with_local_constraint(wlc_cm, &txpwr,
local_constraint_qdbm); local_constraint_qdbm);
brcms_b_set_chanspec(wlc->hw, chanspec, brcms_b_set_chanspec(wlc->hw, chanspec,
(wlc_quiet_chanspec(wlc_cm, chanspec) != 0), (brcms_c_quiet_chanspec(wlc_cm, chanspec) != 0),
&txpwr); &txpwr);
} }
...@@ -1245,7 +1242,7 @@ static void wlc_phy_txpower_limits_dump(txpwr_limits_t *txpwr) ...@@ -1245,7 +1242,7 @@ static void wlc_phy_txpower_limits_dump(txpwr_limits_t *txpwr)
#endif /* POWER_DBG */ #endif /* POWER_DBG */
void void
wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, brcms_c_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec,
txpwr_limits_t *txpwr) txpwr_limits_t *txpwr)
{ {
struct brcms_c_info *wlc = wlc_cm->wlc; struct brcms_c_info *wlc = wlc_cm->wlc;
...@@ -1265,8 +1262,8 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, ...@@ -1265,8 +1262,8 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec,
memset(txpwr, 0, sizeof(txpwr_limits_t)); memset(txpwr, 0, sizeof(txpwr_limits_t));
if (!wlc_valid_chanspec_db(wlc_cm, chanspec)) { if (!brcms_c_valid_chanspec_db(wlc_cm, chanspec)) {
country = wlc_country_lookup(wlc, wlc->autocountry_default); country = brcms_c_country_lookup(wlc, wlc->autocountry_default);
if (country == NULL) if (country == NULL)
return; return;
} else { } else {
...@@ -1276,12 +1273,12 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, ...@@ -1276,12 +1273,12 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec,
chan = CHSPEC_CHANNEL(chanspec); chan = CHSPEC_CHANNEL(chanspec);
band = wlc->bandstate[CHSPEC_WLCBANDUNIT(chanspec)]; band = wlc->bandstate[CHSPEC_WLCBANDUNIT(chanspec)];
li = BAND_5G(band->bandtype) ? li = BAND_5G(band->bandtype) ?
wlc_get_locale_5g(country->locale_5G) : brcms_c_get_locale_5g(country->locale_5G) :
wlc_get_locale_2g(country->locale_2G); brcms_c_get_locale_2g(country->locale_2G);
li_mimo = BAND_5G(band->bandtype) ? li_mimo = BAND_5G(band->bandtype) ?
wlc_get_mimo_5g(country->locale_mimo_5G) : brcms_c_get_mimo_5g(country->locale_mimo_5G) :
wlc_get_mimo_2g(country->locale_mimo_2G); brcms_c_get_mimo_2g(country->locale_mimo_2G);
if (li->flags & WLC_EIRP) { if (li->flags & WLC_EIRP) {
delta = band->antgain; delta = band->antgain;
...@@ -1458,13 +1455,13 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, ...@@ -1458,13 +1455,13 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec,
} }
/* Returns true if currently set country is Japan or variant */ /* Returns true if currently set country is Japan or variant */
static bool wlc_japan(struct brcms_c_info *wlc) static bool brcms_c_japan(struct brcms_c_info *wlc)
{ {
return wlc_japan_ccode(wlc->cmi->country_abbrev); return brcms_c_japan_ccode(wlc->cmi->country_abbrev);
} }
/* JP, J1 - J10 are Japan ccodes */ /* JP, J1 - J10 are Japan ccodes */
static bool wlc_japan_ccode(const char *ccode) static bool brcms_c_japan_ccode(const char *ccode)
{ {
return (ccode[0] == 'J' && return (ccode[0] == 'J' &&
(ccode[1] == 'P' || (ccode[1] >= '1' && ccode[1] <= '9'))); (ccode[1] == 'P' || (ccode[1] >= '1' && ccode[1] <= '9')));
...@@ -1475,7 +1472,8 @@ static bool wlc_japan_ccode(const char *ccode) ...@@ -1475,7 +1472,8 @@ static bool wlc_japan_ccode(const char *ccode)
* are valid 20MZH channels in this locale and they are also a legal HT combination * are valid 20MZH channels in this locale and they are also a legal HT combination
*/ */
static bool static bool
wlc_valid_chanspec_ext(wlc_cm_info_t *wlc_cm, chanspec_t chspec, bool dualband) brcms_c_valid_chanspec_ext(wlc_cm_info_t *wlc_cm, chanspec_t chspec,
bool dualband)
{ {
struct brcms_c_info *wlc = wlc_cm->wlc; struct brcms_c_info *wlc = wlc_cm->wlc;
u8 channel = CHSPEC_CHANNEL(chspec); u8 channel = CHSPEC_CHANNEL(chspec);
...@@ -1536,7 +1534,7 @@ wlc_valid_chanspec_ext(wlc_cm_info_t *wlc_cm, chanspec_t chspec, bool dualband) ...@@ -1536,7 +1534,7 @@ wlc_valid_chanspec_ext(wlc_cm_info_t *wlc_cm, chanspec_t chspec, bool dualband)
return false; return false;
} }
bool wlc_valid_chanspec_db(wlc_cm_info_t *wlc_cm, chanspec_t chspec) bool brcms_c_valid_chanspec_db(wlc_cm_info_t *wlc_cm, chanspec_t chspec)
{ {
return wlc_valid_chanspec_ext(wlc_cm, chspec, true); return brcms_c_valid_chanspec_ext(wlc_cm, chspec, true);
} }
...@@ -103,18 +103,18 @@ struct country_info { ...@@ -103,18 +103,18 @@ struct country_info {
const u8 locale_mimo_5G; /* 5G mimo info */ const u8 locale_mimo_5G; /* 5G mimo info */
}; };
extern wlc_cm_info_t *wlc_channel_mgr_attach(struct brcms_c_info *wlc); extern wlc_cm_info_t *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc);
extern void wlc_channel_mgr_detach(wlc_cm_info_t *wlc_cm); extern void brcms_c_channel_mgr_detach(wlc_cm_info_t *wlc_cm);
extern u8 wlc_channel_locale_flags_in_band(wlc_cm_info_t *wlc_cm, extern u8 brcms_c_channel_locale_flags_in_band(wlc_cm_info_t *wlc_cm,
uint bandunit); uint bandunit);
extern bool wlc_valid_chanspec_db(wlc_cm_info_t *wlc_cm, chanspec_t chspec); extern bool brcms_c_valid_chanspec_db(wlc_cm_info_t *wlc_cm, chanspec_t chspec);
extern void wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, extern void brcms_c_channel_reg_limits(wlc_cm_info_t *wlc_cm,
chanspec_t chanspec, chanspec_t chanspec,
struct txpwr_limits *txpwr); struct txpwr_limits *txpwr);
extern void wlc_channel_set_chanspec(wlc_cm_info_t *wlc_cm, extern void brcms_c_channel_set_chanspec(wlc_cm_info_t *wlc_cm,
chanspec_t chanspec, chanspec_t chanspec,
u8 local_constraint_qdbm); u8 local_constraint_qdbm);
......
...@@ -651,7 +651,7 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw, ...@@ -651,7 +651,7 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw,
case IEEE80211_AMPDU_TX_STOP: case IEEE80211_AMPDU_TX_STOP:
LOCK(wl); LOCK(wl);
wlc_ampdu_flush(wl->wlc, sta, tid); brcms_c_ampdu_flush(wl->wlc, sta, tid);
UNLOCK(wl); UNLOCK(wl);
ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
break; break;
......
...@@ -526,7 +526,7 @@ void brcms_c_init(struct brcms_c_info *wlc) ...@@ -526,7 +526,7 @@ void brcms_c_init(struct brcms_c_info *wlc)
wlc_duty_cycle_set(wlc, wlc->tx_duty_cycle_cck, false, true); wlc_duty_cycle_set(wlc, wlc->tx_duty_cycle_cck, false, true);
/* Update some shared memory locations related to max AMPDU size allowed to received */ /* Update some shared memory locations related to max AMPDU size allowed to received */
wlc_ampdu_shm_upd(wlc->ampdu); brcms_c_ampdu_shm_upd(wlc->ampdu);
/* band-specific inits */ /* band-specific inits */
wlc_bsinit(wlc); wlc_bsinit(wlc);
...@@ -652,7 +652,7 @@ int brcms_c_set_mac(struct brcms_c_bsscfg *cfg) ...@@ -652,7 +652,7 @@ int brcms_c_set_mac(struct brcms_c_bsscfg *cfg)
brcms_c_set_addrmatch(wlc, RCM_MAC_OFFSET, cfg->cur_etheraddr); brcms_c_set_addrmatch(wlc, RCM_MAC_OFFSET, cfg->cur_etheraddr);
} }
wlc_ampdu_macaddr_upd(wlc); brcms_c_ampdu_macaddr_upd(wlc);
return err; return err;
} }
...@@ -760,14 +760,14 @@ static void wlc_set_phy_chanspec(struct brcms_c_info *wlc, chanspec_t chanspec) ...@@ -760,14 +760,14 @@ static void wlc_set_phy_chanspec(struct brcms_c_info *wlc, chanspec_t chanspec)
/* Set the chanspec and power limits for this locale after computing /* Set the chanspec and power limits for this locale after computing
* any 11h local tx power constraints. * any 11h local tx power constraints.
*/ */
wlc_channel_set_chanspec(wlc->cmi, chanspec, brcms_c_channel_set_chanspec(wlc->cmi, chanspec,
wlc_local_constraint_qdbm(wlc)); wlc_local_constraint_qdbm(wlc));
if (wlc->stf->ss_algosel_auto) if (wlc->stf->ss_algosel_auto)
wlc_stf_ss_algo_channel_get(wlc, &wlc->stf->ss_algo_channel, brcms_c_stf_ss_algo_channel_get(wlc, &wlc->stf->ss_algo_channel,
chanspec); chanspec);
wlc_stf_ss_update(wlc, wlc->band); brcms_c_stf_ss_update(wlc, wlc->band);
} }
...@@ -777,7 +777,7 @@ void brcms_c_set_chanspec(struct brcms_c_info *wlc, chanspec_t chanspec) ...@@ -777,7 +777,7 @@ void brcms_c_set_chanspec(struct brcms_c_info *wlc, chanspec_t chanspec)
bool switchband = false; bool switchband = false;
chanspec_t old_chanspec = wlc->chanspec; chanspec_t old_chanspec = wlc->chanspec;
if (!wlc_valid_chanspec_db(wlc->cmi, chanspec)) { if (!brcms_c_valid_chanspec_db(wlc->cmi, chanspec)) {
wiphy_err(wlc->wiphy, "wl%d: %s: Bad channel %d\n", wiphy_err(wlc->wiphy, "wl%d: %s: Bad channel %d\n",
wlc->pub->unit, __func__, CHSPEC_CHANNEL(chanspec)); wlc->pub->unit, __func__, CHSPEC_CHANNEL(chanspec));
return; return;
...@@ -812,12 +812,12 @@ void brcms_c_set_chanspec(struct brcms_c_info *wlc, chanspec_t chanspec) ...@@ -812,12 +812,12 @@ void brcms_c_set_chanspec(struct brcms_c_info *wlc, chanspec_t chanspec)
/* init antenna selection */ /* init antenna selection */
if (CHSPEC_WLC_BW(old_chanspec) != CHSPEC_WLC_BW(chanspec)) { if (CHSPEC_WLC_BW(old_chanspec) != CHSPEC_WLC_BW(chanspec)) {
wlc_antsel_init(wlc->asi); brcms_c_antsel_init(wlc->asi);
/* Fix the hardware rateset based on bw. /* Fix the hardware rateset based on bw.
* Mainly add MCS32 for 40Mhz, remove MCS 32 for 20Mhz * Mainly add MCS32 for 40Mhz, remove MCS 32 for 20Mhz
*/ */
wlc_rateset_bw_mcs_filter(&wlc->band->hw_rateset, brcms_c_rateset_bw_mcs_filter(&wlc->band->hw_rateset,
wlc->band-> wlc->band->
mimo_cap_40 ? CHSPEC_WLC_BW(chanspec) mimo_cap_40 ? CHSPEC_WLC_BW(chanspec)
: 0); : 0);
...@@ -865,7 +865,7 @@ void brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc, ...@@ -865,7 +865,7 @@ void brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc,
/* for non-siso rates or default setting, use the available chains */ /* for non-siso rates or default setting, use the available chains */
if (WLC_PHY_11N_CAP(wlc->band)) { if (WLC_PHY_11N_CAP(wlc->band)) {
phytxant = wlc_stf_phytxchain_sel(wlc, bcn_rspec); phytxant = brcms_c_stf_phytxchain_sel(wlc, bcn_rspec);
} }
phyctl = brcms_c_read_shm(wlc, M_BCN_PCTLWD); phyctl = brcms_c_read_shm(wlc, M_BCN_PCTLWD);
...@@ -1014,12 +1014,12 @@ static void wlc_bandinit_ordered(struct brcms_c_info *wlc, chanspec_t chanspec) ...@@ -1014,12 +1014,12 @@ static void wlc_bandinit_ordered(struct brcms_c_info *wlc, chanspec_t chanspec)
brcms_default_rateset(wlc, &default_rateset); brcms_default_rateset(wlc, &default_rateset);
/* fill in hw_rate */ /* fill in hw_rate */
wlc_rateset_filter(&default_rateset, &wlc->band->hw_rateset, brcms_c_rateset_filter(&default_rateset, &wlc->band->hw_rateset,
false, WLC_RATES_CCK_OFDM, WLC_RATE_MASK, false, WLC_RATES_CCK_OFDM, WLC_RATE_MASK,
(bool) N_ENAB(wlc->pub)); (bool) N_ENAB(wlc->pub));
/* init basic rate lookup */ /* init basic rate lookup */
wlc_rate_lookup_init(wlc, &default_rateset); brcms_c_rate_lookup_init(wlc, &default_rateset);
} }
/* sync up phy/radio chanspec */ /* sync up phy/radio chanspec */
...@@ -1039,7 +1039,7 @@ static void WLBANDINITFN(wlc_bsinit) (struct brcms_c_info *wlc) ...@@ -1039,7 +1039,7 @@ static void WLBANDINITFN(wlc_bsinit) (struct brcms_c_info *wlc)
wlc_ucode_mac_upd(wlc); wlc_ucode_mac_upd(wlc);
/* init antenna selection */ /* init antenna selection */
wlc_antsel_init(wlc->asi); brcms_c_antsel_init(wlc->asi);
} }
...@@ -1317,23 +1317,23 @@ static uint wlc_attach_module(struct brcms_c_info *wlc) ...@@ -1317,23 +1317,23 @@ static uint wlc_attach_module(struct brcms_c_info *wlc)
uint unit; uint unit;
unit = wlc->pub->unit; unit = wlc->pub->unit;
wlc->asi = wlc_antsel_attach(wlc); wlc->asi = brcms_c_antsel_attach(wlc);
if (wlc->asi == NULL) { if (wlc->asi == NULL) {
wiphy_err(wlc->wiphy, "wl%d: wlc_attach: wlc_antsel_attach " wiphy_err(wlc->wiphy, "wl%d: wlc_attach: antsel_attach "
"failed\n", unit); "failed\n", unit);
err = 44; err = 44;
goto fail; goto fail;
} }
wlc->ampdu = wlc_ampdu_attach(wlc); wlc->ampdu = brcms_c_ampdu_attach(wlc);
if (wlc->ampdu == NULL) { if (wlc->ampdu == NULL) {
wiphy_err(wlc->wiphy, "wl%d: wlc_attach: wlc_ampdu_attach " wiphy_err(wlc->wiphy, "wl%d: wlc_attach: brcms_c_ampdu_attach "
"failed\n", unit); "failed\n", unit);
err = 50; err = 50;
goto fail; goto fail;
} }
if ((wlc_stf_attach(wlc) != 0)) { if ((brcms_c_stf_attach(wlc) != 0)) {
wiphy_err(wlc->wiphy, "wl%d: wlc_attach: wlc_stf_attach " wiphy_err(wlc->wiphy, "wl%d: wlc_attach: wlc_stf_attach "
"failed\n", unit); "failed\n", unit);
err = 68; err = 68;
...@@ -1364,7 +1364,7 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, ...@@ -1364,7 +1364,7 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
uint n_disabled; uint n_disabled;
/* allocate struct brcms_c_info state and its substructures */ /* allocate struct brcms_c_info state and its substructures */
wlc = (struct brcms_c_info *) wlc_attach_malloc(unit, &err, device); wlc = (struct brcms_c_info *) brcms_c_attach_malloc(unit, &err, device);
if (wlc == NULL) if (wlc == NULL)
goto fail; goto fail;
wlc->wiphy = wl->wiphy; wlc->wiphy = wl->wiphy;
...@@ -1419,7 +1419,7 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, ...@@ -1419,7 +1419,7 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
wlc->tx_duty_cycle_cck = wlc->tx_duty_cycle_cck =
(u16) getintvar(pub->vars, "tx_duty_cycle_cck"); (u16) getintvar(pub->vars, "tx_duty_cycle_cck");
wlc_stf_phy_chain_calc(wlc); brcms_c_stf_phy_chain_calc(wlc);
/* txchain 1: txant 0, txchain 2: txant 1 */ /* txchain 1: txant 0, txchain 2: txant 1 */
if (WLCISNPHY(wlc->band) && (wlc->stf->txstreams == 1)) if (WLCISNPHY(wlc->band) && (wlc->stf->txstreams == 1))
...@@ -1482,14 +1482,14 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, ...@@ -1482,14 +1482,14 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
brcms_default_rateset(wlc, &wlc->band->defrateset); brcms_default_rateset(wlc, &wlc->band->defrateset);
/* fill in hw_rateset (used early by WLC_SET_RATESET) */ /* fill in hw_rateset (used early by WLC_SET_RATESET) */
wlc_rateset_filter(&wlc->band->defrateset, brcms_c_rateset_filter(&wlc->band->defrateset,
&wlc->band->hw_rateset, false, &wlc->band->hw_rateset, false,
WLC_RATES_CCK_OFDM, WLC_RATE_MASK, WLC_RATES_CCK_OFDM, WLC_RATE_MASK,
(bool) N_ENAB(wlc->pub)); (bool) N_ENAB(wlc->pub));
} }
/* update antenna config due to wlc->stf->txant/txchain/ant_rx_ovr change */ /* update antenna config due to wlc->stf->txant/txchain/ant_rx_ovr change */
wlc_stf_phy_txant_upd(wlc); brcms_c_stf_phy_txant_upd(wlc);
/* attach each modules */ /* attach each modules */
err = wlc_attach_module(wlc); err = wlc_attach_module(wlc);
...@@ -1504,9 +1504,9 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, ...@@ -1504,9 +1504,9 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
} }
/* depend on rateset, gmode */ /* depend on rateset, gmode */
wlc->cmi = wlc_channel_mgr_attach(wlc); wlc->cmi = brcms_c_channel_mgr_attach(wlc);
if (!wlc->cmi) { if (!wlc->cmi) {
wiphy_err(wl->wiphy, "wl%d: %s: wlc_channel_mgr_attach failed" wiphy_err(wl->wiphy, "wl%d: %s: channel_mgr_attach failed"
"\n", unit, __func__); "\n", unit, __func__);
err = 33; err = 33;
goto fail; goto fail;
...@@ -1573,7 +1573,7 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit, ...@@ -1573,7 +1573,7 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_TX_STBC; wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_TX_STBC;
} }
if (n_disabled & WLFEATURE_DISABLE_11N_STBC_RX) if (n_disabled & WLFEATURE_DISABLE_11N_STBC_RX)
wlc_stf_stbc_rx_set(wlc, HT_CAP_RX_STBC_NO); brcms_c_stf_stbc_rx_set(wlc, HT_CAP_RX_STBC_NO);
/* apply the GF override from nvram conf */ /* apply the GF override from nvram conf */
if (n_disabled & WLFEATURE_DISABLE_11N_GF) if (n_disabled & WLFEATURE_DISABLE_11N_GF)
...@@ -1696,16 +1696,16 @@ static void wlc_timers_deinit(struct brcms_c_info *wlc) ...@@ -1696,16 +1696,16 @@ static void wlc_timers_deinit(struct brcms_c_info *wlc)
static void wlc_detach_module(struct brcms_c_info *wlc) static void wlc_detach_module(struct brcms_c_info *wlc)
{ {
if (wlc->asi) { if (wlc->asi) {
wlc_antsel_detach(wlc->asi); brcms_c_antsel_detach(wlc->asi);
wlc->asi = NULL; wlc->asi = NULL;
} }
if (wlc->ampdu) { if (wlc->ampdu) {
wlc_ampdu_detach(wlc->ampdu); brcms_c_ampdu_detach(wlc->ampdu);
wlc->ampdu = NULL; wlc->ampdu = NULL;
} }
wlc_stf_detach(wlc); brcms_c_stf_detach(wlc);
} }
/* /*
...@@ -1733,7 +1733,7 @@ uint brcms_c_detach(struct brcms_c_info *wlc) ...@@ -1733,7 +1733,7 @@ uint brcms_c_detach(struct brcms_c_info *wlc)
if (!wlc_radio_monitor_stop(wlc)) if (!wlc_radio_monitor_stop(wlc))
callbacks++; callbacks++;
wlc_channel_mgr_detach(wlc->cmi); brcms_c_channel_mgr_detach(wlc->cmi);
wlc_timers_deinit(wlc); wlc_timers_deinit(wlc);
...@@ -1743,7 +1743,7 @@ uint brcms_c_detach(struct brcms_c_info *wlc) ...@@ -1743,7 +1743,7 @@ uint brcms_c_detach(struct brcms_c_info *wlc)
while (wlc->tx_queues != NULL) while (wlc->tx_queues != NULL)
wlc_txq_free(wlc, wlc->tx_queues); wlc_txq_free(wlc, wlc->tx_queues);
wlc_detach_mfree(wlc); brcms_c_detach_mfree(wlc);
return callbacks; return callbacks;
} }
...@@ -2006,7 +2006,7 @@ static void wlc_watchdog(void *arg) ...@@ -2006,7 +2006,7 @@ static void wlc_watchdog(void *arg)
((wlc->pub->now - wlc->tempsense_lasttime) >= ((wlc->pub->now - wlc->tempsense_lasttime) >=
WLC_TEMPSENSE_PERIOD)) { WLC_TEMPSENSE_PERIOD)) {
wlc->tempsense_lasttime = wlc->pub->now; wlc->tempsense_lasttime = wlc->pub->now;
wlc_tempsense_upd(wlc); brcms_c_tempsense_upd(wlc);
} }
} }
...@@ -2112,7 +2112,7 @@ int brcms_c_up(struct brcms_c_info *wlc) ...@@ -2112,7 +2112,7 @@ int brcms_c_up(struct brcms_c_info *wlc)
wlc->WDarmed = true; wlc->WDarmed = true;
/* ensure antenna config is up to date */ /* ensure antenna config is up to date */
wlc_stf_phy_txant_upd(wlc); brcms_c_stf_phy_txant_upd(wlc);
/* ensure LDPC config is in sync */ /* ensure LDPC config is in sync */
wlc_ht_update_ldpc(wlc, wlc->stf->ldpc); wlc_ht_update_ldpc(wlc, wlc->stf->ldpc);
...@@ -2247,7 +2247,7 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config) ...@@ -2247,7 +2247,7 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
return -EINVAL; return -EINVAL;
/* Legacy or bust when no OFDM is supported by regulatory */ /* Legacy or bust when no OFDM is supported by regulatory */
if ((wlc_channel_locale_flags_in_band(wlc->cmi, band->bandunit) & if ((brcms_c_channel_locale_flags_in_band(wlc->cmi, band->bandunit) &
WLC_NO_OFDM) && (gmode != GMODE_LEGACY_B)) WLC_NO_OFDM) && (gmode != GMODE_LEGACY_B))
return -EINVAL; return -EINVAL;
...@@ -2264,13 +2264,14 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config) ...@@ -2264,13 +2264,14 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
switch (gmode) { switch (gmode) {
case GMODE_LEGACY_B: case GMODE_LEGACY_B:
shortslot = WLC_SHORTSLOT_OFF; shortslot = WLC_SHORTSLOT_OFF;
wlc_rateset_copy(&gphy_legacy_rates, &rs); brcms_c_rateset_copy(&gphy_legacy_rates, &rs);
break; break;
case GMODE_LRS: case GMODE_LRS:
if (AP_ENAB(wlc->pub)) if (AP_ENAB(wlc->pub))
wlc_rateset_copy(&cck_rates, &wlc->sup_rates_override); brcms_c_rateset_copy(&cck_rates,
&wlc->sup_rates_override);
break; break;
case GMODE_AUTO: case GMODE_AUTO:
...@@ -2285,7 +2286,7 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config) ...@@ -2285,7 +2286,7 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
case GMODE_PERFORMANCE: case GMODE_PERFORMANCE:
if (AP_ENAB(wlc->pub)) /* Put all rates into the Supported Rates element */ if (AP_ENAB(wlc->pub)) /* Put all rates into the Supported Rates element */
wlc_rateset_copy(&cck_ofdm_rates, brcms_c_rateset_copy(&cck_ofdm_rates,
&wlc->sup_rates_override); &wlc->sup_rates_override);
shortslot = WLC_SHORTSLOT_ON; shortslot = WLC_SHORTSLOT_ON;
...@@ -2344,7 +2345,7 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config) ...@@ -2344,7 +2345,7 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
/* Use the default 11g rateset */ /* Use the default 11g rateset */
if (!rs.count) if (!rs.count)
wlc_rateset_copy(&cck_ofdm_rates, &rs); brcms_c_rateset_copy(&cck_ofdm_rates, &rs);
if (ofdm_basic) { if (ofdm_basic) {
for (i = 0; i < rs.count; i++) { for (i = 0; i < rs.count; i++) {
...@@ -2401,7 +2402,7 @@ int brcms_c_set_nmode(struct brcms_c_info *wlc, s32 nmode) ...@@ -2401,7 +2402,7 @@ int brcms_c_set_nmode(struct brcms_c_info *wlc, s32 nmode)
wlc->pub->_n_enab = OFF; wlc->pub->_n_enab = OFF;
wlc->default_bss->flags &= ~WLC_BSS_HT; wlc->default_bss->flags &= ~WLC_BSS_HT;
/* delete the mcs rates from the default and hw ratesets */ /* delete the mcs rates from the default and hw ratesets */
wlc_rateset_mcs_clear(&wlc->default_bss->rateset); brcms_c_rateset_mcs_clear(&wlc->default_bss->rateset);
for (i = 0; i < NBANDS(wlc); i++) { for (i = 0; i < NBANDS(wlc); i++) {
memset(wlc->bandstate[i]->hw_rateset.mcs, 0, memset(wlc->bandstate[i]->hw_rateset.mcs, 0,
MCSSET_LEN); MCSSET_LEN);
...@@ -2429,7 +2430,7 @@ int brcms_c_set_nmode(struct brcms_c_info *wlc, s32 nmode) ...@@ -2429,7 +2430,7 @@ int brcms_c_set_nmode(struct brcms_c_info *wlc, s32 nmode)
wlc->pub->_n_enab = SUPPORT_11N; wlc->pub->_n_enab = SUPPORT_11N;
wlc->default_bss->flags |= WLC_BSS_HT; wlc->default_bss->flags |= WLC_BSS_HT;
/* add the mcs rates to the default and hw ratesets */ /* add the mcs rates to the default and hw ratesets */
wlc_rateset_mcs_build(&wlc->default_bss->rateset, brcms_c_rateset_mcs_build(&wlc->default_bss->rateset,
wlc->stf->txstreams); wlc->stf->txstreams);
for (i = 0; i < NBANDS(wlc); i++) for (i = 0; i < NBANDS(wlc); i++)
memcpy(wlc->bandstate[i]->hw_rateset.mcs, memcpy(wlc->bandstate[i]->hw_rateset.mcs,
...@@ -2457,7 +2458,7 @@ static int wlc_set_rateset(struct brcms_c_info *wlc, wlc_rateset_t *rs_arg) ...@@ -2457,7 +2458,7 @@ static int wlc_set_rateset(struct brcms_c_info *wlc, wlc_rateset_t *rs_arg)
/* try the current band */ /* try the current band */
bandunit = wlc->band->bandunit; bandunit = wlc->band->bandunit;
memcpy(&new, &rs, sizeof(wlc_rateset_t)); memcpy(&new, &rs, sizeof(wlc_rateset_t));
if (wlc_rate_hwrs_filter_sort_validate if (brcms_c_rate_hwrs_filter_sort_validate
(&new, &wlc->bandstate[bandunit]->hw_rateset, true, (&new, &wlc->bandstate[bandunit]->hw_rateset, true,
wlc->stf->txstreams)) wlc->stf->txstreams))
goto good; goto good;
...@@ -2466,7 +2467,7 @@ static int wlc_set_rateset(struct brcms_c_info *wlc, wlc_rateset_t *rs_arg) ...@@ -2466,7 +2467,7 @@ static int wlc_set_rateset(struct brcms_c_info *wlc, wlc_rateset_t *rs_arg)
if (IS_MBAND_UNLOCKED(wlc)) { if (IS_MBAND_UNLOCKED(wlc)) {
bandunit = OTHERBANDUNIT(wlc); bandunit = OTHERBANDUNIT(wlc);
memcpy(&new, &rs, sizeof(wlc_rateset_t)); memcpy(&new, &rs, sizeof(wlc_rateset_t));
if (wlc_rate_hwrs_filter_sort_validate(&new, if (brcms_c_rate_hwrs_filter_sort_validate(&new,
&wlc-> &wlc->
bandstate[bandunit]-> bandstate[bandunit]->
hw_rateset, true, hw_rateset, true,
...@@ -2579,7 +2580,7 @@ _wlc_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len, ...@@ -2579,7 +2580,7 @@ _wlc_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
break; break;
} }
if (!wlc_valid_chanspec_db(wlc->cmi, chspec)) { if (!brcms_c_valid_chanspec_db(wlc->cmi, chspec)) {
bcmerror = -EINVAL; bcmerror = -EINVAL;
break; break;
} }
...@@ -3233,7 +3234,7 @@ void brcms_c_send_q(struct brcms_c_info *wlc) ...@@ -3233,7 +3234,7 @@ void brcms_c_send_q(struct brcms_c_info *wlc)
while (prec_map && (pkt[0] = brcmu_pktq_mdeq(q, prec_map, &prec))) { while (prec_map && (pkt[0] = brcmu_pktq_mdeq(q, prec_map, &prec))) {
tx_info = IEEE80211_SKB_CB(pkt[0]); tx_info = IEEE80211_SKB_CB(pkt[0]);
if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
err = wlc_sendampdu(wlc->ampdu, qi, pkt, prec); err = brcms_c_sendampdu(wlc->ampdu, qi, pkt, prec);
} else { } else {
count = 1; count = 1;
err = brcms_c_prep_pdu(wlc, pkt[0], &fifo); err = brcms_c_prep_pdu(wlc, pkt[0], &fifo);
...@@ -3557,7 +3558,7 @@ u16 brcms_c_phytxctl1_calc(struct brcms_c_info *wlc, ratespec_t rspec) ...@@ -3557,7 +3558,7 @@ u16 brcms_c_phytxctl1_calc(struct brcms_c_info *wlc, ratespec_t rspec)
} else { /* legacy OFDM/CCK */ } else { /* legacy OFDM/CCK */
s16 phycfg; s16 phycfg;
/* get the phyctl byte from rate phycfg table */ /* get the phyctl byte from rate phycfg table */
phycfg = wlc_rate_legacy_phyctl(RSPEC2RATE(rspec)); phycfg = brcms_c_rate_legacy_phyctl(RSPEC2RATE(rspec));
if (phycfg == -1) { if (phycfg == -1) {
wiphy_err(wlc->wiphy, "wlc_phytxctl1_calc: wrong " wiphy_err(wlc->wiphy, "wlc_phytxctl1_calc: wrong "
"legacy OFDM/CCK rate\n"); "legacy OFDM/CCK rate\n");
...@@ -3770,8 +3771,8 @@ wlc_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw, ...@@ -3770,8 +3771,8 @@ wlc_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
} else { } else {
if (!is_multicast_ether_addr(h->addr1)) { if (!is_multicast_ether_addr(h->addr1)) {
/* set tx antenna config */ /* set tx antenna config */
wlc_antsel_antcfg_get(wlc->asi, false, false, 0, brcms_c_antsel_antcfg_get(wlc->asi, false,
0, &antcfg, &fbantcfg); false, 0, 0, &antcfg, &fbantcfg);
} }
} }
} }
...@@ -4103,7 +4104,7 @@ wlc_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw, ...@@ -4103,7 +4104,7 @@ wlc_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
/* add null delimiter count */ /* add null delimiter count */
if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && IS_MCS(rspec)) { if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && IS_MCS(rspec)) {
txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM] = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM] =
wlc_ampdu_null_delim_cnt(wlc->ampdu, scb, rspec, phylen); brcm_c_ampdu_null_delim_cnt(wlc->ampdu, scb, rspec, phylen);
} }
#endif #endif
...@@ -4130,7 +4131,7 @@ wlc_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw, ...@@ -4130,7 +4131,7 @@ wlc_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
} }
/* phytxant is properly bit shifted */ /* phytxant is properly bit shifted */
phyctl |= wlc_stf_d11hdrs_phyctl_txant(wlc, rspec[0]); phyctl |= brcms_c_stf_d11hdrs_phyctl_txant(wlc, rspec[0]);
txh->PhyTxControlWord = cpu_to_le16(phyctl); txh->PhyTxControlWord = cpu_to_le16(phyctl);
/* PhyTxControlWord_1 */ /* PhyTxControlWord_1 */
...@@ -4348,7 +4349,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, tx_status_t *txs, u32 frm_tx2) ...@@ -4348,7 +4349,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, tx_status_t *txs, u32 frm_tx2)
scb = (struct scb *)tx_info->control.sta->drv_priv; scb = (struct scb *)tx_info->control.sta->drv_priv;
if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
wlc_ampdu_dotxstatus(wlc->ampdu, scb, p, txs); brcms_c_ampdu_dotxstatus(wlc->ampdu, scb, p, txs);
return false; return false;
} }
...@@ -4535,7 +4536,7 @@ prep_mac80211_status(struct brcms_c_info *wlc, d11rxhdr_t *rxh, ...@@ -4535,7 +4536,7 @@ prep_mac80211_status(struct brcms_c_info *wlc, d11rxhdr_t *rxh,
plcp = p->data; plcp = p->data;
rspec = wlc_compute_rspec(rxh, plcp); rspec = brcms_c_compute_rspec(rxh, plcp);
if (IS_MCS(rspec)) { if (IS_MCS(rspec)) {
rx_status->rate_idx = rspec & RSPEC_RATE_MASK; rx_status->rate_idx = rspec & RSPEC_RATE_MASK;
rx_status->flag |= RX_FLAG_HT; rx_status->flag |= RX_FLAG_HT;
...@@ -4930,7 +4931,7 @@ wlc_calc_cts_time(struct brcms_c_info *wlc, ratespec_t rspec, u8 preamble_type) ...@@ -4930,7 +4931,7 @@ wlc_calc_cts_time(struct brcms_c_info *wlc, ratespec_t rspec, u8 preamble_type)
} }
/* derive wlc->band->basic_rate[] table from 'rateset' */ /* derive wlc->band->basic_rate[] table from 'rateset' */
void wlc_rate_lookup_init(struct brcms_c_info *wlc, wlc_rateset_t *rateset) void brcms_c_rate_lookup_init(struct brcms_c_info *wlc, wlc_rateset_t *rateset)
{ {
u8 rate; u8 rate;
u8 mandatory; u8 mandatory;
...@@ -4954,8 +4955,8 @@ void wlc_rate_lookup_init(struct brcms_c_info *wlc, wlc_rateset_t *rateset) ...@@ -4954,8 +4955,8 @@ void wlc_rate_lookup_init(struct brcms_c_info *wlc, wlc_rateset_t *rateset)
rate = (rateset->rates[i] & WLC_RATE_MASK); rate = (rateset->rates[i] & WLC_RATE_MASK);
if (rate > WLC_MAXRATE) { if (rate > WLC_MAXRATE) {
wiphy_err(wlc->wiphy, "wlc_rate_lookup_init: invalid " wiphy_err(wlc->wiphy, "brcms_c_rate_lookup_init: "
"rate 0x%X in rate set\n", "invalid rate 0x%X in rate set\n",
rateset->rates[i]); rateset->rates[i]);
continue; continue;
} }
...@@ -5079,8 +5080,8 @@ void brcms_c_set_ratetable(struct brcms_c_info *wlc) ...@@ -5079,8 +5080,8 @@ void brcms_c_set_ratetable(struct brcms_c_info *wlc)
rs_dflt = wlc_rateset_get_hwrs(wlc); rs_dflt = wlc_rateset_get_hwrs(wlc);
wlc_rateset_copy(rs_dflt, &rs); brcms_c_rateset_copy(rs_dflt, &rs);
wlc_rateset_mcs_upd(&rs, wlc->stf->txstreams); brcms_c_rateset_mcs_upd(&rs, wlc->stf->txstreams);
/* walk the phy rate table and update SHM basic rate lookup table */ /* walk the phy rate table and update SHM basic rate lookup table */
for (i = 0; i < rs.count; i++) { for (i = 0; i < rs.count; i++) {
...@@ -5178,8 +5179,8 @@ void brcms_c_mod_prb_rsp_rate_table(struct brcms_c_info *wlc, uint frame_len) ...@@ -5178,8 +5179,8 @@ void brcms_c_mod_prb_rsp_rate_table(struct brcms_c_info *wlc, uint frame_len)
rs_dflt = wlc_rateset_get_hwrs(wlc); rs_dflt = wlc_rateset_get_hwrs(wlc);
wlc_rateset_copy(rs_dflt, &rs); brcms_c_rateset_copy(rs_dflt, &rs);
wlc_rateset_mcs_upd(&rs, wlc->stf->txstreams); brcms_c_rateset_mcs_upd(&rs, wlc->stf->txstreams);
/* walk the phy rate table and update MAC core SHM basic rate table entries */ /* walk the phy rate table and update MAC core SHM basic rate table entries */
for (i = 0; i < rs.count; i++) { for (i = 0; i < rs.count; i++) {
...@@ -5460,8 +5461,9 @@ void brcms_c_bsscfg_reprate_init(struct brcms_c_bsscfg *bsscfg) ...@@ -5460,8 +5461,9 @@ void brcms_c_bsscfg_reprate_init(struct brcms_c_bsscfg *bsscfg)
void brcms_default_rateset(struct brcms_c_info *wlc, wlc_rateset_t *rs) void brcms_default_rateset(struct brcms_c_info *wlc, wlc_rateset_t *rs)
{ {
wlc_rateset_default(rs, NULL, wlc->band->phytype, wlc->band->bandtype, brcms_c_rateset_default(rs, NULL, wlc->band->phytype,
false, WLC_RATE_MASK_FULL, (bool) N_ENAB(wlc->pub), wlc->band->bandtype, false, WLC_RATE_MASK_FULL,
(bool) N_ENAB(wlc->pub),
CHSPEC_WLC_BW(wlc->default_bss->chanspec), CHSPEC_WLC_BW(wlc->default_bss->chanspec),
wlc->stf->txstreams); wlc->stf->txstreams);
} }
...@@ -5491,9 +5493,10 @@ static void wlc_bss_default_init(struct brcms_c_info *wlc) ...@@ -5491,9 +5493,10 @@ static void wlc_bss_default_init(struct brcms_c_info *wlc)
band = wlc->bandstate[OTHERBANDUNIT(wlc)]; band = wlc->bandstate[OTHERBANDUNIT(wlc)];
/* init bss rates to the band specific default rate set */ /* init bss rates to the band specific default rate set */
wlc_rateset_default(&bi->rateset, NULL, band->phytype, band->bandtype, brcms_c_rateset_default(&bi->rateset, NULL, band->phytype,
false, WLC_RATE_MASK_FULL, (bool) N_ENAB(wlc->pub), band->bandtype, false, WLC_RATE_MASK_FULL,
CHSPEC_WLC_BW(chanspec), wlc->stf->txstreams); (bool) N_ENAB(wlc->pub), CHSPEC_WLC_BW(chanspec),
wlc->stf->txstreams);
if (N_ENAB(wlc->pub)) if (N_ENAB(wlc->pub))
bi->flags |= WLC_BSS_HT; bi->flags |= WLC_BSS_HT;
......
...@@ -620,11 +620,11 @@ extern struct wlc_pub *brcms_c_pub(void *wlc); ...@@ -620,11 +620,11 @@ extern struct wlc_pub *brcms_c_pub(void *wlc);
/* common functions for every port */ /* common functions for every port */
extern void brcms_c_mhf(struct brcms_c_info *wlc, u8 idx, u16 mask, u16 val, extern void brcms_c_mhf(struct brcms_c_info *wlc, u8 idx, u16 mask, u16 val,
int bands); int bands);
extern void wlc_rate_lookup_init(struct brcms_c_info *wlc, extern void brcms_c_rate_lookup_init(struct brcms_c_info *wlc,
wlc_rateset_t *rateset); wlc_rateset_t *rateset);
extern void brcms_default_rateset(struct brcms_c_info *wlc, wlc_rateset_t *rs); extern void brcms_default_rateset(struct brcms_c_info *wlc, wlc_rateset_t *rs);
extern void wlc_ampdu_flush(struct brcms_c_info *wlc, extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
struct ieee80211_sta *sta, u16 tid); struct ieee80211_sta *sta, u16 tid);
extern int brcms_c_set_par(struct brcms_c_info *wlc, enum wlc_par_id par_id, extern int brcms_c_set_par(struct brcms_c_info *wlc, enum wlc_par_id par_id,
int val); int val);
......
...@@ -246,12 +246,10 @@ const wlc_rateset_t cck_rates = { ...@@ -246,12 +246,10 @@ const wlc_rateset_t cck_rates = {
0x00, 0x00, 0x00, 0x00} 0x00, 0x00, 0x00, 0x00}
}; };
static bool wlc_rateset_valid(wlc_rateset_t *rs, bool check_brate);
/* check if rateset is valid. /* check if rateset is valid.
* if check_brate is true, rateset without a basic rate is considered NOT valid. * if check_brate is true, rateset without a basic rate is considered NOT valid.
*/ */
static bool wlc_rateset_valid(wlc_rateset_t *rs, bool check_brate) static bool brcms_c_rateset_valid(wlc_rateset_t *rs, bool check_brate)
{ {
uint idx; uint idx;
...@@ -269,7 +267,7 @@ static bool wlc_rateset_valid(wlc_rateset_t *rs, bool check_brate) ...@@ -269,7 +267,7 @@ static bool wlc_rateset_valid(wlc_rateset_t *rs, bool check_brate)
return false; return false;
} }
void wlc_rateset_mcs_upd(wlc_rateset_t *rs, u8 txstreams) void brcms_c_rateset_mcs_upd(wlc_rateset_t *rs, u8 txstreams)
{ {
int i; int i;
for (i = txstreams; i < MAX_STREAMS_SUPPORTED; i++) for (i = txstreams; i < MAX_STREAMS_SUPPORTED; i++)
...@@ -280,7 +278,7 @@ void wlc_rateset_mcs_upd(wlc_rateset_t *rs, u8 txstreams) ...@@ -280,7 +278,7 @@ void wlc_rateset_mcs_upd(wlc_rateset_t *rs, u8 txstreams)
* and check if resulting rateset is valid. * and check if resulting rateset is valid.
*/ */
bool bool
wlc_rate_hwrs_filter_sort_validate(wlc_rateset_t *rs, brcms_c_rate_hwrs_filter_sort_validate(wlc_rateset_t *rs,
const wlc_rateset_t *hw_rs, const wlc_rateset_t *hw_rs,
bool check_brate, u8 txstreams) bool check_brate, u8 txstreams)
{ {
...@@ -315,14 +313,14 @@ wlc_rate_hwrs_filter_sort_validate(wlc_rateset_t *rs, ...@@ -315,14 +313,14 @@ wlc_rate_hwrs_filter_sort_validate(wlc_rateset_t *rs,
for (i = 0; i < MCSSET_LEN; i++) for (i = 0; i < MCSSET_LEN; i++)
rs->mcs[i] = (rs->mcs[i] & hw_rs->mcs[i]); rs->mcs[i] = (rs->mcs[i] & hw_rs->mcs[i]);
if (wlc_rateset_valid(rs, check_brate)) if (brcms_c_rateset_valid(rs, check_brate))
return true; return true;
else else
return false; return false;
} }
/* calculate the rate of a rx'd frame and return it as a ratespec */ /* calculate the rate of a rx'd frame and return it as a ratespec */
ratespec_t wlc_compute_rspec(d11rxhdr_t *rxh, u8 *plcp) ratespec_t brcms_c_compute_rspec(d11rxhdr_t *rxh, u8 *plcp)
{ {
int phy_type; int phy_type;
ratespec_t rspec = PHY_TXC1_BW_20MHZ << RSPEC_BW_SHIFT; ratespec_t rspec = PHY_TXC1_BW_20MHZ << RSPEC_BW_SHIFT;
...@@ -368,7 +366,7 @@ ratespec_t wlc_compute_rspec(d11rxhdr_t *rxh, u8 *plcp) ...@@ -368,7 +366,7 @@ ratespec_t wlc_compute_rspec(d11rxhdr_t *rxh, u8 *plcp)
} }
/* copy rateset src to dst as-is (no masking or sorting) */ /* copy rateset src to dst as-is (no masking or sorting) */
void wlc_rateset_copy(const wlc_rateset_t *src, wlc_rateset_t *dst) void brcms_c_rateset_copy(const wlc_rateset_t *src, wlc_rateset_t *dst)
{ {
memcpy(dst, src, sizeof(wlc_rateset_t)); memcpy(dst, src, sizeof(wlc_rateset_t));
} }
...@@ -383,7 +381,7 @@ void wlc_rateset_copy(const wlc_rateset_t *src, wlc_rateset_t *dst) ...@@ -383,7 +381,7 @@ void wlc_rateset_copy(const wlc_rateset_t *src, wlc_rateset_t *dst)
* 'xmask' is the copy mask (typically 0x7f or 0xff). * 'xmask' is the copy mask (typically 0x7f or 0xff).
*/ */
void void
wlc_rateset_filter(wlc_rateset_t *src, wlc_rateset_t *dst, bool basic_only, brcms_c_rateset_filter(wlc_rateset_t *src, wlc_rateset_t *dst, bool basic_only,
u8 rates, uint xmask, bool mcsallow) u8 rates, uint xmask, bool mcsallow)
{ {
uint i; uint i;
...@@ -407,14 +405,14 @@ wlc_rateset_filter(wlc_rateset_t *src, wlc_rateset_t *dst, bool basic_only, ...@@ -407,14 +405,14 @@ wlc_rateset_filter(wlc_rateset_t *src, wlc_rateset_t *dst, bool basic_only,
if (mcsallow && rates != WLC_RATES_CCK) if (mcsallow && rates != WLC_RATES_CCK)
memcpy(&dst->mcs[0], &src->mcs[0], MCSSET_LEN); memcpy(&dst->mcs[0], &src->mcs[0], MCSSET_LEN);
else else
wlc_rateset_mcs_clear(dst); brcms_c_rateset_mcs_clear(dst);
} }
/* select rateset for a given phy_type and bandtype and filter it, sort it /* select rateset for a given phy_type and bandtype and filter it, sort it
* and fill rs_tgt with result * and fill rs_tgt with result
*/ */
void void
wlc_rateset_default(wlc_rateset_t *rs_tgt, const wlc_rateset_t *rs_hw, brcms_c_rateset_default(wlc_rateset_t *rs_tgt, const wlc_rateset_t *rs_hw,
uint phy_type, int bandtype, bool cck_only, uint rate_mask, uint phy_type, int bandtype, bool cck_only, uint rate_mask,
bool mcsallow, u8 bw, u8 txstreams) bool mcsallow, u8 bw, u8 txstreams)
{ {
...@@ -447,16 +445,16 @@ wlc_rateset_default(wlc_rateset_t *rs_tgt, const wlc_rateset_t *rs_hw, ...@@ -447,16 +445,16 @@ wlc_rateset_default(wlc_rateset_t *rs_tgt, const wlc_rateset_t *rs_hw,
if (!rs_hw) if (!rs_hw)
rs_hw = rs_dflt; rs_hw = rs_dflt;
wlc_rateset_copy(rs_dflt, &rs_sel); brcms_c_rateset_copy(rs_dflt, &rs_sel);
wlc_rateset_mcs_upd(&rs_sel, txstreams); brcms_c_rateset_mcs_upd(&rs_sel, txstreams);
wlc_rateset_filter(&rs_sel, rs_tgt, false, brcms_c_rateset_filter(&rs_sel, rs_tgt, false,
cck_only ? WLC_RATES_CCK : WLC_RATES_CCK_OFDM, cck_only ? WLC_RATES_CCK : WLC_RATES_CCK_OFDM,
rate_mask, mcsallow); rate_mask, mcsallow);
wlc_rate_hwrs_filter_sort_validate(rs_tgt, rs_hw, false, brcms_c_rate_hwrs_filter_sort_validate(rs_tgt, rs_hw, false,
mcsallow ? txstreams : 1); mcsallow ? txstreams : 1);
} }
s16 wlc_rate_legacy_phyctl(uint rate) s16 brcms_c_rate_legacy_phyctl(uint rate)
{ {
uint i; uint i;
for (i = 0; i < LEGACY_PHYCFG_TABLE_SIZE; i++) for (i = 0; i < LEGACY_PHYCFG_TABLE_SIZE; i++)
...@@ -466,21 +464,21 @@ s16 wlc_rate_legacy_phyctl(uint rate) ...@@ -466,21 +464,21 @@ s16 wlc_rate_legacy_phyctl(uint rate)
return -1; return -1;
} }
void wlc_rateset_mcs_clear(wlc_rateset_t *rateset) void brcms_c_rateset_mcs_clear(wlc_rateset_t *rateset)
{ {
uint i; uint i;
for (i = 0; i < MCSSET_LEN; i++) for (i = 0; i < MCSSET_LEN; i++)
rateset->mcs[i] = 0; rateset->mcs[i] = 0;
} }
void wlc_rateset_mcs_build(wlc_rateset_t *rateset, u8 txstreams) void brcms_c_rateset_mcs_build(wlc_rateset_t *rateset, u8 txstreams)
{ {
memcpy(&rateset->mcs[0], &cck_ofdm_mimo_rates.mcs[0], MCSSET_LEN); memcpy(&rateset->mcs[0], &cck_ofdm_mimo_rates.mcs[0], MCSSET_LEN);
wlc_rateset_mcs_upd(rateset, txstreams); brcms_c_rateset_mcs_upd(rateset, txstreams);
} }
/* Based on bandwidth passed, allow/disallow MCS 32 in the rateset */ /* Based on bandwidth passed, allow/disallow MCS 32 in the rateset */
void wlc_rateset_bw_mcs_filter(wlc_rateset_t *rateset, u8 bw) void brcms_c_rateset_bw_mcs_filter(wlc_rateset_t *rateset, u8 bw)
{ {
if (bw == WLC_40_MHZ) if (bw == WLC_40_MHZ)
setbit(rateset->mcs, 32); setbit(rateset->mcs, 32);
......
...@@ -133,35 +133,37 @@ extern const u8 ofdm_rate_lookup[]; ...@@ -133,35 +133,37 @@ extern const u8 ofdm_rate_lookup[];
#define OFDM_PHY2MAC_RATE(rlpt) (ofdm_rate_lookup[rlpt & 0x7]) #define OFDM_PHY2MAC_RATE(rlpt) (ofdm_rate_lookup[rlpt & 0x7])
#define CCK_PHY2MAC_RATE(signal) (signal/5) #define CCK_PHY2MAC_RATE(signal) (signal/5)
/* Rates specified in wlc_rateset_filter() */ /* Rates specified in brcms_c_rateset_filter() */
#define WLC_RATES_CCK_OFDM 0 #define WLC_RATES_CCK_OFDM 0
#define WLC_RATES_CCK 1 #define WLC_RATES_CCK 1
#define WLC_RATES_OFDM 2 #define WLC_RATES_OFDM 2
/* sanitize, and sort a rateset with the basic bit(s) preserved, validate rateset */ /* sanitize, and sort a rateset with the basic bit(s) preserved, validate rateset */
extern bool wlc_rate_hwrs_filter_sort_validate(struct wlc_rateset *rs, extern bool brcms_c_rate_hwrs_filter_sort_validate(struct wlc_rateset *rs,
const struct wlc_rateset *hw_rs, const struct wlc_rateset *hw_rs,
bool check_brate, bool check_brate,
u8 txstreams); u8 txstreams);
/* copy rateset src to dst as-is (no masking or sorting) */ /* copy rateset src to dst as-is (no masking or sorting) */
extern void wlc_rateset_copy(const struct wlc_rateset *src, extern void brcms_c_rateset_copy(const struct wlc_rateset *src,
struct wlc_rateset *dst); struct wlc_rateset *dst);
/* would be nice to have these documented ... */ /* would be nice to have these documented ... */
extern ratespec_t wlc_compute_rspec(d11rxhdr_t *rxh, u8 *plcp); extern ratespec_t brcms_c_compute_rspec(d11rxhdr_t *rxh, u8 *plcp);
extern void wlc_rateset_filter(struct wlc_rateset *src, struct wlc_rateset *dst, extern void brcms_c_rateset_filter(struct wlc_rateset *src,
bool basic_only, u8 rates, uint xmask, struct wlc_rateset *dst, bool basic_only, u8 rates, uint xmask,
bool mcsallow); bool mcsallow);
extern void wlc_rateset_default(struct wlc_rateset *rs_tgt,
extern void brcms_c_rateset_default(struct wlc_rateset *rs_tgt,
const struct wlc_rateset *rs_hw, uint phy_type, const struct wlc_rateset *rs_hw, uint phy_type,
int bandtype, bool cck_only, uint rate_mask, int bandtype, bool cck_only, uint rate_mask,
bool mcsallow, u8 bw, u8 txstreams); bool mcsallow, u8 bw, u8 txstreams);
extern s16 wlc_rate_legacy_phyctl(uint rate); extern s16 brcms_c_rate_legacy_phyctl(uint rate);
extern void wlc_rateset_mcs_upd(struct wlc_rateset *rs, u8 txstreams); extern void brcms_c_rateset_mcs_upd(struct wlc_rateset *rs, u8 txstreams);
extern void wlc_rateset_mcs_clear(struct wlc_rateset *rateset); extern void brcms_c_rateset_mcs_clear(struct wlc_rateset *rateset);
extern void wlc_rateset_mcs_build(struct wlc_rateset *rateset, u8 txstreams); extern void brcms_c_rateset_mcs_build(struct wlc_rateset *rateset,
extern void wlc_rateset_bw_mcs_filter(struct wlc_rateset *rateset, u8 bw); u8 txstreams);
extern void brcms_c_rateset_bw_mcs_filter(struct wlc_rateset *rateset, u8 bw);
#endif /* _WLC_RATE_H_ */ #endif /* _WLC_RATE_H_ */
...@@ -31,13 +31,14 @@ ...@@ -31,13 +31,14 @@
#define WLC_STF_SS_STBC_RX(wlc) (WLCISNPHY(wlc->band) && \ #define WLC_STF_SS_STBC_RX(wlc) (WLCISNPHY(wlc->band) && \
NREV_GT(wlc->band->phyrev, 3) && NREV_LE(wlc->band->phyrev, 6)) NREV_GT(wlc->band->phyrev, 3) && NREV_LE(wlc->band->phyrev, 6))
static bool wlc_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val); static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val);
static int wlc_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts, u8 val); static int brcms_c_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts, u8 val);
static int wlc_stf_spatial_policy_set(struct brcms_c_info *wlc, int val); static int brcms_c_stf_spatial_policy_set(struct brcms_c_info *wlc, int val);
static void wlc_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val); static void brcms_c_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val);
static void _wlc_stf_phy_txant_upd(struct brcms_c_info *wlc); static void _brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc);
static u16 _wlc_stf_phytxchain_sel(struct brcms_c_info *wlc, ratespec_t rspec); static u16 _brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc,
ratespec_t rspec);
#define NSTS_1 1 #define NSTS_1 1
#define NSTS_2 2 #define NSTS_2 2
...@@ -51,7 +52,7 @@ const u8 txcore_default[5] = { ...@@ -51,7 +52,7 @@ const u8 txcore_default[5] = {
(0x0f) /* For Nsts = 4, enable all cores */ (0x0f) /* For Nsts = 4, enable all cores */
}; };
static void wlc_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val) static void brcms_c_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val)
{ {
/* MIMOPHYs rev3-6 cannot receive STBC with only one rx core active */ /* MIMOPHYs rev3-6 cannot receive STBC with only one rx core active */
if (WLC_STF_SS_STBC_RX(wlc)) { if (WLC_STF_SS_STBC_RX(wlc)) {
...@@ -69,7 +70,7 @@ static void wlc_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val) ...@@ -69,7 +70,7 @@ static void wlc_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val)
} }
/* every WLC_TEMPSENSE_PERIOD seconds temperature check to decide whether to turn on/off txchain */ /* every WLC_TEMPSENSE_PERIOD seconds temperature check to decide whether to turn on/off txchain */
void wlc_tempsense_upd(struct brcms_c_info *wlc) void brcms_c_tempsense_upd(struct brcms_c_info *wlc)
{ {
wlc_phy_t *pi = wlc->band->pi; wlc_phy_t *pi = wlc->band->pi;
uint active_chains, txchain; uint active_chains, txchain;
...@@ -82,18 +83,18 @@ void wlc_tempsense_upd(struct brcms_c_info *wlc) ...@@ -82,18 +83,18 @@ void wlc_tempsense_upd(struct brcms_c_info *wlc)
if (wlc->stf->txchain == wlc->stf->hw_txchain) { if (wlc->stf->txchain == wlc->stf->hw_txchain) {
if (txchain && (txchain < wlc->stf->hw_txchain)) { if (txchain && (txchain < wlc->stf->hw_txchain)) {
/* turn off 1 tx chain */ /* turn off 1 tx chain */
wlc_stf_txchain_set(wlc, txchain, true); brcms_c_stf_txchain_set(wlc, txchain, true);
} }
} else if (wlc->stf->txchain < wlc->stf->hw_txchain) { } else if (wlc->stf->txchain < wlc->stf->hw_txchain) {
if (txchain == wlc->stf->hw_txchain) { if (txchain == wlc->stf->hw_txchain) {
/* turn back on txchain */ /* turn back on txchain */
wlc_stf_txchain_set(wlc, txchain, true); brcms_c_stf_txchain_set(wlc, txchain, true);
} }
} }
} }
void void
wlc_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel, brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel,
chanspec_t chanspec) chanspec_t chanspec)
{ {
tx_power_t power; tx_power_t power;
...@@ -134,7 +135,7 @@ wlc_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel, ...@@ -134,7 +135,7 @@ wlc_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel,
setbit(ss_algo_channel, PHY_TXC1_MODE_STBC); setbit(ss_algo_channel, PHY_TXC1_MODE_STBC);
} }
static bool wlc_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val) static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val)
{ {
if ((int_val != AUTO) && (int_val != OFF) && (int_val != ON)) { if ((int_val != AUTO) && (int_val != OFF) && (int_val != ON)) {
return false; return false;
...@@ -155,7 +156,7 @@ static bool wlc_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val) ...@@ -155,7 +156,7 @@ static bool wlc_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val)
return true; return true;
} }
bool wlc_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val) bool brcms_c_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val)
{ {
if ((int_val != HT_CAP_RX_STBC_NO) if ((int_val != HT_CAP_RX_STBC_NO)
&& (int_val != HT_CAP_RX_STBC_ONE_STREAM)) { && (int_val != HT_CAP_RX_STBC_ONE_STREAM)) {
...@@ -168,11 +169,12 @@ bool wlc_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val) ...@@ -168,11 +169,12 @@ bool wlc_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val)
return false; return false;
} }
wlc_stf_stbc_rx_ht_update(wlc, int_val); brcms_c_stf_stbc_rx_ht_update(wlc, int_val);
return true; return true;
} }
static int wlc_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts, u8 core_mask) static int brcms_c_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts,
u8 core_mask)
{ {
BCMMSG(wlc->wiphy, "wl%d: Nsts %d core_mask %x\n", BCMMSG(wlc->wiphy, "wl%d: Nsts %d core_mask %x\n",
wlc->pub->unit, Nsts, core_mask); wlc->pub->unit, Nsts, core_mask);
...@@ -205,7 +207,7 @@ static int wlc_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts, u8 core_mask) ...@@ -205,7 +207,7 @@ static int wlc_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts, u8 core_mask)
return 0; return 0;
} }
static int wlc_stf_spatial_policy_set(struct brcms_c_info *wlc, int val) static int brcms_c_stf_spatial_policy_set(struct brcms_c_info *wlc, int val)
{ {
int i; int i;
u8 core_mask = 0; u8 core_mask = 0;
...@@ -216,12 +218,12 @@ static int wlc_stf_spatial_policy_set(struct brcms_c_info *wlc, int val) ...@@ -216,12 +218,12 @@ static int wlc_stf_spatial_policy_set(struct brcms_c_info *wlc, int val)
for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) { for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) {
core_mask = (val == MAX_SPATIAL_EXPANSION) ? core_mask = (val == MAX_SPATIAL_EXPANSION) ?
wlc->stf->txchain : txcore_default[i]; wlc->stf->txchain : txcore_default[i];
wlc_stf_txcore_set(wlc, (u8) i, core_mask); brcms_c_stf_txcore_set(wlc, (u8) i, core_mask);
} }
return 0; return 0;
} }
int wlc_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force) int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force)
{ {
u8 txchain = (u8) int_val; u8 txchain = (u8) int_val;
u8 txstreams; u8 txstreams;
...@@ -271,24 +273,24 @@ int wlc_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force) ...@@ -271,24 +273,24 @@ int wlc_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force)
wlc->stf->txchain = txchain; wlc->stf->txchain = txchain;
wlc->stf->txstreams = txstreams; wlc->stf->txstreams = txstreams;
wlc_stf_stbc_tx_set(wlc, wlc->band->band_stf_stbc_tx); brcms_c_stf_stbc_tx_set(wlc, wlc->band->band_stf_stbc_tx);
wlc_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]);
wlc_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]);
wlc->stf->txant = wlc->stf->txant =
(wlc->stf->txstreams == 1) ? ANT_TX_FORCE_0 : ANT_TX_DEF; (wlc->stf->txstreams == 1) ? ANT_TX_FORCE_0 : ANT_TX_DEF;
_wlc_stf_phy_txant_upd(wlc); _brcms_c_stf_phy_txant_upd(wlc);
wlc_phy_stf_chain_set(wlc->band->pi, wlc->stf->txchain, wlc_phy_stf_chain_set(wlc->band->pi, wlc->stf->txchain,
wlc->stf->rxchain); wlc->stf->rxchain);
for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++)
wlc_stf_txcore_set(wlc, (u8) i, txcore_default[i]); brcms_c_stf_txcore_set(wlc, (u8) i, txcore_default[i]);
return 0; return 0;
} }
/* update wlc->stf->ss_opmode which represents the operational stf_ss mode we're using */ /* update wlc->stf->ss_opmode which represents the operational stf_ss mode we're using */
int wlc_stf_ss_update(struct brcms_c_info *wlc, struct brcms_c_band *band) int brcms_c_stf_ss_update(struct brcms_c_info *wlc, struct brcms_c_band *band)
{ {
int ret_code = 0; int ret_code = 0;
u8 prev_stf_ss; u8 prev_stf_ss;
...@@ -320,7 +322,7 @@ int wlc_stf_ss_update(struct brcms_c_info *wlc, struct brcms_c_band *band) ...@@ -320,7 +322,7 @@ int wlc_stf_ss_update(struct brcms_c_info *wlc, struct brcms_c_band *band)
return ret_code; return ret_code;
} }
int wlc_stf_attach(struct brcms_c_info *wlc) int brcms_c_stf_attach(struct brcms_c_info *wlc)
{ {
wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_SISO; wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_SISO;
wlc->bandstate[BAND_5G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_CDD; wlc->bandstate[BAND_5G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_CDD;
...@@ -329,10 +331,10 @@ int wlc_stf_attach(struct brcms_c_info *wlc) ...@@ -329,10 +331,10 @@ int wlc_stf_attach(struct brcms_c_info *wlc)
(wlc_phy_txpower_hw_ctrl_get(wlc->band->pi) != PHY_TPC_HW_ON)) (wlc_phy_txpower_hw_ctrl_get(wlc->band->pi) != PHY_TPC_HW_ON))
wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode =
PHY_TXC1_MODE_CDD; PHY_TXC1_MODE_CDD;
wlc_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]);
wlc_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]);
wlc_stf_stbc_rx_ht_update(wlc, HT_CAP_RX_STBC_NO); brcms_c_stf_stbc_rx_ht_update(wlc, HT_CAP_RX_STBC_NO);
wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = OFF; wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = OFF;
wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = OFF; wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = OFF;
...@@ -343,7 +345,7 @@ int wlc_stf_attach(struct brcms_c_info *wlc) ...@@ -343,7 +345,7 @@ int wlc_stf_attach(struct brcms_c_info *wlc)
return 0; return 0;
} }
void wlc_stf_detach(struct brcms_c_info *wlc) void brcms_c_stf_detach(struct brcms_c_info *wlc)
{ {
} }
...@@ -361,7 +363,7 @@ void wlc_stf_detach(struct brcms_c_info *wlc) ...@@ -361,7 +363,7 @@ void wlc_stf_detach(struct brcms_c_info *wlc)
* do tx-antenna selection for SISO transmissions * do tx-antenna selection for SISO transmissions
* for NREV>=7, bit 6 and bit 7 mean antenna 0 and 1 respectively, nit6+bit7 means both cores active * for NREV>=7, bit 6 and bit 7 mean antenna 0 and 1 respectively, nit6+bit7 means both cores active
*/ */
static void _wlc_stf_phy_txant_upd(struct brcms_c_info *wlc) static void _brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc)
{ {
s8 txant; s8 txant;
...@@ -399,12 +401,12 @@ static void _wlc_stf_phy_txant_upd(struct brcms_c_info *wlc) ...@@ -399,12 +401,12 @@ static void _wlc_stf_phy_txant_upd(struct brcms_c_info *wlc)
brcms_b_txant_set(wlc->hw, wlc->stf->phytxant); brcms_b_txant_set(wlc->hw, wlc->stf->phytxant);
} }
void wlc_stf_phy_txant_upd(struct brcms_c_info *wlc) void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc)
{ {
_wlc_stf_phy_txant_upd(wlc); _brcms_c_stf_phy_txant_upd(wlc);
} }
void wlc_stf_phy_chain_calc(struct brcms_c_info *wlc) void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc)
{ {
/* get available rx/tx chains */ /* get available rx/tx chains */
wlc->stf->hw_txchain = (u8) getintvar(wlc->pub->vars, "txchain"); wlc->stf->hw_txchain = (u8) getintvar(wlc->pub->vars, "txchain");
...@@ -438,10 +440,11 @@ void wlc_stf_phy_chain_calc(struct brcms_c_info *wlc) ...@@ -438,10 +440,11 @@ void wlc_stf_phy_chain_calc(struct brcms_c_info *wlc)
/* default spatial_policy */ /* default spatial_policy */
wlc->stf->spatial_policy = MIN_SPATIAL_EXPANSION; wlc->stf->spatial_policy = MIN_SPATIAL_EXPANSION;
wlc_stf_spatial_policy_set(wlc, MIN_SPATIAL_EXPANSION); brcms_c_stf_spatial_policy_set(wlc, MIN_SPATIAL_EXPANSION);
} }
static u16 _wlc_stf_phytxchain_sel(struct brcms_c_info *wlc, ratespec_t rspec) static u16 _brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc,
ratespec_t rspec)
{ {
u16 phytxant = wlc->stf->phytxant; u16 phytxant = wlc->stf->phytxant;
...@@ -453,19 +456,19 @@ static u16 _wlc_stf_phytxchain_sel(struct brcms_c_info *wlc, ratespec_t rspec) ...@@ -453,19 +456,19 @@ static u16 _wlc_stf_phytxchain_sel(struct brcms_c_info *wlc, ratespec_t rspec)
return phytxant; return phytxant;
} }
u16 wlc_stf_phytxchain_sel(struct brcms_c_info *wlc, ratespec_t rspec) u16 brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc, ratespec_t rspec)
{ {
return _wlc_stf_phytxchain_sel(wlc, rspec); return _brcms_c_stf_phytxchain_sel(wlc, rspec);
} }
u16 wlc_stf_d11hdrs_phyctl_txant(struct brcms_c_info *wlc, ratespec_t rspec) u16 brcms_c_stf_d11hdrs_phyctl_txant(struct brcms_c_info *wlc, ratespec_t rspec)
{ {
u16 phytxant = wlc->stf->phytxant; u16 phytxant = wlc->stf->phytxant;
u16 mask = PHY_TXC_ANT_MASK; u16 mask = PHY_TXC_ANT_MASK;
/* for non-siso rates or default setting, use the available chains */ /* for non-siso rates or default setting, use the available chains */
if (WLCISNPHY(wlc->band)) { if (WLCISNPHY(wlc->band)) {
phytxant = _wlc_stf_phytxchain_sel(wlc, rspec); phytxant = _brcms_c_stf_phytxchain_sel(wlc, rspec);
mask = PHY_TXC_HTANT_MASK; mask = PHY_TXC_HTANT_MASK;
} }
phytxant |= phytxant & mask; phytxant |= phytxant & mask;
......
...@@ -19,23 +19,24 @@ ...@@ -19,23 +19,24 @@
#include "types.h" #include "types.h"
extern int wlc_stf_attach(struct brcms_c_info *wlc); extern int brcms_c_stf_attach(struct brcms_c_info *wlc);
extern void wlc_stf_detach(struct brcms_c_info *wlc); extern void brcms_c_stf_detach(struct brcms_c_info *wlc);
extern void wlc_tempsense_upd(struct brcms_c_info *wlc); extern void brcms_c_tempsense_upd(struct brcms_c_info *wlc);
extern void wlc_stf_ss_algo_channel_get(struct brcms_c_info *wlc, extern void brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc,
u16 *ss_algo_channel, u16 *ss_algo_channel,
chanspec_t chanspec); chanspec_t chanspec);
extern int wlc_stf_ss_update(struct brcms_c_info *wlc, extern int brcms_c_stf_ss_update(struct brcms_c_info *wlc,
struct brcms_c_band *band); struct brcms_c_band *band);
extern void wlc_stf_phy_txant_upd(struct brcms_c_info *wlc); extern void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc);
extern int wlc_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, extern int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val,
bool force); bool force);
extern bool wlc_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val); extern bool brcms_c_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val);
extern void wlc_stf_phy_txant_upd(struct brcms_c_info *wlc); extern void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc);
extern void wlc_stf_phy_chain_calc(struct brcms_c_info *wlc); extern void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc);
extern u16 wlc_stf_phytxchain_sel(struct brcms_c_info *wlc, ratespec_t rspec); extern u16 brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc,
extern u16 wlc_stf_d11hdrs_phyctl_txant(struct brcms_c_info *wlc, ratespec_t rspec);
extern u16 brcms_c_stf_d11hdrs_phyctl_txant(struct brcms_c_info *wlc,
ratespec_t rspec); ratespec_t rspec);
#endif /* _BRCM_STF_H_ */ #endif /* _BRCM_STF_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment