aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd.h2
-rw-r--r--drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c40
-rw-r--r--drivers/staging/brcm80211/brcmsmac/alloc.c15
-rw-r--r--drivers/staging/brcm80211/brcmsmac/ampdu.c44
-rw-r--r--drivers/staging/brcm80211/brcmsmac/antsel.c13
-rw-r--r--drivers/staging/brcm80211/brcmsmac/bmac.c138
-rw-r--r--drivers/staging/brcm80211/brcmsmac/channel.c206
-rw-r--r--drivers/staging/brcm80211/brcmsmac/channel.h46
-rw-r--r--drivers/staging/brcm80211/brcmsmac/d11.h12
-rw-r--r--drivers/staging/brcm80211/brcmsmac/mac80211_if.c26
-rw-r--r--drivers/staging/brcm80211/brcmsmac/mac80211_if.h2
-rw-r--r--drivers/staging/brcm80211/brcmsmac/main.c595
-rw-r--r--drivers/staging/brcm80211/brcmsmac/main.h155
-rw-r--r--drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c106
-rw-r--r--drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h44
-rw-r--r--drivers/staging/brcm80211/brcmsmac/phy/phy_int.h2
-rw-r--r--drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c6
-rw-r--r--drivers/staging/brcm80211/brcmsmac/phy/phy_n.c31
-rw-r--r--drivers/staging/brcm80211/brcmsmac/phy_shim.c4
-rw-r--r--drivers/staging/brcm80211/brcmsmac/phy_shim.h10
-rw-r--r--drivers/staging/brcm80211/brcmsmac/pub.h165
-rw-r--r--drivers/staging/brcm80211/brcmsmac/rate.c129
-rw-r--r--drivers/staging/brcm80211/brcmsmac/rate.h32
-rw-r--r--drivers/staging/brcm80211/brcmsmac/stf.c37
-rw-r--r--drivers/staging/brcm80211/brcmsmac/types.h30
-rw-r--r--drivers/staging/brcm80211/include/brcmu_wifi.h37
-rw-r--r--drivers/staging/brcm80211/include/defs.h26
27 files changed, 996 insertions, 957 deletions
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index b4d786ff0f6..0a3c6e5c506 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -590,7 +590,7 @@ struct brcmf_pub {
590 char *pktfilter[100]; 590 char *pktfilter[100];
591 int pktfilter_count; 591 int pktfilter_count;
592 592
593 u8 country_code[WLC_CNTRY_BUF_SZ]; 593 u8 country_code[BRCM_CNTRY_BUF_SZ];
594 char eventmask[BRCMF_EVENTING_MASK_LEN]; 594 char eventmask[BRCMF_EVENTING_MASK_LEN];
595 595
596}; 596};
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 12c6ee35456..f6118d1f3f1 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -363,18 +363,18 @@ do { \
363 } 363 }
364 364
365static struct ieee80211_rate __wl_rates[] = { 365static struct ieee80211_rate __wl_rates[] = {
366 RATETAB_ENT(WLC_RATE_1M, 0), 366 RATETAB_ENT(BRCM_RATE_1M, 0),
367 RATETAB_ENT(WLC_RATE_2M, IEEE80211_RATE_SHORT_PREAMBLE), 367 RATETAB_ENT(BRCM_RATE_2M, IEEE80211_RATE_SHORT_PREAMBLE),
368 RATETAB_ENT(WLC_RATE_5M5, IEEE80211_RATE_SHORT_PREAMBLE), 368 RATETAB_ENT(BRCM_RATE_5M5, IEEE80211_RATE_SHORT_PREAMBLE),
369 RATETAB_ENT(WLC_RATE_11M, IEEE80211_RATE_SHORT_PREAMBLE), 369 RATETAB_ENT(BRCM_RATE_11M, IEEE80211_RATE_SHORT_PREAMBLE),
370 RATETAB_ENT(WLC_RATE_6M, 0), 370 RATETAB_ENT(BRCM_RATE_6M, 0),
371 RATETAB_ENT(WLC_RATE_9M, 0), 371 RATETAB_ENT(BRCM_RATE_9M, 0),
372 RATETAB_ENT(WLC_RATE_12M, 0), 372 RATETAB_ENT(BRCM_RATE_12M, 0),
373 RATETAB_ENT(WLC_RATE_18M, 0), 373 RATETAB_ENT(BRCM_RATE_18M, 0),
374 RATETAB_ENT(WLC_RATE_24M, 0), 374 RATETAB_ENT(BRCM_RATE_24M, 0),
375 RATETAB_ENT(WLC_RATE_36M, 0), 375 RATETAB_ENT(BRCM_RATE_36M, 0),
376 RATETAB_ENT(WLC_RATE_48M, 0), 376 RATETAB_ENT(BRCM_RATE_48M, 0),
377 RATETAB_ENT(WLC_RATE_54M, 0), 377 RATETAB_ENT(BRCM_RATE_54M, 0),
378}; 378};
379 379
380#define wl_a_rates (__wl_rates + 4) 380#define wl_a_rates (__wl_rates + 4)
@@ -895,7 +895,7 @@ static s32 brcmf_set_frag(struct net_device *dev, u32 frag_threshold)
895static s32 brcmf_set_retry(struct net_device *dev, u32 retry, bool l) 895static s32 brcmf_set_retry(struct net_device *dev, u32 retry, bool l)
896{ 896{
897 s32 err = 0; 897 s32 err = 0;
898 u32 cmd = (l ? WLC_SET_LRL : WLC_SET_SRL); 898 u32 cmd = (l ? BRCM_SET_LRL : BRCM_SET_SRL);
899 899
900 retry = cpu_to_le32(retry); 900 retry = cpu_to_le32(retry);
901 err = brcmf_dev_ioctl(dev, cmd, &retry, sizeof(retry)); 901 err = brcmf_dev_ioctl(dev, cmd, &retry, sizeof(retry));
@@ -1025,7 +1025,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1025 else 1025 else
1026 bcnprd = cpu_to_le32(100); 1026 bcnprd = cpu_to_le32(100);
1027 1027
1028 err = brcmf_dev_ioctl(dev, WLC_SET_BCNPRD, &bcnprd, sizeof(bcnprd)); 1028 err = brcmf_dev_ioctl(dev, BRCM_SET_BCNPRD, &bcnprd, sizeof(bcnprd));
1029 if (unlikely(err)) { 1029 if (unlikely(err)) {
1030 WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err); 1030 WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err);
1031 goto done; 1031 goto done;
@@ -1068,7 +1068,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1068 1068
1069 /* set channel for starter */ 1069 /* set channel for starter */
1070 target_channel = cpu_to_le32(cfg_priv->channel); 1070 target_channel = cpu_to_le32(cfg_priv->channel);
1071 err = brcmf_dev_ioctl(dev, WLC_SET_CHANNEL, 1071 err = brcmf_dev_ioctl(dev, BRCM_SET_CHANNEL,
1072 &target_channel, sizeof(target_channel)); 1072 &target_channel, sizeof(target_channel));
1073 if (unlikely(err)) { 1073 if (unlikely(err)) {
1074 WL_ERR("WLC_SET_CHANNEL failed (%d)\n", err); 1074 WL_ERR("WLC_SET_CHANNEL failed (%d)\n", err);
@@ -2039,7 +2039,7 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
2039 2039
2040 /* addr param is always NULL. ignore it */ 2040 /* addr param is always NULL. ignore it */
2041 /* Get current rateset */ 2041 /* Get current rateset */
2042 err = brcmf_dev_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, 2042 err = brcmf_dev_ioctl(dev, BRCM_GET_CURR_RATESET, &rateset,
2043 sizeof(rateset)); 2043 sizeof(rateset));
2044 if (unlikely(err)) { 2044 if (unlikely(err)) {
2045 WL_ERR("could not get current rateset (%d)\n", err); 2045 WL_ERR("could not get current rateset (%d)\n", err);
@@ -3755,7 +3755,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
3755 } 3755 }
3756 3756
3757 roamtrigger[0] = WL_ROAM_TRIGGER_LEVEL; 3757 roamtrigger[0] = WL_ROAM_TRIGGER_LEVEL;
3758 roamtrigger[1] = WLC_BAND_ALL; 3758 roamtrigger[1] = BRCM_BAND_ALL;
3759 err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_ROAM_TRIGGER, 3759 err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_ROAM_TRIGGER,
3760 (void *)roamtrigger, sizeof(roamtrigger)); 3760 (void *)roamtrigger, sizeof(roamtrigger));
3761 if (unlikely(err)) { 3761 if (unlikely(err)) {
@@ -3764,7 +3764,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
3764 } 3764 }
3765 3765
3766 roam_delta[0] = WL_ROAM_DELTA; 3766 roam_delta[0] = WL_ROAM_DELTA;
3767 roam_delta[1] = WLC_BAND_ALL; 3767 roam_delta[1] = BRCM_BAND_ALL;
3768 err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_ROAM_DELTA, 3768 err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_ROAM_DELTA,
3769 (void *)roam_delta, sizeof(roam_delta)); 3769 (void *)roam_delta, sizeof(roam_delta));
3770 if (unlikely(err)) { 3770 if (unlikely(err)) {
@@ -3865,8 +3865,8 @@ static s32 wl_update_wiphybands(struct brcmf_cfg80211_priv *cfg_priv)
3865 s8 phy; 3865 s8 phy;
3866 s32 err = 0; 3866 s32 err = 0;
3867 3867
3868 err = brcmf_dev_ioctl(cfg_to_ndev(cfg_priv), WLC_GET_PHYLIST, &phy_list, 3868 err = brcmf_dev_ioctl(cfg_to_ndev(cfg_priv), BRCM_GET_PHYLIST,
3869 sizeof(phy_list)); 3869 &phy_list, sizeof(phy_list));
3870 if (unlikely(err)) { 3870 if (unlikely(err)) {
3871 WL_ERR("error (%d)\n", err); 3871 WL_ERR("error (%d)\n", err);
3872 return err; 3872 return err;
diff --git a/drivers/staging/brcm80211/brcmsmac/alloc.c b/drivers/staging/brcm80211/brcmsmac/alloc.c
index bf01ba019dd..7f8dd7b396b 100644
--- a/drivers/staging/brcm80211/brcmsmac/alloc.c
+++ b/drivers/staging/brcm80211/brcmsmac/alloc.c
@@ -36,11 +36,11 @@ static void brcms_c_tunables_init(struct brcms_tunables *tunables, uint devid)
36 tunables->maxscb = MAXSCB; 36 tunables->maxscb = MAXSCB;
37 tunables->ampdunummpdu = AMPDU_NUM_MPDU; 37 tunables->ampdunummpdu = AMPDU_NUM_MPDU;
38 tunables->maxpktcb = MAXPKTCB; 38 tunables->maxpktcb = MAXPKTCB;
39 tunables->maxucodebss = WLC_MAX_UCODE_BSS; 39 tunables->maxucodebss = BRCMS_MAX_UCODE_BSS;
40 tunables->maxucodebss4 = WLC_MAX_UCODE_BSS4; 40 tunables->maxucodebss4 = BRCMS_MAX_UCODE_BSS4;
41 tunables->maxbss = MAXBSS; 41 tunables->maxbss = MAXBSS;
42 tunables->datahiwat = WLC_DATAHIWAT; 42 tunables->datahiwat = BRCMS_DATAHIWAT;
43 tunables->ampdudatahiwat = WLC_AMPDUDATAHIWAT; 43 tunables->ampdudatahiwat = BRCMS_AMPDUDATAHIWAT;
44 tunables->rxbnd = RXBND; 44 tunables->rxbnd = RXBND;
45 tunables->txsbnd = TXSBND; 45 tunables->txsbnd = TXSBND;
46} 46}
@@ -169,7 +169,7 @@ struct brcms_c_info *brcms_c_attach_malloc(uint unit, uint *err, uint devid)
169 } 169 }
170 170
171 wlc->modulecb = 171 wlc->modulecb =
172 kzalloc(sizeof(struct modulecb) * WLC_MAXMODULES, GFP_ATOMIC); 172 kzalloc(sizeof(struct modulecb) * BRCMS_MAXMODULES, GFP_ATOMIC);
173 if (wlc->modulecb == NULL) { 173 if (wlc->modulecb == NULL) {
174 *err = 1009; 174 *err = 1009;
175 goto fail; 175 goto fail;
@@ -189,13 +189,14 @@ struct brcms_c_info *brcms_c_attach_malloc(uint unit, uint *err, uint devid)
189 brcms_c_bsscfg_ID_assign(wlc, wlc->cfg); 189 brcms_c_bsscfg_ID_assign(wlc, wlc->cfg);
190 190
191 wlc->wsec_def_keys[0] = 191 wlc->wsec_def_keys[0] =
192 kzalloc(sizeof(struct wsec_key) * WLC_DEFAULT_KEYS, GFP_ATOMIC); 192 kzalloc(sizeof(struct wsec_key) * BRCMS_DEFAULT_KEYS,
193 GFP_ATOMIC);
193 if (wlc->wsec_def_keys[0] == NULL) { 194 if (wlc->wsec_def_keys[0] == NULL) {
194 *err = 1015; 195 *err = 1015;
195 goto fail; 196 goto fail;
196 } else { 197 } else {
197 int i; 198 int i;
198 for (i = 1; i < WLC_DEFAULT_KEYS; i++) { 199 for (i = 1; i < BRCMS_DEFAULT_KEYS; i++) {
199 wlc->wsec_def_keys[i] = (struct wsec_key *) 200 wlc->wsec_def_keys[i] = (struct wsec_key *)
200 ((unsigned long)wlc->wsec_def_keys[0] + 201 ((unsigned long)wlc->wsec_def_keys[0] +
201 (sizeof(struct wsec_key) * i)); 202 (sizeof(struct wsec_key) * i));
diff --git a/drivers/staging/brcm80211/brcmsmac/ampdu.c b/drivers/staging/brcm80211/brcmsmac/ampdu.c
index 599f6e9d38a..fcaf61e3b13 100644
--- a/drivers/staging/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/ampdu.c
@@ -164,7 +164,7 @@ struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc)
164 164
165 ampdu->ffpld_rsvd = AMPDU_DEF_FFPLD_RSVD; 165 ampdu->ffpld_rsvd = AMPDU_DEF_FFPLD_RSVD;
166 /* bump max ampdu rcv size to 64k for all 11n devices except 4321A0 and 4321A1 */ 166 /* bump max ampdu rcv size to 64k for all 11n devices except 4321A0 and 4321A1 */
167 if (WLCISNPHY(wlc->band) && NREV_LT(wlc->band->phyrev, 2)) 167 if (BRCMS_ISNPHY(wlc->band) && NREV_LT(wlc->band->phyrev, 2))
168 ampdu->rx_factor = IEEE80211_HT_MAX_AMPDU_32K; 168 ampdu->rx_factor = IEEE80211_HT_MAX_AMPDU_32K;
169 else 169 else
170 ampdu->rx_factor = IEEE80211_HT_MAX_AMPDU_64K; 170 ampdu->rx_factor = IEEE80211_HT_MAX_AMPDU_64K;
@@ -443,10 +443,10 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
443 struct sk_buff *p, *pkt[AMPDU_MAX_MPDU]; 443 struct sk_buff *p, *pkt[AMPDU_MAX_MPDU];
444 u8 tid, ndelim; 444 u8 tid, ndelim;
445 int err = 0; 445 int err = 0;
446 u8 preamble_type = WLC_GF_PREAMBLE; 446 u8 preamble_type = BRCMS_GF_PREAMBLE;
447 u8 fbr_preamble_type = WLC_GF_PREAMBLE; 447 u8 fbr_preamble_type = BRCMS_GF_PREAMBLE;
448 u8 rts_preamble_type = WLC_LONG_PREAMBLE; 448 u8 rts_preamble_type = BRCMS_LONG_PREAMBLE;
449 u8 rts_fbr_preamble_type = WLC_LONG_PREAMBLE; 449 u8 rts_fbr_preamble_type = BRCMS_LONG_PREAMBLE;
450 450
451 bool rr = true, fbr = false; 451 bool rr = true, fbr = false;
452 uint i, count = 0, fifo, seg_cnt = 0; 452 uint i, count = 0, fifo, seg_cnt = 0;
@@ -551,8 +551,8 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
551 } 551 }
552 552
553 /* extract the length info */ 553 /* extract the length info */
554 len = fbr_iscck ? WLC_GET_CCK_PLCP_LEN(txh->FragPLCPFallback) 554 len = fbr_iscck ? BRCMS_GET_CCK_PLCP_LEN(txh->FragPLCPFallback)
555 : WLC_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback); 555 : BRCMS_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback);
556 556
557 /* retrieve null delimiter count */ 557 /* retrieve null delimiter count */
558 ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM]; 558 ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM];
@@ -622,8 +622,8 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
622 622
623 if (is40) 623 if (is40)
624 mimo_ctlchbw = 624 mimo_ctlchbw =
625 CHSPEC_SB_UPPER(WLC_BAND_PI_RADIO_CHANSPEC) 625 CHSPEC_SB_UPPER(BRCMS_BAND_PI_RADIO_CHANSPEC)
626 ? PHY_TXC1_BW_20MHZ_UP : PHY_TXC1_BW_20MHZ; 626 ? PHY_TXC1_BW_20MHZ_UP : PHY_TXC1_BW_20MHZ;
627 627
628 /* rebuild the rspec and rspec_fallback */ 628 /* rebuild the rspec and rspec_fallback */
629 rspec = RSPEC_MIMORATE; 629 rspec = RSPEC_MIMORATE;
@@ -717,31 +717,31 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
717 717
718 /* remove the pad len from last mpdu */ 718 /* remove the pad len from last mpdu */
719 fbr_iscck = ((le16_to_cpu(txh->XtraFrameTypes) & 0x3) == 0); 719 fbr_iscck = ((le16_to_cpu(txh->XtraFrameTypes) & 0x3) == 0);
720 len = fbr_iscck ? WLC_GET_CCK_PLCP_LEN(txh->FragPLCPFallback) 720 len = fbr_iscck ? BRCMS_GET_CCK_PLCP_LEN(txh->FragPLCPFallback)
721 : WLC_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback); 721 : BRCMS_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback);
722 ampdu_len -= roundup(len, 4) - len; 722 ampdu_len -= roundup(len, 4) - len;
723 723
724 /* patch up the first txh & plcp */ 724 /* patch up the first txh & plcp */
725 txh = (struct d11txh *) pkt[0]->data; 725 txh = (struct d11txh *) pkt[0]->data;
726 plcp = (u8 *) (txh + 1); 726 plcp = (u8 *) (txh + 1);
727 727
728 WLC_SET_MIMO_PLCP_LEN(plcp, ampdu_len); 728 BRCMS_SET_MIMO_PLCP_LEN(plcp, ampdu_len);
729 /* mark plcp to indicate ampdu */ 729 /* mark plcp to indicate ampdu */
730 WLC_SET_MIMO_PLCP_AMPDU(plcp); 730 BRCMS_SET_MIMO_PLCP_AMPDU(plcp);
731 731
732 /* reset the mixed mode header durations */ 732 /* reset the mixed mode header durations */
733 if (txh->MModeLen) { 733 if (txh->MModeLen) {
734 u16 mmodelen = 734 u16 mmodelen =
735 brcms_c_calc_lsig_len(wlc, rspec, ampdu_len); 735 brcms_c_calc_lsig_len(wlc, rspec, ampdu_len);
736 txh->MModeLen = cpu_to_le16(mmodelen); 736 txh->MModeLen = cpu_to_le16(mmodelen);
737 preamble_type = WLC_MM_PREAMBLE; 737 preamble_type = BRCMS_MM_PREAMBLE;
738 } 738 }
739 if (txh->MModeFbrLen) { 739 if (txh->MModeFbrLen) {
740 u16 mmfbrlen = 740 u16 mmfbrlen =
741 brcms_c_calc_lsig_len(wlc, rspec_fallback, 741 brcms_c_calc_lsig_len(wlc, rspec_fallback,
742 ampdu_len); 742 ampdu_len);
743 txh->MModeFbrLen = cpu_to_le16(mmfbrlen); 743 txh->MModeFbrLen = cpu_to_le16(mmfbrlen);
744 fbr_preamble_type = WLC_MM_PREAMBLE; 744 fbr_preamble_type = BRCMS_MM_PREAMBLE;
745 } 745 }
746 746
747 /* set the preload length */ 747 /* set the preload length */
@@ -759,11 +759,11 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
759 rts = (struct ieee80211_rts *)&txh->rts_frame; 759 rts = (struct ieee80211_rts *)&txh->rts_frame;
760 if ((mch & TXC_PREAMBLE_RTS_MAIN_SHORT) == 760 if ((mch & TXC_PREAMBLE_RTS_MAIN_SHORT) ==
761 TXC_PREAMBLE_RTS_MAIN_SHORT) 761 TXC_PREAMBLE_RTS_MAIN_SHORT)
762 rts_preamble_type = WLC_SHORT_PREAMBLE; 762 rts_preamble_type = BRCMS_SHORT_PREAMBLE;
763 763
764 if ((mch & TXC_PREAMBLE_RTS_FB_SHORT) == 764 if ((mch & TXC_PREAMBLE_RTS_FB_SHORT) ==
765 TXC_PREAMBLE_RTS_FB_SHORT) 765 TXC_PREAMBLE_RTS_FB_SHORT)
766 rts_fbr_preamble_type = WLC_SHORT_PREAMBLE; 766 rts_fbr_preamble_type = BRCMS_SHORT_PREAMBLE;
767 767
768 durid = 768 durid =
769 brcms_c_compute_rtscts_dur(wlc, use_cts, rts_rspec, 769 brcms_c_compute_rtscts_dur(wlc, use_cts, rts_rspec,
@@ -788,8 +788,8 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
788 if (fbr) { 788 if (fbr) {
789 mch |= TXC_AMPDU_FBR; 789 mch |= TXC_AMPDU_FBR;
790 txh->MacTxControlHigh = cpu_to_le16(mch); 790 txh->MacTxControlHigh = cpu_to_le16(mch);
791 WLC_SET_MIMO_PLCP_AMPDU(plcp); 791 BRCMS_SET_MIMO_PLCP_AMPDU(plcp);
792 WLC_SET_MIMO_PLCP_AMPDU(txh->FragPLCPFallback); 792 BRCMS_SET_MIMO_PLCP_AMPDU(txh->FragPLCPFallback);
793 } 793 }
794 794
795 BCMMSG(wlc->wiphy, "wl%d: count %d ampdu_len %d\n", 795 BCMMSG(wlc->wiphy, "wl%d: count %d ampdu_len %d\n",
@@ -1046,9 +1046,9 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
1046 ini->tx_in_transit--; 1046 ini->tx_in_transit--;
1047 /* Use high prededence for retransmit to give some punch */ 1047 /* Use high prededence for retransmit to give some punch */
1048 /* brcms_c_txq_enq(wlc, scb, p, 1048 /* brcms_c_txq_enq(wlc, scb, p,
1049 * WLC_PRIO_TO_PREC(tid)); */ 1049 * BRCMS_PRIO_TO_PREC(tid)); */
1050 brcms_c_txq_enq(wlc, scb, p, 1050 brcms_c_txq_enq(wlc, scb, p,
1051 WLC_PRIO_TO_HI_PREC(tid)); 1051 BRCMS_PRIO_TO_HI_PREC(tid));
1052 } else { 1052 } else {
1053 /* Retry timeout */ 1053 /* Retry timeout */
1054 ini->tx_in_transit--; 1054 ini->tx_in_transit--;
@@ -1108,7 +1108,7 @@ static int brcms_c_ampdu_set(struct ampdu_info *ampdu, bool on)
1108 1108
1109static bool brcms_c_ampdu_cap(struct ampdu_info *ampdu) 1109static bool brcms_c_ampdu_cap(struct ampdu_info *ampdu)
1110{ 1110{
1111 if (WLC_PHY_11N_CAP(ampdu->wlc->band)) 1111 if (BRCMS_PHY_11N_CAP(ampdu->wlc->band))
1112 return true; 1112 return true;
1113 else 1113 else
1114 return false; 1114 return false;
diff --git a/drivers/staging/brcm80211/brcmsmac/antsel.c b/drivers/staging/brcm80211/brcmsmac/antsel.c
index e93d8ae4607..c4e76c093ae 100644
--- a/drivers/staging/brcm80211/brcmsmac/antsel.c
+++ b/drivers/staging/brcm80211/brcmsmac/antsel.c
@@ -31,11 +31,12 @@
31#define ANT_SELCFG_RX_DEF 3 /* default rx antenna configuration */ 31#define ANT_SELCFG_RX_DEF 3 /* default rx antenna configuration */
32 32
33/* useful macros */ 33/* useful macros */
34#define WLC_ANTSEL_11N_0(ant) ((((ant) & ANT_SELCFG_MASK) >> 4) & 0xf) 34#define BRCMS_ANTSEL_11N_0(ant) ((((ant) & ANT_SELCFG_MASK) >> 4) & 0xf)
35#define WLC_ANTSEL_11N_1(ant) (((ant) & ANT_SELCFG_MASK) & 0xf) 35#define BRCMS_ANTSEL_11N_1(ant) (((ant) & ANT_SELCFG_MASK) & 0xf)
36#define WLC_ANTIDX_11N(ant) (((WLC_ANTSEL_11N_0(ant)) << 2) + (WLC_ANTSEL_11N_1(ant))) 36#define BRCMS_ANTIDX_11N(ant) (((BRCMS_ANTSEL_11N_0(ant)) << 2) +\
37#define WLC_ANT_ISAUTO_11N(ant) (((ant) & ANT_SELCFG_AUTO) == ANT_SELCFG_AUTO) 37 (BRCMS_ANTSEL_11N_1(ant)))
38#define WLC_ANTSEL_11N(ant) ((ant) & ANT_SELCFG_MASK) 38#define BRCMS_ANT_ISAUTO_11N(ant) (((ant) & ANT_SELCFG_AUTO) == ANT_SELCFG_AUTO)
39#define BRCMS_ANTSEL_11N(ant) ((ant) & ANT_SELCFG_MASK)
39 40
40/* antenna switch */ 41/* antenna switch */
41/* defines for no boardlevel antenna diversity */ 42/* defines for no boardlevel antenna diversity */
@@ -263,7 +264,7 @@ static u8 brcms_c_antsel_id2antcfg(struct antsel_info *asi, u8 id)
263/* boardlevel antenna selection: convert ant_cfg to mimo_antsel (ucode interface) */ 264/* boardlevel antenna selection: convert ant_cfg to mimo_antsel (ucode interface) */
264static u16 brcms_c_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg) 265static u16 brcms_c_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg)
265{ 266{
266 u8 idx = WLC_ANTIDX_11N(WLC_ANTSEL_11N(ant_cfg)); 267 u8 idx = BRCMS_ANTIDX_11N(BRCMS_ANTSEL_11N(ant_cfg));
267 u16 mimo_antsel = 0; 268 u16 mimo_antsel = 0;
268 269
269 if (asi->antsel_type == ANTSEL_2x4) { 270 if (asi->antsel_type == ANTSEL_2x4) {
diff --git a/drivers/staging/brcm80211/brcmsmac/bmac.c b/drivers/staging/brcm80211/brcmsmac/bmac.c
index 412611ec077..225178ef421 100644
--- a/drivers/staging/brcm80211/brcmsmac/bmac.c
+++ b/drivers/staging/brcm80211/brcmsmac/bmac.c
@@ -38,7 +38,6 @@
38#define SYNTHPU_DLY_PHY_US_QT 100 /* QT synthpu_dly time in us */ 38#define SYNTHPU_DLY_PHY_US_QT 100 /* QT synthpu_dly time in us */
39 39
40#ifndef BMAC_DUP_TO_REMOVE 40#ifndef BMAC_DUP_TO_REMOVE
41#define WLC_RM_WAIT_TX_SUSPEND 4 /* Wait Tx Suspend */
42 41
43#define ANTCNT 10 /* vanilla M_MAX_ANTCNT value */ 42#define ANTCNT 10 /* vanilla M_MAX_ANTCNT value */
44 43
@@ -186,7 +185,7 @@ static void WLBANDINITFN(brcms_c_ucode_bsinit) (struct brcms_hardware *wlc_hw)
186 185
187 /* do band-specific ucode IHR, SHM, and SCR inits */ 186 /* do band-specific ucode IHR, SHM, and SCR inits */
188 if (D11REV_IS(wlc_hw->corerev, 23)) { 187 if (D11REV_IS(wlc_hw->corerev, 23)) {
189 if (WLCISNPHY(wlc_hw->band)) { 188 if (BRCMS_ISNPHY(wlc_hw->band)) {
190 brcms_c_write_inits(wlc_hw, d11n0bsinitvals16); 189 brcms_c_write_inits(wlc_hw, d11n0bsinitvals16);
191 } else { 190 } else {
192 wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev" 191 wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev"
@@ -195,7 +194,7 @@ static void WLBANDINITFN(brcms_c_ucode_bsinit) (struct brcms_hardware *wlc_hw)
195 } 194 }
196 } else { 195 } else {
197 if (D11REV_IS(wlc_hw->corerev, 24)) { 196 if (D11REV_IS(wlc_hw->corerev, 24)) {
198 if (WLCISLCNPHY(wlc_hw->band)) { 197 if (BRCMS_ISLCNPHY(wlc_hw->band)) {
199 brcms_c_write_inits(wlc_hw, 198 brcms_c_write_inits(wlc_hw,
200 d11lcn0bsinitvals24); 199 d11lcn0bsinitvals24);
201 } else 200 } else
@@ -421,7 +420,7 @@ brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, chanspec_t chanspec,
421 420
422 /* Switch bands if necessary */ 421 /* Switch bands if necessary */
423 if (NBANDS_HW(wlc_hw) > 1) { 422 if (NBANDS_HW(wlc_hw) > 1) {
424 bandunit = CHSPEC_WLCBANDUNIT(chanspec); 423 bandunit = CHSPEC_BANDUNIT(chanspec);
425 if (wlc_hw->band->bandunit != bandunit) { 424 if (wlc_hw->band->bandunit != bandunit) {
426 /* brcms_b_setband disables other bandunit, 425 /* brcms_b_setband disables other bandunit,
427 * use light band switch if not up yet 426 * use light band switch if not up yet
@@ -501,7 +500,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)
501 NULL), DMAREG(wlc_hw, DMA_RX, 0), 500 NULL), DMAREG(wlc_hw, DMA_RX, 0),
502 (wme ? tune->ntxd : 0), tune->nrxd, 501 (wme ? tune->ntxd : 0), tune->nrxd,
503 tune->rxbufsz, -1, tune->nrxbufpost, 502 tune->rxbufsz, -1, tune->nrxbufpost,
504 WL_HWRXOFF, &brcm_msg_level); 503 BRCMS_HWRXOFF, &brcm_msg_level);
505 dma_attach_err |= (NULL == wlc_hw->di[0]); 504 dma_attach_err |= (NULL == wlc_hw->di[0]);
506 505
507 /* 506 /*
@@ -681,7 +680,7 @@ int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, uint unit,
681 * But it will be called again inside wlc_corereset, after d11 is out of reset. 680 * But it will be called again inside wlc_corereset, after d11 is out of reset.
682 */ 681 */
683 brcms_b_clkctl_clk(wlc_hw, CLK_FAST); 682 brcms_b_clkctl_clk(wlc_hw, CLK_FAST);
684 brcms_b_corereset(wlc_hw, WLC_USE_COREFLAGS); 683 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS);
685 684
686 if (!brcms_b_validate_chip_access(wlc_hw)) { 685 if (!brcms_b_validate_chip_access(wlc_hw)) {
687 wiphy_err(wiphy, "wl%d: brcms_b_attach: validate_chip_access " 686 wiphy_err(wiphy, "wl%d: brcms_b_attach: validate_chip_access "
@@ -708,7 +707,7 @@ int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, uint unit,
708 wlc_hw->boardflags2 = (u32) getintvar(vars, "boardflags2"); 707 wlc_hw->boardflags2 = (u32) getintvar(vars, "boardflags2");
709 708
710 if (wlc_hw->boardflags & BFL_NOPLLDOWN) 709 if (wlc_hw->boardflags & BFL_NOPLLDOWN)
711 brcms_b_pllreq(wlc_hw, true, WLC_PLLREQ_SHARED); 710 brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED);
712 711
713 if ((wlc_hw->sih->bustype == PCI_BUS) 712 if ((wlc_hw->sih->bustype == PCI_BUS)
714 && (ai_pci_war16165(wlc_hw->sih))) 713 && (ai_pci_war16165(wlc_hw->sih)))
@@ -788,9 +787,9 @@ int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, uint unit,
788 brcms_c_setxband(wlc_hw, j); 787 brcms_c_setxband(wlc_hw, j);
789 788
790 wlc_hw->band->bandunit = j; 789 wlc_hw->band->bandunit = j;
791 wlc_hw->band->bandtype = j ? WLC_BAND_5G : WLC_BAND_2G; 790 wlc_hw->band->bandtype = j ? BRCM_BAND_5G : BRCM_BAND_2G;
792 wlc->band->bandunit = j; 791 wlc->band->bandunit = j;
793 wlc->band->bandtype = j ? WLC_BAND_5G : WLC_BAND_2G; 792 wlc->band->bandtype = j ? BRCM_BAND_5G : BRCM_BAND_2G;
794 wlc->core->coreidx = ai_coreidx(wlc_hw->sih); 793 wlc->core->coreidx = ai_coreidx(wlc_hw->sih);
795 794
796 wlc_hw->machwcap = R_REG(&regs->machwcap); 795 wlc_hw->machwcap = R_REG(&regs->machwcap);
@@ -824,12 +823,12 @@ int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, uint unit,
824 wlc_phy_get_coreflags(wlc_hw->band->pi); 823 wlc_phy_get_coreflags(wlc_hw->band->pi);
825 824
826 /* verify good phy_type & supported phy revision */ 825 /* verify good phy_type & supported phy revision */
827 if (WLCISNPHY(wlc_hw->band)) { 826 if (BRCMS_ISNPHY(wlc_hw->band)) {
828 if (NCONF_HAS(wlc_hw->band->phyrev)) 827 if (NCONF_HAS(wlc_hw->band->phyrev))
829 goto good_phy; 828 goto good_phy;
830 else 829 else
831 goto bad_phy; 830 goto bad_phy;
832 } else if (WLCISLCNPHY(wlc_hw->band)) { 831 } else if (BRCMS_ISLCNPHY(wlc_hw->band)) {
833 if (LCNCONF_HAS(wlc_hw->band->phyrev)) 832 if (LCNCONF_HAS(wlc_hw->band->phyrev))
834 goto good_phy; 833 goto good_phy;
835 else 834 else
@@ -1002,7 +1001,7 @@ void brcms_b_reset(struct brcms_hardware *wlc_hw)
1002 1001
1003 /* reset the core */ 1002 /* reset the core */
1004 if (!DEVICEREMOVED(wlc_hw->wlc)) 1003 if (!DEVICEREMOVED(wlc_hw->wlc))
1005 brcms_b_corereset(wlc_hw, WLC_USE_COREFLAGS); 1004 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS);
1006 1005
1007 /* purge the dma rings */ 1006 /* purge the dma rings */
1008 brcms_c_flushqueues(wlc_hw->wlc); 1007 brcms_c_flushqueues(wlc_hw->wlc);
@@ -1028,7 +1027,7 @@ brcms_b_init(struct brcms_hardware *wlc_hw, chanspec_t chanspec,
1028 macintmask = brcms_intrsoff(wlc->wl); 1027 macintmask = brcms_intrsoff(wlc->wl);
1029 1028
1030 /* set up the specified band and chanspec */ 1029 /* set up the specified band and chanspec */
1031 brcms_c_setxband(wlc_hw, CHSPEC_WLCBANDUNIT(chanspec)); 1030 brcms_c_setxband(wlc_hw, CHSPEC_BANDUNIT(chanspec));
1032 wlc_phy_chanspec_radio_set(wlc_hw->band->pi, chanspec); 1031 wlc_phy_chanspec_radio_set(wlc_hw->band->pi, chanspec);
1033 1032
1034 /* do one-time phy inits and calibration */ 1033 /* do one-time phy inits and calibration */
@@ -1047,10 +1046,10 @@ brcms_b_init(struct brcms_hardware *wlc_hw, chanspec_t chanspec,
1047 /* restore macintmask */ 1046 /* restore macintmask */
1048 brcms_intrsrestore(wlc->wl, macintmask); 1047 brcms_intrsrestore(wlc->wl, macintmask);
1049 1048
1050 /* seed wake_override with WLC_WAKE_OVERRIDE_MACSUSPEND since the mac is suspended 1049 /* seed wake_override with BRCMS_WAKE_OVERRIDE_MACSUSPEND since the mac
1051 * and brcms_c_enable_mac() will clear this override bit. 1050 * is suspended and brcms_c_enable_mac() will clear this override bit.
1052 */ 1051 */
1053 mboolset(wlc_hw->wake_override, WLC_WAKE_OVERRIDE_MACSUSPEND); 1052 mboolset(wlc_hw->wake_override, BRCMS_WAKE_OVERRIDE_MACSUSPEND);
1054 1053
1055 /* 1054 /*
1056 * initialize mac_suspend_depth to 1 to match ucode initial suspended state 1055 * initialize mac_suspend_depth to 1 to match ucode initial suspended state
@@ -1101,7 +1100,7 @@ int brcms_b_up_prep(struct brcms_hardware *wlc_hw)
1101 ai_pci_up(wlc_hw->sih); 1100 ai_pci_up(wlc_hw->sih);
1102 1101
1103 /* reset the d11 core */ 1102 /* reset the d11 core */
1104 brcms_b_corereset(wlc_hw, WLC_USE_COREFLAGS); 1103 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS);
1105 1104
1106 return 0; 1105 return 0;
1107} 1106}
@@ -1274,10 +1273,10 @@ static void brcms_b_clkctl_clk(struct brcms_hardware *wlc_hw, uint mode)
1274 */ 1273 */
1275 if (wlc_hw->forcefastclk) 1274 if (wlc_hw->forcefastclk)
1276 mboolset(wlc_hw->wake_override, 1275 mboolset(wlc_hw->wake_override,
1277 WLC_WAKE_OVERRIDE_FORCEFAST); 1276 BRCMS_WAKE_OVERRIDE_FORCEFAST);
1278 else 1277 else
1279 mboolclr(wlc_hw->wake_override, 1278 mboolclr(wlc_hw->wake_override,
1280 WLC_WAKE_OVERRIDE_FORCEFAST); 1279 BRCMS_WAKE_OVERRIDE_FORCEFAST);
1281 } 1280 }
1282} 1281}
1283 1282
@@ -1295,7 +1294,7 @@ brcms_c_mhfdef(struct brcms_c_info *wlc, u16 *mhfs, u16 mhf2_init)
1295 if (wlc_hw->boardflags & BFL_NOPLLDOWN) 1294 if (wlc_hw->boardflags & BFL_NOPLLDOWN)
1296 mhfs[MHF1] |= MHF1_FORCEFASTCLK; 1295 mhfs[MHF1] |= MHF1_FORCEFASTCLK;
1297 1296
1298 if (WLCISNPHY(wlc_hw->band) && NREV_LT(wlc_hw->band->phyrev, 2)) { 1297 if (BRCMS_ISNPHY(wlc_hw->band) && NREV_LT(wlc_hw->band->phyrev, 2)) {
1299 mhfs[MHF2] |= MHF2_NPHY40MHZ_WAR; 1298 mhfs[MHF2] |= MHF2_NPHY40MHZ_WAR;
1300 mhfs[MHF1] |= MHF1_IQSWAP_WAR; 1299 mhfs[MHF1] |= MHF1_IQSWAP_WAR;
1301 } 1300 }
@@ -1307,10 +1306,10 @@ brcms_c_mhfdef(struct brcms_c_info *wlc, u16 *mhfs, u16 mhf2_init)
1307 * pre-CLK changes should use wlc_write_mhf to get around the optimization 1306 * pre-CLK changes should use wlc_write_mhf to get around the optimization
1308 * 1307 *
1309 * 1308 *
1310 * bands values are: WLC_BAND_AUTO <--- Current band only 1309 * bands values are: BRCM_BAND_AUTO <--- Current band only
1311 * WLC_BAND_5G <--- 5G band only 1310 * BRCM_BAND_5G <--- 5G band only
1312 * WLC_BAND_2G <--- 2G band only 1311 * BRCM_BAND_2G <--- 2G band only
1313 * WLC_BAND_ALL <--- All bands 1312 * BRCM_BAND_ALL <--- All bands
1314 */ 1313 */
1315void 1314void
1316brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, u16 val, 1315brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, u16 val,
@@ -1330,14 +1329,14 @@ brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, u16 val,
1330 /* Current band only or all bands, 1329 /* Current band only or all bands,
1331 * then set the band to current band 1330 * then set the band to current band
1332 */ 1331 */
1333 case WLC_BAND_AUTO: 1332 case BRCM_BAND_AUTO:
1334 case WLC_BAND_ALL: 1333 case BRCM_BAND_ALL:
1335 band = wlc_hw->band; 1334 band = wlc_hw->band;
1336 break; 1335 break;
1337 case WLC_BAND_5G: 1336 case BRCM_BAND_5G:
1338 band = wlc_hw->bandstate[BAND_5G_INDEX]; 1337 band = wlc_hw->bandstate[BAND_5G_INDEX];
1339 break; 1338 break;
1340 case WLC_BAND_2G: 1339 case BRCM_BAND_2G:
1341 band = wlc_hw->bandstate[BAND_2G_INDEX]; 1340 band = wlc_hw->bandstate[BAND_2G_INDEX];
1342 break; 1341 break;
1343 default: 1342 default:
@@ -1357,7 +1356,7 @@ brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, u16 val,
1357 (u16) band->mhfs[idx]); 1356 (u16) band->mhfs[idx]);
1358 } 1357 }
1359 1358
1360 if (bands == WLC_BAND_ALL) { 1359 if (bands == BRCM_BAND_ALL) {
1361 wlc_hw->bandstate[0]->mhfs[idx] = 1360 wlc_hw->bandstate[0]->mhfs[idx] =
1362 (wlc_hw->bandstate[0]->mhfs[idx] & ~mask) | val; 1361 (wlc_hw->bandstate[0]->mhfs[idx] & ~mask) | val;
1363 wlc_hw->bandstate[1]->mhfs[idx] = 1362 wlc_hw->bandstate[1]->mhfs[idx] =
@@ -1372,13 +1371,13 @@ u16 brcms_b_mhf_get(struct brcms_hardware *wlc_hw, u8 idx, int bands)
1372 if (idx >= MHFMAX) 1371 if (idx >= MHFMAX)
1373 return 0; /* error condition */ 1372 return 0; /* error condition */
1374 switch (bands) { 1373 switch (bands) {
1375 case WLC_BAND_AUTO: 1374 case BRCM_BAND_AUTO:
1376 band = wlc_hw->band; 1375 band = wlc_hw->band;
1377 break; 1376 break;
1378 case WLC_BAND_5G: 1377 case BRCM_BAND_5G:
1379 band = wlc_hw->bandstate[BAND_5G_INDEX]; 1378 band = wlc_hw->bandstate[BAND_5G_INDEX];
1380 break; 1379 break;
1381 case WLC_BAND_2G: 1380 case BRCM_BAND_2G:
1382 band = wlc_hw->bandstate[BAND_2G_INDEX]; 1381 band = wlc_hw->bandstate[BAND_2G_INDEX];
1383 break; 1382 break;
1384 default: 1383 default:
@@ -1678,9 +1677,9 @@ static void WLBANDINITFN(brcms_b_upd_synthpu) (struct brcms_hardware *wlc_hw)
1678 struct brcms_c_info *wlc = wlc_hw->wlc; 1677 struct brcms_c_info *wlc = wlc_hw->wlc;
1679 /* update SYNTHPU_DLY */ 1678 /* update SYNTHPU_DLY */
1680 1679
1681 if (WLCISLCNPHY(wlc->band)) { 1680 if (BRCMS_ISLCNPHY(wlc->band)) {
1682 v = SYNTHPU_DLY_LPPHY_US; 1681 v = SYNTHPU_DLY_LPPHY_US;
1683 } else if (WLCISNPHY(wlc->band) && (NREV_GE(wlc->band->phyrev, 3))) { 1682 } else if (BRCMS_ISNPHY(wlc->band) && (NREV_GE(wlc->band->phyrev, 3))) {
1684 v = SYNTHPU_DLY_NPHY_US; 1683 v = SYNTHPU_DLY_NPHY_US;
1685 } else { 1684 } else {
1686 v = SYNTHPU_DLY_BPHY_US; 1685 v = SYNTHPU_DLY_BPHY_US;
@@ -1772,7 +1771,7 @@ void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw)
1772void brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk) 1771void brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk)
1773{ 1772{
1774 /* support(necessary for NPHY and HYPHY) only */ 1773 /* support(necessary for NPHY and HYPHY) only */
1775 if (!WLCISNPHY(wlc_hw->band)) 1774 if (!BRCMS_ISNPHY(wlc_hw->band))
1776 return; 1775 return;
1777 1776
1778 if (ON == clk) 1777 if (ON == clk)
@@ -1804,7 +1803,7 @@ void brcms_b_phy_reset(struct brcms_hardware *wlc_hw)
1804 phy_bw_clkbits = wlc_phy_clk_bwbits(wlc_hw->band->pi); 1803 phy_bw_clkbits = wlc_phy_clk_bwbits(wlc_hw->band->pi);
1805 1804
1806 /* Specific reset sequence required for NPHY rev 3 and 4 */ 1805 /* Specific reset sequence required for NPHY rev 3 and 4 */
1807 if (WLCISNPHY(wlc_hw->band) && NREV_GE(wlc_hw->band->phyrev, 3) && 1806 if (BRCMS_ISNPHY(wlc_hw->band) && NREV_GE(wlc_hw->band->phyrev, 3) &&
1808 NREV_LE(wlc_hw->band->phyrev, 4)) { 1807 NREV_LE(wlc_hw->band->phyrev, 4)) {
1809 /* Set the PHY bandwidth */ 1808 /* Set the PHY bandwidth */
1810 ai_core_cflags(wlc_hw->sih, SICF_BWMASK, phy_bw_clkbits); 1809 ai_core_cflags(wlc_hw->sih, SICF_BWMASK, phy_bw_clkbits);
@@ -2065,7 +2064,7 @@ void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags)
2065 bool fastclk; 2064 bool fastclk;
2066 u32 resetbits = 0; 2065 u32 resetbits = 0;
2067 2066
2068 if (flags == WLC_USE_COREFLAGS) 2067 if (flags == BRCMS_USE_COREFLAGS)
2069 flags = (wlc_hw->band->pi ? wlc_hw->band->core_flags : 0); 2068 flags = (wlc_hw->band->pi ? wlc_hw->band->core_flags : 0);
2070 2069
2071 BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); 2070 BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit);
@@ -2238,14 +2237,14 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc)
2238 sflags = ai_core_sflags(wlc_hw->sih, 0, 0); 2237 sflags = ai_core_sflags(wlc_hw->sih, 0, 0);
2239 2238
2240 if (D11REV_IS(wlc_hw->corerev, 23)) { 2239 if (D11REV_IS(wlc_hw->corerev, 23)) {
2241 if (WLCISNPHY(wlc_hw->band)) 2240 if (BRCMS_ISNPHY(wlc_hw->band))
2242 brcms_c_write_inits(wlc_hw, d11n0initvals16); 2241 brcms_c_write_inits(wlc_hw, d11n0initvals16);
2243 else 2242 else
2244 wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev" 2243 wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev"
2245 " %d\n", __func__, wlc_hw->unit, 2244 " %d\n", __func__, wlc_hw->unit,
2246 wlc_hw->corerev); 2245 wlc_hw->corerev);
2247 } else if (D11REV_IS(wlc_hw->corerev, 24)) { 2246 } else if (D11REV_IS(wlc_hw->corerev, 24)) {
2248 if (WLCISLCNPHY(wlc_hw->band)) { 2247 if (BRCMS_ISLCNPHY(wlc_hw->band)) {
2249 brcms_c_write_inits(wlc_hw, d11lcn0initvals24); 2248 brcms_c_write_inits(wlc_hw, d11lcn0initvals24);
2250 } else { 2249 } else {
2251 wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev" 2250 wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev"
@@ -2403,7 +2402,7 @@ void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode)
2403 W_REG(&regs->tsf_clk_frac_l, 0x8889); 2402 W_REG(&regs->tsf_clk_frac_l, 0x8889);
2404 W_REG(&regs->tsf_clk_frac_h, 0x8); 2403 W_REG(&regs->tsf_clk_frac_h, 0x8);
2405 } 2404 }
2406 } else if (WLCISLCNPHY(wlc_hw->band)) { 2405 } else if (BRCMS_ISLCNPHY(wlc_hw->band)) {
2407 if (spurmode == WL_SPURAVOID_ON1) { /* 82Mhz */ 2406 if (spurmode == WL_SPURAVOID_ON1) { /* 82Mhz */
2408 W_REG(&regs->tsf_clk_frac_l, 0x7CE0); 2407 W_REG(&regs->tsf_clk_frac_l, 0x7CE0);
2409 W_REG(&regs->tsf_clk_frac_h, 0xC); 2408 W_REG(&regs->tsf_clk_frac_h, 0xC);
@@ -2440,9 +2439,9 @@ static void brcms_c_gpio_init(struct brcms_c_info *wlc)
2440 if (wlc_hw->antsel_type == ANTSEL_2x3) { 2439 if (wlc_hw->antsel_type == ANTSEL_2x3) {
2441 /* Enable antenna diversity, use 2x3 mode */ 2440 /* Enable antenna diversity, use 2x3 mode */
2442 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN, 2441 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN,
2443 MHF3_ANTSEL_EN, WLC_BAND_ALL); 2442 MHF3_ANTSEL_EN, BRCM_BAND_ALL);
2444 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE, 2443 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE,
2445 MHF3_ANTSEL_MODE, WLC_BAND_ALL); 2444 MHF3_ANTSEL_MODE, BRCM_BAND_ALL);
2446 2445
2447 /* init superswitch control */ 2446 /* init superswitch control */
2448 wlc_phy_antsel_init(wlc_hw->band->pi, false); 2447 wlc_phy_antsel_init(wlc_hw->band->pi, false);
@@ -2460,9 +2459,9 @@ static void brcms_c_gpio_init(struct brcms_c_info *wlc)
2460 2459
2461 /* Enable antenna diversity, use 2x4 mode */ 2460 /* Enable antenna diversity, use 2x4 mode */
2462 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN, 2461 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN,
2463 MHF3_ANTSEL_EN, WLC_BAND_ALL); 2462 MHF3_ANTSEL_EN, BRCM_BAND_ALL);
2464 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE, 0, 2463 brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE, 0,
2465 WLC_BAND_ALL); 2464 BRCM_BAND_ALL);
2466 2465
2467 /* Configure the desired clock to be 4Mhz */ 2466 /* Configure the desired clock to be 4Mhz */
2468 brcms_b_write_shm(wlc_hw, M_ANTSEL_CLKDIV, 2467 brcms_b_write_shm(wlc_hw, M_ANTSEL_CLKDIV,
@@ -2486,7 +2485,7 @@ static void brcms_ucode_download(struct brcms_hardware *wlc_hw)
2486 return; 2485 return;
2487 2486
2488 if (D11REV_IS(wlc_hw->corerev, 23)) { 2487 if (D11REV_IS(wlc_hw->corerev, 23)) {
2489 if (WLCISNPHY(wlc_hw->band)) { 2488 if (BRCMS_ISNPHY(wlc_hw->band)) {
2490 brcms_ucode_write(wlc_hw, bcm43xx_16_mimo, 2489 brcms_ucode_write(wlc_hw, bcm43xx_16_mimo,
2491 bcm43xx_16_mimosz); 2490 bcm43xx_16_mimosz);
2492 wlc_hw->ucode_loaded = true; 2491 wlc_hw->ucode_loaded = true;
@@ -2495,7 +2494,7 @@ static void brcms_ucode_download(struct brcms_hardware *wlc_hw)
2495 "corerev %d\n", 2494 "corerev %d\n",
2496 __func__, wlc_hw->unit, wlc_hw->corerev); 2495 __func__, wlc_hw->unit, wlc_hw->corerev);
2497 } else if (D11REV_IS(wlc_hw->corerev, 24)) { 2496 } else if (D11REV_IS(wlc_hw->corerev, 24)) {
2498 if (WLCISLCNPHY(wlc_hw->band)) { 2497 if (BRCMS_ISLCNPHY(wlc_hw->band)) {
2499 brcms_ucode_write(wlc_hw, bcm43xx_24_lcn, 2498 brcms_ucode_write(wlc_hw, bcm43xx_24_lcn,
2500 bcm43xx_24_lcnsz); 2499 bcm43xx_24_lcnsz);
2501 wlc_hw->ucode_loaded = true; 2500 wlc_hw->ucode_loaded = true;
@@ -2796,7 +2795,7 @@ static void brcms_b_tx_fifo_suspend(struct brcms_hardware *wlc_hw,
2796 /* force the core awake only if not already */ 2795 /* force the core awake only if not already */
2797 if (wlc_hw->suspended_fifos == 0) 2796 if (wlc_hw->suspended_fifos == 0)
2798 brcms_c_ucode_wake_override_set(wlc_hw, 2797 brcms_c_ucode_wake_override_set(wlc_hw,
2799 WLC_WAKE_OVERRIDE_TXFIFO); 2798 BRCMS_WAKE_OVERRIDE_TXFIFO);
2800 2799
2801 wlc_hw->suspended_fifos |= fifo; 2800 wlc_hw->suspended_fifos |= fifo;
2802 2801
@@ -2805,12 +2804,12 @@ static void brcms_b_tx_fifo_suspend(struct brcms_hardware *wlc_hw,
2805 * which may result in mismatch between ucode and driver 2804 * which may result in mismatch between ucode and driver
2806 * so suspend the mac before suspending the FIFO 2805 * so suspend the mac before suspending the FIFO
2807 */ 2806 */
2808 if (WLC_PHY_11N_CAP(wlc_hw->band)) 2807 if (BRCMS_PHY_11N_CAP(wlc_hw->band))
2809 brcms_c_suspend_mac_and_wait(wlc_hw->wlc); 2808 brcms_c_suspend_mac_and_wait(wlc_hw->wlc);
2810 2809
2811 dma_txsuspend(wlc_hw->di[tx_fifo]); 2810 dma_txsuspend(wlc_hw->di[tx_fifo]);
2812 2811
2813 if (WLC_PHY_11N_CAP(wlc_hw->band)) 2812 if (BRCMS_PHY_11N_CAP(wlc_hw->band))
2814 brcms_c_enable_mac(wlc_hw->wlc); 2813 brcms_c_enable_mac(wlc_hw->wlc);
2815 } 2814 }
2816} 2815}
@@ -2818,7 +2817,7 @@ static void brcms_b_tx_fifo_suspend(struct brcms_hardware *wlc_hw,
2818static void brcms_b_tx_fifo_resume(struct brcms_hardware *wlc_hw, 2817static void brcms_b_tx_fifo_resume(struct brcms_hardware *wlc_hw,
2819 uint tx_fifo) 2818 uint tx_fifo)
2820{ 2819{
2821 /* BMAC_NOTE: WLC_TX_FIFO_ENAB is done in brcms_c_dpc() for DMA case 2820 /* BMAC_NOTE: BRCMS_TX_FIFO_ENAB is done in brcms_c_dpc() for DMA case
2822 * but need to be done here for PIO otherwise the watchdog will catch 2821 * but need to be done here for PIO otherwise the watchdog will catch
2823 * the inconsistency and fire 2822 * the inconsistency and fire
2824 */ 2823 */
@@ -2833,7 +2832,7 @@ static void brcms_b_tx_fifo_resume(struct brcms_hardware *wlc_hw,
2833 wlc_hw->suspended_fifos &= ~(1 << tx_fifo); 2832 wlc_hw->suspended_fifos &= ~(1 << tx_fifo);
2834 if (wlc_hw->suspended_fifos == 0) 2833 if (wlc_hw->suspended_fifos == 0)
2835 brcms_c_ucode_wake_override_clear(wlc_hw, 2834 brcms_c_ucode_wake_override_clear(wlc_hw,
2836 WLC_WAKE_OVERRIDE_TXFIFO); 2835 BRCMS_WAKE_OVERRIDE_TXFIFO);
2837 } 2836 }
2838} 2837}
2839 2838
@@ -3048,7 +3047,7 @@ void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc)
3048 return; 3047 return;
3049 3048
3050 /* force the core awake */ 3049 /* force the core awake */
3051 brcms_c_ucode_wake_override_set(wlc_hw, WLC_WAKE_OVERRIDE_MACSUSPEND); 3050 brcms_c_ucode_wake_override_set(wlc_hw, BRCMS_WAKE_OVERRIDE_MACSUSPEND);
3052 3051
3053 mc = R_REG(&regs->maccontrol); 3052 mc = R_REG(&regs->maccontrol);
3054 3053
@@ -3074,12 +3073,12 @@ void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc)
3074 brcms_b_mctrl(wlc_hw, MCTL_EN_MAC, 0); 3073 brcms_b_mctrl(wlc_hw, MCTL_EN_MAC, 0);
3075 3074
3076 SPINWAIT(!(R_REG(&regs->macintstatus) & MI_MACSSPNDD), 3075 SPINWAIT(!(R_REG(&regs->macintstatus) & MI_MACSSPNDD),
3077 WLC_MAX_MAC_SUSPEND); 3076 BRCMS_MAX_MAC_SUSPEND);
3078 3077
3079 if (!(R_REG(&regs->macintstatus) & MI_MACSSPNDD)) { 3078 if (!(R_REG(&regs->macintstatus) & MI_MACSSPNDD)) {
3080 wiphy_err(wiphy, "wl%d: wlc_suspend_mac_and_wait: waited %d uS" 3079 wiphy_err(wiphy, "wl%d: wlc_suspend_mac_and_wait: waited %d uS"
3081 " and MI_MACSSPNDD is still not on.\n", 3080 " and MI_MACSSPNDD is still not on.\n",
3082 wlc_hw->unit, WLC_MAX_MAC_SUSPEND); 3081 wlc_hw->unit, BRCMS_MAX_MAC_SUSPEND);
3083 wiphy_err(wiphy, "wl%d: psmdebug 0x%08x, phydebug 0x%08x, " 3082 wiphy_err(wiphy, "wl%d: psmdebug 0x%08x, phydebug 0x%08x, "
3084 "psm_brc 0x%04x\n", wlc_hw->unit, 3083 "psm_brc 0x%04x\n", wlc_hw->unit,
3085 R_REG(&regs->psmdebug), 3084 R_REG(&regs->psmdebug),
@@ -3131,21 +3130,22 @@ void brcms_c_enable_mac(struct brcms_c_info *wlc)
3131 mi = R_REG(&regs->macintstatus); 3130 mi = R_REG(&regs->macintstatus);
3132 WARN_ON(mi & MI_MACSSPNDD); 3131 WARN_ON(mi & MI_MACSSPNDD);
3133 3132
3134 brcms_c_ucode_wake_override_clear(wlc_hw, WLC_WAKE_OVERRIDE_MACSUSPEND); 3133 brcms_c_ucode_wake_override_clear(wlc_hw,
3134 BRCMS_WAKE_OVERRIDE_MACSUSPEND);
3135} 3135}
3136 3136
3137static void brcms_upd_ofdm_pctl1_table(struct brcms_hardware *wlc_hw) 3137static void brcms_upd_ofdm_pctl1_table(struct brcms_hardware *wlc_hw)
3138{ 3138{
3139 u8 rate; 3139 u8 rate;
3140 u8 rates[8] = { 3140 u8 rates[8] = {
3141 WLC_RATE_6M, WLC_RATE_9M, WLC_RATE_12M, WLC_RATE_18M, 3141 BRCM_RATE_6M, BRCM_RATE_9M, BRCM_RATE_12M, BRCM_RATE_18M,
3142 WLC_RATE_24M, WLC_RATE_36M, WLC_RATE_48M, WLC_RATE_54M 3142 BRCM_RATE_24M, BRCM_RATE_36M, BRCM_RATE_48M, BRCM_RATE_54M
3143 }; 3143 };
3144 u16 entry_ptr; 3144 u16 entry_ptr;
3145 u16 pctl1; 3145 u16 pctl1;
3146 uint i; 3146 uint i;
3147 3147
3148 if (!WLC_PHY_11N_CAP(wlc_hw->band)) 3148 if (!BRCMS_PHY_11N_CAP(wlc_hw->band))
3149 return; 3149 return;
3150 3150
3151 /* walk the phy rate table and update the entries */ 3151 /* walk the phy rate table and update the entries */
@@ -3179,14 +3179,14 @@ static u16 brcms_b_ofdm_ratetable_offset(struct brcms_hardware *wlc_hw,
3179 }; 3179 };
3180 /* OFDM RATE sub-field of PLCP SIGNAL field, per 802.11 sec 17.3.4.1 */ 3180 /* OFDM RATE sub-field of PLCP SIGNAL field, per 802.11 sec 17.3.4.1 */
3181 const struct plcp_signal_rate_lookup rate_lookup[] = { 3181 const struct plcp_signal_rate_lookup rate_lookup[] = {
3182 {WLC_RATE_6M, 0xB}, 3182 {BRCM_RATE_6M, 0xB},
3183 {WLC_RATE_9M, 0xF}, 3183 {BRCM_RATE_9M, 0xF},
3184 {WLC_RATE_12M, 0xA}, 3184 {BRCM_RATE_12M, 0xA},
3185 {WLC_RATE_18M, 0xE}, 3185 {BRCM_RATE_18M, 0xE},
3186 {WLC_RATE_24M, 0x9}, 3186 {BRCM_RATE_24M, 0x9},
3187 {WLC_RATE_36M, 0xD}, 3187 {BRCM_RATE_36M, 0xD},
3188 {WLC_RATE_48M, 0x8}, 3188 {BRCM_RATE_48M, 0x8},
3189 {WLC_RATE_54M, 0xC} 3189 {BRCM_RATE_54M, 0xC}
3190 }; 3190 };
3191 3191
3192 for (i = 0; i < ARRAY_SIZE(rate_lookup); i++) { 3192 for (i = 0; i < ARRAY_SIZE(rate_lookup); i++) {
@@ -3543,7 +3543,7 @@ void brcms_b_pllreq(struct brcms_hardware *wlc_hw, bool set, mbool req_bit)
3543 3543
3544 mboolset(wlc_hw->pllreq, req_bit); 3544 mboolset(wlc_hw->pllreq, req_bit);
3545 3545
3546 if (mboolisset(wlc_hw->pllreq, WLC_PLLREQ_FLIP)) { 3546 if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) {
3547 if (!wlc_hw->sbclk) { 3547 if (!wlc_hw->sbclk) {
3548 brcms_b_xtal(wlc_hw, ON); 3548 brcms_b_xtal(wlc_hw, ON);
3549 } 3549 }
@@ -3554,7 +3554,7 @@ void brcms_b_pllreq(struct brcms_hardware *wlc_hw, bool set, mbool req_bit)
3554 3554
3555 mboolclr(wlc_hw->pllreq, req_bit); 3555 mboolclr(wlc_hw->pllreq, req_bit);
3556 3556
3557 if (mboolisset(wlc_hw->pllreq, WLC_PLLREQ_FLIP)) { 3557 if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) {
3558 if (wlc_hw->sbclk) { 3558 if (wlc_hw->sbclk) {
3559 brcms_b_xtal(wlc_hw, OFF); 3559 brcms_b_xtal(wlc_hw, OFF);
3560 } 3560 }
@@ -3578,7 +3578,7 @@ u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate)
3578 /* for a given rate, the LS-nibble of the PLCP SIGNAL field is 3578 /* for a given rate, the LS-nibble of the PLCP SIGNAL field is
3579 * the index into the rate table. 3579 * the index into the rate table.
3580 */ 3580 */
3581 phy_rate = rate_info[rate] & WLC_RATE_MASK; 3581 phy_rate = rate_info[rate] & BRCMS_RATE_MASK;
3582 index = phy_rate & 0xf; 3582 index = phy_rate & 0xf;
3583 3583
3584 /* Find the SHM pointer to the rate table entry by looking in the 3584 /* Find the SHM pointer to the rate table entry by looking in the
diff --git a/drivers/staging/brcm80211/brcmsmac/channel.c b/drivers/staging/brcm80211/brcmsmac/channel.c
index ba245d8869d..f59693e1d8a 100644
--- a/drivers/staging/brcm80211/brcmsmac/channel.c
+++ b/drivers/staging/brcm80211/brcmsmac/channel.c
@@ -41,12 +41,12 @@ struct brcms_cm_band {
41struct brcms_cm_info { 41struct brcms_cm_info {
42 struct brcms_pub *pub; 42 struct brcms_pub *pub;
43 struct brcms_c_info *wlc; 43 struct brcms_c_info *wlc;
44 char srom_ccode[WLC_CNTRY_BUF_SZ]; /* Country Code in SROM */ 44 char srom_ccode[BRCM_CNTRY_BUF_SZ]; /* Country Code in SROM */
45 uint srom_regrev; /* Regulatory Rev for the SROM ccode */ 45 uint srom_regrev; /* Regulatory Rev for the SROM ccode */
46 const struct country_info *country; /* current country def */ 46 const struct country_info *country; /* current country def */
47 char ccode[WLC_CNTRY_BUF_SZ]; /* current internal Country Code */ 47 char ccode[BRCM_CNTRY_BUF_SZ]; /* current internal Country Code */
48 uint regrev; /* current Regulatory Revision */ 48 uint regrev; /* current Regulatory Revision */
49 char country_abbrev[WLC_CNTRY_BUF_SZ]; /* current advertised ccode */ 49 char country_abbrev[BRCM_CNTRY_BUF_SZ]; /* current advertised ccode */
50 /* per-band state (one per phy/radio) */ 50 /* per-band state (one per phy/radio) */
51 struct brcms_cm_band bandstate[MAXBANDS]; 51 struct brcms_cm_band bandstate[MAXBANDS];
52 /* quiet channels currently for radar sensitivity or 11h support */ 52 /* quiet channels currently for radar sensitivity or 11h support */
@@ -106,7 +106,7 @@ static const struct locale_mimo_info *brcms_c_get_mimo_5g(u8 locale_idx);
106#ifdef QDB 106#ifdef QDB
107#undef QDB 107#undef QDB
108#endif 108#endif
109#define QDB(n) ((n) * WLC_TXPWR_DB_FACTOR) 109#define QDB(n) ((n) * BRCMS_TXPWR_DB_FACTOR)
110 110
111/* Regulatory Matrix Spreadsheet (CLM) MIMO v3.7.9 */ 111/* Regulatory Matrix Spreadsheet (CLM) MIMO v3.7.9 */
112 112
@@ -422,7 +422,7 @@ static const struct locale_info locale_i = { /* locale i. channel 1 - 13 */
422 {QDB(19), QDB(19), QDB(19), 422 {QDB(19), QDB(19), QDB(19),
423 QDB(19), QDB(19), QDB(19)}, 423 QDB(19), QDB(19), QDB(19)},
424 {20, 20, 20, 0}, 424 {20, 20, 20, 0},
425 WLC_EIRP 425 BRCMS_EIRP
426}; 426};
427 427
428/* 428/*
@@ -435,7 +435,7 @@ static const struct locale_info locale_11 = {
435 LOCALE_RESTRICTED_NONE, 435 LOCALE_RESTRICTED_NONE,
436 {QDB(21), QDB(21), QDB(21), QDB(21), QDB(21)}, 436 {QDB(21), QDB(21), QDB(21), QDB(21), QDB(21)},
437 {23, 23, 23, 30, 30}, 437 {23, 23, 23, 30, 30},
438 WLC_EIRP | WLC_DFS_EU 438 BRCMS_EIRP | BRCMS_DFS_EU
439}; 439};
440 440
441#define LOCALE_2G_IDX_i 0 441#define LOCALE_2G_IDX_i 0
@@ -500,7 +500,7 @@ static const struct locale_mimo_info *g_mimo_5g_table[] = {
500#define LOCALES(band2, band5, mimo2, mimo5) {LC_2G(band2), LC_5G(band5), LC(mimo2), LC(mimo5)} 500#define LOCALES(band2, band5, mimo2, mimo5) {LC_2G(band2), LC_5G(band5), LC(mimo2), LC(mimo5)}
501 501
502static const struct { 502static const struct {
503 char abbrev[WLC_CNTRY_BUF_SZ]; /* country abbreviation */ 503 char abbrev[BRCM_CNTRY_BUF_SZ]; /* country abbreviation */
504 struct country_info country; 504 struct country_info country;
505} cntry_locales[] = { 505} cntry_locales[] = {
506 { 506 {
@@ -619,7 +619,7 @@ static const struct locale_mimo_info *brcms_c_get_mimo_5g(u8 locale_idx)
619struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc) 619struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc)
620{ 620{
621 struct brcms_cm_info *wlc_cm; 621 struct brcms_cm_info *wlc_cm;
622 char country_abbrev[WLC_CNTRY_BUF_SZ]; 622 char country_abbrev[BRCM_CNTRY_BUF_SZ];
623 const struct country_info *country; 623 const struct country_info *country;
624 struct brcms_pub *pub = wlc->pub; 624 struct brcms_pub *pub = wlc->pub;
625 char *ccode; 625 char *ccode;
@@ -639,19 +639,19 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc)
639 /* store the country code for passing up as a regulatory hint */ 639 /* store the country code for passing up as a regulatory hint */
640 ccode = getvar(wlc->pub->vars, "ccode"); 640 ccode = getvar(wlc->pub->vars, "ccode");
641 if (ccode) { 641 if (ccode) {
642 strncpy(wlc->pub->srom_ccode, ccode, WLC_CNTRY_BUF_SZ - 1); 642 strncpy(wlc->pub->srom_ccode, ccode, BRCM_CNTRY_BUF_SZ - 1);
643 } 643 }
644 644
645 /* internal country information which must match regulatory constraints in firmware */ 645 /* internal country information which must match regulatory constraints in firmware */
646 memset(country_abbrev, 0, WLC_CNTRY_BUF_SZ); 646 memset(country_abbrev, 0, BRCM_CNTRY_BUF_SZ);
647 strncpy(country_abbrev, "X2", sizeof(country_abbrev) - 1); 647 strncpy(country_abbrev, "X2", sizeof(country_abbrev) - 1);
648 country = brcms_c_country_lookup(wlc, country_abbrev); 648 country = brcms_c_country_lookup(wlc, country_abbrev);
649 649
650 /* save default country for exiting 11d regulatory mode */ 650 /* save default country for exiting 11d regulatory mode */
651 strncpy(wlc->country_default, country_abbrev, WLC_CNTRY_BUF_SZ - 1); 651 strncpy(wlc->country_default, country_abbrev, BRCM_CNTRY_BUF_SZ - 1);
652 652
653 /* initialize autocountry_default to driver default */ 653 /* initialize autocountry_default to driver default */
654 strncpy(wlc->autocountry_default, "X2", WLC_CNTRY_BUF_SZ - 1); 654 strncpy(wlc->autocountry_default, "X2", BRCM_CNTRY_BUF_SZ - 1);
655 655
656 brcms_c_set_countrycode(wlc_cm, country_abbrev); 656 brcms_c_set_countrycode(wlc_cm, country_abbrev);
657 657
@@ -676,8 +676,8 @@ brcms_c_channel_locale_flags_in_band(struct brcms_cm_info *wlc_cm,
676static int 676static int
677brcms_c_set_countrycode(struct brcms_cm_info *wlc_cm, const char *ccode) 677brcms_c_set_countrycode(struct brcms_cm_info *wlc_cm, const char *ccode)
678{ 678{
679 char country_abbrev[WLC_CNTRY_BUF_SZ]; 679 char country_abbrev[BRCM_CNTRY_BUF_SZ];
680 strncpy(country_abbrev, ccode, WLC_CNTRY_BUF_SZ); 680 strncpy(country_abbrev, ccode, BRCM_CNTRY_BUF_SZ);
681 return brcms_c_set_countrycode_rev(wlc_cm, country_abbrev, ccode, -1); 681 return brcms_c_set_countrycode_rev(wlc_cm, country_abbrev, ccode, -1);
682} 682}
683 683
@@ -687,7 +687,7 @@ brcms_c_set_countrycode_rev(struct brcms_cm_info *wlc_cm,
687 const char *ccode, int regrev) 687 const char *ccode, int regrev)
688{ 688{
689 const struct country_info *country; 689 const struct country_info *country;
690 char mapped_ccode[WLC_CNTRY_BUF_SZ]; 690 char mapped_ccode[BRCM_CNTRY_BUF_SZ];
691 uint mapped_regrev; 691 uint mapped_regrev;
692 692
693 /* if regrev is -1, lookup the mapped country code, 693 /* if regrev is -1, lookup the mapped country code,
@@ -701,7 +701,7 @@ brcms_c_set_countrycode_rev(struct brcms_cm_info *wlc_cm,
701 } else { 701 } else {
702 /* find the matching built-in country definition */ 702 /* find the matching built-in country definition */
703 country = brcms_c_country_lookup_direct(ccode, regrev); 703 country = brcms_c_country_lookup_direct(ccode, regrev);
704 strncpy(mapped_ccode, ccode, WLC_CNTRY_BUF_SZ); 704 strncpy(mapped_ccode, ccode, BRCM_CNTRY_BUF_SZ);
705 mapped_regrev = regrev; 705 mapped_regrev = regrev;
706 } 706 }
707 707
@@ -727,22 +727,22 @@ brcms_c_set_country_common(struct brcms_cm_info *wlc_cm,
727 const struct locale_mimo_info *li_mimo; 727 const struct locale_mimo_info *li_mimo;
728 const struct locale_info *locale; 728 const struct locale_info *locale;
729 struct brcms_c_info *wlc = wlc_cm->wlc; 729 struct brcms_c_info *wlc = wlc_cm->wlc;
730 char prev_country_abbrev[WLC_CNTRY_BUF_SZ]; 730 char prev_country_abbrev[BRCM_CNTRY_BUF_SZ];
731 731
732 /* save current country state */ 732 /* save current country state */
733 wlc_cm->country = country; 733 wlc_cm->country = country;
734 734
735 memset(&prev_country_abbrev, 0, WLC_CNTRY_BUF_SZ); 735 memset(&prev_country_abbrev, 0, BRCM_CNTRY_BUF_SZ);
736 strncpy(prev_country_abbrev, wlc_cm->country_abbrev, 736 strncpy(prev_country_abbrev, wlc_cm->country_abbrev,
737 WLC_CNTRY_BUF_SZ - 1); 737 BRCM_CNTRY_BUF_SZ - 1);
738 738
739 strncpy(wlc_cm->country_abbrev, country_abbrev, WLC_CNTRY_BUF_SZ - 1); 739 strncpy(wlc_cm->country_abbrev, country_abbrev, BRCM_CNTRY_BUF_SZ - 1);
740 strncpy(wlc_cm->ccode, ccode, WLC_CNTRY_BUF_SZ - 1); 740 strncpy(wlc_cm->ccode, ccode, BRCM_CNTRY_BUF_SZ - 1);
741 wlc_cm->regrev = regrev; 741 wlc_cm->regrev = regrev;
742 742
743 /* disable/restore nmode based on country regulations */ 743 /* disable/restore nmode based on country regulations */
744 li_mimo = brcms_c_get_mimo_2g(country->locale_mimo_2G); 744 li_mimo = brcms_c_get_mimo_2g(country->locale_mimo_2G);
745 if (li_mimo && (li_mimo->flags & WLC_NO_MIMO)) { 745 if (li_mimo && (li_mimo->flags & BRCMS_NO_MIMO)) {
746 brcms_c_set_nmode(wlc, OFF); 746 brcms_c_set_nmode(wlc, OFF);
747 wlc->stf->no_cddstbc = true; 747 wlc->stf->no_cddstbc = true;
748 } else { 748 } else {
@@ -755,7 +755,7 @@ brcms_c_set_country_common(struct brcms_cm_info *wlc_cm,
755 brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); 755 brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]);
756 /* set or restore gmode as required by regulatory */ 756 /* set or restore gmode as required by regulatory */
757 locale = brcms_c_get_locale_2g(country->locale_2G); 757 locale = brcms_c_get_locale_2g(country->locale_2G);
758 if (locale && (locale->flags & WLC_NO_OFDM)) { 758 if (locale && (locale->flags & BRCMS_NO_OFDM)) {
759 brcms_c_set_gmode(wlc, GMODE_LEGACY_B, false); 759 brcms_c_set_gmode(wlc, GMODE_LEGACY_B, false);
760 } else { 760 } else {
761 brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false); 761 brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false);
@@ -773,7 +773,7 @@ static const struct country_info *
773brcms_c_country_lookup(struct brcms_c_info *wlc, const char *ccode) 773brcms_c_country_lookup(struct brcms_c_info *wlc, const char *ccode)
774{ 774{
775 const struct country_info *country; 775 const struct country_info *country;
776 char mapped_ccode[WLC_CNTRY_BUF_SZ]; 776 char mapped_ccode[BRCM_CNTRY_BUF_SZ];
777 uint mapped_regrev; 777 uint mapped_regrev;
778 778
779 /* map the country code to a built-in country code, regrev, and country_info struct */ 779 /* map the country code to a built-in country code, regrev, and country_info struct */
@@ -794,14 +794,14 @@ brcms_c_countrycode_map(struct brcms_cm_info *wlc_cm, const char *ccode,
794 int mapped; 794 int mapped;
795 795
796 /* check for currently supported ccode size */ 796 /* check for currently supported ccode size */
797 if (strlen(ccode) > (WLC_CNTRY_BUF_SZ - 1)) { 797 if (strlen(ccode) > (BRCM_CNTRY_BUF_SZ - 1)) {
798 wiphy_err(wlc->wiphy, "wl%d: %s: ccode \"%s\" too long for " 798 wiphy_err(wlc->wiphy, "wl%d: %s: ccode \"%s\" too long for "
799 "match\n", wlc->pub->unit, __func__, ccode); 799 "match\n", wlc->pub->unit, __func__, ccode);
800 return NULL; 800 return NULL;
801 } 801 }
802 802
803 /* default mapping is the given ccode and regrev 0 */ 803 /* default mapping is the given ccode and regrev 0 */
804 strncpy(mapped_ccode, ccode, WLC_CNTRY_BUF_SZ); 804 strncpy(mapped_ccode, ccode, BRCM_CNTRY_BUF_SZ);
805 *mapped_regrev = 0; 805 *mapped_regrev = 0;
806 806
807 /* If the desired country code matches the srom country code, 807 /* If the desired country code matches the srom country code,
@@ -959,8 +959,7 @@ static void brcms_c_channels_commit(struct brcms_cm_info *wlc_cm)
959 if (wlc->pub->up && chan != INVCHANNEL) { 959 if (wlc->pub->up && chan != INVCHANNEL) {
960 brcms_c_channel_reg_limits(wlc_cm, wlc->chanspec, &txpwr); 960 brcms_c_channel_reg_limits(wlc_cm, wlc->chanspec, &txpwr);
961 brcms_c_channel_min_txpower_limits_with_local_constraint(wlc_cm, 961 brcms_c_channel_min_txpower_limits_with_local_constraint(wlc_cm,
962 &txpwr, 962 &txpwr, BRCMS_TXPWR_MAX);
963 WLC_TXPWR_MAX);
964 wlc_phy_txpower_limit_set(wlc->band->pi, &txpwr, wlc->chanspec); 963 wlc_phy_txpower_limit_set(wlc->band->pi, &txpwr, wlc->chanspec);
965 } 964 }
966} 965}
@@ -1050,66 +1049,66 @@ brcms_c_channel_min_txpower_limits_with_local_constraint(
1050 } 1049 }
1051 1050
1052 /* 20 MHz Legacy OFDM CDD */ 1051 /* 20 MHz Legacy OFDM CDD */
1053 for (j = 0; j < WLC_NUM_RATES_OFDM; j++) { 1052 for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++) {
1054 txpwr->ofdm_cdd[j] = 1053 txpwr->ofdm_cdd[j] =
1055 min(txpwr->ofdm_cdd[j], local_constraint_qdbm); 1054 min(txpwr->ofdm_cdd[j], local_constraint_qdbm);
1056 } 1055 }
1057 1056
1058 /* 40 MHz Legacy OFDM SISO */ 1057 /* 40 MHz Legacy OFDM SISO */
1059 for (j = 0; j < WLC_NUM_RATES_OFDM; j++) { 1058 for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++) {
1060 txpwr->ofdm_40_siso[j] = 1059 txpwr->ofdm_40_siso[j] =
1061 min(txpwr->ofdm_40_siso[j], local_constraint_qdbm); 1060 min(txpwr->ofdm_40_siso[j], local_constraint_qdbm);
1062 } 1061 }
1063 1062
1064 /* 40 MHz Legacy OFDM CDD */ 1063 /* 40 MHz Legacy OFDM CDD */
1065 for (j = 0; j < WLC_NUM_RATES_OFDM; j++) { 1064 for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++) {
1066 txpwr->ofdm_40_cdd[j] = 1065 txpwr->ofdm_40_cdd[j] =
1067 min(txpwr->ofdm_40_cdd[j], local_constraint_qdbm); 1066 min(txpwr->ofdm_40_cdd[j], local_constraint_qdbm);
1068 } 1067 }
1069 1068
1070 /* 20MHz MCS 0-7 SISO */ 1069 /* 20MHz MCS 0-7 SISO */
1071 for (j = 0; j < WLC_NUM_RATES_MCS_1_STREAM; j++) { 1070 for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
1072 txpwr->mcs_20_siso[j] = 1071 txpwr->mcs_20_siso[j] =
1073 min(txpwr->mcs_20_siso[j], local_constraint_qdbm); 1072 min(txpwr->mcs_20_siso[j], local_constraint_qdbm);
1074 } 1073 }
1075 1074
1076 /* 20MHz MCS 0-7 CDD */ 1075 /* 20MHz MCS 0-7 CDD */
1077 for (j = 0; j < WLC_NUM_RATES_MCS_1_STREAM; j++) { 1076 for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
1078 txpwr->mcs_20_cdd[j] = 1077 txpwr->mcs_20_cdd[j] =
1079 min(txpwr->mcs_20_cdd[j], local_constraint_qdbm); 1078 min(txpwr->mcs_20_cdd[j], local_constraint_qdbm);
1080 } 1079 }
1081 1080
1082 /* 20MHz MCS 0-7 STBC */ 1081 /* 20MHz MCS 0-7 STBC */
1083 for (j = 0; j < WLC_NUM_RATES_MCS_1_STREAM; j++) { 1082 for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
1084 txpwr->mcs_20_stbc[j] = 1083 txpwr->mcs_20_stbc[j] =
1085 min(txpwr->mcs_20_stbc[j], local_constraint_qdbm); 1084 min(txpwr->mcs_20_stbc[j], local_constraint_qdbm);
1086 } 1085 }
1087 1086
1088 /* 20MHz MCS 8-15 MIMO */ 1087 /* 20MHz MCS 8-15 MIMO */
1089 for (j = 0; j < WLC_NUM_RATES_MCS_2_STREAM; j++) 1088 for (j = 0; j < BRCMS_NUM_RATES_MCS_2_STREAM; j++)
1090 txpwr->mcs_20_mimo[j] = 1089 txpwr->mcs_20_mimo[j] =
1091 min(txpwr->mcs_20_mimo[j], local_constraint_qdbm); 1090 min(txpwr->mcs_20_mimo[j], local_constraint_qdbm);
1092 1091
1093 /* 40MHz MCS 0-7 SISO */ 1092 /* 40MHz MCS 0-7 SISO */
1094 for (j = 0; j < WLC_NUM_RATES_MCS_1_STREAM; j++) { 1093 for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
1095 txpwr->mcs_40_siso[j] = 1094 txpwr->mcs_40_siso[j] =
1096 min(txpwr->mcs_40_siso[j], local_constraint_qdbm); 1095 min(txpwr->mcs_40_siso[j], local_constraint_qdbm);
1097 } 1096 }
1098 1097
1099 /* 40MHz MCS 0-7 CDD */ 1098 /* 40MHz MCS 0-7 CDD */
1100 for (j = 0; j < WLC_NUM_RATES_MCS_1_STREAM; j++) { 1099 for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
1101 txpwr->mcs_40_cdd[j] = 1100 txpwr->mcs_40_cdd[j] =
1102 min(txpwr->mcs_40_cdd[j], local_constraint_qdbm); 1101 min(txpwr->mcs_40_cdd[j], local_constraint_qdbm);
1103 } 1102 }
1104 1103
1105 /* 40MHz MCS 0-7 STBC */ 1104 /* 40MHz MCS 0-7 STBC */
1106 for (j = 0; j < WLC_NUM_RATES_MCS_1_STREAM; j++) { 1105 for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
1107 txpwr->mcs_40_stbc[j] = 1106 txpwr->mcs_40_stbc[j] =
1108 min(txpwr->mcs_40_stbc[j], local_constraint_qdbm); 1107 min(txpwr->mcs_40_stbc[j], local_constraint_qdbm);
1109 } 1108 }
1110 1109
1111 /* 40MHz MCS 8-15 MIMO */ 1110 /* 40MHz MCS 8-15 MIMO */
1112 for (j = 0; j < WLC_NUM_RATES_MCS_2_STREAM; j++) 1111 for (j = 0; j < BRCMS_NUM_RATES_MCS_2_STREAM; j++)
1113 txpwr->mcs_40_mimo[j] = 1112 txpwr->mcs_40_mimo[j] =
1114 min(txpwr->mcs_40_mimo[j], local_constraint_qdbm); 1113 min(txpwr->mcs_40_mimo[j], local_constraint_qdbm);
1115 1114
@@ -1143,112 +1142,122 @@ static void wlc_phy_txpower_limits_dump(struct txpwr_limits *txpwr)
1143 char fraction[4][4] = { " ", ".25", ".5 ", ".75" }; 1142 char fraction[4][4] = { " ", ".25", ".5 ", ".75" };
1144 1143
1145 sprintf(buf, "CCK "); 1144 sprintf(buf, "CCK ");
1146 for (i = 0; i < WLC_NUM_RATES_CCK; i++) { 1145 for (i = 0; i < BRCMS_NUM_RATES_CCK; i++) {
1147 sprintf(buf[strlen(buf)], " %2d%s", 1146 sprintf(buf[strlen(buf)], " %2d%s",
1148 txpwr->cck[i] / WLC_TXPWR_DB_FACTOR, 1147 txpwr->cck[i] / BRCMS_TXPWR_DB_FACTOR,
1149 fraction[txpwr->cck[i] % WLC_TXPWR_DB_FACTOR]); 1148 fraction[txpwr->cck[i] % BRCMS_TXPWR_DB_FACTOR]);
1150 } 1149 }
1151 printk(KERN_DEBUG "%s\n", buf); 1150 printk(KERN_DEBUG "%s\n", buf);
1152 1151
1153 sprintf(buf, "20 MHz OFDM SISO "); 1152 sprintf(buf, "20 MHz OFDM SISO ");
1154 for (i = 0; i < WLC_NUM_RATES_OFDM; i++) { 1153 for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) {
1155 sprintf(buf[strlen(buf)], " %2d%s", 1154 sprintf(buf[strlen(buf)], " %2d%s",
1156 txpwr->ofdm[i] / WLC_TXPWR_DB_FACTOR, 1155 txpwr->ofdm[i] / BRCMS_TXPWR_DB_FACTOR,
1157 fraction[txpwr->ofdm[i] % WLC_TXPWR_DB_FACTOR]); 1156 fraction[txpwr->ofdm[i] % BRCMS_TXPWR_DB_FACTOR]);
1158 } 1157 }
1159 printk(KERN_DEBUG "%s\n", buf); 1158 printk(KERN_DEBUG "%s\n", buf);
1160 1159
1161 sprintf(buf, "20 MHz OFDM CDD "); 1160 sprintf(buf, "20 MHz OFDM CDD ");
1162 for (i = 0; i < WLC_NUM_RATES_OFDM; i++) { 1161 for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) {
1163 sprintf(buf[strlen(buf)], " %2d%s", 1162 sprintf(buf[strlen(buf)], " %2d%s",
1164 txpwr->ofdm_cdd[i] / WLC_TXPWR_DB_FACTOR, 1163 txpwr->ofdm_cdd[i] / BRCMS_TXPWR_DB_FACTOR,
1165 fraction[txpwr->ofdm_cdd[i] % WLC_TXPWR_DB_FACTOR]); 1164 fraction[txpwr->ofdm_cdd[i] % BRCMS_TXPWR_DB_FACTOR]);
1166 } 1165 }
1167 printk(KERN_DEBUG "%s\n", buf); 1166 printk(KERN_DEBUG "%s\n", buf);
1168 1167
1169 sprintf(buf, "40 MHz OFDM SISO "); 1168 sprintf(buf, "40 MHz OFDM SISO ");
1170 for (i = 0; i < WLC_NUM_RATES_OFDM; i++) { 1169 for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) {
1171 sprintf(buf[strlen(buf)], " %2d%s", 1170 sprintf(buf[strlen(buf)], " %2d%s",
1172 txpwr->ofdm_40_siso[i] / WLC_TXPWR_DB_FACTOR, 1171 txpwr->ofdm_40_siso[i] / BRCMS_TXPWR_DB_FACTOR,
1173 fraction[txpwr->ofdm_40_siso[i] % WLC_TXPWR_DB_FACTOR]); 1172 fraction[txpwr->ofdm_40_siso[i] %
1173 BRCMS_TXPWR_DB_FACTOR]);
1174 } 1174 }
1175 printk(KERN_DEBUG "%s\n", buf); 1175 printk(KERN_DEBUG "%s\n", buf);
1176 1176
1177 sprintf(buf, "40 MHz OFDM CDD "); 1177 sprintf(buf, "40 MHz OFDM CDD ");
1178 for (i = 0; i < WLC_NUM_RATES_OFDM; i++) { 1178 for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) {
1179 sprintf(buf[strlen(buf)], " %2d%s", 1179 sprintf(buf[strlen(buf)], " %2d%s",
1180 txpwr->ofdm_40_cdd[i] / WLC_TXPWR_DB_FACTOR, 1180 txpwr->ofdm_40_cdd[i] / BRCMS_TXPWR_DB_FACTOR,
1181 fraction[txpwr->ofdm_40_cdd[i] % WLC_TXPWR_DB_FACTOR]); 1181 fraction[txpwr->ofdm_40_cdd[i] %
1182 BRCMS_TXPWR_DB_FACTOR]);
1182 } 1183 }
1183 printk(KERN_DEBUG "%s\n", buf); 1184 printk(KERN_DEBUG "%s\n", buf);
1184 1185
1185 sprintf(buf, "20 MHz MCS0-7 SISO "); 1186 sprintf(buf, "20 MHz MCS0-7 SISO ");
1186 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1187 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1187 sprintf(buf[strlen(buf)], " %2d%s", 1188 sprintf(buf[strlen(buf)], " %2d%s",
1188 txpwr->mcs_20_siso[i] / WLC_TXPWR_DB_FACTOR, 1189 txpwr->mcs_20_siso[i] / BRCMS_TXPWR_DB_FACTOR,
1189 fraction[txpwr->mcs_20_siso[i] % WLC_TXPWR_DB_FACTOR]); 1190 fraction[txpwr->mcs_20_siso[i] %
1191 BRCMS_TXPWR_DB_FACTOR]);
1190 } 1192 }
1191 printk(KERN_DEBUG "%s\n", buf); 1193 printk(KERN_DEBUG "%s\n", buf);
1192 1194
1193 sprintf(buf, "20 MHz MCS0-7 CDD "); 1195 sprintf(buf, "20 MHz MCS0-7 CDD ");
1194 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1196 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1195 sprintf(buf[strlen(buf)], " %2d%s", 1197 sprintf(buf[strlen(buf)], " %2d%s",
1196 txpwr->mcs_20_cdd[i] / WLC_TXPWR_DB_FACTOR, 1198 txpwr->mcs_20_cdd[i] / BRCMS_TXPWR_DB_FACTOR,
1197 fraction[txpwr->mcs_20_cdd[i] % WLC_TXPWR_DB_FACTOR]); 1199 fraction[txpwr->mcs_20_cdd[i] %
1200 BRCMS_TXPWR_DB_FACTOR]);
1198 } 1201 }
1199 printk(KERN_DEBUG "%s\n", buf); 1202 printk(KERN_DEBUG "%s\n", buf);
1200 1203
1201 sprintf(buf, "20 MHz MCS0-7 STBC "); 1204 sprintf(buf, "20 MHz MCS0-7 STBC ");
1202 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1205 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1203 sprintf(buf[strlen(buf)], " %2d%s", 1206 sprintf(buf[strlen(buf)], " %2d%s",
1204 txpwr->mcs_20_stbc[i] / WLC_TXPWR_DB_FACTOR, 1207 txpwr->mcs_20_stbc[i] / BRCMS_TXPWR_DB_FACTOR,
1205 fraction[txpwr->mcs_20_stbc[i] % WLC_TXPWR_DB_FACTOR]); 1208 fraction[txpwr->mcs_20_stbc[i] %
1209 BRCMS_TXPWR_DB_FACTOR]);
1206 } 1210 }
1207 printk(KERN_DEBUG "%s\n", buf); 1211 printk(KERN_DEBUG "%s\n", buf);
1208 1212
1209 sprintf(buf, "20 MHz MCS8-15 SDM "); 1213 sprintf(buf, "20 MHz MCS8-15 SDM ");
1210 for (i = 0; i < WLC_NUM_RATES_MCS_2_STREAM; i++) { 1214 for (i = 0; i < BRCMS_NUM_RATES_MCS_2_STREAM; i++) {
1211 sprintf(buf[strlen(buf)], " %2d%s", 1215 sprintf(buf[strlen(buf)], " %2d%s",
1212 txpwr->mcs_20_mimo[i] / WLC_TXPWR_DB_FACTOR, 1216 txpwr->mcs_20_mimo[i] / BRCMS_TXPWR_DB_FACTOR,
1213 fraction[txpwr->mcs_20_mimo[i] % WLC_TXPWR_DB_FACTOR]); 1217 fraction[txpwr->mcs_20_mimo[i] %
1218 BRCMS_TXPWR_DB_FACTOR]);
1214 } 1219 }
1215 printk(KERN_DEBUG "%s\n", buf); 1220 printk(KERN_DEBUG "%s\n", buf);
1216 1221
1217 sprintf(buf, "40 MHz MCS0-7 SISO "); 1222 sprintf(buf, "40 MHz MCS0-7 SISO ");
1218 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1223 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1219 sprintf(buf[strlen(buf)], " %2d%s", 1224 sprintf(buf[strlen(buf)], " %2d%s",
1220 txpwr->mcs_40_siso[i] / WLC_TXPWR_DB_FACTOR, 1225 txpwr->mcs_40_siso[i] / BRCMS_TXPWR_DB_FACTOR,
1221 fraction[txpwr->mcs_40_siso[i] % WLC_TXPWR_DB_FACTOR]); 1226 fraction[txpwr->mcs_40_siso[i] %
1227 BRCMS_TXPWR_DB_FACTOR]);
1222 } 1228 }
1223 printk(KERN_DEBUG "%s\n", buf); 1229 printk(KERN_DEBUG "%s\n", buf);
1224 1230
1225 sprintf(buf, "40 MHz MCS0-7 CDD "); 1231 sprintf(buf, "40 MHz MCS0-7 CDD ");
1226 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1232 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1227 sprintf(buf[strlen(buf)], " %2d%s", 1233 sprintf(buf[strlen(buf)], " %2d%s",
1228 txpwr->mcs_40_cdd[i] / WLC_TXPWR_DB_FACTOR, 1234 txpwr->mcs_40_cdd[i] / BRCMS_TXPWR_DB_FACTOR,
1229 fraction[txpwr->mcs_40_cdd[i] % WLC_TXPWR_DB_FACTOR]); 1235 fraction[txpwr->mcs_40_cdd[i] %
1236 BRCMS_TXPWR_DB_FACTOR]);
1230 } 1237 }
1231 printk(KERN_DEBUG "%s\n", buf); 1238 printk(KERN_DEBUG "%s\n", buf);
1232 1239
1233 sprintf(buf, "40 MHz MCS0-7 STBC "); 1240 sprintf(buf, "40 MHz MCS0-7 STBC ");
1234 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1241 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1235 sprintf(buf[strlen(buf)], " %2d%s", 1242 sprintf(buf[strlen(buf)], " %2d%s",
1236 txpwr->mcs_40_stbc[i] / WLC_TXPWR_DB_FACTOR, 1243 txpwr->mcs_40_stbc[i] / BRCMS_TXPWR_DB_FACTOR,
1237 fraction[txpwr->mcs_40_stbc[i] % WLC_TXPWR_DB_FACTOR]); 1244 fraction[txpwr->mcs_40_stbc[i] %
1245 BRCMS_TXPWR_DB_FACTOR]);
1238 } 1246 }
1239 printk(KERN_DEBUG "%s\n", buf); 1247 printk(KERN_DEBUG "%s\n", buf);
1240 1248
1241 sprintf(buf, "40 MHz MCS8-15 SDM "); 1249 sprintf(buf, "40 MHz MCS8-15 SDM ");
1242 for (i = 0; i < WLC_NUM_RATES_MCS_2_STREAM; i++) { 1250 for (i = 0; i < BRCMS_NUM_RATES_MCS_2_STREAM; i++) {
1243 sprintf(buf[strlen(buf)], " %2d%s", 1251 sprintf(buf[strlen(buf)], " %2d%s",
1244 txpwr->mcs_40_mimo[i] / WLC_TXPWR_DB_FACTOR, 1252 txpwr->mcs_40_mimo[i] / BRCMS_TXPWR_DB_FACTOR,
1245 fraction[txpwr->mcs_40_mimo[i] % WLC_TXPWR_DB_FACTOR]); 1253 fraction[txpwr->mcs_40_mimo[i] %
1254 BRCMS_TXPWR_DB_FACTOR]);
1246 } 1255 }
1247 printk(KERN_DEBUG "%s\n", buf); 1256 printk(KERN_DEBUG "%s\n", buf);
1248 1257
1249 printk(KERN_DEBUG "MCS32 %2d%s\n", 1258 printk(KERN_DEBUG "MCS32 %2d%s\n",
1250 txpwr->mcs32 / WLC_TXPWR_DB_FACTOR, 1259 txpwr->mcs32 / BRCMS_TXPWR_DB_FACTOR,
1251 fraction[txpwr->mcs32 % WLC_TXPWR_DB_FACTOR]); 1260 fraction[txpwr->mcs32 % BRCMS_TXPWR_DB_FACTOR]);
1252} 1261}
1253#endif /* POWER_DBG */ 1262#endif /* POWER_DBG */
1254 1263
@@ -1282,7 +1291,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, chanspec_t chanspec,
1282 } 1291 }
1283 1292
1284 chan = CHSPEC_CHANNEL(chanspec); 1293 chan = CHSPEC_CHANNEL(chanspec);
1285 band = wlc->bandstate[CHSPEC_WLCBANDUNIT(chanspec)]; 1294 band = wlc->bandstate[CHSPEC_BANDUNIT(chanspec)];
1286 li = BAND_5G(band->bandtype) ? 1295 li = BAND_5G(band->bandtype) ?
1287 brcms_c_get_locale_5g(country->locale_5G) : 1296 brcms_c_get_locale_5g(country->locale_5G) :
1288 brcms_c_get_locale_2g(country->locale_2G); 1297 brcms_c_get_locale_2g(country->locale_2G);
@@ -1291,7 +1300,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, chanspec_t chanspec,
1291 brcms_c_get_mimo_5g(country->locale_mimo_5G) : 1300 brcms_c_get_mimo_5g(country->locale_mimo_5G) :
1292 brcms_c_get_mimo_2g(country->locale_mimo_2G); 1301 brcms_c_get_mimo_2g(country->locale_mimo_2G);
1293 1302
1294 if (li->flags & WLC_EIRP) { 1303 if (li->flags & BRCMS_EIRP) {
1295 delta = band->antgain; 1304 delta = band->antgain;
1296 } else { 1305 } else {
1297 delta = 0; 1306 delta = 0;
@@ -1312,7 +1321,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, chanspec_t chanspec,
1312 maxpwr = max(maxpwr, 0); 1321 maxpwr = max(maxpwr, 0);
1313 maxpwr = min(maxpwr, conducted_max); 1322 maxpwr = min(maxpwr, conducted_max);
1314 1323
1315 for (i = 0; i < WLC_NUM_RATES_CCK; i++) 1324 for (i = 0; i < BRCMS_NUM_RATES_CCK; i++)
1316 txpwr->cck[i] = (u8) maxpwr; 1325 txpwr->cck[i] = (u8) maxpwr;
1317 } 1326 }
1318 1327
@@ -1332,11 +1341,10 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, chanspec_t chanspec,
1332 if (BAND_2G(band->bandtype)) 1341 if (BAND_2G(band->bandtype))
1333 maxpwr = min_t(int, maxpwr, txpwr->cck[0]); 1342 maxpwr = min_t(int, maxpwr, txpwr->cck[0]);
1334 1343
1335 for (i = 0; i < WLC_NUM_RATES_OFDM; i++) { 1344 for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++)
1336 txpwr->ofdm[i] = (u8) maxpwr; 1345 txpwr->ofdm[i] = (u8) maxpwr;
1337 }
1338 1346
1339 for (i = 0; i < WLC_NUM_RATES_OFDM; i++) { 1347 for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) {
1340 /* OFDM 40 MHz SISO has the same power as the corresponding MCS0-7 rate unless 1348 /* OFDM 40 MHz SISO has the same power as the corresponding MCS0-7 rate unless
1341 * overriden by the locale specific code. We set this value to 0 as a 1349 * overriden by the locale specific code. We set this value to 0 as a
1342 * flag (presumably 0 dBm isn't a possibility) and then copy the MCS0-7 value 1350 * flag (presumably 0 dBm isn't a possibility) and then copy the MCS0-7 value
@@ -1350,7 +1358,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, chanspec_t chanspec,
1350 } 1358 }
1351 1359
1352 /* MIMO/HT specific limits */ 1360 /* MIMO/HT specific limits */
1353 if (li_mimo->flags & WLC_EIRP) { 1361 if (li_mimo->flags & BRCMS_EIRP) {
1354 delta = band->antgain; 1362 delta = band->antgain;
1355 } else { 1363 } else {
1356 delta = 0; 1364 delta = 0;
@@ -1372,7 +1380,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, chanspec_t chanspec,
1372 maxpwr40 = max(maxpwr40, 0); 1380 maxpwr40 = max(maxpwr40, 0);
1373 1381
1374 /* Fill in the MCS 0-7 (SISO) rates */ 1382 /* Fill in the MCS 0-7 (SISO) rates */
1375 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1383 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1376 1384
1377 /* 20 MHz has the same power as the corresponding OFDM rate unless 1385 /* 20 MHz has the same power as the corresponding OFDM rate unless
1378 * overriden by the locale specific code. 1386 * overriden by the locale specific code.
@@ -1382,7 +1390,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, chanspec_t chanspec,
1382 } 1390 }
1383 1391
1384 /* Fill in the MCS 0-7 CDD rates */ 1392 /* Fill in the MCS 0-7 CDD rates */
1385 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1393 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1386 txpwr->mcs_20_cdd[i] = (u8) maxpwr20; 1394 txpwr->mcs_20_cdd[i] = (u8) maxpwr20;
1387 txpwr->mcs_40_cdd[i] = (u8) maxpwr40; 1395 txpwr->mcs_40_cdd[i] = (u8) maxpwr40;
1388 } 1396 }
@@ -1398,20 +1406,20 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, chanspec_t chanspec,
1398 } 1406 }
1399 } 1407 }
1400 1408
1401 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1409 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1402 txpwr->mcs_20_siso[i] = (u8) maxpwr20; 1410 txpwr->mcs_20_siso[i] = (u8) maxpwr20;
1403 txpwr->mcs_40_siso[i] = (u8) maxpwr40; 1411 txpwr->mcs_40_siso[i] = (u8) maxpwr40;
1404 } 1412 }
1405 } 1413 }
1406 1414
1407 /* Fill in the MCS 0-7 STBC rates */ 1415 /* Fill in the MCS 0-7 STBC rates */
1408 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1416 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1409 txpwr->mcs_20_stbc[i] = 0; 1417 txpwr->mcs_20_stbc[i] = 0;
1410 txpwr->mcs_40_stbc[i] = 0; 1418 txpwr->mcs_40_stbc[i] = 0;
1411 } 1419 }
1412 1420
1413 /* Fill in the MCS 8-15 SDM rates */ 1421 /* Fill in the MCS 8-15 SDM rates */
1414 for (i = 0; i < WLC_NUM_RATES_MCS_2_STREAM; i++) { 1422 for (i = 0; i < BRCMS_NUM_RATES_MCS_2_STREAM; i++) {
1415 txpwr->mcs_20_mimo[i] = (u8) maxpwr20; 1423 txpwr->mcs_20_mimo[i] = (u8) maxpwr20;
1416 txpwr->mcs_40_mimo[i] = (u8) maxpwr40; 1424 txpwr->mcs_40_mimo[i] = (u8) maxpwr40;
1417 } 1425 }
@@ -1419,7 +1427,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, chanspec_t chanspec,
1419 /* Fill in MCS32 */ 1427 /* Fill in MCS32 */
1420 txpwr->mcs32 = (u8) maxpwr40; 1428 txpwr->mcs32 = (u8) maxpwr40;
1421 1429
1422 for (i = 0, j = 0; i < WLC_NUM_RATES_OFDM; i++, j++) { 1430 for (i = 0, j = 0; i < BRCMS_NUM_RATES_OFDM; i++, j++) {
1423 if (txpwr->ofdm_40_cdd[i] == 0) 1431 if (txpwr->ofdm_40_cdd[i] == 0)
1424 txpwr->ofdm_40_cdd[i] = txpwr->mcs_40_cdd[j]; 1432 txpwr->ofdm_40_cdd[i] = txpwr->mcs_40_cdd[j];
1425 if (i == 0) { 1433 if (i == 0) {
@@ -1433,12 +1441,12 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, chanspec_t chanspec,
1433 * provided explicitly. 1441 * provided explicitly.
1434 */ 1442 */
1435 1443
1436 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1444 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1437 if (txpwr->mcs_40_siso[i] == 0) 1445 if (txpwr->mcs_40_siso[i] == 0)
1438 txpwr->mcs_40_siso[i] = txpwr->mcs_40_cdd[i]; 1446 txpwr->mcs_40_siso[i] = txpwr->mcs_40_cdd[i];
1439 } 1447 }
1440 1448
1441 for (i = 0, j = 0; i < WLC_NUM_RATES_OFDM; i++, j++) { 1449 for (i = 0, j = 0; i < BRCMS_NUM_RATES_OFDM; i++, j++) {
1442 if (txpwr->ofdm_40_siso[i] == 0) 1450 if (txpwr->ofdm_40_siso[i] == 0)
1443 txpwr->ofdm_40_siso[i] = txpwr->mcs_40_siso[j]; 1451 txpwr->ofdm_40_siso[i] = txpwr->mcs_40_siso[j];
1444 if (i == 0) { 1452 if (i == 0) {
@@ -1451,7 +1459,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, chanspec_t chanspec,
1451 /* Copy the 20 and 40 MHz MCS0-7 CDD values to the corresponding STBC values if they weren't 1459 /* Copy the 20 and 40 MHz MCS0-7 CDD values to the corresponding STBC values if they weren't
1452 * provided explicitly. 1460 * provided explicitly.
1453 */ 1461 */
1454 for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { 1462 for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
1455 if (txpwr->mcs_20_stbc[i] == 0) 1463 if (txpwr->mcs_20_stbc[i] == 0)
1456 txpwr->mcs_20_stbc[i] = txpwr->mcs_20_cdd[i]; 1464 txpwr->mcs_20_stbc[i] = txpwr->mcs_20_cdd[i];
1457 1465
@@ -1497,7 +1505,7 @@ brcms_c_valid_chanspec_ext(struct brcms_cm_info *wlc_cm, chanspec_t chspec,
1497 } 1505 }
1498 1506
1499 if (CHANNEL_BANDUNIT(wlc_cm->wlc, channel) != 1507 if (CHANNEL_BANDUNIT(wlc_cm->wlc, channel) !=
1500 CHSPEC_WLCBANDUNIT(chspec)) 1508 CHSPEC_BANDUNIT(chspec))
1501 return false; 1509 return false;
1502 1510
1503 /* Check a 20Mhz channel */ 1511 /* Check a 20Mhz channel */
@@ -1511,12 +1519,12 @@ brcms_c_valid_chanspec_ext(struct brcms_cm_info *wlc_cm, chanspec_t chspec,
1511 /* We know we are now checking a 40MHZ channel, so we should only be here 1519 /* We know we are now checking a 40MHZ channel, so we should only be here
1512 * for NPHYS 1520 * for NPHYS
1513 */ 1521 */
1514 if (WLCISNPHY(wlc->band) || WLCISSSLPNPHY(wlc->band)) { 1522 if (BRCMS_ISNPHY(wlc->band) || BRCMS_ISSSLPNPHY(wlc->band)) {
1515 u8 upper_sideband = 0, idx; 1523 u8 upper_sideband = 0, idx;
1516 u8 num_ch20_entries = 1524 u8 num_ch20_entries =
1517 sizeof(chan20_info) / sizeof(struct chan20_info); 1525 sizeof(chan20_info) / sizeof(struct chan20_info);
1518 1526
1519 if (!VALID_40CHANSPEC_IN_BAND(wlc, CHSPEC_WLCBANDUNIT(chspec))) 1527 if (!VALID_40CHANSPEC_IN_BAND(wlc, CHSPEC_BANDUNIT(chspec)))
1520 return false; 1528 return false;
1521 1529
1522 if (dualband) { 1530 if (dualband) {
diff --git a/drivers/staging/brcm80211/brcmsmac/channel.h b/drivers/staging/brcm80211/brcmsmac/channel.h
index ff7123c5fda..d22f2f5f592 100644
--- a/drivers/staging/brcm80211/brcmsmac/channel.h
+++ b/drivers/staging/brcm80211/brcmsmac/channel.h
@@ -17,7 +17,8 @@
17#ifndef _BRCM_CHANNEL_H_ 17#ifndef _BRCM_CHANNEL_H_
18#define _BRCM_CHANNEL_H_ 18#define _BRCM_CHANNEL_H_
19 19
20#define WLC_TXPWR_DB_FACTOR 4 /* conversion for phy txpwr cacluations that use .25 dB units */ 20/* conversion for phy txpwr calculations that use .25 dB units */
21#define BRCMS_TXPWR_DB_FACTOR 4
21 22
22 23
23/* maxpwr mapping to 5GHz band channels: 24/* maxpwr mapping to 5GHz band channels:
@@ -46,8 +47,10 @@
46#define CHANNEL_POWER_IDX_5G(c) \ 47#define CHANNEL_POWER_IDX_5G(c) \
47 (((c) < 52) ? 0 : (((c) < 62) ? 1 : (((c) < 100) ? 2 : (((c) < 149) ? 3 : 4)))) 48 (((c) < 52) ? 0 : (((c) < 62) ? 1 : (((c) < 100) ? 2 : (((c) < 149) ? 3 : 4))))
48 49
49#define WLC_MAXPWR_TBL_SIZE 6 /* max of BAND_5G_PWR_LVLS and 6 for 2.4 GHz */ 50/* max of BAND_5G_PWR_LVLS and 6 for 2.4 GHz */
50#define WLC_MAXPWR_MIMO_TBL_SIZE 14 /* max of BAND_5G_PWR_LVLS and 14 for 2.4 GHz */ 51#define BRCMS_MAXPWR_TBL_SIZE 6
52/* max of BAND_5G_PWR_LVLS and 14 for 2.4 GHz */
53#define BRCMS_MAXPWR_MIMO_TBL_SIZE 14
51 54
52#define NBANDS(wlc) ((wlc)->pub->_nbands) 55#define NBANDS(wlc) ((wlc)->pub->_nbands)
53#define NBANDS_PUB(pub) ((pub)->_nbands) 56#define NBANDS_PUB(pub) ((pub)->_nbands)
@@ -58,9 +61,12 @@
58/* locale channel and power info. */ 61/* locale channel and power info. */
59struct locale_info { 62struct locale_info {
60 u32 valid_channels; 63 u32 valid_channels;
61 u8 radar_channels; /* List of radar sensitive channels */ 64 /* List of radar sensitive channels */
62 u8 restricted_channels; /* List of channels used only if APs are detected */ 65 u8 radar_channels;
63 s8 maxpwr[WLC_MAXPWR_TBL_SIZE]; /* Max tx pwr in qdBm for each sub-band */ 66 /* List of channels used only if APs are detected */
67 u8 restricted_channels;
68 /* Max tx pwr in qdBm for each sub-band */
69 s8 maxpwr[BRCMS_MAXPWR_TBL_SIZE];
64 s8 pub_maxpwr[BAND_5G_PWR_LVLS]; /* Country IE advertised max tx pwr in dBm 70 s8 pub_maxpwr[BAND_5G_PWR_LVLS]; /* Country IE advertised max tx pwr in dBm
65 * per sub-band 71 * per sub-band
66 */ 72 */
@@ -68,25 +74,27 @@ struct locale_info {
68}; 74};
69 75
70/* bits for locale_info flags */ 76/* bits for locale_info flags */
71#define WLC_PEAK_CONDUCTED 0x00 /* Peak for locals */ 77#define BRCMS_PEAK_CONDUCTED 0x00 /* Peak for locals */
72#define WLC_EIRP 0x01 /* Flag for EIRP */ 78#define BRCMS_EIRP 0x01 /* Flag for EIRP */
73#define WLC_DFS_TPC 0x02 /* Flag for DFS TPC */ 79#define BRCMS_DFS_TPC 0x02 /* Flag for DFS TPC */
74#define WLC_NO_OFDM 0x04 /* Flag for No OFDM */ 80#define BRCMS_NO_OFDM 0x04 /* Flag for No OFDM */
75#define WLC_NO_40MHZ 0x08 /* Flag for No MIMO 40MHz */ 81#define BRCMS_NO_40MHZ 0x08 /* Flag for No MIMO 40MHz */
76#define WLC_NO_MIMO 0x10 /* Flag for No MIMO, 20 or 40 MHz */ 82#define BRCMS_NO_MIMO 0x10 /* Flag for No MIMO, 20 or 40 MHz */
77#define WLC_RADAR_TYPE_EU 0x20 /* Flag for EU */ 83#define BRCMS_RADAR_TYPE_EU 0x20 /* Flag for EU */
78#define WLC_DFS_FCC WLC_DFS_TPC /* Flag for DFS FCC */ 84#define BRCMS_DFS_FCC BRCMS_DFS_TPC /* Flag for DFS FCC */
79#define WLC_DFS_EU (WLC_DFS_TPC | WLC_RADAR_TYPE_EU) /* Flag for DFS EU */ 85#define BRCMS_DFS_EU (BRCMS_DFS_TPC | BRCMS_RADAR_TYPE_EU) /* Flag for DFS EU */
80 86
81#define ISDFS_EU(fl) (((fl) & WLC_DFS_EU) == WLC_DFS_EU) 87#define ISDFS_EU(fl) (((fl) & BRCMS_DFS_EU) == BRCMS_DFS_EU)
82 88
83/* locale per-channel tx power limits for MIMO frames 89/* locale per-channel tx power limits for MIMO frames
84 * maxpwr arrays are index by channel for 2.4 GHz limits, and 90 * maxpwr arrays are index by channel for 2.4 GHz limits, and
85 * by sub-band for 5 GHz limits using CHANNEL_POWER_IDX_5G(channel) 91 * by sub-band for 5 GHz limits using CHANNEL_POWER_IDX_5G(channel)
86 */ 92 */
87struct locale_mimo_info { 93struct locale_mimo_info {
88 s8 maxpwr20[WLC_MAXPWR_MIMO_TBL_SIZE]; /* tx 20 MHz power limits, qdBm units */ 94 /* tx 20 MHz power limits, qdBm units */
89 s8 maxpwr40[WLC_MAXPWR_MIMO_TBL_SIZE]; /* tx 40 MHz power limits, qdBm units */ 95 s8 maxpwr20[BRCMS_MAXPWR_MIMO_TBL_SIZE];
96 /* tx 40 MHz power limits, qdBm units */
97 s8 maxpwr40[BRCMS_MAXPWR_MIMO_TBL_SIZE];
90 u8 flags; 98 u8 flags;
91}; 99};
92 100
diff --git a/drivers/staging/brcm80211/brcmsmac/d11.h b/drivers/staging/brcm80211/brcmsmac/d11.h
index 37629bfdc16..70d3802d17b 100644
--- a/drivers/staging/brcm80211/brcmsmac/d11.h
+++ b/drivers/staging/brcm80211/brcmsmac/d11.h
@@ -681,17 +681,17 @@ struct cck_phy_hdr {
681#define MIMO_PLCP_40MHZ 0x80 /* 40 Hz frame */ 681#define MIMO_PLCP_40MHZ 0x80 /* 40 Hz frame */
682#define MIMO_PLCP_AMPDU 0x08 /* ampdu */ 682#define MIMO_PLCP_AMPDU 0x08 /* ampdu */
683 683
684#define WLC_GET_CCK_PLCP_LEN(plcp) (plcp[4] + (plcp[5] << 8)) 684#define BRCMS_GET_CCK_PLCP_LEN(plcp) (plcp[4] + (plcp[5] << 8))
685#define WLC_GET_MIMO_PLCP_LEN(plcp) (plcp[1] + (plcp[2] << 8)) 685#define BRCMS_GET_MIMO_PLCP_LEN(plcp) (plcp[1] + (plcp[2] << 8))
686#define WLC_SET_MIMO_PLCP_LEN(plcp, len) \ 686#define BRCMS_SET_MIMO_PLCP_LEN(plcp, len) \
687 do { \ 687 do { \
688 plcp[1] = len & 0xff; \ 688 plcp[1] = len & 0xff; \
689 plcp[2] = ((len >> 8) & 0xff); \ 689 plcp[2] = ((len >> 8) & 0xff); \
690 } while (0); 690 } while (0);
691 691
692#define WLC_SET_MIMO_PLCP_AMPDU(plcp) (plcp[3] |= MIMO_PLCP_AMPDU) 692#define BRCMS_SET_MIMO_PLCP_AMPDU(plcp) (plcp[3] |= MIMO_PLCP_AMPDU)
693#define WLC_CLR_MIMO_PLCP_AMPDU(plcp) (plcp[3] &= ~MIMO_PLCP_AMPDU) 693#define BRCMS_CLR_MIMO_PLCP_AMPDU(plcp) (plcp[3] &= ~MIMO_PLCP_AMPDU)
694#define WLC_IS_MIMO_PLCP_AMPDU(plcp) (plcp[3] & MIMO_PLCP_AMPDU) 694#define BRCMS_IS_MIMO_PLCP_AMPDU(plcp) (plcp[3] & MIMO_PLCP_AMPDU)
695 695
696/* The dot11a PLCP header is 5 bytes. To simplify the software (so that we 696/* The dot11a PLCP header is 5 bytes. To simplify the software (so that we
697 * don't need e.g. different tx DMA headers for 11a and 11b), the PLCP header has 697 * don't need e.g. different tx DMA headers for 11a and 11b), the PLCP header has
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index 77b06d57d11..84245b9a23e 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -248,7 +248,7 @@ ieee_set_channel(struct ieee80211_hw *hw, struct ieee80211_channel *chan,
248 switch (type) { 248 switch (type) {
249 case NL80211_CHAN_HT20: 249 case NL80211_CHAN_HT20:
250 case NL80211_CHAN_NO_HT: 250 case NL80211_CHAN_NO_HT:
251 err = brcms_c_set(wl->wlc, WLC_SET_CHANNEL, chan->hw_value); 251 err = brcms_c_set(wl->wlc, BRCM_SET_CHANNEL, chan->hw_value);
252 break; 252 break;
253 case NL80211_CHAN_HT40MINUS: 253 case NL80211_CHAN_HT40MINUS:
254 case NL80211_CHAN_HT40PLUS: 254 case NL80211_CHAN_HT40PLUS:
@@ -310,13 +310,13 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed)
310 } 310 }
311 if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) { 311 if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
312 if (brcms_c_set 312 if (brcms_c_set
313 (wl->wlc, WLC_SET_SRL, 313 (wl->wlc, BRCM_SET_SRL,
314 conf->short_frame_max_tx_count) < 0) { 314 conf->short_frame_max_tx_count) < 0) {
315 wiphy_err(wiphy, "%s: Error setting srl\n", __func__); 315 wiphy_err(wiphy, "%s: Error setting srl\n", __func__);
316 err = -EIO; 316 err = -EIO;
317 goto config_out; 317 goto config_out;
318 } 318 }
319 if (brcms_c_set(wl->wlc, WLC_SET_LRL, 319 if (brcms_c_set(wl->wlc, BRCM_SET_LRL,
320 conf->long_frame_max_tx_count) < 0) { 320 conf->long_frame_max_tx_count) < 0) {
321 wiphy_err(wiphy, "%s: Error setting lrl\n", __func__); 321 wiphy_err(wiphy, "%s: Error setting lrl\n", __func__);
322 err = -EIO; 322 err = -EIO;
@@ -355,7 +355,7 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw,
355 else 355 else
356 val = 0; 356 val = 0;
357 LOCK(wl); 357 LOCK(wl);
358 brcms_c_set(wl->wlc, WLC_SET_SHORTSLOT_OVERRIDE, val); 358 brcms_c_set(wl->wlc, BRCMS_SET_SHORTSLOT_OVERRIDE, val);
359 UNLOCK(wl); 359 UNLOCK(wl);
360 } 360 }
361 361
@@ -364,11 +364,11 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw,
364 u16 mode = info->ht_operation_mode; 364 u16 mode = info->ht_operation_mode;
365 365
366 LOCK(wl); 366 LOCK(wl);
367 brcms_c_protection_upd(wl->wlc, WLC_PROT_N_CFG, 367 brcms_c_protection_upd(wl->wlc, BRCMS_PROT_N_CFG,
368 mode & IEEE80211_HT_OP_MODE_PROTECTION); 368 mode & IEEE80211_HT_OP_MODE_PROTECTION);
369 brcms_c_protection_upd(wl->wlc, WLC_PROT_N_NONGF, 369 brcms_c_protection_upd(wl->wlc, BRCMS_PROT_N_NONGF,
370 mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); 370 mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
371 brcms_c_protection_upd(wl->wlc, WLC_PROT_N_OBSS, 371 brcms_c_protection_upd(wl->wlc, BRCMS_PROT_N_OBSS,
372 mode & IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT); 372 mode & IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT);
373 UNLOCK(wl); 373 UNLOCK(wl);
374 } 374 }
@@ -381,7 +381,7 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw,
381 381
382 /* retrieve the current rates */ 382 /* retrieve the current rates */
383 LOCK(wl); 383 LOCK(wl);
384 error = brcms_c_ioctl(wl->wlc, WLC_GET_CURR_RATESET, 384 error = brcms_c_ioctl(wl->wlc, BRCM_GET_CURR_RATESET,
385 &rs, sizeof(rs), NULL); 385 &rs, sizeof(rs), NULL);
386 UNLOCK(wl); 386 UNLOCK(wl);
387 if (error) { 387 if (error) {
@@ -402,13 +402,13 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw,
402 402
403 /* update the rate set */ 403 /* update the rate set */
404 LOCK(wl); 404 LOCK(wl);
405 brcms_c_ioctl(wl->wlc, WLC_SET_RATESET, &rs, sizeof(rs), NULL); 405 brcms_c_ioctl(wl->wlc, BRCM_SET_RATESET, &rs, sizeof(rs), NULL);
406 UNLOCK(wl); 406 UNLOCK(wl);
407 } 407 }
408 if (changed & BSS_CHANGED_BEACON_INT) { 408 if (changed & BSS_CHANGED_BEACON_INT) {
409 /* Beacon interval changed */ 409 /* Beacon interval changed */
410 LOCK(wl); 410 LOCK(wl);
411 brcms_c_set(wl->wlc, WLC_SET_BCNPRD, info->beacon_int); 411 brcms_c_set(wl->wlc, BRCM_SET_BCNPRD, info->beacon_int);
412 UNLOCK(wl); 412 UNLOCK(wl);
413 } 413 }
414 if (changed & BSS_CHANGED_BSSID) { 414 if (changed & BSS_CHANGED_BSSID) {
@@ -1045,7 +1045,7 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw)
1045 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = NULL; 1045 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
1046 hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL; 1046 hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
1047 1047
1048 if (brcms_c_get(wl->wlc, WLC_GET_PHYLIST, (int *)&phy_list) < 0) 1048 if (brcms_c_get(wl->wlc, BRCM_GET_PHYLIST, (int *)&phy_list) < 0)
1049 wiphy_err(hw->wiphy, "Phy list failed\n"); 1049 wiphy_err(hw->wiphy, "Phy list failed\n");
1050 1050
1051 if (phy_list[0] == 'n' || phy_list[0] == 'c') { 1051 if (phy_list[0] == 'n' || phy_list[0] == 'c') {
@@ -1382,9 +1382,9 @@ static void brcms_set_basic_rate(struct wl_rateset *rs, u16 rate, bool is_br)
1382 continue; 1382 continue;
1383 1383
1384 if (is_br) 1384 if (is_br)
1385 rs->rates[i] |= WLC_RATE_FLAG; 1385 rs->rates[i] |= BRCMS_RATE_FLAG;
1386 else 1386 else
1387 rs->rates[i] &= WLC_RATE_MASK; 1387 rs->rates[i] &= BRCMS_RATE_MASK;
1388 return; 1388 return;
1389 } 1389 }
1390} 1390}
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.h b/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
index 42fc04c2a9f..40e3d375ea9 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
@@ -21,7 +21,7 @@
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22 22
23/* softmac ioctl definitions */ 23/* softmac ioctl definitions */
24#define WLC_SET_SHORTSLOT_OVERRIDE 146 24#define BRCMS_SET_SHORTSLOT_OVERRIDE 146
25 25
26 26
27/* BMAC Note: High-only driver is no longer working in softirq context as it needs to block and 27/* BMAC Note: High-only driver is no longer working in softirq context as it needs to block and
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index b89b0ec8c17..7c06026d569 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -54,11 +54,14 @@
54#define TIMER_INTERVAL_WATCHDOG 1000 /* watchdog timer, in unit of ms */ 54#define TIMER_INTERVAL_WATCHDOG 1000 /* watchdog timer, in unit of ms */
55#define TIMER_INTERVAL_RADIOCHK 800 /* radio monitor timer, in unit of ms */ 55#define TIMER_INTERVAL_RADIOCHK 800 /* radio monitor timer, in unit of ms */
56 56
57#ifndef WLC_MPC_MAX_DELAYCNT 57/* Max MPC timeout, in unit of watchdog */
58#define WLC_MPC_MAX_DELAYCNT 10 /* Max MPC timeout, in unit of watchdog */ 58#ifndef BRCMS_MPC_MAX_DELAYCNT
59#define BRCMS_MPC_MAX_DELAYCNT 10
59#endif 60#endif
60#define WLC_MPC_MIN_DELAYCNT 1 /* Min MPC timeout, in unit of watchdog */ 61
61#define WLC_MPC_THRESHOLD 3 /* MPC count threshold level */ 62/* Min MPC timeout, in unit of watchdog */
63#define BRCMS_MPC_MIN_DELAYCNT 1
64#define BRCMS_MPC_THRESHOLD 3 /* MPC count threshold level */
62 65
63#define BEACON_INTERVAL_DEFAULT 100 /* beacon interval, in unit of 1024TU */ 66#define BEACON_INTERVAL_DEFAULT 100 /* beacon interval, in unit of 1024TU */
64#define DTIM_INTERVAL_DEFAULT 3 /* DTIM interval, in unit of beacon interval */ 67#define DTIM_INTERVAL_DEFAULT 3 /* DTIM interval, in unit of beacon interval */
@@ -167,7 +170,7 @@
167/* To inform the ucode of the last mcast frame posted so that it can clear moredata bit */ 170/* To inform the ucode of the last mcast frame posted so that it can clear moredata bit */
168#define BCMCFID(wlc, fid) brcms_b_write_shm((wlc)->hw, M_BCMC_FID, (fid)) 171#define BCMCFID(wlc, fid) brcms_b_write_shm((wlc)->hw, M_BCMC_FID, (fid))
169 172
170#define WLC_WAR16165(wlc) (wlc->pub->sih->bustype == PCI_BUS && \ 173#define BRCMS_WAR16165(wlc) (wlc->pub->sih->bustype == PCI_BUS && \
171 (!AP_ENAB(wlc->pub)) && (wlc->war16165)) 174 (!AP_ENAB(wlc->pub)) && (wlc->war16165))
172 175
173/* debug/trace */ 176/* debug/trace */
@@ -179,7 +182,7 @@ uint brcm_msg_level =
179#endif /* BCMDBG */ 182#endif /* BCMDBG */
180 183
181/* Find basic rate for a given rate */ 184/* Find basic rate for a given rate */
182#define WLC_BASIC_RATE(wlc, rspec) (IS_MCS(rspec) ? \ 185#define BRCMS_BASIC_RATE(wlc, rspec) (IS_MCS(rspec) ? \
183 (wlc)->band->basic_rate[mcs_table[rspec & RSPEC_RATE_MASK].leg_ofdm] : \ 186 (wlc)->band->basic_rate[mcs_table[rspec & RSPEC_RATE_MASK].leg_ofdm] : \
184 (wlc)->band->basic_rate[rspec & RSPEC_RATE_MASK]) 187 (wlc)->band->basic_rate[rspec & RSPEC_RATE_MASK])
185 188
@@ -187,7 +190,7 @@ uint brcm_msg_level =
187 190
188#define RFDISABLE_DEFAULT 10000000 /* rfdisable delay timer 500 ms, runs of ALP clock */ 191#define RFDISABLE_DEFAULT 10000000 /* rfdisable delay timer 500 ms, runs of ALP clock */
189 192
190#define WLC_TEMPSENSE_PERIOD 10 /* 10 second timeout */ 193#define BRCMS_TEMPSENSE_PERIOD 10 /* 10 second timeout */
191 194
192#define SCAN_IN_PROGRESS(x) 0 195#define SCAN_IN_PROGRESS(x) 0
193 196
@@ -214,22 +217,22 @@ const u8 prio2fifo[NUMPRIO] = {
214 * Odd numbers are used for HI priority traffic at same precedence levels 217 * Odd numbers are used for HI priority traffic at same precedence levels
215 * These constants are used ONLY by wlc_prio2prec_map. Do not use them elsewhere. 218 * These constants are used ONLY by wlc_prio2prec_map. Do not use them elsewhere.
216 */ 219 */
217#define _WLC_PREC_NONE 0 /* None = - */ 220#define _BRCMS_PREC_NONE 0 /* None = - */
218#define _WLC_PREC_BK 2 /* BK - Background */ 221#define _BRCMS_PREC_BK 2 /* BK - Background */
219#define _WLC_PREC_BE 4 /* BE - Best-effort */ 222#define _BRCMS_PREC_BE 4 /* BE - Best-effort */
220#define _WLC_PREC_EE 6 /* EE - Excellent-effort */ 223#define _BRCMS_PREC_EE 6 /* EE - Excellent-effort */
221#define _WLC_PREC_CL 8 /* CL - Controlled Load */ 224#define _BRCMS_PREC_CL 8 /* CL - Controlled Load */
222#define _WLC_PREC_VI 10 /* Vi - Video */ 225#define _BRCMS_PREC_VI 10 /* Vi - Video */
223#define _WLC_PREC_VO 12 /* Vo - Voice */ 226#define _BRCMS_PREC_VO 12 /* Vo - Voice */
224#define _WLC_PREC_NC 14 /* NC - Network Control */ 227#define _BRCMS_PREC_NC 14 /* NC - Network Control */
225 228
226#define MAXMACLIST 64 /* max # source MAC matches */ 229#define MAXMACLIST 64 /* max # source MAC matches */
227#define BCN_TEMPLATE_COUNT 2 230#define BCN_TEMPLATE_COUNT 2
228 231
229#define WLC_BSSCFG_HW_BCN 0x20 /* The BSS is generating beacons in HW */ 232/* The BSS is generating beacons in HW */
233#define BRCMS_BSSCFG_HW_BCN 0x20
230 234
231#define HWBCN_ENAB(cfg) (((cfg)->flags & WLC_BSSCFG_HW_BCN) != 0) 235#define HWBCN_ENAB(cfg) (((cfg)->flags & BRCMS_BSSCFG_HW_BCN) != 0)
232#define HWPRB_ENAB(cfg) (((cfg)->flags & WLC_BSSCFG_HW_PRB) != 0)
233 236
234#define MBSS_BCN_ENAB(cfg) 0 237#define MBSS_BCN_ENAB(cfg) 0
235#define MBSS_PRB_ENAB(cfg) 0 238#define MBSS_PRB_ENAB(cfg) 0
@@ -237,14 +240,14 @@ const u8 prio2fifo[NUMPRIO] = {
237 240
238/* 802.1D Priority to precedence queue mapping */ 241/* 802.1D Priority to precedence queue mapping */
239const u8 wlc_prio2prec_map[] = { 242const u8 wlc_prio2prec_map[] = {
240 _WLC_PREC_BE, /* 0 BE - Best-effort */ 243 _BRCMS_PREC_BE, /* 0 BE - Best-effort */
241 _WLC_PREC_BK, /* 1 BK - Background */ 244 _BRCMS_PREC_BK, /* 1 BK - Background */
242 _WLC_PREC_NONE, /* 2 None = - */ 245 _BRCMS_PREC_NONE, /* 2 None = - */
243 _WLC_PREC_EE, /* 3 EE - Excellent-effort */ 246 _BRCMS_PREC_EE, /* 3 EE - Excellent-effort */
244 _WLC_PREC_CL, /* 4 CL - Controlled Load */ 247 _BRCMS_PREC_CL, /* 4 CL - Controlled Load */
245 _WLC_PREC_VI, /* 5 Vi - Video */ 248 _BRCMS_PREC_VI, /* 5 Vi - Video */
246 _WLC_PREC_VO, /* 6 Vo - Voice */ 249 _BRCMS_PREC_VO, /* 6 Vo - Voice */
247 _WLC_PREC_NC, /* 7 NC - Network Control */ 250 _BRCMS_PREC_NC, /* 7 NC - Network Control */
248}; 251};
249 252
250/* Check if a particular BSS config is AP or STA */ 253/* Check if a particular BSS config is AP or STA */
@@ -254,18 +257,9 @@ const u8 wlc_prio2prec_map[] = {
254 257
255/* As above for all non-NULL BSS configs */ 258/* As above for all non-NULL BSS configs */
256#define FOREACH_BSS(wlc, idx, cfg) \ 259#define FOREACH_BSS(wlc, idx, cfg) \
257 for (idx = 0; (int) idx < WLC_MAXBSSCFG; idx++) \ 260 for (idx = 0; (int) idx < BRCMS_MAXBSSCFG; idx++) \
258 if ((cfg = (wlc)->bsscfg[idx])) 261 if ((cfg = (wlc)->bsscfg[idx]))
259 262
260/* Sanity check for tx_prec_map and fifo synchup
261 * Either there are some packets pending for the fifo, else if fifo is empty then
262 * all the corresponding precmap bits should be set
263 */
264#define WLC_TX_FIFO_CHECK(wlc, fifo) (TXPKTPENDGET((wlc), (fifo)) || \
265 (TXPKTPENDGET((wlc), (fifo)) == 0 && \
266 ((wlc)->tx_prec_map & (wlc)->fifo2prec_map[(fifo)]) == \
267 (wlc)->fifo2prec_map[(fifo)]))
268
269/* TX FIFO number to WME/802.1E Access Category */ 263/* TX FIFO number to WME/802.1E Access Category */
270const u8 wme_fifo2ac[] = { AC_BK, AC_BE, AC_VI, AC_VO, AC_BE, AC_BE }; 264const u8 wme_fifo2ac[] = { AC_BK, AC_BE, AC_VI, AC_VO, AC_BE, AC_BE };
271 265
@@ -292,10 +286,8 @@ static const u8 acbitmap2maxprio[] = {
292}; 286};
293 287
294/* currently the best mechanism for determining SIFS is the band in use */ 288/* currently the best mechanism for determining SIFS is the band in use */
295#define SIFS(band) ((band)->bandtype == WLC_BAND_5G ? APHY_SIFS_TIME : BPHY_SIFS_TIME); 289#define SIFS(band) ((band)->bandtype == BRCM_BAND_5G ? APHY_SIFS_TIME : \
296 290 BPHY_SIFS_TIME);
297/* value for # replay counters currently supported */
298#define WLC_REPLAY_CNTRS_VALUE WPA_CAP_16_REPLAY_CNTRS
299 291
300/* local prototypes */ 292/* local prototypes */
301static u16 brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, 293static u16 brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc,
@@ -390,14 +382,14 @@ bool brcms_c_ps_allowed(struct brcms_c_info *wlc)
390 if (AP_ACTIVE(wlc) || wlc->monitor) 382 if (AP_ACTIVE(wlc) || wlc->monitor)
391 return false; 383 return false;
392 384
393 for (idx = 0; idx < WLC_MAXBSSCFG; idx++) { 385 for (idx = 0; idx < BRCMS_MAXBSSCFG; idx++) {
394 cfg = wlc->bsscfg[idx]; 386 cfg = wlc->bsscfg[idx];
395 if (cfg && BSSCFG_STA(cfg) && cfg->associated) { 387 if (cfg && BSSCFG_STA(cfg) && cfg->associated) {
396 /* 388 /*
397 * disallow PS when one of the following 389 * disallow PS when one of the following
398 * bsscfg specific conditions meets 390 * bsscfg specific conditions meets
399 */ 391 */
400 if (!cfg->BSS || !WLC_PORTOPEN(cfg)) 392 if (!cfg->BSS || !BRCMS_PORTOPEN(cfg))
401 return false; 393 return false;
402 394
403 if (!cfg->dtim_programmed) 395 if (!cfg->dtim_programmed)
@@ -561,13 +553,14 @@ void brcms_c_init(struct brcms_c_info *wlc)
561 W_REG(&wlc->regs->rfdisabledly, RFDISABLE_DEFAULT); 553 W_REG(&wlc->regs->rfdisabledly, RFDISABLE_DEFAULT);
562 554
563 /* initialize mpc delay */ 555 /* initialize mpc delay */
564 wlc->mpc_delay_off = wlc->mpc_dlycnt = WLC_MPC_MIN_DELAYCNT; 556 wlc->mpc_delay_off = wlc->mpc_dlycnt = BRCMS_MPC_MIN_DELAYCNT;
565 557
566 /* 558 /*
567 * Initialize WME parameters; if they haven't been set by some other 559 * Initialize WME parameters; if they haven't been set by some other
568 * mechanism (IOVar, etc) then read them from the hardware. 560 * mechanism (IOVar, etc) then read them from the hardware.
569 */ 561 */
570 if (WLC_WME_RETRY_SHORT_GET(wlc, 0) == 0) { /* Uninitialized; read from HW */ 562 if (BRCMS_WME_RETRY_SHORT_GET(wlc, 0) == 0) {
563 /* Uninitialized; read from HW */
571 int ac; 564 int ac;
572 565
573 for (ac = 0; ac < AC_COUNT; ac++) { 566 for (ac = 0; ac < AC_COUNT; ac++) {
@@ -686,8 +679,8 @@ void brcms_c_switch_shortslot(struct brcms_c_info *wlc, bool shortslot)
686 struct brcms_bss_cfg *cfg; 679 struct brcms_bss_cfg *cfg;
687 680
688 /* use the override if it is set */ 681 /* use the override if it is set */
689 if (wlc->shortslot_override != WLC_SHORTSLOT_AUTO) 682 if (wlc->shortslot_override != BRCMS_SHORTSLOT_AUTO)
690 shortslot = (wlc->shortslot_override == WLC_SHORTSLOT_ON); 683 shortslot = (wlc->shortslot_override == BRCMS_SHORTSLOT_ON);
691 684
692 if (wlc->shortslot == shortslot) 685 if (wlc->shortslot == shortslot)
693 return; 686 return;
@@ -713,7 +706,7 @@ static u8 brcms_c_local_constraint_qdbm(struct brcms_c_info *wlc)
713 u8 local; 706 u8 local;
714 s16 local_max; 707 s16 local_max;
715 708
716 local = WLC_TXPWR_MAX; 709 local = BRCMS_TXPWR_MAX;
717 if (wlc->pub->associated && 710 if (wlc->pub->associated &&
718 (brcmu_chspec_ctlchan(wlc->chanspec) == 711 (brcmu_chspec_ctlchan(wlc->chanspec) ==
719 brcmu_chspec_ctlchan(wlc->home_chanspec))) { 712 brcmu_chspec_ctlchan(wlc->home_chanspec))) {
@@ -721,11 +714,12 @@ static u8 brcms_c_local_constraint_qdbm(struct brcms_c_info *wlc)
721 /* get the local power constraint if we are on the AP's 714 /* get the local power constraint if we are on the AP's
722 * channel [802.11h, 7.3.2.13] 715 * channel [802.11h, 7.3.2.13]
723 */ 716 */
724 /* Clamp the value between 0 and WLC_TXPWR_MAX w/o overflowing the target */ 717 /* Clamp the value between 0 and BRCMS_TXPWR_MAX w/o
718 * overflowing the target */
725 local_max = 719 local_max =
726 (wlc->txpwr_local_max - 720 (wlc->txpwr_local_max -
727 wlc->txpwr_local_constraint) * WLC_TXPWR_DB_FACTOR; 721 wlc->txpwr_local_constraint) * BRCMS_TXPWR_DB_FACTOR;
728 if (local_max > 0 && local_max < WLC_TXPWR_MAX) 722 if (local_max > 0 && local_max < BRCMS_TXPWR_MAX)
729 return (u8) local_max; 723 return (u8) local_max;
730 if (local_max < 0) 724 if (local_max < 0)
731 return 0; 725 return 0;
@@ -787,7 +781,7 @@ void brcms_c_set_chanspec(struct brcms_c_info *wlc, chanspec_t chanspec)
787 781
788 /* Switch bands if necessary */ 782 /* Switch bands if necessary */
789 if (NBANDS(wlc) > 1) { 783 if (NBANDS(wlc) > 1) {
790 bandunit = CHSPEC_WLCBANDUNIT(chanspec); 784 bandunit = CHSPEC_BANDUNIT(chanspec);
791 if (wlc->band->bandunit != bandunit || wlc->bandinit_pending) { 785 if (wlc->band->bandunit != bandunit || wlc->bandinit_pending) {
792 switchband = true; 786 switchband = true;
793 if (wlc->bandlocked) { 787 if (wlc->bandlocked) {
@@ -836,10 +830,10 @@ ratespec_t brcms_c_lowest_basic_rspec(struct brcms_c_info *wlc,
836 uint i; 830 uint i;
837 831
838 /* Use the lowest basic rate */ 832 /* Use the lowest basic rate */
839 lowest_basic_rspec = rs->rates[0] & WLC_RATE_MASK; 833 lowest_basic_rspec = rs->rates[0] & BRCMS_RATE_MASK;
840 for (i = 0; i < rs->count; i++) { 834 for (i = 0; i < rs->count; i++) {
841 if (rs->rates[i] & WLC_RATE_FLAG) { 835 if (rs->rates[i] & BRCMS_RATE_FLAG) {
842 lowest_basic_rspec = rs->rates[i] & WLC_RATE_MASK; 836 lowest_basic_rspec = rs->rates[i] & BRCMS_RATE_MASK;
843 break; 837 break;
844 } 838 }
845 } 839 }
@@ -866,9 +860,8 @@ void brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc,
866 u16 mask = PHY_TXC_ANT_MASK; 860 u16 mask = PHY_TXC_ANT_MASK;
867 861
868 /* for non-siso rates or default setting, use the available chains */ 862 /* for non-siso rates or default setting, use the available chains */
869 if (WLC_PHY_11N_CAP(wlc->band)) { 863 if (BRCMS_PHY_11N_CAP(wlc->band))
870 phytxant = brcms_c_stf_phytxchain_sel(wlc, bcn_rspec); 864 phytxant = brcms_c_stf_phytxchain_sel(wlc, bcn_rspec);
871 }
872 865
873 phyctl = brcms_c_read_shm(wlc, M_BCN_PCTLWD); 866 phyctl = brcms_c_read_shm(wlc, M_BCN_PCTLWD);
874 phyctl = (phyctl & ~mask) | phytxant; 867 phyctl = (phyctl & ~mask) | phytxant;
@@ -883,37 +876,37 @@ void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, int val)
883 BCMMSG(wlc->wiphy, "idx %d, val %d\n", idx, val); 876 BCMMSG(wlc->wiphy, "idx %d, val %d\n", idx, val);
884 877
885 switch (idx) { 878 switch (idx) {
886 case WLC_PROT_G_SPEC: 879 case BRCMS_PROT_G_SPEC:
887 wlc->protection->_g = (bool) val; 880 wlc->protection->_g = (bool) val;
888 break; 881 break;
889 case WLC_PROT_G_OVR: 882 case BRCMS_PROT_G_OVR:
890 wlc->protection->g_override = (s8) val; 883 wlc->protection->g_override = (s8) val;
891 break; 884 break;
892 case WLC_PROT_G_USER: 885 case BRCMS_PROT_G_USER:
893 wlc->protection->gmode_user = (u8) val; 886 wlc->protection->gmode_user = (u8) val;
894 break; 887 break;
895 case WLC_PROT_OVERLAP: 888 case BRCMS_PROT_OVERLAP:
896 wlc->protection->overlap = (s8) val; 889 wlc->protection->overlap = (s8) val;
897 break; 890 break;
898 case WLC_PROT_N_USER: 891 case BRCMS_PROT_N_USER:
899 wlc->protection->nmode_user = (s8) val; 892 wlc->protection->nmode_user = (s8) val;
900 break; 893 break;
901 case WLC_PROT_N_CFG: 894 case BRCMS_PROT_N_CFG:
902 wlc->protection->n_cfg = (s8) val; 895 wlc->protection->n_cfg = (s8) val;
903 break; 896 break;
904 case WLC_PROT_N_CFG_OVR: 897 case BRCMS_PROT_N_CFG_OVR:
905 wlc->protection->n_cfg_override = (s8) val; 898 wlc->protection->n_cfg_override = (s8) val;
906 break; 899 break;
907 case WLC_PROT_N_NONGF: 900 case BRCMS_PROT_N_NONGF:
908 wlc->protection->nongf = (bool) val; 901 wlc->protection->nongf = (bool) val;
909 break; 902 break;
910 case WLC_PROT_N_NONGF_OVR: 903 case BRCMS_PROT_N_NONGF_OVR:
911 wlc->protection->nongf_override = (s8) val; 904 wlc->protection->nongf_override = (s8) val;
912 break; 905 break;
913 case WLC_PROT_N_PAM_OVR: 906 case BRCMS_PROT_N_PAM_OVR:
914 wlc->protection->n_pam_override = (s8) val; 907 wlc->protection->n_pam_override = (s8) val;
915 break; 908 break;
916 case WLC_PROT_N_OBSS: 909 case BRCMS_PROT_N_OBSS:
917 wlc->protection->n_obss = (bool) val; 910 wlc->protection->n_obss = (bool) val;
918 break; 911 break;
919 912
@@ -927,9 +920,9 @@ static void brcms_c_ht_update_sgi_rx(struct brcms_c_info *wlc, int val)
927{ 920{
928 wlc->ht_cap.cap_info &= ~(IEEE80211_HT_CAP_SGI_20 | 921 wlc->ht_cap.cap_info &= ~(IEEE80211_HT_CAP_SGI_20 |
929 IEEE80211_HT_CAP_SGI_40); 922 IEEE80211_HT_CAP_SGI_40);
930 wlc->ht_cap.cap_info |= (val & WLC_N_SGI_20) ? 923 wlc->ht_cap.cap_info |= (val & BRCMS_N_SGI_20) ?
931 IEEE80211_HT_CAP_SGI_20 : 0; 924 IEEE80211_HT_CAP_SGI_20 : 0;
932 wlc->ht_cap.cap_info |= (val & WLC_N_SGI_40) ? 925 wlc->ht_cap.cap_info |= (val & BRCMS_N_SGI_40) ?
933 IEEE80211_HT_CAP_SGI_40 : 0; 926 IEEE80211_HT_CAP_SGI_40 : 0;
934 927
935 if (wlc->pub->up) { 928 if (wlc->pub->up) {
@@ -962,7 +955,7 @@ static void brcms_c_ucode_mac_upd(struct brcms_c_info *wlc)
962 /* enable or disable any active IBSSs depending on whether or not 955 /* enable or disable any active IBSSs depending on whether or not
963 * we are on the home channel 956 * we are on the home channel
964 */ 957 */
965 if (wlc->home_chanspec == WLC_BAND_PI_RADIO_CHANSPEC) { 958 if (wlc->home_chanspec == BRCMS_BAND_PI_RADIO_CHANSPEC) {
966 if (wlc->pub->associated) { 959 if (wlc->pub->associated) {
967 /* BMAC_NOTE: This is something that should be fixed in ucode inits. 960 /* BMAC_NOTE: This is something that should be fixed in ucode inits.
968 * I think that the ucode inits set up the bcn templates and shm values 961 * I think that the ucode inits set up the bcn templates and shm values
@@ -970,7 +963,7 @@ static void brcms_c_ucode_mac_upd(struct brcms_c_info *wlc)
970 * to set up a beacon for testing, the test routines should write it down, 963 * to set up a beacon for testing, the test routines should write it down,
971 * not expect the inits to populate a bogus beacon. 964 * not expect the inits to populate a bogus beacon.
972 */ 965 */
973 if (WLC_PHY_11N_CAP(wlc->band)) { 966 if (BRCMS_PHY_11N_CAP(wlc->band)) {
974 brcms_c_write_shm(wlc, M_BCN_TXTSF_OFFSET, 967 brcms_c_write_shm(wlc, M_BCN_TXTSF_OFFSET,
975 wlc->band->bcntsfoff); 968 wlc->band->bcntsfoff);
976 } 969 }
@@ -1002,7 +995,7 @@ static void brcms_c_bandinit_ordered(struct brcms_c_info *wlc,
1002 band_order[0] = band_order[1] = parkband; 995 band_order[0] = band_order[1] = parkband;
1003 } else { 996 } else {
1004 /* park on the band of the specified chanspec */ 997 /* park on the band of the specified chanspec */
1005 parkband = CHSPEC_WLCBANDUNIT(chanspec); 998 parkband = CHSPEC_BANDUNIT(chanspec);
1006 999
1007 /* order so that parkband initialize last */ 1000 /* order so that parkband initialize last */
1008 band_order[0] = parkband ^ 1; 1001 band_order[0] = parkband ^ 1;
@@ -1019,7 +1012,7 @@ static void brcms_c_bandinit_ordered(struct brcms_c_info *wlc,
1019 1012
1020 /* fill in hw_rate */ 1013 /* fill in hw_rate */
1021 brcms_c_rateset_filter(&default_rateset, &wlc->band->hw_rateset, 1014 brcms_c_rateset_filter(&default_rateset, &wlc->band->hw_rateset,
1022 false, WLC_RATES_CCK_OFDM, WLC_RATE_MASK, 1015 false, BRCMS_RATES_CCK_OFDM, BRCMS_RATE_MASK,
1023 (bool) N_ENAB(wlc->pub)); 1016 (bool) N_ENAB(wlc->pub));
1024 1017
1025 /* init basic rate lookup */ 1018 /* init basic rate lookup */
@@ -1060,7 +1053,7 @@ static void WLBANDINITFN(brcms_c_setband) (struct brcms_c_info *wlc,
1060 return; 1053 return;
1061 1054
1062 /* wait for at least one beacon before entering sleeping state */ 1055 /* wait for at least one beacon before entering sleeping state */
1063 for (idx = 0; idx < WLC_MAXBSSCFG; idx++) { 1056 for (idx = 0; idx < BRCMS_MAXBSSCFG; idx++) {
1064 cfg = wlc->bsscfg[idx]; 1057 cfg = wlc->bsscfg[idx];
1065 if (cfg && BSSCFG_STA(cfg) && cfg->associated) 1058 if (cfg && BSSCFG_STA(cfg) && cfg->associated)
1066 cfg->PMawakebcn = true; 1059 cfg->PMawakebcn = true;
@@ -1247,19 +1240,21 @@ void brcms_c_info_init(struct brcms_c_info *wlc, int unit)
1247 1240
1248 /* various 802.11g modes */ 1241 /* various 802.11g modes */
1249 wlc->shortslot = false; 1242 wlc->shortslot = false;
1250 wlc->shortslot_override = WLC_SHORTSLOT_AUTO; 1243 wlc->shortslot_override = BRCMS_SHORTSLOT_AUTO;
1251 1244
1252 brcms_c_protection_upd(wlc, WLC_PROT_G_OVR, WLC_PROTECTION_AUTO); 1245 brcms_c_protection_upd(wlc, BRCMS_PROT_G_OVR, BRCMS_PROTECTION_AUTO);
1253 brcms_c_protection_upd(wlc, WLC_PROT_G_SPEC, false); 1246 brcms_c_protection_upd(wlc, BRCMS_PROT_G_SPEC, false);
1254 1247
1255 brcms_c_protection_upd(wlc, WLC_PROT_N_CFG_OVR, WLC_PROTECTION_AUTO); 1248 brcms_c_protection_upd(wlc, BRCMS_PROT_N_CFG_OVR,
1256 brcms_c_protection_upd(wlc, WLC_PROT_N_CFG, WLC_N_PROTECTION_OFF); 1249 BRCMS_PROTECTION_AUTO);
1257 brcms_c_protection_upd(wlc, WLC_PROT_N_NONGF_OVR, WLC_PROTECTION_AUTO); 1250 brcms_c_protection_upd(wlc, BRCMS_PROT_N_CFG, BRCMS_N_PROTECTION_OFF);
1258 brcms_c_protection_upd(wlc, WLC_PROT_N_NONGF, false); 1251 brcms_c_protection_upd(wlc, BRCMS_PROT_N_NONGF_OVR,
1259 brcms_c_protection_upd(wlc, WLC_PROT_N_PAM_OVR, AUTO); 1252 BRCMS_PROTECTION_AUTO);
1253 brcms_c_protection_upd(wlc, BRCMS_PROT_N_NONGF, false);
1254 brcms_c_protection_upd(wlc, BRCMS_PROT_N_PAM_OVR, AUTO);
1260 1255
1261 brcms_c_protection_upd(wlc, WLC_PROT_OVERLAP, 1256 brcms_c_protection_upd(wlc, BRCMS_PROT_OVERLAP,
1262 WLC_PROTECTION_CTL_OVERLAP); 1257 BRCMS_PROTECTION_CTL_OVERLAP);
1263 1258
1264 /* 802.11g draft 4.0 NonERP elt advertisement */ 1259 /* 802.11g draft 4.0 NonERP elt advertisement */
1265 wlc->include_legacy_erp = true; 1260 wlc->include_legacy_erp = true;
@@ -1267,7 +1262,7 @@ void brcms_c_info_init(struct brcms_c_info *wlc, int unit)
1267 wlc->stf->ant_rx_ovr = ANT_RX_DIV_DEF; 1262 wlc->stf->ant_rx_ovr = ANT_RX_DIV_DEF;
1268 wlc->stf->txant = ANT_TX_DEF; 1263 wlc->stf->txant = ANT_TX_DEF;
1269 1264
1270 wlc->prb_resp_timeout = WLC_PRB_RESP_TIMEOUT; 1265 wlc->prb_resp_timeout = BRCMS_PRB_RESP_TIMEOUT;
1271 1266
1272 wlc->usr_fragthresh = DOT11_DEFAULT_FRAG_LEN; 1267 wlc->usr_fragthresh = DOT11_DEFAULT_FRAG_LEN;
1273 for (i = 0; i < NFIFO; i++) 1268 for (i = 0; i < NFIFO; i++)
@@ -1303,7 +1298,7 @@ void brcms_c_info_init(struct brcms_c_info *wlc, int unit)
1303 wlc->pub->_coex = ON; 1298 wlc->pub->_coex = ON;
1304 1299
1305 /* initialize mpc delay */ 1300 /* initialize mpc delay */
1306 wlc->mpc_delay_off = wlc->mpc_dlycnt = WLC_MPC_MIN_DELAYCNT; 1301 wlc->mpc_delay_off = wlc->mpc_dlycnt = BRCMS_MPC_MIN_DELAYCNT;
1307} 1302}
1308 1303
1309static bool brcms_c_state_bmac_sync(struct brcms_c_info *wlc) 1304static bool brcms_c_state_bmac_sync(struct brcms_c_info *wlc)
@@ -1314,7 +1309,7 @@ static bool brcms_c_state_bmac_sync(struct brcms_c_info *wlc)
1314 return false; 1309 return false;
1315 1310
1316 wlc->machwcap = state_bmac.machwcap; 1311 wlc->machwcap = state_bmac.machwcap;
1317 brcms_c_protection_upd(wlc, WLC_PROT_N_PAM_OVR, 1312 brcms_c_protection_upd(wlc, BRCMS_PROT_N_PAM_OVR,
1318 (s8) state_bmac.preamble_ovr); 1313 (s8) state_bmac.preamble_ovr);
1319 1314
1320 return true; 1315 return true;
@@ -1416,7 +1411,7 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
1416 goto fail; 1411 goto fail;
1417 } 1412 }
1418 1413
1419 pub->phy_11ncapable = WLC_PHY_11N_CAP(wlc->band); 1414 pub->phy_11ncapable = BRCMS_PHY_11N_CAP(wlc->band);
1420 1415
1421 /* propagate *vars* from BMAC driver to high driver */ 1416 /* propagate *vars* from BMAC driver to high driver */
1422 brcms_b_copyfrom_vars(wlc->hw, &pub->vars, &wlc->vars_size); 1417 brcms_b_copyfrom_vars(wlc->hw, &pub->vars, &wlc->vars_size);
@@ -1431,7 +1426,7 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
1431 brcms_c_stf_phy_chain_calc(wlc); 1426 brcms_c_stf_phy_chain_calc(wlc);
1432 1427
1433 /* txchain 1: txant 0, txchain 2: txant 1 */ 1428 /* txchain 1: txant 0, txchain 2: txant 1 */
1434 if (WLCISNPHY(wlc->band) && (wlc->stf->txstreams == 1)) 1429 if (BRCMS_ISNPHY(wlc->band) && (wlc->stf->txstreams == 1))
1435 wlc->stf->txant = wlc->stf->hw_txchain - 1; 1430 wlc->stf->txant = wlc->stf->hw_txchain - 1;
1436 1431
1437 /* push to BMAC driver */ 1432 /* push to BMAC driver */
@@ -1468,19 +1463,19 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
1468 /* init gmode value */ 1463 /* init gmode value */
1469 if (BAND_2G(wlc->band->bandtype)) { 1464 if (BAND_2G(wlc->band->bandtype)) {
1470 wlc->band->gmode = GMODE_AUTO; 1465 wlc->band->gmode = GMODE_AUTO;
1471 brcms_c_protection_upd(wlc, WLC_PROT_G_USER, 1466 brcms_c_protection_upd(wlc, BRCMS_PROT_G_USER,
1472 wlc->band->gmode); 1467 wlc->band->gmode);
1473 } 1468 }
1474 1469
1475 /* init _n_enab supported mode */ 1470 /* init _n_enab supported mode */
1476 if (WLC_PHY_11N_CAP(wlc->band) && CHIP_SUPPORTS_11N(wlc)) { 1471 if (BRCMS_PHY_11N_CAP(wlc->band) && CHIP_SUPPORTS_11N(wlc)) {
1477 if (n_disabled & WLFEATURE_DISABLE_11N) { 1472 if (n_disabled & WLFEATURE_DISABLE_11N) {
1478 pub->_n_enab = OFF; 1473 pub->_n_enab = OFF;
1479 brcms_c_protection_upd(wlc, WLC_PROT_N_USER, 1474 brcms_c_protection_upd(wlc, BRCMS_PROT_N_USER,
1480 OFF); 1475 OFF);
1481 } else { 1476 } else {
1482 pub->_n_enab = SUPPORT_11N; 1477 pub->_n_enab = SUPPORT_11N;
1483 brcms_c_protection_upd(wlc, WLC_PROT_N_USER, 1478 brcms_c_protection_upd(wlc, BRCMS_PROT_N_USER,
1484 ((pub->_n_enab == 1479 ((pub->_n_enab ==
1485 SUPPORT_11N) ? WL_11N_2x2 : 1480 SUPPORT_11N) ? WL_11N_2x2 :
1486 WL_11N_3x3)); 1481 WL_11N_3x3));
@@ -1490,10 +1485,10 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
1490 /* init per-band default rateset, depend on band->gmode */ 1485 /* init per-band default rateset, depend on band->gmode */
1491 brcms_default_rateset(wlc, &wlc->band->defrateset); 1486 brcms_default_rateset(wlc, &wlc->band->defrateset);
1492 1487
1493 /* fill in hw_rateset (used early by WLC_SET_RATESET) */ 1488 /* fill in hw_rateset (used early by BRCM_SET_RATESET) */
1494 brcms_c_rateset_filter(&wlc->band->defrateset, 1489 brcms_c_rateset_filter(&wlc->band->defrateset,
1495 &wlc->band->hw_rateset, false, 1490 &wlc->band->hw_rateset, false,
1496 WLC_RATES_CCK_OFDM, WLC_RATE_MASK, 1491 BRCMS_RATES_CCK_OFDM, BRCMS_RATE_MASK,
1497 (bool) N_ENAB(wlc->pub)); 1492 (bool) N_ENAB(wlc->pub));
1498 } 1493 }
1499 1494
@@ -1552,14 +1547,16 @@ void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
1552 wlc->mimo_40txbw = AUTO; 1547 wlc->mimo_40txbw = AUTO;
1553 wlc->ofdm_40txbw = AUTO; 1548 wlc->ofdm_40txbw = AUTO;
1554 wlc->cck_40txbw = AUTO; 1549 wlc->cck_40txbw = AUTO;
1555 brcms_c_update_mimo_band_bwcap(wlc, WLC_N_BW_20IN2G_40IN5G); 1550 brcms_c_update_mimo_band_bwcap(wlc, BRCMS_N_BW_20IN2G_40IN5G);
1556 1551
1557 /* Set default values of SGI */ 1552 /* Set default values of SGI */
1558 if (WLC_SGI_CAP_PHY(wlc)) { 1553 if (BRCMS_SGI_CAP_PHY(wlc)) {
1559 brcms_c_ht_update_sgi_rx(wlc, (WLC_N_SGI_20 | WLC_N_SGI_40)); 1554 brcms_c_ht_update_sgi_rx(wlc, (BRCMS_N_SGI_20 |
1555 BRCMS_N_SGI_40));
1560 wlc->sgi_tx = AUTO; 1556 wlc->sgi_tx = AUTO;
1561 } else if (WLCISSSLPNPHY(wlc->band)) { 1557 } else if (BRCMS_ISSSLPNPHY(wlc->band)) {
1562 brcms_c_ht_update_sgi_rx(wlc, (WLC_N_SGI_20 | WLC_N_SGI_40)); 1558 brcms_c_ht_update_sgi_rx(wlc, (BRCMS_N_SGI_20 |
1559 BRCMS_N_SGI_40));
1563 wlc->sgi_tx = AUTO; 1560 wlc->sgi_tx = AUTO;
1564 } else { 1561 } else {
1565 brcms_c_ht_update_sgi_rx(wlc, 0); 1562 brcms_c_ht_update_sgi_rx(wlc, 0);
@@ -1752,9 +1749,11 @@ uint brcms_c_detach(struct brcms_c_info *wlc)
1752void brcms_c_ap_upd(struct brcms_c_info *wlc) 1749void brcms_c_ap_upd(struct brcms_c_info *wlc)
1753{ 1750{
1754 if (AP_ENAB(wlc->pub)) 1751 if (AP_ENAB(wlc->pub))
1755 wlc->PLCPHdr_override = WLC_PLCP_AUTO; /* AP: short not allowed, but not enforced */ 1752 /* AP: short not allowed, but not enforced */
1753 wlc->PLCPHdr_override = BRCMS_PLCP_AUTO;
1756 else 1754 else
1757 wlc->PLCPHdr_override = WLC_PLCP_SHORT; /* STA-BSS; short capable */ 1755 /* STA-BSS; short capable */
1756 wlc->PLCPHdr_override = BRCMS_PLCP_SHORT;
1758 1757
1759 /* fixup mpc */ 1758 /* fixup mpc */
1760 wlc->mpc = true; 1759 wlc->mpc = true;
@@ -1819,10 +1818,10 @@ void brcms_c_radio_mpc_upd(struct brcms_c_info *wlc)
1819 else if (radio_state == OFF && mpc_radio == ON) { 1818 else if (radio_state == OFF && mpc_radio == ON) {
1820 mboolclr(wlc->pub->radio_disabled, WL_RADIO_MPC_DISABLE); 1819 mboolclr(wlc->pub->radio_disabled, WL_RADIO_MPC_DISABLE);
1821 brcms_c_radio_upd(wlc); 1820 brcms_c_radio_upd(wlc);
1822 if (wlc->mpc_offcnt < WLC_MPC_THRESHOLD) { 1821 if (wlc->mpc_offcnt < BRCMS_MPC_THRESHOLD)
1823 wlc->mpc_dlycnt = WLC_MPC_MAX_DELAYCNT; 1822 wlc->mpc_dlycnt = BRCMS_MPC_MAX_DELAYCNT;
1824 } else 1823 else
1825 wlc->mpc_dlycnt = WLC_MPC_MIN_DELAYCNT; 1824 wlc->mpc_dlycnt = BRCMS_MPC_MIN_DELAYCNT;
1826 wlc->mpc_dur += OSL_SYSUPTIME() - wlc->mpc_laston_ts; 1825 wlc->mpc_dur += OSL_SYSUPTIME() - wlc->mpc_laston_ts;
1827 } 1826 }
1828 /* Below logic is meant to capture the transition from mpc off to mpc on for reasons 1827 /* Below logic is meant to capture the transition from mpc off to mpc on for reasons
@@ -1855,9 +1854,9 @@ static void brcms_c_down_led_upd(struct brcms_c_info *wlc)
1855 /* maintain LEDs while in down state, turn on sbclk if not available yet */ 1854 /* maintain LEDs while in down state, turn on sbclk if not available yet */
1856 /* turn on sbclk if necessary */ 1855 /* turn on sbclk if necessary */
1857 if (!AP_ENAB(wlc->pub)) { 1856 if (!AP_ENAB(wlc->pub)) {
1858 brcms_c_pllreq(wlc, true, WLC_PLLREQ_FLIP); 1857 brcms_c_pllreq(wlc, true, BRCMS_PLLREQ_FLIP);
1859 1858
1860 brcms_c_pllreq(wlc, false, WLC_PLLREQ_FLIP); 1859 brcms_c_pllreq(wlc, false, BRCMS_PLLREQ_FLIP);
1861 } 1860 }
1862} 1861}
1863 1862
@@ -1904,7 +1903,7 @@ static void brcms_c_radio_timer(void *arg)
1904 } 1903 }
1905 1904
1906 /* cap mpc off count */ 1905 /* cap mpc off count */
1907 if (wlc->mpc_offcnt < WLC_MPC_MAX_DELAYCNT) 1906 if (wlc->mpc_offcnt < BRCMS_MPC_MAX_DELAYCNT)
1908 wlc->mpc_offcnt++; 1907 wlc->mpc_offcnt++;
1909 1908
1910 brcms_c_radio_hwdisable_upd(wlc); 1909 brcms_c_radio_hwdisable_upd(wlc);
@@ -1918,7 +1917,7 @@ static bool brcms_c_radio_monitor_start(struct brcms_c_info *wlc)
1918 return true; 1917 return true;
1919 1918
1920 wlc->radio_monitor = true; 1919 wlc->radio_monitor = true;
1921 brcms_c_pllreq(wlc, true, WLC_PLLREQ_RADIO_MON); 1920 brcms_c_pllreq(wlc, true, BRCMS_PLLREQ_RADIO_MON);
1922 brcms_add_timer(wlc->wl, wlc->radio_timer, TIMER_INTERVAL_RADIOCHK, 1921 brcms_add_timer(wlc->wl, wlc->radio_timer, TIMER_INTERVAL_RADIOCHK,
1923 true); 1922 true);
1924 return true; 1923 return true;
@@ -1930,7 +1929,7 @@ bool brcms_c_radio_monitor_stop(struct brcms_c_info *wlc)
1930 return true; 1929 return true;
1931 1930
1932 wlc->radio_monitor = false; 1931 wlc->radio_monitor = false;
1933 brcms_c_pllreq(wlc, false, WLC_PLLREQ_RADIO_MON); 1932 brcms_c_pllreq(wlc, false, BRCMS_PLLREQ_RADIO_MON);
1934 return brcms_del_timer(wlc->wl, wlc->radio_timer); 1933 return brcms_del_timer(wlc->wl, wlc->radio_timer);
1935} 1934}
1936 1935
@@ -1998,14 +1997,14 @@ static void brcms_c_watchdog(void *arg)
1998 } 1997 }
1999 1998
2000 /* Call any registered watchdog handlers */ 1999 /* Call any registered watchdog handlers */
2001 for (i = 0; i < WLC_MAXMODULES; i++) { 2000 for (i = 0; i < BRCMS_MAXMODULES; i++) {
2002 if (wlc->modulecb[i].watchdog_fn) 2001 if (wlc->modulecb[i].watchdog_fn)
2003 wlc->modulecb[i].watchdog_fn(wlc->modulecb[i].hdl); 2002 wlc->modulecb[i].watchdog_fn(wlc->modulecb[i].hdl);
2004 } 2003 }
2005 2004
2006 if (WLCISNPHY(wlc->band) && !wlc->pub->tempsense_disable && 2005 if (BRCMS_ISNPHY(wlc->band) && !wlc->pub->tempsense_disable &&
2007 ((wlc->pub->now - wlc->tempsense_lasttime) >= 2006 ((wlc->pub->now - wlc->tempsense_lasttime) >=
2008 WLC_TEMPSENSE_PERIOD)) { 2007 BRCMS_TEMPSENSE_PERIOD)) {
2009 wlc->tempsense_lasttime = wlc->pub->now; 2008 wlc->tempsense_lasttime = wlc->pub->now;
2010 brcms_c_tempsense_upd(wlc); 2009 brcms_c_tempsense_upd(wlc);
2011 } 2010 }
@@ -2030,10 +2029,10 @@ int brcms_c_up(struct brcms_c_info *wlc)
2030 if (wlc->pub->boardrev >= 0x1250 2029 if (wlc->pub->boardrev >= 0x1250
2031 && (wlc->pub->boardflags & BFL_FEM_BT)) { 2030 && (wlc->pub->boardflags & BFL_FEM_BT)) {
2032 brcms_c_mhf(wlc, MHF5, MHF5_4313_GPIOCTRL, 2031 brcms_c_mhf(wlc, MHF5, MHF5_4313_GPIOCTRL,
2033 MHF5_4313_GPIOCTRL, WLC_BAND_ALL); 2032 MHF5_4313_GPIOCTRL, BRCM_BAND_ALL);
2034 } else { 2033 } else {
2035 brcms_c_mhf(wlc, MHF4, MHF4_EXTPA_ENABLE, 2034 brcms_c_mhf(wlc, MHF4, MHF4_EXTPA_ENABLE,
2036 MHF4_EXTPA_ENABLE, WLC_BAND_ALL); 2035 MHF4_EXTPA_ENABLE, BRCM_BAND_ALL);
2037 } 2036 }
2038 } 2037 }
2039 2038
@@ -2080,14 +2079,14 @@ int brcms_c_up(struct brcms_c_info *wlc)
2080 2079
2081 /* Set EDCF hostflags */ 2080 /* Set EDCF hostflags */
2082 if (EDCF_ENAB(wlc->pub)) { 2081 if (EDCF_ENAB(wlc->pub)) {
2083 brcms_c_mhf(wlc, MHF1, MHF1_EDCF, MHF1_EDCF, WLC_BAND_ALL); 2082 brcms_c_mhf(wlc, MHF1, MHF1_EDCF, MHF1_EDCF, BRCM_BAND_ALL);
2084 } else { 2083 } else {
2085 brcms_c_mhf(wlc, MHF1, MHF1_EDCF, 0, WLC_BAND_ALL); 2084 brcms_c_mhf(wlc, MHF1, MHF1_EDCF, 0, BRCM_BAND_ALL);
2086 } 2085 }
2087 2086
2088 if (WLC_WAR16165(wlc)) 2087 if (BRCMS_WAR16165(wlc))
2089 brcms_c_mhf(wlc, MHF2, MHF2_PCISLOWCLKWAR, MHF2_PCISLOWCLKWAR, 2088 brcms_c_mhf(wlc, MHF2, MHF2_PCISLOWCLKWAR, MHF2_PCISLOWCLKWAR,
2090 WLC_BAND_ALL); 2089 BRCM_BAND_ALL);
2091 2090
2092 brcms_init(wlc->wl); 2091 brcms_init(wlc->wl);
2093 wlc->pub->up = true; 2092 wlc->pub->up = true;
@@ -2123,20 +2122,20 @@ int brcms_c_up(struct brcms_c_info *wlc)
2123/* Initialize the base precedence map for dequeueing from txq based on WME settings */ 2122/* Initialize the base precedence map for dequeueing from txq based on WME settings */
2124static void brcms_c_tx_prec_map_init(struct brcms_c_info *wlc) 2123static void brcms_c_tx_prec_map_init(struct brcms_c_info *wlc)
2125{ 2124{
2126 wlc->tx_prec_map = WLC_PREC_BMP_ALL; 2125 wlc->tx_prec_map = BRCMS_PREC_BMP_ALL;
2127 memset(wlc->fifo2prec_map, 0, NFIFO * sizeof(u16)); 2126 memset(wlc->fifo2prec_map, 0, NFIFO * sizeof(u16));
2128 2127
2129 /* For non-WME, both fifos have overlapping MAXPRIO. So just disable all precedences 2128 /* For non-WME, both fifos have overlapping MAXPRIO. So just disable all precedences
2130 * if either is full. 2129 * if either is full.
2131 */ 2130 */
2132 if (!EDCF_ENAB(wlc->pub)) { 2131 if (!EDCF_ENAB(wlc->pub)) {
2133 wlc->fifo2prec_map[TX_DATA_FIFO] = WLC_PREC_BMP_ALL; 2132 wlc->fifo2prec_map[TX_DATA_FIFO] = BRCMS_PREC_BMP_ALL;
2134 wlc->fifo2prec_map[TX_CTL_FIFO] = WLC_PREC_BMP_ALL; 2133 wlc->fifo2prec_map[TX_CTL_FIFO] = BRCMS_PREC_BMP_ALL;
2135 } else { 2134 } else {
2136 wlc->fifo2prec_map[TX_AC_BK_FIFO] = WLC_PREC_BMP_AC_BK; 2135 wlc->fifo2prec_map[TX_AC_BK_FIFO] = BRCMS_PREC_BMP_AC_BK;
2137 wlc->fifo2prec_map[TX_AC_BE_FIFO] = WLC_PREC_BMP_AC_BE; 2136 wlc->fifo2prec_map[TX_AC_BE_FIFO] = BRCMS_PREC_BMP_AC_BE;
2138 wlc->fifo2prec_map[TX_AC_VI_FIFO] = WLC_PREC_BMP_AC_VI; 2137 wlc->fifo2prec_map[TX_AC_VI_FIFO] = BRCMS_PREC_BMP_AC_VI;
2139 wlc->fifo2prec_map[TX_AC_VO_FIFO] = WLC_PREC_BMP_AC_VO; 2138 wlc->fifo2prec_map[TX_AC_VO_FIFO] = BRCMS_PREC_BMP_AC_VO;
2140 } 2139 }
2141} 2140}
2142 2141
@@ -2179,7 +2178,7 @@ uint brcms_c_down(struct brcms_c_info *wlc)
2179 dev_gone = DEVICEREMOVED(wlc); 2178 dev_gone = DEVICEREMOVED(wlc);
2180 2179
2181 /* Call any registered down handlers */ 2180 /* Call any registered down handlers */
2182 for (i = 0; i < WLC_MAXMODULES; i++) { 2181 for (i = 0; i < BRCMS_MAXMODULES; i++) {
2183 if (wlc->modulecb[i].down_fn) 2182 if (wlc->modulecb[i].down_fn)
2184 callbacks += 2183 callbacks +=
2185 wlc->modulecb[i].down_fn(wlc->modulecb[i].hdl); 2184 wlc->modulecb[i].down_fn(wlc->modulecb[i].hdl);
@@ -2222,11 +2221,13 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
2222 uint i; 2221 uint i;
2223 wlc_rateset_t rs; 2222 wlc_rateset_t rs;
2224 /* Default to 54g Auto */ 2223 /* Default to 54g Auto */
2225 s8 shortslot = WLC_SHORTSLOT_AUTO; /* Advertise and use shortslot (-1/0/1 Auto/Off/On) */ 2224 /* Advertise and use shortslot (-1/0/1 Auto/Off/On) */
2225 s8 shortslot = BRCMS_SHORTSLOT_AUTO;
2226 bool shortslot_restrict = false; /* Restrict association to stations that support shortslot 2226 bool shortslot_restrict = false; /* Restrict association to stations that support shortslot
2227 */ 2227 */
2228 bool ofdm_basic = false; /* Make 6, 12, and 24 basic rates */ 2228 bool ofdm_basic = false; /* Make 6, 12, and 24 basic rates */
2229 int preamble = WLC_PLCP_LONG; /* Advertise and use short preambles (-1/0/1 Auto/Off/On) */ 2229 /* Advertise and use short preambles (-1/0/1 Auto/Off/On) */
2230 int preamble = BRCMS_PLCP_LONG;
2230 bool preamble_restrict = false; /* Restrict association to stations that support short 2231 bool preamble_restrict = false; /* Restrict association to stations that support short
2231 * preambles 2232 * preambles
2232 */ 2233 */
@@ -2239,22 +2240,22 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
2239 return -ENOTSUPP; 2240 return -ENOTSUPP;
2240 2241
2241 /* verify that we are dealing with 2G band and grab the band pointer */ 2242 /* verify that we are dealing with 2G band and grab the band pointer */
2242 if (wlc->band->bandtype == WLC_BAND_2G) 2243 if (wlc->band->bandtype == BRCM_BAND_2G)
2243 band = wlc->band; 2244 band = wlc->band;
2244 else if ((NBANDS(wlc) > 1) && 2245 else if ((NBANDS(wlc) > 1) &&
2245 (wlc->bandstate[OTHERBANDUNIT(wlc)]->bandtype == WLC_BAND_2G)) 2246 (wlc->bandstate[OTHERBANDUNIT(wlc)]->bandtype == BRCM_BAND_2G))
2246 band = wlc->bandstate[OTHERBANDUNIT(wlc)]; 2247 band = wlc->bandstate[OTHERBANDUNIT(wlc)];
2247 else 2248 else
2248 return -EINVAL; 2249 return -EINVAL;
2249 2250
2250 /* Legacy or bust when no OFDM is supported by regulatory */ 2251 /* Legacy or bust when no OFDM is supported by regulatory */
2251 if ((brcms_c_channel_locale_flags_in_band(wlc->cmi, band->bandunit) & 2252 if ((brcms_c_channel_locale_flags_in_band(wlc->cmi, band->bandunit) &
2252 WLC_NO_OFDM) && (gmode != GMODE_LEGACY_B)) 2253 BRCMS_NO_OFDM) && (gmode != GMODE_LEGACY_B))
2253 return -EINVAL; 2254 return -EINVAL;
2254 2255
2255 /* update configuration value */ 2256 /* update configuration value */
2256 if (config == true) 2257 if (config == true)
2257 brcms_c_protection_upd(wlc, WLC_PROT_G_USER, gmode); 2258 brcms_c_protection_upd(wlc, BRCMS_PROT_G_USER, gmode);
2258 2259
2259 /* Clear supported rates filter */ 2260 /* Clear supported rates filter */
2260 memset(&wlc->sup_rates_override, 0, sizeof(wlc_rateset_t)); 2261 memset(&wlc->sup_rates_override, 0, sizeof(wlc_rateset_t));
@@ -2264,7 +2265,7 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
2264 2265
2265 switch (gmode) { 2266 switch (gmode) {
2266 case GMODE_LEGACY_B: 2267 case GMODE_LEGACY_B:
2267 shortslot = WLC_SHORTSLOT_OFF; 2268 shortslot = BRCMS_SHORTSLOT_OFF;
2268 brcms_c_rateset_copy(&gphy_legacy_rates, &rs); 2269 brcms_c_rateset_copy(&gphy_legacy_rates, &rs);
2269 2270
2270 break; 2271 break;
@@ -2281,7 +2282,7 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
2281 2282
2282 case GMODE_ONLY: 2283 case GMODE_ONLY:
2283 ofdm_basic = true; 2284 ofdm_basic = true;
2284 preamble = WLC_PLCP_SHORT; 2285 preamble = BRCMS_PLCP_SHORT;
2285 preamble_restrict = true; 2286 preamble_restrict = true;
2286 break; 2287 break;
2287 2288
@@ -2290,10 +2291,10 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
2290 brcms_c_rateset_copy(&cck_ofdm_rates, 2291 brcms_c_rateset_copy(&cck_ofdm_rates,
2291 &wlc->sup_rates_override); 2292 &wlc->sup_rates_override);
2292 2293
2293 shortslot = WLC_SHORTSLOT_ON; 2294 shortslot = BRCMS_SHORTSLOT_ON;
2294 shortslot_restrict = true; 2295 shortslot_restrict = true;
2295 ofdm_basic = true; 2296 ofdm_basic = true;
2296 preamble = WLC_PLCP_SHORT; 2297 preamble = BRCMS_PLCP_SHORT;
2297 preamble_restrict = true; 2298 preamble_restrict = true;
2298 break; 2299 break;
2299 2300
@@ -2327,18 +2328,18 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
2327 /* wlc->ap->shortslot_restrict = shortslot_restrict; */ 2328 /* wlc->ap->shortslot_restrict = shortslot_restrict; */
2328 wlc->PLCPHdr_override = 2329 wlc->PLCPHdr_override =
2329 (preamble != 2330 (preamble !=
2330 WLC_PLCP_LONG) ? WLC_PLCP_SHORT : WLC_PLCP_AUTO; 2331 BRCMS_PLCP_LONG) ? BRCMS_PLCP_SHORT : BRCMS_PLCP_AUTO;
2331 } 2332 }
2332 2333
2333 if ((AP_ENAB(wlc->pub) && preamble != WLC_PLCP_LONG) 2334 if ((AP_ENAB(wlc->pub) && preamble != BRCMS_PLCP_LONG)
2334 || preamble == WLC_PLCP_SHORT) 2335 || preamble == BRCMS_PLCP_SHORT)
2335 wlc->default_bss->capability |= WLAN_CAPABILITY_SHORT_PREAMBLE; 2336 wlc->default_bss->capability |= WLAN_CAPABILITY_SHORT_PREAMBLE;
2336 else 2337 else
2337 wlc->default_bss->capability &= ~WLAN_CAPABILITY_SHORT_PREAMBLE; 2338 wlc->default_bss->capability &= ~WLAN_CAPABILITY_SHORT_PREAMBLE;
2338 2339
2339 /* Update shortslot capability bit for AP and IBSS */ 2340 /* Update shortslot capability bit for AP and IBSS */
2340 if ((AP_ENAB(wlc->pub) && shortslot == WLC_SHORTSLOT_AUTO) || 2341 if ((AP_ENAB(wlc->pub) && shortslot == BRCMS_SHORTSLOT_AUTO) ||
2341 shortslot == WLC_SHORTSLOT_ON) 2342 shortslot == BRCMS_SHORTSLOT_ON)
2342 wlc->default_bss->capability |= WLAN_CAPABILITY_SHORT_SLOT_TIME; 2343 wlc->default_bss->capability |= WLAN_CAPABILITY_SHORT_SLOT_TIME;
2343 else 2344 else
2344 wlc->default_bss->capability &= 2345 wlc->default_bss->capability &=
@@ -2350,10 +2351,10 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
2350 2351
2351 if (ofdm_basic) { 2352 if (ofdm_basic) {
2352 for (i = 0; i < rs.count; i++) { 2353 for (i = 0; i < rs.count; i++) {
2353 if (rs.rates[i] == WLC_RATE_6M 2354 if (rs.rates[i] == BRCM_RATE_6M
2354 || rs.rates[i] == WLC_RATE_12M 2355 || rs.rates[i] == BRCM_RATE_12M
2355 || rs.rates[i] == WLC_RATE_24M) 2356 || rs.rates[i] == BRCM_RATE_24M)
2356 rs.rates[i] |= WLC_RATE_FLAG; 2357 rs.rates[i] |= BRCMS_RATE_FLAG;
2357 } 2358 }
2358 } 2359 }
2359 2360
@@ -2377,7 +2378,7 @@ static int brcms_c_nmode_validate(struct brcms_c_info *wlc, s32 nmode)
2377 case AUTO: 2378 case AUTO:
2378 case WL_11N_2x2: 2379 case WL_11N_2x2:
2379 case WL_11N_3x3: 2380 case WL_11N_3x3:
2380 if (!(WLC_PHY_11N_CAP(wlc->band))) 2381 if (!(BRCMS_PHY_11N_CAP(wlc->band)))
2381 err = -EINVAL; 2382 err = -EINVAL;
2382 break; 2383 break;
2383 2384
@@ -2401,7 +2402,7 @@ int brcms_c_set_nmode(struct brcms_c_info *wlc, s32 nmode)
2401 switch (nmode) { 2402 switch (nmode) {
2402 case OFF: 2403 case OFF:
2403 wlc->pub->_n_enab = OFF; 2404 wlc->pub->_n_enab = OFF;
2404 wlc->default_bss->flags &= ~WLC_BSS_HT; 2405 wlc->default_bss->flags &= ~BRCMS_BSS_HT;
2405 /* delete the mcs rates from the default and hw ratesets */ 2406 /* delete the mcs rates from the default and hw ratesets */
2406 brcms_c_rateset_mcs_clear(&wlc->default_bss->rateset); 2407 brcms_c_rateset_mcs_clear(&wlc->default_bss->rateset);
2407 for (i = 0; i < NBANDS(wlc); i++) { 2408 for (i = 0; i < NBANDS(wlc); i++) {
@@ -2429,7 +2430,7 @@ int brcms_c_set_nmode(struct brcms_c_info *wlc, s32 nmode)
2429 wlc->pub->_n_enab = SUPPORT_HT; 2430 wlc->pub->_n_enab = SUPPORT_HT;
2430 else 2431 else
2431 wlc->pub->_n_enab = SUPPORT_11N; 2432 wlc->pub->_n_enab = SUPPORT_11N;
2432 wlc->default_bss->flags |= WLC_BSS_HT; 2433 wlc->default_bss->flags |= BRCMS_BSS_HT;
2433 /* add the mcs rates to the default and hw ratesets */ 2434 /* add the mcs rates to the default and hw ratesets */
2434 brcms_c_rateset_mcs_build(&wlc->default_bss->rateset, 2435 brcms_c_rateset_mcs_build(&wlc->default_bss->rateset,
2435 wlc->stf->txstreams); 2436 wlc->stf->txstreams);
@@ -2453,7 +2454,7 @@ static int brcms_c_set_rateset(struct brcms_c_info *wlc, wlc_rateset_t *rs_arg)
2453 memcpy(&rs, rs_arg, sizeof(wlc_rateset_t)); 2454 memcpy(&rs, rs_arg, sizeof(wlc_rateset_t));
2454 2455
2455 /* check for bad count value */ 2456 /* check for bad count value */
2456 if ((rs.count == 0) || (rs.count > WLC_NUMRATES)) 2457 if ((rs.count == 0) || (rs.count > BRCMS_NUMRATES))
2457 return -EINVAL; 2458 return -EINVAL;
2458 2459
2459 /* try the current band */ 2460 /* try the current band */
@@ -2573,7 +2574,7 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
2573 2574
2574 switch (cmd) { 2575 switch (cmd) {
2575 2576
2576 case WLC_SET_CHANNEL:{ 2577 case BRCM_SET_CHANNEL:{
2577 chanspec_t chspec = CH20MHZ_CHSPEC(val); 2578 chanspec_t chspec = CH20MHZ_CHSPEC(val);
2578 2579
2579 if (val < 0 || val > MAXCHANNEL) { 2580 if (val < 0 || val > MAXCHANNEL) {
@@ -2588,7 +2589,7 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
2588 2589
2589 if (!wlc->pub->up && IS_MBAND_UNLOCKED(wlc)) { 2590 if (!wlc->pub->up && IS_MBAND_UNLOCKED(wlc)) {
2590 if (wlc->band->bandunit != 2591 if (wlc->band->bandunit !=
2591 CHSPEC_WLCBANDUNIT(chspec)) 2592 CHSPEC_BANDUNIT(chspec))
2592 wlc->bandinit_pending = true; 2593 wlc->bandinit_pending = true;
2593 else 2594 else
2594 wlc->bandinit_pending = false; 2595 wlc->bandinit_pending = false;
@@ -2598,7 +2599,7 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
2598 /* brcms_c_BSSinit() will sanitize the rateset before 2599 /* brcms_c_BSSinit() will sanitize the rateset before
2599 * using it.. */ 2600 * using it.. */
2600 if (wlc->pub->up && 2601 if (wlc->pub->up &&
2601 (WLC_BAND_PI_RADIO_CHANSPEC != chspec)) { 2602 (BRCMS_BAND_PI_RADIO_CHANSPEC != chspec)) {
2602 brcms_c_set_home_chanspec(wlc, chspec); 2603 brcms_c_set_home_chanspec(wlc, chspec);
2603 brcms_c_suspend_mac_and_wait(wlc); 2604 brcms_c_suspend_mac_and_wait(wlc);
2604 brcms_c_set_chanspec(wlc, chspec); 2605 brcms_c_set_chanspec(wlc, chspec);
@@ -2607,7 +2608,7 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
2607 break; 2608 break;
2608 } 2609 }
2609 2610
2610 case WLC_SET_SRL: 2611 case BRCM_SET_SRL:
2611 if (val >= 1 && val <= RETRY_SHORT_MAX) { 2612 if (val >= 1 && val <= RETRY_SHORT_MAX) {
2612 int ac; 2613 int ac;
2613 wlc->SRL = (u16) val; 2614 wlc->SRL = (u16) val;
@@ -2615,14 +2616,14 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
2615 brcms_b_retrylimit_upd(wlc->hw, wlc->SRL, wlc->LRL); 2616 brcms_b_retrylimit_upd(wlc->hw, wlc->SRL, wlc->LRL);
2616 2617
2617 for (ac = 0; ac < AC_COUNT; ac++) { 2618 for (ac = 0; ac < AC_COUNT; ac++) {
2618 WLC_WME_RETRY_SHORT_SET(wlc, ac, wlc->SRL); 2619 BRCMS_WME_RETRY_SHORT_SET(wlc, ac, wlc->SRL);
2619 } 2620 }
2620 brcms_c_wme_retries_write(wlc); 2621 brcms_c_wme_retries_write(wlc);
2621 } else 2622 } else
2622 bcmerror = -EINVAL; 2623 bcmerror = -EINVAL;
2623 break; 2624 break;
2624 2625
2625 case WLC_SET_LRL: 2626 case BRCM_SET_LRL:
2626 if (val >= 1 && val <= 255) { 2627 if (val >= 1 && val <= 255) {
2627 int ac; 2628 int ac;
2628 wlc->LRL = (u16) val; 2629 wlc->LRL = (u16) val;
@@ -2630,14 +2631,14 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
2630 brcms_b_retrylimit_upd(wlc->hw, wlc->SRL, wlc->LRL); 2631 brcms_b_retrylimit_upd(wlc->hw, wlc->SRL, wlc->LRL);
2631 2632
2632 for (ac = 0; ac < AC_COUNT; ac++) { 2633 for (ac = 0; ac < AC_COUNT; ac++) {
2633 WLC_WME_RETRY_LONG_SET(wlc, ac, wlc->LRL); 2634 BRCMS_WME_RETRY_LONG_SET(wlc, ac, wlc->LRL);
2634 } 2635 }
2635 brcms_c_wme_retries_write(wlc); 2636 brcms_c_wme_retries_write(wlc);
2636 } else 2637 } else
2637 bcmerror = -EINVAL; 2638 bcmerror = -EINVAL;
2638 break; 2639 break;
2639 2640
2640 case WLC_GET_CURR_RATESET:{ 2641 case BRCM_GET_CURR_RATESET:{
2641 wl_rateset_t *ret_rs = (wl_rateset_t *) arg; 2642 wl_rateset_t *ret_rs = (wl_rateset_t *) arg;
2642 wlc_rateset_t *rs; 2643 wlc_rateset_t *rs;
2643 2644
@@ -2657,7 +2658,7 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
2657 break; 2658 break;
2658 } 2659 }
2659 2660
2660 case WLC_SET_RATESET:{ 2661 case BRCM_SET_RATESET:{
2661 wlc_rateset_t rs; 2662 wlc_rateset_t rs;
2662 wl_rateset_t *in_rs = (wl_rateset_t *) arg; 2663 wl_rateset_t *in_rs = (wl_rateset_t *) arg;
2663 2664
@@ -2666,7 +2667,7 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
2666 break; 2667 break;
2667 } 2668 }
2668 2669
2669 if (in_rs->count > WLC_NUMRATES) { 2670 if (in_rs->count > BRCMS_NUMRATES) {
2670 bcmerror = -ENOBUFS; 2671 bcmerror = -ENOBUFS;
2671 break; 2672 break;
2672 } 2673 }
@@ -2697,16 +2698,16 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
2697 break; 2698 break;
2698 } 2699 }
2699 2700
2700 case WLC_SET_BCNPRD: 2701 case BRCM_SET_BCNPRD:
2701 /* range [1, 0xffff] */ 2702 /* range [1, 0xffff] */
2702 if (val >= DOT11_MIN_BEACON_PERIOD 2703 if (val >= DOT11_MIN_BEACON_PERIOD
2703 && val <= DOT11_MAX_BEACON_PERIOD) { 2704 && val <= DOT11_MAX_BEACON_PERIOD)
2704 wlc->default_bss->beacon_period = (u16) val; 2705 wlc->default_bss->beacon_period = (u16) val;
2705 } else 2706 else
2706 bcmerror = -EINVAL; 2707 bcmerror = -EINVAL;
2707 break; 2708 break;
2708 2709
2709 case WLC_GET_PHYLIST: 2710 case BRCM_GET_PHYLIST:
2710 { 2711 {
2711 unsigned char *cp = arg; 2712 unsigned char *cp = arg;
2712 if (len < 3) { 2713 if (len < 3) {
@@ -2714,20 +2715,19 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
2714 break; 2715 break;
2715 } 2716 }
2716 2717
2717 if (WLCISNPHY(wlc->band)) { 2718 if (BRCMS_ISNPHY(wlc->band))
2718 *cp++ = 'n'; 2719 *cp++ = 'n';
2719 } else if (WLCISLCNPHY(wlc->band)) { 2720 else if (BRCMS_ISLCNPHY(wlc->band))
2720 *cp++ = 'c'; 2721 *cp++ = 'c';
2721 } else if (WLCISSSLPNPHY(wlc->band)) { 2722 else if (BRCMS_ISSSLPNPHY(wlc->band))
2722 *cp++ = 's'; 2723 *cp++ = 's';
2723 }
2724 *cp = '\0'; 2724 *cp = '\0';
2725 break; 2725 break;
2726 } 2726 }
2727 2727
2728 case WLC_SET_SHORTSLOT_OVERRIDE: 2728 case BRCMS_SET_SHORTSLOT_OVERRIDE:
2729 if ((val != WLC_SHORTSLOT_AUTO) && 2729 if (val != BRCMS_SHORTSLOT_AUTO && val != BRCMS_SHORTSLOT_OFF &&
2730 (val != WLC_SHORTSLOT_OFF) && (val != WLC_SHORTSLOT_ON)) { 2730 val != BRCMS_SHORTSLOT_ON) {
2731 bcmerror = -EINVAL; 2731 bcmerror = -EINVAL;
2732 break; 2732 break;
2733 } 2733 }
@@ -2748,12 +2748,12 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
2748 } else { 2748 } else {
2749 /* driver is down, so just update the brcms_c_info 2749 /* driver is down, so just update the brcms_c_info
2750 * value */ 2750 * value */
2751 if (wlc->shortslot_override == WLC_SHORTSLOT_AUTO) { 2751 if (wlc->shortslot_override == BRCMS_SHORTSLOT_AUTO) {
2752 wlc->shortslot = false; 2752 wlc->shortslot = false;
2753 } else { 2753 } else {
2754 wlc->shortslot = 2754 wlc->shortslot =
2755 (wlc->shortslot_override == 2755 (wlc->shortslot_override ==
2756 WLC_SHORTSLOT_ON); 2756 BRCMS_SHORTSLOT_ON);
2757 } 2757 }
2758 } 2758 }
2759 2759
@@ -2779,7 +2779,7 @@ int brcms_c_module_register(struct brcms_pub *pub,
2779 int i; 2779 int i;
2780 2780
2781 /* find an empty entry and just add, no duplication check! */ 2781 /* find an empty entry and just add, no duplication check! */
2782 for (i = 0; i < WLC_MAXMODULES; i++) { 2782 for (i = 0; i < BRCMS_MAXMODULES; i++) {
2783 if (wlc->modulecb[i].name[0] == '\0') { 2783 if (wlc->modulecb[i].name[0] == '\0') {
2784 strncpy(wlc->modulecb[i].name, name, 2784 strncpy(wlc->modulecb[i].name, name,
2785 sizeof(wlc->modulecb[i].name) - 1); 2785 sizeof(wlc->modulecb[i].name) - 1);
@@ -2803,7 +2803,7 @@ brcms_c_module_unregister(struct brcms_pub *pub, const char *name, void *hdl)
2803 if (wlc == NULL) 2803 if (wlc == NULL)
2804 return -ENODATA; 2804 return -ENODATA;
2805 2805
2806 for (i = 0; i < WLC_MAXMODULES; i++) { 2806 for (i = 0; i < BRCMS_MAXMODULES; i++) {
2807 if (!strcmp(wlc->modulecb[i].name, name) && 2807 if (!strcmp(wlc->modulecb[i].name, name) &&
2808 (wlc->modulecb[i].hdl == hdl)) { 2808 (wlc->modulecb[i].hdl == hdl)) {
2809 memset(&wlc->modulecb[i], 0, sizeof(struct modulecb)); 2809 memset(&wlc->modulecb[i], 0, sizeof(struct modulecb));
@@ -3210,7 +3210,7 @@ brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
3210 (brcms_c_d11hdrs_mac80211( 3210 (brcms_c_d11hdrs_mac80211(
3211 wlc, hw, pkt, scb, 0, 1, fifo, 0, NULL, 0))) 3211 wlc, hw, pkt, scb, 0, 1, fifo, 0, NULL, 0)))
3212 return -EINVAL; 3212 return -EINVAL;
3213 brcms_c_txq_enq(wlc, scb, pkt, WLC_PRIO_TO_PREC(prio)); 3213 brcms_c_txq_enq(wlc, scb, pkt, BRCMS_PRIO_TO_PREC(prio));
3214 brcms_c_send_q(wlc); 3214 brcms_c_send_q(wlc);
3215 return 0; 3215 return 0;
3216} 3216}
@@ -3320,7 +3320,7 @@ brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p,
3320 3320
3321 } 3321 }
3322 3322
3323 if (WLC_WAR16165(wlc)) 3323 if (BRCMS_WAR16165(wlc))
3324 brcms_c_war16165(wlc, true); 3324 brcms_c_war16165(wlc, true);
3325 3325
3326 3326
@@ -3363,7 +3363,7 @@ static void brcms_c_compute_mimo_plcp(ratespec_t rspec, uint length, u8 *plcp)
3363 plcp[0] = mcs; 3363 plcp[0] = mcs;
3364 if (RSPEC_IS40MHZ(rspec) || (mcs == 32)) 3364 if (RSPEC_IS40MHZ(rspec) || (mcs == 32))
3365 plcp[0] |= MIMO_PLCP_40MHZ; 3365 plcp[0] |= MIMO_PLCP_40MHZ;
3366 WLC_SET_MIMO_PLCP_LEN(plcp, length); 3366 BRCMS_SET_MIMO_PLCP_LEN(plcp, length);
3367 plcp[3] = RSPEC_MIMOPLCP3(rspec); /* rspec already holds this byte */ 3367 plcp[3] = RSPEC_MIMOPLCP3(rspec); /* rspec already holds this byte */
3368 plcp[3] |= 0x7; /* set smoothing, not sounding ppdu & reserved */ 3368 plcp[3] |= 0x7; /* set smoothing, not sounding ppdu & reserved */
3369 plcp[4] = 0; /* number of extension spatial streams bit 0 & 1 */ 3369 plcp[4] = 0; /* number of extension spatial streams bit 0 & 1 */
@@ -3379,7 +3379,7 @@ brcms_c_compute_ofdm_plcp(ratespec_t rspec, u32 length, u8 *plcp)
3379 int rate = RSPEC2RATE(rspec); 3379 int rate = RSPEC2RATE(rspec);
3380 3380
3381 /* encode rate per 802.11a-1999 sec 17.3.4.1, with lsb transmitted first */ 3381 /* encode rate per 802.11a-1999 sec 17.3.4.1, with lsb transmitted first */
3382 rate_signal = rate_info[rate] & WLC_RATE_MASK; 3382 rate_signal = rate_info[rate] & BRCMS_RATE_MASK;
3383 memset(plcp, 0, D11_PHY_HDR_LEN); 3383 memset(plcp, 0, D11_PHY_HDR_LEN);
3384 D11A_PHY_HDR_SRATE((struct ofdm_phy_hdr *) plcp, rate_signal); 3384 D11A_PHY_HDR_SRATE((struct ofdm_phy_hdr *) plcp, rate_signal);
3385 3385
@@ -3405,18 +3405,18 @@ static void brcms_c_cck_plcp_set(struct brcms_c_info *wlc, int rate_500,
3405 u8 le = 0; 3405 u8 le = 0;
3406 3406
3407 switch (rate_500) { 3407 switch (rate_500) {
3408 case WLC_RATE_1M: 3408 case BRCM_RATE_1M:
3409 usec = length << 3; 3409 usec = length << 3;
3410 break; 3410 break;
3411 case WLC_RATE_2M: 3411 case BRCM_RATE_2M:
3412 usec = length << 2; 3412 usec = length << 2;
3413 break; 3413 break;
3414 case WLC_RATE_5M5: 3414 case BRCM_RATE_5M5:
3415 usec = (length << 4) / 11; 3415 usec = (length << 4) / 11;
3416 if ((length << 4) - (usec * 11) > 0) 3416 if ((length << 4) - (usec * 11) > 0)
3417 usec++; 3417 usec++;
3418 break; 3418 break;
3419 case WLC_RATE_11M: 3419 case BRCM_RATE_11M:
3420 usec = (length << 3) / 11; 3420 usec = (length << 3) / 11;
3421 if ((length << 3) - (usec * 11) > 0) { 3421 if ((length << 3) - (usec * 11) > 0) {
3422 usec++; 3422 usec++;
@@ -3428,7 +3428,7 @@ static void brcms_c_cck_plcp_set(struct brcms_c_info *wlc, int rate_500,
3428 default: 3428 default:
3429 wiphy_err(wlc->wiphy, "brcms_c_cck_plcp_set: unsupported rate %d" 3429 wiphy_err(wlc->wiphy, "brcms_c_cck_plcp_set: unsupported rate %d"
3430 "\n", rate_500); 3430 "\n", rate_500);
3431 rate_500 = WLC_RATE_1M; 3431 rate_500 = BRCM_RATE_1M;
3432 usec = length << 3; 3432 usec = length << 3;
3433 break; 3433 break;
3434 } 3434 }
@@ -3522,7 +3522,7 @@ brcms_c_compute_rtscts_dur(struct brcms_c_info *wlc, bool cts_only,
3522 if (ba) 3522 if (ba)
3523 dur += 3523 dur +=
3524 (u16) brcms_c_calc_ba_time(wlc, frame_rate, 3524 (u16) brcms_c_calc_ba_time(wlc, frame_rate,
3525 WLC_SHORT_PREAMBLE); 3525 BRCMS_SHORT_PREAMBLE);
3526 else 3526 else
3527 dur += 3527 dur +=
3528 (u16) brcms_c_calc_ack_time(wlc, frame_rate, 3528 (u16) brcms_c_calc_ack_time(wlc, frame_rate,
@@ -3535,7 +3535,7 @@ u16 brcms_c_phytxctl1_calc(struct brcms_c_info *wlc, ratespec_t rspec)
3535 u16 phyctl1 = 0; 3535 u16 phyctl1 = 0;
3536 u16 bw; 3536 u16 bw;
3537 3537
3538 if (WLCISLCNPHY(wlc->band)) { 3538 if (BRCMS_ISLCNPHY(wlc->band)) {
3539 bw = PHY_TXC1_BW_20MHZ; 3539 bw = PHY_TXC1_BW_20MHZ;
3540 } else { 3540 } else {
3541 bw = RSPEC_GET_BW(rspec); 3541 bw = RSPEC_GET_BW(rspec);
@@ -3554,8 +3554,8 @@ u16 brcms_c_phytxctl1_calc(struct brcms_c_info *wlc, ratespec_t rspec)
3554 phyctl1 = RSPEC_PHYTXBYTE2(rspec); 3554 phyctl1 = RSPEC_PHYTXBYTE2(rspec);
3555 /* set the upper byte of phyctl1 */ 3555 /* set the upper byte of phyctl1 */
3556 phyctl1 |= (mcs_table[mcs].tx_phy_ctl3 << 8); 3556 phyctl1 |= (mcs_table[mcs].tx_phy_ctl3 << 8);
3557 } else if (IS_CCK(rspec) && !WLCISLCNPHY(wlc->band) 3557 } else if (IS_CCK(rspec) && !BRCMS_ISLCNPHY(wlc->band)
3558 && !WLCISSSLPNPHY(wlc->band)) { 3558 && !BRCMS_ISSSLPNPHY(wlc->band)) {
3559 /* In CCK mode LPPHY overloads OFDM Modulation bits with CCK Data Rate */ 3559 /* In CCK mode LPPHY overloads OFDM Modulation bits with CCK Data Rate */
3560 /* Eventually MIMOPHY would also be converted to this format */ 3560 /* Eventually MIMOPHY would also be converted to this format */
3561 /* 0 = 1Mbps; 1 = 2Mbps; 2 = 5.5Mbps; 3 = 11Mbps */ 3561 /* 0 = 1Mbps; 1 = 2Mbps; 2 = 5.5Mbps; 3 = 11Mbps */
@@ -3589,21 +3589,21 @@ brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, ratespec_t rspec,
3589 3589
3590 } else if (wlc->band->gmode && wlc->protection->_g && !IS_CCK(rspec)) { 3590 } else if (wlc->band->gmode && wlc->protection->_g && !IS_CCK(rspec)) {
3591 /* Use 11Mbps as the g protection RTS target rate and fallback. 3591 /* Use 11Mbps as the g protection RTS target rate and fallback.
3592 * Use the WLC_BASIC_RATE() lookup to find the best basic rate under the 3592 * Use the BRCMS_BASIC_RATE() lookup to find the best basic rate
3593 * target in case 11 Mbps is not Basic. 3593 * under the target in case 11 Mbps is not Basic.
3594 * 6 and 9 Mbps are not usually selected by rate selection, but even 3594 * 6 and 9 Mbps are not usually selected by rate selection, but even
3595 * if the OFDM rate we are protecting is 6 or 9 Mbps, 11 is more robust. 3595 * if the OFDM rate we are protecting is 6 or 9 Mbps, 11 is more robust.
3596 */ 3596 */
3597 rts_rspec = WLC_BASIC_RATE(wlc, WLC_RATE_11M); 3597 rts_rspec = BRCMS_BASIC_RATE(wlc, BRCM_RATE_11M);
3598 } else { 3598 } else {
3599 /* calculate RTS rate and fallback rate based on the frame rate 3599 /* calculate RTS rate and fallback rate based on the frame rate
3600 * RTS must be sent at a basic rate since it is a 3600 * RTS must be sent at a basic rate since it is a
3601 * control frame, sec 9.6 of 802.11 spec 3601 * control frame, sec 9.6 of 802.11 spec
3602 */ 3602 */
3603 rts_rspec = WLC_BASIC_RATE(wlc, rspec); 3603 rts_rspec = BRCMS_BASIC_RATE(wlc, rspec);
3604 } 3604 }
3605 3605
3606 if (WLC_PHY_11N_CAP(wlc->band)) { 3606 if (BRCMS_PHY_11N_CAP(wlc->band)) {
3607 /* set rts txbw to correct side band */ 3607 /* set rts txbw to correct side band */
3608 rts_rspec &= ~RSPEC_BW_MASK; 3608 rts_rspec &= ~RSPEC_BW_MASK;
3609 3609
@@ -3645,14 +3645,14 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3645 int len, phylen, rts_phylen; 3645 int len, phylen, rts_phylen;
3646 u16 mch, phyctl, xfts, mainrates; 3646 u16 mch, phyctl, xfts, mainrates;
3647 u16 seq = 0, mcl = 0, status = 0, frameid = 0; 3647 u16 seq = 0, mcl = 0, status = 0, frameid = 0;
3648 ratespec_t rspec[2] = { WLC_RATE_1M, WLC_RATE_1M }, rts_rspec[2] = { 3648 ratespec_t rspec[2] = { BRCM_RATE_1M, BRCM_RATE_1M }, rts_rspec[2] = {
3649 WLC_RATE_1M, WLC_RATE_1M}; 3649 BRCM_RATE_1M, BRCM_RATE_1M};
3650 bool use_rts = false; 3650 bool use_rts = false;
3651 bool use_cts = false; 3651 bool use_cts = false;
3652 bool use_rifs = false; 3652 bool use_rifs = false;
3653 bool short_preamble[2] = { false, false }; 3653 bool short_preamble[2] = { false, false };
3654 u8 preamble_type[2] = { WLC_LONG_PREAMBLE, WLC_LONG_PREAMBLE }; 3654 u8 preamble_type[2] = { BRCMS_LONG_PREAMBLE, BRCMS_LONG_PREAMBLE };
3655 u8 rts_preamble_type[2] = { WLC_LONG_PREAMBLE, WLC_LONG_PREAMBLE }; 3655 u8 rts_preamble_type[2] = { BRCMS_LONG_PREAMBLE, BRCMS_LONG_PREAMBLE };
3656 u8 *rts_plcp, rts_plcp_fallback[D11_PHY_HDR_LEN]; 3656 u8 *rts_plcp, rts_plcp_fallback[D11_PHY_HDR_LEN];
3657 struct ieee80211_rts *rts = NULL; 3657 struct ieee80211_rts *rts = NULL;
3658 bool qos; 3658 bool qos;
@@ -3704,7 +3704,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3704 /* non-AP STA should never use BCMC queue */ 3704 /* non-AP STA should never use BCMC queue */
3705 if (queue == TX_BCMC_FIFO) { 3705 if (queue == TX_BCMC_FIFO) {
3706 wiphy_err(wlc->wiphy, "wl%d: %s: ASSERT queue == " 3706 wiphy_err(wlc->wiphy, "wl%d: %s: ASSERT queue == "
3707 "TX_BCMC!\n", WLCWLUNIT(wlc), __func__); 3707 "TX_BCMC!\n", BRCMS_UNIT(wlc), __func__);
3708 frameid = bcmc_fid_generate(wlc, NULL, txh); 3708 frameid = bcmc_fid_generate(wlc, NULL, txh);
3709 } else { 3709 } else {
3710 /* Increment the counter for first fragment */ 3710 /* Increment the counter for first fragment */
@@ -3750,7 +3750,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3750 flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE ? 3750 flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE ?
3751 true : false; 3751 true : false;
3752 } else { 3752 } else {
3753 rate_val[k] = WLC_RATE_1M; 3753 rate_val[k] = BRCM_RATE_1M;
3754 } 3754 }
3755 } else { 3755 } else {
3756 rate_val[k] = txrate[k]->idx; 3756 rate_val[k] = txrate[k]->idx;
@@ -3772,7 +3772,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3772 3772
3773 /* (1) RATE: determine and validate primary rate and fallback rates */ 3773 /* (1) RATE: determine and validate primary rate and fallback rates */
3774 if (!RSPEC_ACTIVE(rspec[k])) { 3774 if (!RSPEC_ACTIVE(rspec[k])) {
3775 rspec[k] = WLC_RATE_1M; 3775 rspec[k] = BRCM_RATE_1M;
3776 } else { 3776 } else {
3777 if (!is_multicast_ether_addr(h->addr1)) { 3777 if (!is_multicast_ether_addr(h->addr1)) {
3778 /* set tx antenna config */ 3778 /* set tx antenna config */
@@ -3796,7 +3796,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3796 3796
3797 /* For SISO MCS use STBC if possible */ 3797 /* For SISO MCS use STBC if possible */
3798 if (IS_MCS(rspec[k]) 3798 if (IS_MCS(rspec[k])
3799 && WLC_STF_SS_STBC_TX(wlc, scb)) { 3799 && BRCMS_STF_SS_STBC_TX(wlc, scb)) {
3800 u8 stc; 3800 u8 stc;
3801 3801
3802 stc = 1; /* Nss for single stream is always 1 */ 3802 stc = 1; /* Nss for single stream is always 1 */
@@ -3810,11 +3810,11 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3810 } 3810 }
3811 3811
3812 /* Is the phy configured to use 40MHZ frames? If so then pick the desired txbw */ 3812 /* Is the phy configured to use 40MHZ frames? If so then pick the desired txbw */
3813 if (CHSPEC_WLC_BW(wlc->chanspec) == WLC_40_MHZ) { 3813 if (CHSPEC_WLC_BW(wlc->chanspec) == BRCMS_40_MHZ) {
3814 /* default txbw is 20in40 SB */ 3814 /* default txbw is 20in40 SB */
3815 mimo_ctlchbw = mimo_txbw = 3815 mimo_ctlchbw = mimo_txbw =
3816 CHSPEC_SB_UPPER(WLC_BAND_PI_RADIO_CHANSPEC) 3816 CHSPEC_SB_UPPER(BRCMS_BAND_PI_RADIO_CHANSPEC)
3817 ? PHY_TXC1_BW_20MHZ_UP : PHY_TXC1_BW_20MHZ; 3817 ? PHY_TXC1_BW_20MHZ_UP : PHY_TXC1_BW_20MHZ;
3818 3818
3819 if (IS_MCS(rspec[k])) { 3819 if (IS_MCS(rspec[k])) {
3820 /* mcs 32 must be 40b/w DUP */ 3820 /* mcs 32 must be 40b/w DUP */
@@ -3863,15 +3863,15 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3863 rspec[k] &= ~RSPEC_SHORT_GI; 3863 rspec[k] &= ~RSPEC_SHORT_GI;
3864#endif 3864#endif
3865 3865
3866 mimo_preamble_type = WLC_MM_PREAMBLE; 3866 mimo_preamble_type = BRCMS_MM_PREAMBLE;
3867 if (txrate[k]->flags & IEEE80211_TX_RC_GREEN_FIELD) 3867 if (txrate[k]->flags & IEEE80211_TX_RC_GREEN_FIELD)
3868 mimo_preamble_type = WLC_GF_PREAMBLE; 3868 mimo_preamble_type = BRCMS_GF_PREAMBLE;
3869 3869
3870 if ((txrate[k]->flags & IEEE80211_TX_RC_MCS) 3870 if ((txrate[k]->flags & IEEE80211_TX_RC_MCS)
3871 && (!IS_MCS(rspec[k]))) { 3871 && (!IS_MCS(rspec[k]))) {
3872 wiphy_err(wlc->wiphy, "wl%d: %s: IEEE80211_TX_" 3872 wiphy_err(wlc->wiphy, "wl%d: %s: IEEE80211_TX_"
3873 "RC_MCS != IS_MCS(rspec)\n", 3873 "RC_MCS != IS_MCS(rspec)\n",
3874 WLCWLUNIT(wlc), __func__); 3874 BRCMS_UNIT(wlc), __func__);
3875 } 3875 }
3876 3876
3877 if (IS_MCS(rspec[k])) { 3877 if (IS_MCS(rspec[k])) {
@@ -3881,7 +3881,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3881 if ((rspec[k] & RSPEC_SHORT_GI) 3881 if ((rspec[k] & RSPEC_SHORT_GI)
3882 && IS_SINGLE_STREAM(rspec[k] & 3882 && IS_SINGLE_STREAM(rspec[k] &
3883 RSPEC_RATE_MASK)) { 3883 RSPEC_RATE_MASK)) {
3884 preamble_type[k] = WLC_MM_PREAMBLE; 3884 preamble_type[k] = BRCMS_MM_PREAMBLE;
3885 } 3885 }
3886 } 3886 }
3887 3887
@@ -3889,7 +3889,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3889 if (!IS_MCS(rspec[0]) 3889 if (!IS_MCS(rspec[0])
3890 && (tx_info->control.rates[0]. 3890 && (tx_info->control.rates[0].
3891 flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)) 3891 flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE))
3892 preamble_type[k] = WLC_SHORT_PREAMBLE; 3892 preamble_type[k] = BRCMS_SHORT_PREAMBLE;
3893 } 3893 }
3894 } else { 3894 } else {
3895 for (k = 0; k < hw->max_rates; k++) { 3895 for (k = 0; k < hw->max_rates; k++) {
@@ -3898,7 +3898,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3898 rspec[k] |= (PHY_TXC1_BW_20MHZ << RSPEC_BW_SHIFT); 3898 rspec[k] |= (PHY_TXC1_BW_20MHZ << RSPEC_BW_SHIFT);
3899 3899
3900 /* for nphy, stf of ofdm frames must follow policies */ 3900 /* for nphy, stf of ofdm frames must follow policies */
3901 if (WLCISNPHY(wlc->band) && IS_OFDM(rspec[k])) { 3901 if (BRCMS_ISNPHY(wlc->band) && IS_OFDM(rspec[k])) {
3902 rspec[k] &= ~RSPEC_STF_MASK; 3902 rspec[k] &= ~RSPEC_STF_MASK;
3903 rspec[k] |= phyctl1_stf << RSPEC_STF_SHIFT; 3903 rspec[k] |= phyctl1_stf << RSPEC_STF_SHIFT;
3904 } 3904 }
@@ -3971,7 +3971,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3971 if (BAND_5G(wlc->band->bandtype)) 3971 if (BAND_5G(wlc->band->bandtype))
3972 mcl |= TXC_FREQBAND_5G; 3972 mcl |= TXC_FREQBAND_5G;
3973 3973
3974 if (CHSPEC_IS40(WLC_BAND_PI_RADIO_CHANSPEC)) 3974 if (CHSPEC_IS40(BRCMS_BAND_PI_RADIO_CHANSPEC))
3975 mcl |= TXC_BW_40; 3975 mcl |= TXC_BW_40;
3976 3976
3977 /* set AMIC bit if using hardware TKIP MIC */ 3977 /* set AMIC bit if using hardware TKIP MIC */
@@ -3984,9 +3984,9 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
3984 mch = 0; 3984 mch = 0;
3985 3985
3986 /* Set fallback rate preamble type */ 3986 /* Set fallback rate preamble type */
3987 if ((preamble_type[1] == WLC_SHORT_PREAMBLE) || 3987 if ((preamble_type[1] == BRCMS_SHORT_PREAMBLE) ||
3988 (preamble_type[1] == WLC_GF_PREAMBLE)) { 3988 (preamble_type[1] == BRCMS_GF_PREAMBLE)) {
3989 if (RSPEC2RATE(rspec[1]) != WLC_RATE_1M) 3989 if (RSPEC2RATE(rspec[1]) != BRCM_RATE_1M)
3990 mch |= TXC_PREAMBLE_DATA_FB_SHORT; 3990 mch |= TXC_PREAMBLE_DATA_FB_SHORT;
3991 } 3991 }
3992 3992
@@ -4029,16 +4029,16 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
4029 } 4029 }
4030 4030
4031 if (!IS_OFDM(rts_rspec[0]) && 4031 if (!IS_OFDM(rts_rspec[0]) &&
4032 !((RSPEC2RATE(rts_rspec[0]) == WLC_RATE_1M) || 4032 !((RSPEC2RATE(rts_rspec[0]) == BRCM_RATE_1M) ||
4033 (wlc->PLCPHdr_override == WLC_PLCP_LONG))) { 4033 (wlc->PLCPHdr_override == BRCMS_PLCP_LONG))) {
4034 rts_preamble_type[0] = WLC_SHORT_PREAMBLE; 4034 rts_preamble_type[0] = BRCMS_SHORT_PREAMBLE;
4035 mch |= TXC_PREAMBLE_RTS_MAIN_SHORT; 4035 mch |= TXC_PREAMBLE_RTS_MAIN_SHORT;
4036 } 4036 }
4037 4037
4038 if (!IS_OFDM(rts_rspec[1]) && 4038 if (!IS_OFDM(rts_rspec[1]) &&
4039 !((RSPEC2RATE(rts_rspec[1]) == WLC_RATE_1M) || 4039 !((RSPEC2RATE(rts_rspec[1]) == BRCM_RATE_1M) ||
4040 (wlc->PLCPHdr_override == WLC_PLCP_LONG))) { 4040 (wlc->PLCPHdr_override == BRCMS_PLCP_LONG))) {
4041 rts_preamble_type[1] = WLC_SHORT_PREAMBLE; 4041 rts_preamble_type[1] = BRCMS_SHORT_PREAMBLE;
4042 mch |= TXC_PREAMBLE_RTS_FB_SHORT; 4042 mch |= TXC_PREAMBLE_RTS_FB_SHORT;
4043 } 4043 }
4044 4044
@@ -4127,14 +4127,14 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
4127 xfts |= (FRAMETYPE(rts_rspec[0], wlc->mimoft) << XFTS_RTS_FT_SHIFT); 4127 xfts |= (FRAMETYPE(rts_rspec[0], wlc->mimoft) << XFTS_RTS_FT_SHIFT);
4128 xfts |= (FRAMETYPE(rts_rspec[1], wlc->mimoft) << XFTS_FBRRTS_FT_SHIFT); 4128 xfts |= (FRAMETYPE(rts_rspec[1], wlc->mimoft) << XFTS_FBRRTS_FT_SHIFT);
4129 xfts |= 4129 xfts |=
4130 CHSPEC_CHANNEL(WLC_BAND_PI_RADIO_CHANSPEC) << XFTS_CHANNEL_SHIFT; 4130 CHSPEC_CHANNEL(BRCMS_BAND_PI_RADIO_CHANSPEC) << XFTS_CHANNEL_SHIFT;
4131 txh->XtraFrameTypes = cpu_to_le16(xfts); 4131 txh->XtraFrameTypes = cpu_to_le16(xfts);
4132 4132
4133 /* PhyTxControlWord */ 4133 /* PhyTxControlWord */
4134 phyctl = FRAMETYPE(rspec[0], wlc->mimoft); 4134 phyctl = FRAMETYPE(rspec[0], wlc->mimoft);
4135 if ((preamble_type[0] == WLC_SHORT_PREAMBLE) || 4135 if ((preamble_type[0] == BRCMS_SHORT_PREAMBLE) ||
4136 (preamble_type[0] == WLC_GF_PREAMBLE)) { 4136 (preamble_type[0] == BRCMS_GF_PREAMBLE)) {
4137 if (RSPEC2RATE(rspec[0]) != WLC_RATE_1M) 4137 if (RSPEC2RATE(rspec[0]) != BRCM_RATE_1M)
4138 phyctl |= PHY_TXC_SHORT_HDR; 4138 phyctl |= PHY_TXC_SHORT_HDR;
4139 } 4139 }
4140 4140
@@ -4143,7 +4143,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
4143 txh->PhyTxControlWord = cpu_to_le16(phyctl); 4143 txh->PhyTxControlWord = cpu_to_le16(phyctl);
4144 4144
4145 /* PhyTxControlWord_1 */ 4145 /* PhyTxControlWord_1 */
4146 if (WLC_PHY_11N_CAP(wlc->band)) { 4146 if (BRCMS_PHY_11N_CAP(wlc->band)) {
4147 u16 phyctl1 = 0; 4147 u16 phyctl1 = 0;
4148 4148
4149 phyctl1 = brcms_c_phytxctl1_calc(wlc, rspec[0]); 4149 phyctl1 = brcms_c_phytxctl1_calc(wlc, rspec[0]);
@@ -4163,13 +4163,15 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
4163 * fill in non-zero MModeLen and/or MModeFbrLen 4163 * fill in non-zero MModeLen and/or MModeFbrLen
4164 * it will be unnecessary if they are separated 4164 * it will be unnecessary if they are separated
4165 */ 4165 */
4166 if (IS_MCS(rspec[0]) && (preamble_type[0] == WLC_MM_PREAMBLE)) { 4166 if (IS_MCS(rspec[0]) &&
4167 (preamble_type[0] == BRCMS_MM_PREAMBLE)) {
4167 u16 mmodelen = 4168 u16 mmodelen =
4168 brcms_c_calc_lsig_len(wlc, rspec[0], phylen); 4169 brcms_c_calc_lsig_len(wlc, rspec[0], phylen);
4169 txh->MModeLen = cpu_to_le16(mmodelen); 4170 txh->MModeLen = cpu_to_le16(mmodelen);
4170 } 4171 }
4171 4172
4172 if (IS_MCS(rspec[1]) && (preamble_type[1] == WLC_MM_PREAMBLE)) { 4173 if (IS_MCS(rspec[1]) &&
4174 (preamble_type[1] == BRCMS_MM_PREAMBLE)) {
4173 u16 mmodefbrlen = 4175 u16 mmodefbrlen =
4174 brcms_c_calc_lsig_len(wlc, rspec[1], phylen); 4176 brcms_c_calc_lsig_len(wlc, rspec[1], phylen);
4175 txh->MModeFbrLen = cpu_to_le16(mmodefbrlen); 4177 txh->MModeFbrLen = cpu_to_le16(mmodefbrlen);
@@ -4290,7 +4292,6 @@ static void brcms_c_war16165(struct brcms_c_info *wlc, bool tx)
4290} 4292}
4291 4293
4292/* process an individual struct tx_status */ 4294/* process an individual struct tx_status */
4293/* WLC_HIGH_API */
4294bool 4295bool
4295brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs, u32 frm_tx2) 4296brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs, u32 frm_tx2)
4296{ 4297{
@@ -4329,7 +4330,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs, u32 frm_tx2)
4329 } 4330 }
4330 4331
4331 p = GETNEXTTXP(wlc, queue); 4332 p = GETNEXTTXP(wlc, queue);
4332 if (WLC_WAR16165(wlc)) 4333 if (BRCMS_WAR16165(wlc))
4333 brcms_c_war16165(wlc, false); 4334 brcms_c_war16165(wlc, false);
4334 if (p == NULL) 4335 if (p == NULL)
4335 goto fatal; 4336 goto fatal;
@@ -4389,8 +4390,8 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs, u32 frm_tx2)
4389 fbl; 4390 fbl;
4390 4391
4391 if (queue < AC_COUNT) { 4392 if (queue < AC_COUNT) {
4392 sfbl = WLC_WME_RETRY_SFB_GET(wlc, wme_fifo2ac[queue]); 4393 sfbl = BRCMS_WME_RETRY_SFB_GET(wlc, wme_fifo2ac[queue]);
4393 lfbl = WLC_WME_RETRY_LFB_GET(wlc, wme_fifo2ac[queue]); 4394 lfbl = BRCMS_WME_RETRY_LFB_GET(wlc, wme_fifo2ac[queue]);
4394 } else { 4395 } else {
4395 sfbl = wlc->SFBL; 4396 sfbl = wlc->SFBL;
4396 lfbl = wlc->LFBL; 4397 lfbl = wlc->LFBL;
@@ -4461,12 +4462,12 @@ brcms_c_txfifo_complete(struct brcms_c_info *wlc, uint fifo, s8 txpktpend)
4461 TXPKTPENDGET(wlc, fifo)); 4462 TXPKTPENDGET(wlc, fifo));
4462 4463
4463 /* There is more room; mark precedences related to this FIFO sendable */ 4464 /* There is more room; mark precedences related to this FIFO sendable */
4464 WLC_TX_FIFO_ENAB(wlc, fifo); 4465 BRCMS_TX_FIFO_ENAB(wlc, fifo);
4465 4466
4466 /* Clear MHF2_TXBCMC_NOW flag if BCMC fifo has drained */ 4467 /* Clear MHF2_TXBCMC_NOW flag if BCMC fifo has drained */
4467 if (AP_ENAB(wlc->pub) && 4468 if (AP_ENAB(wlc->pub) &&
4468 !TXPKTPENDGET(wlc, TX_BCMC_FIFO)) { 4469 !TXPKTPENDGET(wlc, TX_BCMC_FIFO)) {
4469 brcms_c_mhf(wlc, MHF2, MHF2_TXBCMC_NOW, 0, WLC_BAND_AUTO); 4470 brcms_c_mhf(wlc, MHF2, MHF2_TXBCMC_NOW, 0, BRCM_BAND_AUTO);
4470 } 4471 }
4471 4472
4472 /* figure out which bsscfg is being worked on... */ 4473 /* figure out which bsscfg is being worked on... */
@@ -4539,7 +4540,7 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
4539 rx_status->mactime = brcms_c_recover_tsf64(wlc, wlc_rxh); 4540 rx_status->mactime = brcms_c_recover_tsf64(wlc, wlc_rxh);
4540 rx_status->flag |= RX_FLAG_MACTIME_MPDU; 4541 rx_status->flag |= RX_FLAG_MACTIME_MPDU;
4541 4542
4542 channel = WLC_CHAN_CHANNEL(rxh->RxChan); 4543 channel = BRCMS_CHAN_CHANNEL(rxh->RxChan);
4543 4544
4544 if (channel > 14) { 4545 if (channel > 14) {
4545 rx_status->band = IEEE80211_BAND_5GHZ; 4546 rx_status->band = IEEE80211_BAND_5GHZ;
@@ -4567,40 +4568,40 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
4567 rx_status->flag |= RX_FLAG_40MHZ; 4568 rx_status->flag |= RX_FLAG_40MHZ;
4568 } else { 4569 } else {
4569 switch (RSPEC2RATE(rspec)) { 4570 switch (RSPEC2RATE(rspec)) {
4570 case WLC_RATE_1M: 4571 case BRCM_RATE_1M:
4571 rx_status->rate_idx = 0; 4572 rx_status->rate_idx = 0;
4572 break; 4573 break;
4573 case WLC_RATE_2M: 4574 case BRCM_RATE_2M:
4574 rx_status->rate_idx = 1; 4575 rx_status->rate_idx = 1;
4575 break; 4576 break;
4576 case WLC_RATE_5M5: 4577 case BRCM_RATE_5M5:
4577 rx_status->rate_idx = 2; 4578 rx_status->rate_idx = 2;
4578 break; 4579 break;
4579 case WLC_RATE_11M: 4580 case BRCM_RATE_11M:
4580 rx_status->rate_idx = 3; 4581 rx_status->rate_idx = 3;
4581 break; 4582 break;
4582 case WLC_RATE_6M: 4583 case BRCM_RATE_6M:
4583 rx_status->rate_idx = 4; 4584 rx_status->rate_idx = 4;
4584 break; 4585 break;
4585 case WLC_RATE_9M: 4586 case BRCM_RATE_9M:
4586 rx_status->rate_idx = 5; 4587 rx_status->rate_idx = 5;
4587 break; 4588 break;
4588 case WLC_RATE_12M: 4589 case BRCM_RATE_12M:
4589 rx_status->rate_idx = 6; 4590 rx_status->rate_idx = 6;
4590 break; 4591 break;
4591 case WLC_RATE_18M: 4592 case BRCM_RATE_18M:
4592 rx_status->rate_idx = 7; 4593 rx_status->rate_idx = 7;
4593 break; 4594 break;
4594 case WLC_RATE_24M: 4595 case BRCM_RATE_24M:
4595 rx_status->rate_idx = 8; 4596 rx_status->rate_idx = 8;
4596 break; 4597 break;
4597 case WLC_RATE_36M: 4598 case BRCM_RATE_36M:
4598 rx_status->rate_idx = 9; 4599 rx_status->rate_idx = 9;
4599 break; 4600 break;
4600 case WLC_RATE_48M: 4601 case BRCM_RATE_48M:
4601 rx_status->rate_idx = 10; 4602 rx_status->rate_idx = 10;
4602 break; 4603 break;
4603 case WLC_RATE_54M: 4604 case BRCM_RATE_54M:
4604 rx_status->rate_idx = 11; 4605 rx_status->rate_idx = 11;
4605 break; 4606 break;
4606 default: 4607 default:
@@ -4660,7 +4661,6 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
4660 * Return true if more frames need to be processed. false otherwise. 4661 * Return true if more frames need to be processed. false otherwise.
4661 * Param 'bound' indicates max. # frames to process before break out. 4662 * Param 'bound' indicates max. # frames to process before break out.
4662 */ 4663 */
4663/* WLC_HIGH_API */
4664void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p) 4664void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p)
4665{ 4665{
4666 struct d11rxhdr *rxh; 4666 struct d11rxhdr *rxh;
@@ -4674,7 +4674,7 @@ void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p)
4674 rxh = (struct d11rxhdr *) (p->data); 4674 rxh = (struct d11rxhdr *) (p->data);
4675 4675
4676 /* strip off rxhdr */ 4676 /* strip off rxhdr */
4677 skb_pull(p, WL_HWRXOFF); 4677 skb_pull(p, BRCMS_HWRXOFF);
4678 4678
4679 /* fixup rx header endianness */ 4679 /* fixup rx header endianness */
4680 rxh->RxFrameSize = le16_to_cpu(rxh->RxFrameSize); 4680 rxh->RxFrameSize = le16_to_cpu(rxh->RxFrameSize);
@@ -4808,7 +4808,7 @@ brcms_c_calc_frame_time(struct brcms_c_info *wlc, ratespec_t ratespec,
4808 if (rate == 0) { 4808 if (rate == 0) {
4809 wiphy_err(wlc->wiphy, "wl%d: WAR: using rate of 1 mbps\n", 4809 wiphy_err(wlc->wiphy, "wl%d: WAR: using rate of 1 mbps\n",
4810 wlc->pub->unit); 4810 wlc->pub->unit);
4811 rate = WLC_RATE_1M; 4811 rate = BRCM_RATE_1M;
4812 } 4812 }
4813 4813
4814 BCMMSG(wlc->wiphy, "wl%d: rspec 0x%x, preamble_type %d, len%d\n", 4814 BCMMSG(wlc->wiphy, "wl%d: rspec 0x%x, preamble_type %d, len%d\n",
@@ -4819,7 +4819,7 @@ brcms_c_calc_frame_time(struct brcms_c_info *wlc, ratespec_t ratespec,
4819 int tot_streams = MCS_TXS(mcs) + RSPEC_STC(ratespec); 4819 int tot_streams = MCS_TXS(mcs) + RSPEC_STC(ratespec);
4820 4820
4821 dur = PREN_PREAMBLE + (tot_streams * PREN_PREAMBLE_EXT); 4821 dur = PREN_PREAMBLE + (tot_streams * PREN_PREAMBLE_EXT);
4822 if (preamble_type == WLC_MM_PREAMBLE) 4822 if (preamble_type == BRCMS_MM_PREAMBLE)
4823 dur += PREN_MM_EXT; 4823 dur += PREN_MM_EXT;
4824 /* 1000Ndbps = kbps * 4 */ 4824 /* 1000Ndbps = kbps * 4 */
4825 kNdps = 4825 kNdps =
@@ -4858,7 +4858,7 @@ brcms_c_calc_frame_time(struct brcms_c_info *wlc, ratespec_t ratespec,
4858 mac_len = mac_len * 8 * 2; 4858 mac_len = mac_len * 8 * 2;
4859 /* calc ceiling of bits/rate = microseconds of air time */ 4859 /* calc ceiling of bits/rate = microseconds of air time */
4860 dur = (mac_len + rate - 1) / rate; 4860 dur = (mac_len + rate - 1) / rate;
4861 if (preamble_type & WLC_SHORT_PREAMBLE) 4861 if (preamble_type & BRCMS_SHORT_PREAMBLE)
4862 dur += BPHY_PLCP_SHORT_TIME; 4862 dur += BPHY_PLCP_SHORT_TIME;
4863 else 4863 else
4864 dur += BPHY_PLCP_TIME; 4864 dur += BPHY_PLCP_TIME;
@@ -4902,7 +4902,7 @@ brcms_c_calc_frame_len(struct brcms_c_info *wlc, ratespec_t ratespec,
4902 ((nsyms * Ndps) - 4902 ((nsyms * Ndps) -
4903 (APHY_SERVICE_NBITS + APHY_TAIL_NBITS)) / 8; 4903 (APHY_SERVICE_NBITS + APHY_TAIL_NBITS)) / 8;
4904 } else { 4904 } else {
4905 if (preamble_type & WLC_SHORT_PREAMBLE) 4905 if (preamble_type & BRCMS_SHORT_PREAMBLE)
4906 dur -= BPHY_PLCP_SHORT_TIME; 4906 dur -= BPHY_PLCP_SHORT_TIME;
4907 else 4907 else
4908 dur -= BPHY_PLCP_TIME; 4908 dur -= BPHY_PLCP_TIME;
@@ -4922,7 +4922,7 @@ brcms_c_calc_ba_time(struct brcms_c_info *wlc, ratespec_t rspec,
4922 /* Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that is less than 4922 /* Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that is less than
4923 * or equal to the rate of the immediately previous frame in the FES 4923 * or equal to the rate of the immediately previous frame in the FES
4924 */ 4924 */
4925 rspec = WLC_BASIC_RATE(wlc, rspec); 4925 rspec = BRCMS_BASIC_RATE(wlc, rspec);
4926 /* BA len == 32 == 16(ctl hdr) + 4(ba len) + 8(bitmap) + 4(fcs) */ 4926 /* BA len == 32 == 16(ctl hdr) + 4(ba len) + 8(bitmap) + 4(fcs) */
4927 return brcms_c_calc_frame_time(wlc, rspec, preamble_type, 4927 return brcms_c_calc_frame_time(wlc, rspec, preamble_type,
4928 (DOT11_BA_LEN + DOT11_BA_BITMAP_LEN + 4928 (DOT11_BA_LEN + DOT11_BA_BITMAP_LEN +
@@ -4940,7 +4940,7 @@ brcms_c_calc_ack_time(struct brcms_c_info *wlc, ratespec_t rspec,
4940 /* Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that is less than 4940 /* Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that is less than
4941 * or equal to the rate of the immediately previous frame in the FES 4941 * or equal to the rate of the immediately previous frame in the FES
4942 */ 4942 */
4943 rspec = WLC_BASIC_RATE(wlc, rspec); 4943 rspec = BRCMS_BASIC_RATE(wlc, rspec);
4944 /* ACK frame len == 14 == 2(fc) + 2(dur) + 6(ra) + 4(fcs) */ 4944 /* ACK frame len == 14 == 2(fc) + 2(dur) + 6(ra) + 4(fcs) */
4945 dur = 4945 dur =
4946 brcms_c_calc_frame_time(wlc, rspec, preamble_type, 4946 brcms_c_calc_frame_time(wlc, rspec, preamble_type,
@@ -4968,20 +4968,20 @@ void brcms_c_rate_lookup_init(struct brcms_c_info *wlc, wlc_rateset_t *rateset)
4968 uint i; 4968 uint i;
4969 4969
4970 /* incoming rates are in 500kbps units as in 802.11 Supported Rates */ 4970 /* incoming rates are in 500kbps units as in 802.11 Supported Rates */
4971 memset(br, 0, WLC_MAXRATE + 1); 4971 memset(br, 0, BRCM_MAXRATE + 1);
4972 4972
4973 /* For each basic rate in the rates list, make an entry in the 4973 /* For each basic rate in the rates list, make an entry in the
4974 * best basic lookup. 4974 * best basic lookup.
4975 */ 4975 */
4976 for (i = 0; i < rateset->count; i++) { 4976 for (i = 0; i < rateset->count; i++) {
4977 /* only make an entry for a basic rate */ 4977 /* only make an entry for a basic rate */
4978 if (!(rateset->rates[i] & WLC_RATE_FLAG)) 4978 if (!(rateset->rates[i] & BRCMS_RATE_FLAG))
4979 continue; 4979 continue;
4980 4980
4981 /* mask off basic bit */ 4981 /* mask off basic bit */
4982 rate = (rateset->rates[i] & WLC_RATE_MASK); 4982 rate = (rateset->rates[i] & BRCMS_RATE_MASK);
4983 4983
4984 if (rate > WLC_MAXRATE) { 4984 if (rate > BRCM_MAXRATE) {
4985 wiphy_err(wlc->wiphy, "brcms_c_rate_lookup_init: " 4985 wiphy_err(wlc->wiphy, "brcms_c_rate_lookup_init: "
4986 "invalid rate 0x%X in rate set\n", 4986 "invalid rate 0x%X in rate set\n",
4987 rateset->rates[i]); 4987 rateset->rates[i]);
@@ -5033,12 +5033,12 @@ void brcms_c_rate_lookup_init(struct brcms_c_info *wlc, wlc_rateset_t *rateset)
5033 5033
5034 if (IS_OFDM(rate)) { 5034 if (IS_OFDM(rate)) {
5035 /* In 11g and 11a, the OFDM mandatory rates are 6, 12, and 24 Mbps */ 5035 /* In 11g and 11a, the OFDM mandatory rates are 6, 12, and 24 Mbps */
5036 if (rate >= WLC_RATE_24M) 5036 if (rate >= BRCM_RATE_24M)
5037 mandatory = WLC_RATE_24M; 5037 mandatory = BRCM_RATE_24M;
5038 else if (rate >= WLC_RATE_12M) 5038 else if (rate >= BRCM_RATE_12M)
5039 mandatory = WLC_RATE_12M; 5039 mandatory = BRCM_RATE_12M;
5040 else 5040 else
5041 mandatory = WLC_RATE_6M; 5041 mandatory = BRCM_RATE_6M;
5042 } else { 5042 } else {
5043 /* In 11b, all the CCK rates are mandatory 1 - 11 Mbps */ 5043 /* In 11b, all the CCK rates are mandatory 1 - 11 Mbps */
5044 mandatory = rate; 5044 mandatory = rate;
@@ -5066,8 +5066,8 @@ static void brcms_c_write_rate_shm(struct brcms_c_info *wlc, u8 rate,
5066 * for a given rate, the LS-nibble of the PLCP SIGNAL field is 5066 * for a given rate, the LS-nibble of the PLCP SIGNAL field is
5067 * the index into the rate table. 5067 * the index into the rate table.
5068 */ 5068 */
5069 phy_rate = rate_info[rate] & WLC_RATE_MASK; 5069 phy_rate = rate_info[rate] & BRCMS_RATE_MASK;
5070 basic_phy_rate = rate_info[basic_rate] & WLC_RATE_MASK; 5070 basic_phy_rate = rate_info[basic_rate] & BRCMS_RATE_MASK;
5071 index = phy_rate & 0xf; 5071 index = phy_rate & 0xf;
5072 basic_index = basic_phy_rate & 0xf; 5072 basic_index = basic_phy_rate & 0xf;
5073 5073
@@ -5086,7 +5086,7 @@ static const wlc_rateset_t *brcms_c_rateset_get_hwrs(struct brcms_c_info *wlc)
5086{ 5086{
5087 const wlc_rateset_t *rs_dflt; 5087 const wlc_rateset_t *rs_dflt;
5088 5088
5089 if (WLC_PHY_11N_CAP(wlc->band)) { 5089 if (BRCMS_PHY_11N_CAP(wlc->band)) {
5090 if (BAND_5G(wlc->band->bandtype)) 5090 if (BAND_5G(wlc->band->bandtype))
5091 rs_dflt = &ofdm_mimo_rates; 5091 rs_dflt = &ofdm_mimo_rates;
5092 else 5092 else
@@ -5113,17 +5113,17 @@ void brcms_c_set_ratetable(struct brcms_c_info *wlc)
5113 5113
5114 /* walk the phy rate table and update SHM basic rate lookup table */ 5114 /* walk the phy rate table and update SHM basic rate lookup table */
5115 for (i = 0; i < rs.count; i++) { 5115 for (i = 0; i < rs.count; i++) {
5116 rate = rs.rates[i] & WLC_RATE_MASK; 5116 rate = rs.rates[i] & BRCMS_RATE_MASK;
5117 5117
5118 /* for a given rate WLC_BASIC_RATE returns the rate at 5118 /* for a given rate BRCMS_BASIC_RATE returns the rate at
5119 * which a response ACK/CTS should be sent. 5119 * which a response ACK/CTS should be sent.
5120 */ 5120 */
5121 basic_rate = WLC_BASIC_RATE(wlc, rate); 5121 basic_rate = BRCMS_BASIC_RATE(wlc, rate);
5122 if (basic_rate == 0) { 5122 if (basic_rate == 0) {
5123 /* This should only happen if we are using a 5123 /* This should only happen if we are using a
5124 * restricted rateset. 5124 * restricted rateset.
5125 */ 5125 */
5126 basic_rate = rs.rates[0] & WLC_RATE_MASK; 5126 basic_rate = rs.rates[0] & BRCMS_RATE_MASK;
5127 } 5127 }
5128 5128
5129 brcms_c_write_rate_shm(wlc, rate, basic_rate); 5129 brcms_c_write_rate_shm(wlc, rate, basic_rate);
@@ -5132,7 +5132,7 @@ void brcms_c_set_ratetable(struct brcms_c_info *wlc)
5132 5132
5133/* 5133/*
5134 * Return true if the specified rate is supported by the specified band. 5134 * Return true if the specified rate is supported by the specified band.
5135 * WLC_BAND_AUTO indicates the current band. 5135 * BRCM_BAND_AUTO indicates the current band.
5136 */ 5136 */
5137bool brcms_c_valid_rate(struct brcms_c_info *wlc, ratespec_t rspec, int band, 5137bool brcms_c_valid_rate(struct brcms_c_info *wlc, ratespec_t rspec, int band,
5138 bool verbose) 5138 bool verbose)
@@ -5140,7 +5140,7 @@ bool brcms_c_valid_rate(struct brcms_c_info *wlc, ratespec_t rspec, int band,
5140 wlc_rateset_t *hw_rateset; 5140 wlc_rateset_t *hw_rateset;
5141 uint i; 5141 uint i;
5142 5142
5143 if ((band == WLC_BAND_AUTO) || (band == wlc->band->bandtype)) { 5143 if ((band == BRCM_BAND_AUTO) || (band == wlc->band->bandtype)) {
5144 hw_rateset = &wlc->band->hw_rateset; 5144 hw_rateset = &wlc->band->hw_rateset;
5145 } else if (NBANDS(wlc) > 1) { 5145 } else if (NBANDS(wlc) > 1) {
5146 hw_rateset = &wlc->bandstate[OTHERBANDUNIT(wlc)]->hw_rateset; 5146 hw_rateset = &wlc->bandstate[OTHERBANDUNIT(wlc)]->hw_rateset;
@@ -5178,14 +5178,14 @@ static void brcms_c_update_mimo_band_bwcap(struct brcms_c_info *wlc, u8 bwcap)
5178 if (IS_SINGLEBAND_5G(wlc->deviceid)) 5178 if (IS_SINGLEBAND_5G(wlc->deviceid))
5179 i = BAND_5G_INDEX; 5179 i = BAND_5G_INDEX;
5180 band = wlc->bandstate[i]; 5180 band = wlc->bandstate[i];
5181 if (band->bandtype == WLC_BAND_5G) { 5181 if (band->bandtype == BRCM_BAND_5G) {
5182 if ((bwcap == WLC_N_BW_40ALL) 5182 if ((bwcap == BRCMS_N_BW_40ALL)
5183 || (bwcap == WLC_N_BW_20IN2G_40IN5G)) 5183 || (bwcap == BRCMS_N_BW_20IN2G_40IN5G))
5184 band->mimo_cap_40 = true; 5184 band->mimo_cap_40 = true;
5185 else 5185 else
5186 band->mimo_cap_40 = false; 5186 band->mimo_cap_40 = false;
5187 } else { 5187 } else {
5188 if (bwcap == WLC_N_BW_40ALL) 5188 if (bwcap == BRCMS_N_BW_40ALL)
5189 band->mimo_cap_40 = true; 5189 band->mimo_cap_40 = true;
5190 else 5190 else
5191 band->mimo_cap_40 = false; 5191 band->mimo_cap_40 = false;
@@ -5212,7 +5212,7 @@ void brcms_c_mod_prb_rsp_rate_table(struct brcms_c_info *wlc, uint frame_len)
5212 5212
5213 /* walk the phy rate table and update MAC core SHM basic rate table entries */ 5213 /* walk the phy rate table and update MAC core SHM basic rate table entries */
5214 for (i = 0; i < rs.count; i++) { 5214 for (i = 0; i < rs.count; i++) {
5215 rate = rs.rates[i] & WLC_RATE_MASK; 5215 rate = rs.rates[i] & BRCMS_RATE_MASK;
5216 5216
5217 entry_ptr = brcms_c_rate_shm_offset(wlc, rate); 5217 entry_ptr = brcms_c_rate_shm_offset(wlc, rate);
5218 5218
@@ -5220,9 +5220,8 @@ void brcms_c_mod_prb_rsp_rate_table(struct brcms_c_info *wlc, uint frame_len)
5220 brcms_c_compute_plcp(wlc, rate, frame_len, plcp); 5220 brcms_c_compute_plcp(wlc, rate, frame_len, plcp);
5221 5221
5222 /* Calculate the duration of the Probe Response frame plus SIFS for the MAC */ 5222 /* Calculate the duration of the Probe Response frame plus SIFS for the MAC */
5223 dur = 5223 dur = (u16) brcms_c_calc_frame_time(wlc, rate,
5224 (u16) brcms_c_calc_frame_time(wlc, rate, WLC_LONG_PREAMBLE, 5224 BRCMS_LONG_PREAMBLE, frame_len);
5225 frame_len);
5226 dur += sifs; 5225 dur += sifs;
5227 5226
5228 /* Update the SHM Rate Table entry Probe Response values */ 5227 /* Update the SHM Rate Table entry Probe Response values */
@@ -5465,7 +5464,7 @@ int brcms_c_prep_pdu(struct brcms_c_info *wlc, struct sk_buff *pdu, uint *fifop)
5465 /* return if insufficient dma resources */ 5464 /* return if insufficient dma resources */
5466 if (TXAVAIL(wlc, fifo) < MAX_DMA_SEGS) { 5465 if (TXAVAIL(wlc, fifo) < MAX_DMA_SEGS) {
5467 /* Mark precedences related to this FIFO, unsendable */ 5466 /* Mark precedences related to this FIFO, unsendable */
5468 WLC_TX_FIFO_CLEAR(wlc, fifo); 5467 BRCMS_TX_FIFO_CLEAR(wlc, fifo);
5469 return -EBUSY; 5468 return -EBUSY;
5470 } 5469 }
5471 return 0; 5470 return 0;
@@ -5492,7 +5491,7 @@ void brcms_c_bsscfg_reprate_init(struct brcms_bss_cfg *bsscfg)
5492void brcms_default_rateset(struct brcms_c_info *wlc, wlc_rateset_t *rs) 5491void brcms_default_rateset(struct brcms_c_info *wlc, wlc_rateset_t *rs)
5493{ 5492{
5494 brcms_c_rateset_default(rs, NULL, wlc->band->phytype, 5493 brcms_c_rateset_default(rs, NULL, wlc->band->phytype,
5495 wlc->band->bandtype, false, WLC_RATE_MASK_FULL, 5494 wlc->band->bandtype, false, BRCMS_RATE_MASK_FULL,
5496 (bool) N_ENAB(wlc->pub), 5495 (bool) N_ENAB(wlc->pub),
5497 CHSPEC_WLC_BW(wlc->default_bss->chanspec), 5496 CHSPEC_WLC_BW(wlc->default_bss->chanspec),
5498 wlc->stf->txstreams); 5497 wlc->stf->txstreams);
@@ -5517,17 +5516,17 @@ static void brcms_c_bss_default_init(struct brcms_c_info *wlc)
5517 5516
5518 /* find the band of our default channel */ 5517 /* find the band of our default channel */
5519 band = wlc->band; 5518 band = wlc->band;
5520 if (NBANDS(wlc) > 1 && band->bandunit != CHSPEC_WLCBANDUNIT(chanspec)) 5519 if (NBANDS(wlc) > 1 && band->bandunit != CHSPEC_BANDUNIT(chanspec))
5521 band = wlc->bandstate[OTHERBANDUNIT(wlc)]; 5520 band = wlc->bandstate[OTHERBANDUNIT(wlc)];
5522 5521
5523 /* init bss rates to the band specific default rate set */ 5522 /* init bss rates to the band specific default rate set */
5524 brcms_c_rateset_default(&bi->rateset, NULL, band->phytype, 5523 brcms_c_rateset_default(&bi->rateset, NULL, band->phytype,
5525 band->bandtype, false, WLC_RATE_MASK_FULL, 5524 band->bandtype, false, BRCMS_RATE_MASK_FULL,
5526 (bool) N_ENAB(wlc->pub), CHSPEC_WLC_BW(chanspec), 5525 (bool) N_ENAB(wlc->pub), CHSPEC_WLC_BW(chanspec),
5527 wlc->stf->txstreams); 5526 wlc->stf->txstreams);
5528 5527
5529 if (N_ENAB(wlc->pub)) 5528 if (N_ENAB(wlc->pub))
5530 bi->flags |= WLC_BSS_HT; 5529 bi->flags |= BRCMS_BSS_HT;
5531} 5530}
5532 5531
5533static ratespec_t 5532static ratespec_t
@@ -5552,7 +5551,7 @@ mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band,
5552 /* mcs only allowed when nmode */ 5551 /* mcs only allowed when nmode */
5553 if (stf > PHY_TXC1_MODE_SDM) { 5552 if (stf > PHY_TXC1_MODE_SDM) {
5554 wiphy_err(wlc->wiphy, "wl%d: %s: Invalid stf\n", 5553 wiphy_err(wlc->wiphy, "wl%d: %s: Invalid stf\n",
5555 WLCWLUNIT(wlc), __func__); 5554 BRCMS_UNIT(wlc), __func__);
5556 bcmerror = -EINVAL; 5555 bcmerror = -EINVAL;
5557 goto done; 5556 goto done;
5558 } 5557 }
@@ -5563,7 +5562,7 @@ mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band,
5563 ((stf != PHY_TXC1_MODE_SISO) 5562 ((stf != PHY_TXC1_MODE_SISO)
5564 && (stf != PHY_TXC1_MODE_CDD))) { 5563 && (stf != PHY_TXC1_MODE_CDD))) {
5565 wiphy_err(wlc->wiphy, "wl%d: %s: Invalid mcs " 5564 wiphy_err(wlc->wiphy, "wl%d: %s: Invalid mcs "
5566 "32\n", WLCWLUNIT(wlc), __func__); 5565 "32\n", BRCMS_UNIT(wlc), __func__);
5567 bcmerror = -EINVAL; 5566 bcmerror = -EINVAL;
5568 goto done; 5567 goto done;
5569 } 5568 }
@@ -5573,16 +5572,16 @@ mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band,
5573 if (stf != PHY_TXC1_MODE_SDM) { 5572 if (stf != PHY_TXC1_MODE_SDM) {
5574 BCMMSG(wlc->wiphy, "wl%d: enabling " 5573 BCMMSG(wlc->wiphy, "wl%d: enabling "
5575 "SDM mode for mcs %d\n", 5574 "SDM mode for mcs %d\n",
5576 WLCWLUNIT(wlc), rate); 5575 BRCMS_UNIT(wlc), rate);
5577 stf = PHY_TXC1_MODE_SDM; 5576 stf = PHY_TXC1_MODE_SDM;
5578 } 5577 }
5579 } else { 5578 } else {
5580 /* MCS 0-7 may use SISO, CDD, and for phy_rev >= 3 STBC */ 5579 /* MCS 0-7 may use SISO, CDD, and for phy_rev >= 3 STBC */
5581 if ((stf > PHY_TXC1_MODE_STBC) || 5580 if ((stf > PHY_TXC1_MODE_STBC) ||
5582 (!WLC_STBC_CAP_PHY(wlc) 5581 (!BRCMS_STBC_CAP_PHY(wlc)
5583 && (stf == PHY_TXC1_MODE_STBC))) { 5582 && (stf == PHY_TXC1_MODE_STBC))) {
5584 wiphy_err(wlc->wiphy, "wl%d: %s: Invalid STBC" 5583 wiphy_err(wlc->wiphy, "wl%d: %s: Invalid STBC"
5585 "\n", WLCWLUNIT(wlc), __func__); 5584 "\n", BRCMS_UNIT(wlc), __func__);
5586 bcmerror = -EINVAL; 5585 bcmerror = -EINVAL;
5587 goto done; 5586 goto done;
5588 } 5587 }
@@ -5590,28 +5589,28 @@ mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band,
5590 } else if (IS_OFDM(rate)) { 5589 } else if (IS_OFDM(rate)) {
5591 if ((stf != PHY_TXC1_MODE_CDD) && (stf != PHY_TXC1_MODE_SISO)) { 5590 if ((stf != PHY_TXC1_MODE_CDD) && (stf != PHY_TXC1_MODE_SISO)) {
5592 wiphy_err(wlc->wiphy, "wl%d: %s: Invalid OFDM\n", 5591 wiphy_err(wlc->wiphy, "wl%d: %s: Invalid OFDM\n",
5593 WLCWLUNIT(wlc), __func__); 5592 BRCMS_UNIT(wlc), __func__);
5594 bcmerror = -EINVAL; 5593 bcmerror = -EINVAL;
5595 goto done; 5594 goto done;
5596 } 5595 }
5597 } else if (IS_CCK(rate)) { 5596 } else if (IS_CCK(rate)) {
5598 if ((cur_band->bandtype != WLC_BAND_2G) 5597 if ((cur_band->bandtype != BRCM_BAND_2G)
5599 || (stf != PHY_TXC1_MODE_SISO)) { 5598 || (stf != PHY_TXC1_MODE_SISO)) {
5600 wiphy_err(wlc->wiphy, "wl%d: %s: Invalid CCK\n", 5599 wiphy_err(wlc->wiphy, "wl%d: %s: Invalid CCK\n",
5601 WLCWLUNIT(wlc), __func__); 5600 BRCMS_UNIT(wlc), __func__);
5602 bcmerror = -EINVAL; 5601 bcmerror = -EINVAL;
5603 goto done; 5602 goto done;
5604 } 5603 }
5605 } else { 5604 } else {
5606 wiphy_err(wlc->wiphy, "wl%d: %s: Unknown rate type\n", 5605 wiphy_err(wlc->wiphy, "wl%d: %s: Unknown rate type\n",
5607 WLCWLUNIT(wlc), __func__); 5606 BRCMS_UNIT(wlc), __func__);
5608 bcmerror = -EINVAL; 5607 bcmerror = -EINVAL;
5609 goto done; 5608 goto done;
5610 } 5609 }
5611 /* make sure multiple antennae are available for non-siso rates */ 5610 /* make sure multiple antennae are available for non-siso rates */
5612 if ((stf != PHY_TXC1_MODE_SISO) && (wlc->stf->txstreams == 1)) { 5611 if ((stf != PHY_TXC1_MODE_SISO) && (wlc->stf->txstreams == 1)) {
5613 wiphy_err(wlc->wiphy, "wl%d: %s: SISO antenna but !SISO " 5612 wiphy_err(wlc->wiphy, "wl%d: %s: SISO antenna but !SISO "
5614 "request\n", WLCWLUNIT(wlc), __func__); 5613 "request\n", BRCMS_UNIT(wlc), __func__);
5615 bcmerror = -EINVAL; 5614 bcmerror = -EINVAL;
5616 goto done; 5615 goto done;
5617 } 5616 }
@@ -5877,7 +5876,7 @@ brcms_c_txflowcontrol_signal(struct brcms_c_info *wlc,
5877 struct brcms_c_if *wlcif; 5876 struct brcms_c_if *wlcif;
5878 5877
5879 for (wlcif = wlc->wlcif_list; wlcif != NULL; wlcif = wlcif->next) { 5878 for (wlcif = wlc->wlcif_list; wlcif != NULL; wlcif = wlcif->next) {
5880 if (wlcif->qi == qi && wlcif->flags & WLC_IF_LINKED) 5879 if (wlcif->qi == qi && wlcif->flags & BRCMS_IF_LINKED)
5881 brcms_txflowcontrol(wlc->wl, wlcif->wlif, on, prio); 5880 brcms_txflowcontrol(wlc->wl, wlcif->wlif, on, prio);
5882 } 5881 }
5883#endif 5882#endif
@@ -5895,7 +5894,7 @@ static struct brcms_txq_info *brcms_c_txq_alloc(struct brcms_c_info *wlc)
5895 * leave PS mode. The watermark for flowcontrol to OS packets 5894 * leave PS mode. The watermark for flowcontrol to OS packets
5896 * will remain the same 5895 * will remain the same
5897 */ 5896 */
5898 brcmu_pktq_init(&qi->q, WLC_PREC_COUNT, 5897 brcmu_pktq_init(&qi->q, BRCMS_PREC_COUNT,
5899 (2 * wlc->pub->tunables->datahiwat) + PKTQ_LEN_DEFAULT 5898 (2 * wlc->pub->tunables->datahiwat) + PKTQ_LEN_DEFAULT
5900 + wlc->pub->psq_pkts_total); 5899 + wlc->pub->psq_pkts_total);
5901 5900
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index 80b08a93c04..2d0a56777d7 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -24,10 +24,12 @@
24#include "d11.h" 24#include "d11.h"
25 25
26#define MA_WINDOW_SZ 8 /* moving average window size */ 26#define MA_WINDOW_SZ 8 /* moving average window size */
27#define WL_HWRXOFF 38 /* chip rx buffer offset */ 27#define BRCMS_HWRXOFF 38 /* chip rx buffer offset */
28#define INVCHANNEL 255 /* invalid channel */ 28#define INVCHANNEL 255 /* invalid channel */
29#define MAXCOREREV 28 /* max # supported core revisions (0 .. MAXCOREREV - 1) */ 29/* max # supported core revisions (0 .. MAXCOREREV - 1) */
30#define WLC_MAXMODULES 22 /* max # brcms_c_module_register() calls */ 30#define MAXCOREREV 28
31/* max # brcms_c_module_register() calls */
32#define BRCMS_MAXMODULES 22
31 33
32#define SEQNUM_SHIFT 4 34#define SEQNUM_SHIFT 4
33#define AMPDU_DELIMITER_LEN 4 35#define AMPDU_DELIMITER_LEN 4
@@ -41,14 +43,15 @@
41 43
42#define NTXRATE 64 /* # tx MPDUs rate is reported for */ 44#define NTXRATE 64 /* # tx MPDUs rate is reported for */
43 45
44#define WLC_BITSCNT(x) brcmu_bitcount((u8 *)&(x), sizeof(u8)) 46#define BRCMS_BITSCNT(x) brcmu_bitcount((u8 *)&(x), sizeof(u8))
45 47
46/* Maximum wait time for a MAC suspend */ 48/* Maximum wait time for a MAC suspend */
47#define WLC_MAX_MAC_SUSPEND 83000 /* uS: 83mS is max packet time (64KB ampdu @ 6Mbps) */ 49/* uS: 83mS is max packet time (64KB ampdu @ 6Mbps) */
50#define BRCMS_MAX_MAC_SUSPEND 83000
48 51
49/* Probe Response timeout - responses for probe requests older that this are tossed, zero to disable 52/* Probe Response timeout - responses for probe requests older that this are tossed, zero to disable
50 */ 53 */
51#define WLC_PRB_RESP_TIMEOUT 0 /* Disable probe response timeout */ 54#define BRCMS_PRB_RESP_TIMEOUT 0 /* Disable probe response timeout */
52 55
53/* transmit buffer max headroom for protocol headers */ 56/* transmit buffer max headroom for protocol headers */
54#define TXOFF (D11_TXH_LEN + D11_PHY_HDR_LEN) 57#define TXOFF (D11_TXH_LEN + D11_PHY_HDR_LEN)
@@ -83,26 +86,28 @@
83#define VALID_COREREV(corerev) CONF_HAS(D11CONF, corerev) 86#define VALID_COREREV(corerev) CONF_HAS(D11CONF, corerev)
84 87
85/* values for shortslot_override */ 88/* values for shortslot_override */
86#define WLC_SHORTSLOT_AUTO -1 /* Driver will manage Shortslot setting */ 89#define BRCMS_SHORTSLOT_AUTO -1 /* Driver will manage Shortslot setting */
87#define WLC_SHORTSLOT_OFF 0 /* Turn off short slot */ 90#define BRCMS_SHORTSLOT_OFF 0 /* Turn off short slot */
88#define WLC_SHORTSLOT_ON 1 /* Turn on short slot */ 91#define BRCMS_SHORTSLOT_ON 1 /* Turn on short slot */
89 92
90/* value for short/long and mixmode/greenfield preamble */ 93/* value for short/long and mixmode/greenfield preamble */
91 94#define BRCMS_LONG_PREAMBLE (0)
92#define WLC_LONG_PREAMBLE (0) 95#define BRCMS_SHORT_PREAMBLE (1 << 0)
93#define WLC_SHORT_PREAMBLE (1 << 0) 96#define BRCMS_GF_PREAMBLE (1 << 1)
94#define WLC_GF_PREAMBLE (1 << 1) 97#define BRCMS_MM_PREAMBLE (1 << 2)
95#define WLC_MM_PREAMBLE (1 << 2) 98#define BRCMS_IS_MIMO_PREAMBLE(_pre) (((_pre) == BRCMS_GF_PREAMBLE) || \
96#define WLC_IS_MIMO_PREAMBLE(_pre) (((_pre) == WLC_GF_PREAMBLE) || ((_pre) == WLC_MM_PREAMBLE)) 99 ((_pre) == BRCMS_MM_PREAMBLE))
97 100
98/* values for barker_preamble */ 101/* values for barker_preamble */
99#define WLC_BARKER_SHORT_ALLOWED 0 /* Short pre-amble allowed */ 102#define BRCMS_BARKER_SHORT_ALLOWED 0 /* Short pre-amble allowed */
100 103
101/* A fifo is full. Clear precedences related to that FIFO */ 104/* A fifo is full. Clear precedences related to that FIFO */
102#define WLC_TX_FIFO_CLEAR(wlc, fifo) ((wlc)->tx_prec_map &= ~(wlc)->fifo2prec_map[fifo]) 105#define BRCMS_TX_FIFO_CLEAR(wlc, fifo) \
106 ((wlc)->tx_prec_map &= ~(wlc)->fifo2prec_map[fifo])
103 107
104/* Fifo is NOT full. Enable precedences for that FIFO */ 108/* Fifo is NOT full. Enable precedences for that FIFO */
105#define WLC_TX_FIFO_ENAB(wlc, fifo) ((wlc)->tx_prec_map |= (wlc)->fifo2prec_map[fifo]) 109#define BRCMS_TX_FIFO_ENAB(wlc, fifo) \
110 ((wlc)->tx_prec_map |= (wlc)->fifo2prec_map[fifo])
106 111
107/* TxFrameID */ 112/* TxFrameID */
108/* seq and frag bits: SEQNUM_SHIFT, FRAGNUM_MASK (802.11.h) */ 113/* seq and frag bits: SEQNUM_SHIFT, FRAGNUM_MASK (802.11.h) */
@@ -121,10 +126,10 @@
121/* if wpa is in use then portopen is true when the group key is plumbed otherwise it is always true 126/* if wpa is in use then portopen is true when the group key is plumbed otherwise it is always true
122 */ 127 */
123#define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED)) 128#define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
124#define WLC_SW_KEYS(wlc, bsscfg) ((((wlc)->wsec_swkeys) || \ 129#define BRCMS_SW_KEYS(wlc, bsscfg) ((((wlc)->wsec_swkeys) || \
125 ((bsscfg)->wsec & WSEC_SWFLAG))) 130 ((bsscfg)->wsec & WSEC_SWFLAG)))
126 131
127#define WLC_PORTOPEN(cfg) \ 132#define BRCMS_PORTOPEN(cfg) \
128 (((cfg)->WPA_auth != WPA_AUTH_DISABLED && WSEC_ENABLED((cfg)->wsec)) ? \ 133 (((cfg)->WPA_auth != WPA_AUTH_DISABLED && WSEC_ENABLED((cfg)->wsec)) ? \
129 (cfg)->wsec_portopen : true) 134 (cfg)->wsec_portopen : true)
130 135
@@ -136,11 +141,11 @@
136extern const u8 prio2fifo[]; 141extern const u8 prio2fifo[];
137 142
138/* Ucode MCTL_WAKE override bits */ 143/* Ucode MCTL_WAKE override bits */
139#define WLC_WAKE_OVERRIDE_CLKCTL 0x01 144#define BRCMS_WAKE_OVERRIDE_CLKCTL 0x01
140#define WLC_WAKE_OVERRIDE_PHYREG 0x02 145#define BRCMS_WAKE_OVERRIDE_PHYREG 0x02
141#define WLC_WAKE_OVERRIDE_MACSUSPEND 0x04 146#define BRCMS_WAKE_OVERRIDE_MACSUSPEND 0x04
142#define WLC_WAKE_OVERRIDE_TXFIFO 0x08 147#define BRCMS_WAKE_OVERRIDE_TXFIFO 0x08
143#define WLC_WAKE_OVERRIDE_FORCEFAST 0x10 148#define BRCMS_WAKE_OVERRIDE_FORCEFAST 0x10
144 149
145/* stuff pulled in from wlc.c */ 150/* stuff pulled in from wlc.c */
146 151
@@ -179,24 +184,32 @@ extern const u8 prio2fifo[];
179 184
180#define NFIFO 6 /* # tx/rx fifopairs */ 185#define NFIFO 6 /* # tx/rx fifopairs */
181 186
182#define WLC_WME_RETRY_SHORT_GET(wlc, ac) GFIELD(wlc->wme_retries[ac], EDCF_SHORT) 187#define BRCMS_WME_RETRY_SHORT_GET(wlc, ac) \
183#define WLC_WME_RETRY_SFB_GET(wlc, ac) GFIELD(wlc->wme_retries[ac], EDCF_SFB) 188 GFIELD(wlc->wme_retries[ac], EDCF_SHORT)
184#define WLC_WME_RETRY_LONG_GET(wlc, ac) GFIELD(wlc->wme_retries[ac], EDCF_LONG) 189#define BRCMS_WME_RETRY_SFB_GET(wlc, ac) \
185#define WLC_WME_RETRY_LFB_GET(wlc, ac) GFIELD(wlc->wme_retries[ac], EDCF_LFB) 190 GFIELD(wlc->wme_retries[ac], EDCF_SFB)
191#define BRCMS_WME_RETRY_LONG_GET(wlc, ac) \
192 GFIELD(wlc->wme_retries[ac], EDCF_LONG)
193#define BRCMS_WME_RETRY_LFB_GET(wlc, ac) \
194 GFIELD(wlc->wme_retries[ac], EDCF_LFB)
186 195
187#define WLC_WME_RETRY_SHORT_SET(wlc, ac, val) \ 196#define BRCMS_WME_RETRY_SHORT_SET(wlc, ac, val) \
188 (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_SHORT, val)) 197 (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_SHORT, val))
189#define WLC_WME_RETRY_SFB_SET(wlc, ac, val) \ 198#define BRCMS_WME_RETRY_SFB_SET(wlc, ac, val) \
190 (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_SFB, val)) 199 (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_SFB, val))
191#define WLC_WME_RETRY_LONG_SET(wlc, ac, val) \ 200#define BRCMS_WME_RETRY_LONG_SET(wlc, ac, val) \
192 (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_LONG, val)) 201 (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_LONG, val))
193#define WLC_WME_RETRY_LFB_SET(wlc, ac, val) \ 202#define BRCMS_WME_RETRY_LFB_SET(wlc, ac, val) \
194 (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_LFB, val)) 203 (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_LFB, val))
195 204
196/* PLL requests */ 205/* PLL requests */
197#define WLC_PLLREQ_SHARED 0x1 /* pll is shared on old chips */ 206
198#define WLC_PLLREQ_RADIO_MON 0x2 /* hold pll for radio monitor register checking */ 207/* pll is shared on old chips */
199#define WLC_PLLREQ_FLIP 0x4 /* hold/release pll for some short operation */ 208#define BRCMS_PLLREQ_SHARED 0x1
209/* hold pll for radio monitor register checking */
210#define BRCMS_PLLREQ_RADIO_MON 0x2
211/* hold/release pll for some short operation */
212#define BRCMS_PLLREQ_FLIP 0x4
200 213
201/* 214/*
202 * Macros to check if AP or STA is active. 215 * Macros to check if AP or STA is active.
@@ -227,7 +240,7 @@ extern const u8 prio2fifo[];
227 (MCTL_PSM_JMP_0 | MCTL_IHR_EN)) != MCTL_IHR_EN) : \ 240 (MCTL_PSM_JMP_0 | MCTL_IHR_EN)) != MCTL_IHR_EN) : \
228 (ai_deviceremoved(wlc->hw->sih))) 241 (ai_deviceremoved(wlc->hw->sih)))
229 242
230#define WLCWLUNIT(wlc) ((wlc)->pub->unit) 243#define BRCMS_UNIT(wlc) ((wlc)->pub->unit)
231 244
232struct brcms_protection { 245struct brcms_protection {
233 bool _g; /* use g spec protection, driver internal */ 246 bool _g; /* use g spec protection, driver internal */
@@ -270,37 +283,41 @@ struct brcms_stf {
270 s8 spatial_policy; 283 s8 spatial_policy;
271}; 284};
272 285
273#define WLC_STF_SS_STBC_TX(wlc, scb) \ 286#define BRCMS_STF_SS_STBC_TX(wlc, scb) \
274 (((wlc)->stf->txstreams > 1) && (((wlc)->band->band_stf_stbc_tx == ON) || \ 287 (((wlc)->stf->txstreams > 1) && (((wlc)->band->band_stf_stbc_tx == ON) || \
275 (SCB_STBC_CAP((scb)) && \ 288 (SCB_STBC_CAP((scb)) && \
276 (wlc)->band->band_stf_stbc_tx == AUTO && \ 289 (wlc)->band->band_stf_stbc_tx == AUTO && \
277 isset(&((wlc)->stf->ss_algo_channel), PHY_TXC1_MODE_STBC)))) 290 isset(&((wlc)->stf->ss_algo_channel), PHY_TXC1_MODE_STBC))))
278 291
279#define WLC_STBC_CAP_PHY(wlc) (WLCISNPHY(wlc->band) && NREV_GE(wlc->band->phyrev, 3)) 292#define BRCMS_STBC_CAP_PHY(wlc) (BRCMS_ISNPHY(wlc->band) && \
293 NREV_GE(wlc->band->phyrev, 3))
280 294
281#define WLC_SGI_CAP_PHY(wlc) ((WLCISNPHY(wlc->band) && NREV_GE(wlc->band->phyrev, 3)) || \ 295#define BRCMS_SGI_CAP_PHY(wlc) ((BRCMS_ISNPHY(wlc->band) && \
282 WLCISLCNPHY(wlc->band)) 296 NREV_GE(wlc->band->phyrev, 3)) || \
297 BRCMS_ISLCNPHY(wlc->band))
283 298
284#define WLC_CHAN_PHYTYPE(x) (((x) & RXS_CHAN_PHYTYPE_MASK) >> RXS_CHAN_PHYTYPE_SHIFT) 299#define BRCMS_CHAN_PHYTYPE(x) (((x) & RXS_CHAN_PHYTYPE_MASK) \
285#define WLC_CHAN_CHANNEL(x) (((x) & RXS_CHAN_ID_MASK) >> RXS_CHAN_ID_SHIFT) 300 >> RXS_CHAN_PHYTYPE_SHIFT)
286#define WLC_RX_CHANNEL(rxh) (WLC_CHAN_CHANNEL((rxh)->RxChan)) 301#define BRCMS_CHAN_CHANNEL(x) (((x) & RXS_CHAN_ID_MASK) \
302 >> RXS_CHAN_ID_SHIFT)
303#define BRCMS_RX_CHANNEL(rxh) (BRCMS_CHAN_CHANNEL((rxh)->RxChan))
287 304
288/* brcms_bss_info flag bit values */ 305/* brcms_bss_info flag bit values */
289#define WLC_BSS_HT 0x0020 /* BSS is HT (MIMO) capable */ 306#define BRCMS_BSS_HT 0x0020 /* BSS is HT (MIMO) capable */
290 307
291/* Flags used in brcms_c_txq_info.stopped */ 308/* Flags used in brcms_c_txq_info.stopped */
292#define TXQ_STOP_FOR_PRIOFC_MASK 0x000000FF /* per prio flow control bits */ 309#define TXQ_STOP_FOR_PRIOFC_MASK 0x000000FF /* per prio flow control bits */
293#define TXQ_STOP_FOR_PKT_DRAIN 0x00000100 /* stop txq enqueue for packet drain */ 310#define TXQ_STOP_FOR_PKT_DRAIN 0x00000100 /* stop txq enqueue for packet drain */
294#define TXQ_STOP_FOR_AMPDU_FLOW_CNTRL 0x00000200 /* stop txq enqueue for ampdu flow control */ 311#define TXQ_STOP_FOR_AMPDU_FLOW_CNTRL 0x00000200 /* stop txq enqueue for ampdu flow control */
295 312
296#define WLC_HT_WEP_RESTRICT 0x01 /* restrict HT with WEP */ 313#define BRCMS_HT_WEP_RESTRICT 0x01 /* restrict HT with WEP */
297#define WLC_HT_TKIP_RESTRICT 0x02 /* restrict HT with TKIP */ 314#define BRCMS_HT_TKIP_RESTRICT 0x02 /* restrict HT with TKIP */
298 315
299/* Maximum # of keys that wl driver supports in S/W. 316/* Maximum # of keys that wl driver supports in S/W.
300 * Keys supported in H/W is less than or equal to WSEC_MAX_KEYS. 317 * Keys supported in H/W is less than or equal to WSEC_MAX_KEYS.
301 */ 318 */
302#define WSEC_MAX_KEYS 54 /* Max # of keys (50 + 4 default keys) */ 319#define WSEC_MAX_KEYS 54 /* Max # of keys (50 + 4 default keys) */
303#define WLC_DEFAULT_KEYS 4 /* Default # of keys */ 320#define BRCMS_DEFAULT_KEYS 4 /* Default # of keys */
304 321
305/* 322/*
306* Max # of keys currently supported: 323* Max # of keys currently supported:
@@ -308,7 +325,7 @@ struct brcms_stf {
308* s/w keys if WSEC_SW(wlc->wsec). 325* s/w keys if WSEC_SW(wlc->wsec).
309* h/w keys otherwise. 326* h/w keys otherwise.
310*/ 327*/
311#define WLC_MAX_WSEC_KEYS(wlc) WSEC_MAX_KEYS 328#define BRCMS_MAX_WSEC_KEYS(wlc) WSEC_MAX_KEYS
312 329
313/* number of 802.11 default (non-paired, group keys) */ 330/* number of 802.11 default (non-paired, group keys) */
314#define WSEC_MAX_DEFAULT_KEYS 4 /* # of default keys */ 331#define WSEC_MAX_DEFAULT_KEYS 4 /* # of default keys */
@@ -318,7 +335,7 @@ struct wsec_iv {
318 u16 lo; /* lower 16 bits of IV */ 335 u16 lo; /* lower 16 bits of IV */
319}; 336};
320 337
321#define WLC_NUMRXIVS 16 /* # rx IVs (one per 802.11e TID) */ 338#define BRCMS_NUMRXIVS 16 /* # rx IVs (one per 802.11e TID) */
322 339
323struct wsec_key { 340struct wsec_key {
324 u8 ea[ETH_ALEN]; /* per station */ 341 u8 ea[ETH_ALEN]; /* per station */
@@ -334,7 +351,7 @@ struct wsec_key {
334 u32 len; /* key length..don't move this var */ 351 u32 len; /* key length..don't move this var */
335 /* data is 4byte aligned */ 352 /* data is 4byte aligned */
336 u8 data[WLAN_MAX_KEY_LEN]; /* key data */ 353 u8 data[WLAN_MAX_KEY_LEN]; /* key data */
337 struct wsec_iv rxiv[WLC_NUMRXIVS]; /* Rx IV (one per TID) */ 354 struct wsec_iv rxiv[BRCMS_NUMRXIVS]; /* Rx IV (one per TID) */
338 struct wsec_iv txiv; /* Tx IV */ 355 struct wsec_iv txiv; /* Tx IV */
339}; 356};
340 357
@@ -355,7 +372,7 @@ struct brcms_core {
355 * band state (phy+ana+radio) 372 * band state (phy+ana+radio)
356 */ 373 */
357struct brcms_band { 374struct brcms_band {
358 int bandtype; /* WLC_BAND_2G, WLC_BAND_5G */ 375 int bandtype; /* BRCM_BAND_2G, BRCM_BAND_5G */
359 uint bandunit; /* bandstate[] index */ 376 uint bandunit; /* bandstate[] index */
360 377
361 u16 phytype; /* phytype */ 378 u16 phytype; /* phytype */
@@ -376,7 +393,7 @@ struct brcms_band {
376 u8 band_stf_ss_mode; /* Configured STF type, 0:siso; 1:cdd */ 393 u8 band_stf_ss_mode; /* Configured STF type, 0:siso; 1:cdd */
377 s8 band_stf_stbc_tx; /* STBC TX 0:off; 1:force on; -1:auto */ 394 s8 band_stf_stbc_tx; /* STBC TX 0:off; 1:force on; -1:auto */
378 wlc_rateset_t hw_rateset; /* rates supported by chip (phy-specific) */ 395 wlc_rateset_t hw_rateset; /* rates supported by chip (phy-specific) */
379 u8 basic_rate[WLC_MAXRATE + 1]; /* basic rates indexed by rate */ 396 u8 basic_rate[BRCM_MAXRATE + 1]; /* basic rates indexed by rate */
380 bool mimo_cap_40; /* 40 MHz cap enabled on this band */ 397 bool mimo_cap_40; /* 40 MHz cap enabled on this band */
381 s8 antgain; /* antenna gain from srom */ 398 s8 antgain; /* antenna gain from srom */
382 399
@@ -436,7 +453,7 @@ struct wme_param_ie {
436/* virtual interface */ 453/* virtual interface */
437struct brcms_c_if { 454struct brcms_c_if {
438 struct brcms_c_if *next; 455 struct brcms_c_if *next;
439 u8 type; /* WLC_IFTYPE_BSS or WLC_IFTYPE_WDS */ 456 u8 type; /* BSS or WDS */
440 u8 index; /* assigned in wl_add_if(), index of the wlif if any, 457 u8 index; /* assigned in wl_add_if(), index of the wlif if any,
441 * not necessarily corresponding to bsscfg._idx or 458 * not necessarily corresponding to bsscfg._idx or
442 * AID2PVBMAP(scb). 459 * AID2PVBMAP(scb).
@@ -445,18 +462,18 @@ struct brcms_c_if {
445 struct brcms_if *wlif; /* pointer to wlif */ 462 struct brcms_if *wlif; /* pointer to wlif */
446 struct brcms_txq_info *qi; /* pointer to associated tx queue */ 463 struct brcms_txq_info *qi; /* pointer to associated tx queue */
447 union { 464 union {
448 /* pointer to scb if WLC_IFTYPE_WDS */ 465 /* pointer to scb if WDS */
449 struct scb *scb; 466 struct scb *scb;
450 /* pointer to bsscfg if WLC_IFTYPE_BSS */ 467 /* pointer to bsscfg if BSS */
451 struct brcms_bss_cfg *bsscfg; 468 struct brcms_bss_cfg *bsscfg;
452 } u; 469 } u;
453}; 470};
454 471
455/* flags for the interface, this interface is linked to a brcms_if */ 472/* flags for the interface, this interface is linked to a brcms_if */
456#define WLC_IF_LINKED 0x02 473#define BRCMS_IF_LINKED 0x02
457 474
458struct brcms_hw_band { 475struct brcms_hw_band {
459 int bandtype; /* WLC_BAND_2G, WLC_BAND_5G */ 476 int bandtype; /* BRCM_BAND_2G, BRCM_BAND_5G */
460 uint bandunit; /* bandstate[] index */ 477 uint bandunit; /* bandstate[] index */
461 u16 mhfs[MHFMAX]; /* MHF array shadow */ 478 u16 mhfs[MHFMAX]; /* MHF array shadow */
462 u8 bandhw_stf_ss_mode; /* HW configured STF type, 0:siso; 1:cdd */ 479 u8 bandhw_stf_ss_mode; /* HW configured STF type, 0:siso; 1:cdd */
@@ -673,7 +690,7 @@ struct brcms_c_info {
673 * BSS Configurations set of BSS configurations, idx 0 is default and 690 * BSS Configurations set of BSS configurations, idx 0 is default and
674 * always valid 691 * always valid
675 */ 692 */
676 struct brcms_bss_cfg *bsscfg[WLC_MAXBSSCFG]; 693 struct brcms_bss_cfg *bsscfg[BRCMS_MAXBSSCFG];
677 struct brcms_bss_cfg *cfg; /* the primary bsscfg (can be AP or STA) */ 694 struct brcms_bss_cfg *cfg; /* the primary bsscfg (can be AP or STA) */
678 695
679 /* tx queue */ 696 /* tx queue */
@@ -682,7 +699,7 @@ struct brcms_c_info {
682 /* security */ 699 /* security */
683 struct wsec_key *wsec_keys[WSEC_MAX_KEYS]; /* dynamic key storage */ 700 struct wsec_key *wsec_keys[WSEC_MAX_KEYS]; /* dynamic key storage */
684 /* default key storage */ 701 /* default key storage */
685 struct wsec_key *wsec_def_keys[WLC_DEFAULT_KEYS]; 702 struct wsec_key *wsec_def_keys[BRCMS_DEFAULT_KEYS];
686 bool wsec_swkeys; /* indicates that all keys should be 703 bool wsec_swkeys; /* indicates that all keys should be
687 * treated as sw keys (used for debugging) 704 * treated as sw keys (used for debugging)
688 */ 705 */
@@ -699,12 +716,10 @@ struct brcms_c_info {
699 716
700 u16 mc_fid_counter; /* BC/MC FIFO frame ID counter */ 717 u16 mc_fid_counter; /* BC/MC FIFO frame ID counter */
701 718
702 char country_default[WLC_CNTRY_BUF_SZ]; /* saved country for leaving 802.11d 719 /* saved country for leaving 802.11d auto-country mode */
703 * auto-country mode 720 char country_default[BRCM_CNTRY_BUF_SZ];
704 */ 721 /* initial country for 802.11d auto-country mode */
705 char autocountry_default[WLC_CNTRY_BUF_SZ]; /* initial country for 802.11d 722 char autocountry_default[BRCM_CNTRY_BUF_SZ];
706 * auto-country mode
707 */
708 u16 prb_resp_timeout; /* do not send prb resp if request older than this, 723 u16 prb_resp_timeout; /* do not send prb resp if request older than this,
709 * 0 = disable 724 * 0 = disable
710 */ 725 */
@@ -800,7 +815,7 @@ struct brcms_bss_cfg {
800 struct wsec_iv wpa_none_txiv; 815 struct wsec_iv wpa_none_txiv;
801 int wsec_index; /* 0-3: default tx key, -1: not set */ 816 int wsec_index; /* 0-3: default tx key, -1: not set */
802 /* default key storage: */ 817 /* default key storage: */
803 struct wsec_key *bss_def_keys[WLC_DEFAULT_KEYS]; 818 struct wsec_key *bss_def_keys[BRCMS_DEFAULT_KEYS];
804 819
805 /* TKIP countermeasures */ 820 /* TKIP countermeasures */
806 bool tkip_countermeasures; /* flags TKIP no-assoc period */ 821 bool tkip_countermeasures; /* flags TKIP no-assoc period */
@@ -814,7 +829,7 @@ struct brcms_bss_cfg {
814 u16 bcmc_fid; /* the last BCMC FID queued to TX_BCMC_FIFO */ 829 u16 bcmc_fid; /* the last BCMC FID queued to TX_BCMC_FIFO */
815 u16 bcmc_fid_shm; /* the last BCMC FID written to shared mem */ 830 u16 bcmc_fid_shm; /* the last BCMC FID written to shared mem */
816 831
817 u32 flags; /* WLC_BSSCFG flags; see below */ 832 u32 flags; /* BSSCFG flags; see below */
818 833
819 u8 *bcn; /* AP beacon */ 834 u8 *bcn; /* AP beacon */
820 uint bcn_len; /* AP beacon length */ 835 uint bcn_len; /* AP beacon length */
@@ -853,7 +868,7 @@ struct brcms_bss_cfg {
853#define IS_MBAND_UNLOCKED(wlc) \ 868#define IS_MBAND_UNLOCKED(wlc) \
854 ((NBANDS(wlc) > 1) && !(wlc)->bandlocked) 869 ((NBANDS(wlc) > 1) && !(wlc)->bandlocked)
855 870
856#define WLC_BAND_PI_RADIO_CHANSPEC wlc_phy_chanspec_get(wlc->band->pi) 871#define BRCMS_BAND_PI_RADIO_CHANSPEC wlc_phy_chanspec_get(wlc->band->pi)
857 872
858/* sum the individual fifo tx pending packet counts */ 873/* sum the individual fifo tx pending packet counts */
859#define TXPKTPENDTOT(wlc) ((wlc)->core->txpktpend[0] + (wlc)->core->txpktpend[1] + \ 874#define TXPKTPENDTOT(wlc) ((wlc)->core->txpktpend[0] + (wlc)->core->txpktpend[1] + \
@@ -866,7 +881,7 @@ struct brcms_bss_cfg {
866#define GETNEXTTXP(wlc, _queue) \ 881#define GETNEXTTXP(wlc, _queue) \
867 dma_getnexttxp((wlc)->hw->di[(_queue)], DMA_RANGE_TRANSMITTED) 882 dma_getnexttxp((wlc)->hw->di[(_queue)], DMA_RANGE_TRANSMITTED)
868 883
869#define WLC_IS_MATCH_SSID(wlc, ssid1, ssid2, len1, len2) \ 884#define BRCMS_IS_MATCH_SSID(wlc, ssid1, ssid2, len1, len2) \
870 ((len1 == len2) && !memcmp(ssid1, ssid2, len1)) 885 ((len1 == len2) && !memcmp(ssid1, ssid2, len1))
871 886
872extern void brcms_c_fatal_error(struct brcms_c_info *wlc); 887extern void brcms_c_fatal_error(struct brcms_c_info *wlc);
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
index c4e90694bcf..7b1b584e530 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -109,14 +109,14 @@ u16 ltrn_list[PHY_LTRN_LIST_LEN] = {
109 109
110const u8 ofdm_rate_lookup[] = { 110const u8 ofdm_rate_lookup[] = {
111 111
112 WLC_RATE_48M, 112 BRCM_RATE_48M,
113 WLC_RATE_24M, 113 BRCM_RATE_24M,
114 WLC_RATE_12M, 114 BRCM_RATE_12M,
115 WLC_RATE_6M, 115 BRCM_RATE_6M,
116 WLC_RATE_54M, 116 BRCM_RATE_54M,
117 WLC_RATE_36M, 117 BRCM_RATE_36M,
118 WLC_RATE_18M, 118 BRCM_RATE_18M,
119 WLC_RATE_9M 119 BRCM_RATE_9M
120}; 120};
121 121
122#define PHY_WREG_LIMIT 24 122#define PHY_WREG_LIMIT 24
@@ -636,9 +636,9 @@ wlc_phy_attach(struct shared_phy *sh, void *regs, int bandtype,
636 pi->phynoise_polling = false; 636 pi->phynoise_polling = false;
637 637
638 for (i = 0; i < TXP_NUM_RATES; i++) { 638 for (i = 0; i < TXP_NUM_RATES; i++) {
639 pi->txpwr_limit[i] = WLC_TXPWR_MAX; 639 pi->txpwr_limit[i] = BRCMS_TXPWR_MAX;
640 pi->txpwr_env_limit[i] = WLC_TXPWR_MAX; 640 pi->txpwr_env_limit[i] = BRCMS_TXPWR_MAX;
641 pi->tx_user_target[i] = WLC_TXPWR_MAX; 641 pi->tx_user_target[i] = BRCMS_TXPWR_MAX;
642 } 642 }
643 643
644 pi->radiopwr_override = RADIOPWR_OVERRIDE_DEF; 644 pi->radiopwr_override = RADIOPWR_OVERRIDE_DEF;
@@ -1110,7 +1110,7 @@ wlc_phy_init_radio_regs(struct brcms_phy *pi, struct radio_regs *radioregs,
1110 address | core_offset, 1110 address | core_offset,
1111 (u16) radioregs[i].init_a); 1111 (u16) radioregs[i].init_a);
1112 if (ISNPHY(pi) && (++count % 4 == 0)) 1112 if (ISNPHY(pi) && (++count % 4 == 0))
1113 WLC_PHY_WAR_PR51571(pi); 1113 BRCMS_PHY_WAR_PR51571(pi);
1114 } 1114 }
1115 } else { 1115 } else {
1116 if (radioregs[i].do_init_g) { 1116 if (radioregs[i].do_init_g) {
@@ -1119,7 +1119,7 @@ wlc_phy_init_radio_regs(struct brcms_phy *pi, struct radio_regs *radioregs,
1119 address | core_offset, 1119 address | core_offset,
1120 (u16) radioregs[i].init_g); 1120 (u16) radioregs[i].init_g);
1121 if (ISNPHY(pi) && (++count % 4 == 0)) 1121 if (ISNPHY(pi) && (++count % 4 == 0))
1122 WLC_PHY_WAR_PR51571(pi); 1122 BRCMS_PHY_WAR_PR51571(pi);
1123 } 1123 }
1124 } 1124 }
1125 1125
@@ -1411,8 +1411,8 @@ wlc_phy_chanspec_band_validch(struct brcms_phy_pub *ppi, uint band,
1411 && (channel <= LAST_REF5_CHANNUM)) 1411 && (channel <= LAST_REF5_CHANNUM))
1412 continue; 1412 continue;
1413 1413
1414 if (((band == WLC_BAND_2G) && (channel <= CH_MAX_2G_CHANNEL)) || 1414 if ((band == BRCM_BAND_2G && channel <= CH_MAX_2G_CHANNEL) ||
1415 ((band == WLC_BAND_5G) && (channel > CH_MAX_2G_CHANNEL))) 1415 (band == BRCM_BAND_5G && channel > CH_MAX_2G_CHANNEL))
1416 setbit(channels->vec, channel); 1416 setbit(channels->vec, channel);
1417 } 1417 }
1418} 1418}
@@ -1443,7 +1443,7 @@ chanspec_t wlc_phy_chanspec_band_firstch(struct brcms_phy_pub *ppi, uint band)
1443 chspec = 1443 chspec =
1444 channel | WL_CHANSPEC_BW_40 | 1444 channel | WL_CHANSPEC_BW_40 |
1445 WL_CHANSPEC_CTL_SB_LOWER; 1445 WL_CHANSPEC_CTL_SB_LOWER;
1446 if (band == WLC_BAND_2G) 1446 if (band == BRCM_BAND_2G)
1447 chspec |= WL_CHANSPEC_BAND_2G; 1447 chspec |= WL_CHANSPEC_BAND_2G;
1448 else 1448 else
1449 chspec |= WL_CHANSPEC_BAND_5G; 1449 chspec |= WL_CHANSPEC_BAND_5G;
@@ -1454,8 +1454,8 @@ chanspec_t wlc_phy_chanspec_band_firstch(struct brcms_phy_pub *ppi, uint band)
1454 && (channel <= LAST_REF5_CHANNUM)) 1454 && (channel <= LAST_REF5_CHANNUM))
1455 continue; 1455 continue;
1456 1456
1457 if (((band == WLC_BAND_2G) && (channel <= CH_MAX_2G_CHANNEL)) || 1457 if ((band == BRCM_BAND_2G && channel <= CH_MAX_2G_CHANNEL) ||
1458 ((band == WLC_BAND_5G) && (channel > CH_MAX_2G_CHANNEL))) 1458 (band == BRCM_BAND_5G && channel > CH_MAX_2G_CHANNEL))
1459 return chspec; 1459 return chspec;
1460 } 1460 }
1461 1461
@@ -1479,35 +1479,35 @@ void wlc_phy_txpower_target_set(struct brcms_phy_pub *ppi,
1479 struct brcms_phy *pi = (struct brcms_phy *) ppi; 1479 struct brcms_phy *pi = (struct brcms_phy *) ppi;
1480 1480
1481 memcpy(&pi->tx_user_target[TXP_FIRST_CCK], 1481 memcpy(&pi->tx_user_target[TXP_FIRST_CCK],
1482 &txpwr->cck[0], WLC_NUM_RATES_CCK); 1482 &txpwr->cck[0], BRCMS_NUM_RATES_CCK);
1483 1483
1484 memcpy(&pi->tx_user_target[TXP_FIRST_OFDM], 1484 memcpy(&pi->tx_user_target[TXP_FIRST_OFDM],
1485 &txpwr->ofdm[0], WLC_NUM_RATES_OFDM); 1485 &txpwr->ofdm[0], BRCMS_NUM_RATES_OFDM);
1486 memcpy(&pi->tx_user_target[TXP_FIRST_OFDM_20_CDD], 1486 memcpy(&pi->tx_user_target[TXP_FIRST_OFDM_20_CDD],
1487 &txpwr->ofdm_cdd[0], WLC_NUM_RATES_OFDM); 1487 &txpwr->ofdm_cdd[0], BRCMS_NUM_RATES_OFDM);
1488 1488
1489 memcpy(&pi->tx_user_target[TXP_FIRST_OFDM_40_SISO], 1489 memcpy(&pi->tx_user_target[TXP_FIRST_OFDM_40_SISO],
1490 &txpwr->ofdm_40_siso[0], WLC_NUM_RATES_OFDM); 1490 &txpwr->ofdm_40_siso[0], BRCMS_NUM_RATES_OFDM);
1491 memcpy(&pi->tx_user_target[TXP_FIRST_OFDM_40_CDD], 1491 memcpy(&pi->tx_user_target[TXP_FIRST_OFDM_40_CDD],
1492 &txpwr->ofdm_40_cdd[0], WLC_NUM_RATES_OFDM); 1492 &txpwr->ofdm_40_cdd[0], BRCMS_NUM_RATES_OFDM);
1493 1493
1494 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_SISO], 1494 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_SISO],
1495 &txpwr->mcs_20_siso[0], WLC_NUM_RATES_MCS_1_STREAM); 1495 &txpwr->mcs_20_siso[0], BRCMS_NUM_RATES_MCS_1_STREAM);
1496 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_CDD], 1496 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_CDD],
1497 &txpwr->mcs_20_cdd[0], WLC_NUM_RATES_MCS_1_STREAM); 1497 &txpwr->mcs_20_cdd[0], BRCMS_NUM_RATES_MCS_1_STREAM);
1498 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_STBC], 1498 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_STBC],
1499 &txpwr->mcs_20_stbc[0], WLC_NUM_RATES_MCS_1_STREAM); 1499 &txpwr->mcs_20_stbc[0], BRCMS_NUM_RATES_MCS_1_STREAM);
1500 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_SDM], 1500 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_SDM],
1501 &txpwr->mcs_20_mimo[0], WLC_NUM_RATES_MCS_2_STREAM); 1501 &txpwr->mcs_20_mimo[0], BRCMS_NUM_RATES_MCS_2_STREAM);
1502 1502
1503 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_SISO], 1503 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_SISO],
1504 &txpwr->mcs_40_siso[0], WLC_NUM_RATES_MCS_1_STREAM); 1504 &txpwr->mcs_40_siso[0], BRCMS_NUM_RATES_MCS_1_STREAM);
1505 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_CDD], 1505 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_CDD],
1506 &txpwr->mcs_40_cdd[0], WLC_NUM_RATES_MCS_1_STREAM); 1506 &txpwr->mcs_40_cdd[0], BRCMS_NUM_RATES_MCS_1_STREAM);
1507 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_STBC], 1507 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_STBC],
1508 &txpwr->mcs_40_stbc[0], WLC_NUM_RATES_MCS_1_STREAM); 1508 &txpwr->mcs_40_stbc[0], BRCMS_NUM_RATES_MCS_1_STREAM);
1509 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_SDM], 1509 memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_SDM],
1510 &txpwr->mcs_40_mimo[0], WLC_NUM_RATES_MCS_2_STREAM); 1510 &txpwr->mcs_40_mimo[0], BRCMS_NUM_RATES_MCS_2_STREAM);
1511 1511
1512 if (R_REG(&pi->regs->maccontrol) & MCTL_EN_MAC) 1512 if (R_REG(&pi->regs->maccontrol) & MCTL_EN_MAC)
1513 mac_enabled = true; 1513 mac_enabled = true;
@@ -1564,7 +1564,7 @@ wlc_phy_txpower_sromlimit(struct brcms_phy_pub *ppi, uint channel, u8 *min_pwr,
1564 struct brcms_phy *pi = (struct brcms_phy *) ppi; 1564 struct brcms_phy *pi = (struct brcms_phy *) ppi;
1565 uint i; 1565 uint i;
1566 1566
1567 *min_pwr = pi->min_txpower * WLC_TXPWR_DB_FACTOR; 1567 *min_pwr = pi->min_txpower * BRCMS_TXPWR_DB_FACTOR;
1568 1568
1569 if (ISNPHY(pi)) { 1569 if (ISNPHY(pi)) {
1570 if (txp_rate_idx < 0) 1570 if (txp_rate_idx < 0)
@@ -1578,7 +1578,7 @@ wlc_phy_txpower_sromlimit(struct brcms_phy_pub *ppi, uint channel, u8 *min_pwr,
1578 *max_pwr = pi->tx_srom_max_rate_2g[txp_rate_idx]; 1578 *max_pwr = pi->tx_srom_max_rate_2g[txp_rate_idx];
1579 } else { 1579 } else {
1580 1580
1581 *max_pwr = WLC_TXPWR_MAX; 1581 *max_pwr = BRCMS_TXPWR_MAX;
1582 1582
1583 if (txp_rate_idx < 0) 1583 if (txp_rate_idx < 0)
1584 txp_rate_idx = TXP_FIRST_OFDM; 1584 txp_rate_idx = TXP_FIRST_OFDM;
@@ -1670,7 +1670,7 @@ void wlc_phy_txpower_recalc_target(struct brcms_phy *pi)
1670 u8 max_num_rate; 1670 u8 max_num_rate;
1671 u8 start_rate = 0; 1671 u8 start_rate = 0;
1672 chanspec_t chspec; 1672 chanspec_t chspec;
1673 u32 band = CHSPEC2WLC_BAND(pi->radio_chanspec); 1673 u32 band = CHSPEC2BAND(pi->radio_chanspec);
1674 initfn_t txpwr_recalc_fn = NULL; 1674 initfn_t txpwr_recalc_fn = NULL;
1675 1675
1676 chspec = pi->radio_chanspec; 1676 chspec = pi->radio_chanspec;
@@ -1782,7 +1782,7 @@ void
1782wlc_phy_txpower_reg_limit_calc(struct brcms_phy *pi, struct txpwr_limits *txpwr, 1782wlc_phy_txpower_reg_limit_calc(struct brcms_phy *pi, struct txpwr_limits *txpwr,
1783 chanspec_t chanspec) 1783 chanspec_t chanspec)
1784{ 1784{
1785 u8 tmp_txpwr_limit[2 * WLC_NUM_RATES_OFDM]; 1785 u8 tmp_txpwr_limit[2 * BRCMS_NUM_RATES_OFDM];
1786 u8 *txpwr_ptr1 = NULL, *txpwr_ptr2 = NULL; 1786 u8 *txpwr_ptr1 = NULL, *txpwr_ptr2 = NULL;
1787 int rate_start_index = 0, rate1, rate2, k; 1787 int rate_start_index = 0, rate1, rate2, k;
1788 1788
@@ -1825,16 +1825,15 @@ wlc_phy_txpower_reg_limit_calc(struct brcms_phy *pi, struct txpwr_limits *txpwr,
1825 break; 1825 break;
1826 } 1826 }
1827 1827
1828 for (rate2 = 0; rate2 < WLC_NUM_RATES_OFDM; rate2++) { 1828 for (rate2 = 0; rate2 < BRCMS_NUM_RATES_OFDM; rate2++) {
1829 tmp_txpwr_limit[rate2] = 0; 1829 tmp_txpwr_limit[rate2] = 0;
1830 tmp_txpwr_limit[WLC_NUM_RATES_OFDM + rate2] = 1830 tmp_txpwr_limit[BRCMS_NUM_RATES_OFDM + rate2] =
1831 txpwr_ptr1[rate2]; 1831 txpwr_ptr1[rate2];
1832 } 1832 }
1833 wlc_phy_mcs_to_ofdm_powers_nphy(tmp_txpwr_limit, 0, 1833 wlc_phy_mcs_to_ofdm_powers_nphy(tmp_txpwr_limit, 0,
1834 WLC_NUM_RATES_OFDM - 1, 1834 BRCMS_NUM_RATES_OFDM - 1, BRCMS_NUM_RATES_OFDM);
1835 WLC_NUM_RATES_OFDM);
1836 for (rate1 = rate_start_index, rate2 = 0; 1835 for (rate1 = rate_start_index, rate2 = 0;
1837 rate2 < WLC_NUM_RATES_OFDM; rate1++, rate2++) 1836 rate2 < BRCMS_NUM_RATES_OFDM; rate1++, rate2++)
1838 pi->txpwr_limit[rate1] = 1837 pi->txpwr_limit[rate1] =
1839 min(txpwr_ptr2[rate2], 1838 min(txpwr_ptr2[rate2],
1840 tmp_txpwr_limit[rate2]); 1839 tmp_txpwr_limit[rate2]);
@@ -1867,16 +1866,15 @@ wlc_phy_txpower_reg_limit_calc(struct brcms_phy *pi, struct txpwr_limits *txpwr,
1867 rate_start_index = WL_TX_POWER_MCS40_CDD_FIRST; 1866 rate_start_index = WL_TX_POWER_MCS40_CDD_FIRST;
1868 break; 1867 break;
1869 } 1868 }
1870 for (rate2 = 0; rate2 < WLC_NUM_RATES_OFDM; rate2++) { 1869 for (rate2 = 0; rate2 < BRCMS_NUM_RATES_OFDM; rate2++) {
1871 tmp_txpwr_limit[rate2] = 0; 1870 tmp_txpwr_limit[rate2] = 0;
1872 tmp_txpwr_limit[WLC_NUM_RATES_OFDM + rate2] = 1871 tmp_txpwr_limit[BRCMS_NUM_RATES_OFDM + rate2] =
1873 txpwr_ptr1[rate2]; 1872 txpwr_ptr1[rate2];
1874 } 1873 }
1875 wlc_phy_ofdm_to_mcs_powers_nphy(tmp_txpwr_limit, 0, 1874 wlc_phy_ofdm_to_mcs_powers_nphy(tmp_txpwr_limit, 0,
1876 WLC_NUM_RATES_OFDM - 1, 1875 BRCMS_NUM_RATES_OFDM - 1, BRCMS_NUM_RATES_OFDM);
1877 WLC_NUM_RATES_OFDM);
1878 for (rate1 = rate_start_index, rate2 = 0; 1876 for (rate1 = rate_start_index, rate2 = 0;
1879 rate2 < WLC_NUM_RATES_MCS_1_STREAM; 1877 rate2 < BRCMS_NUM_RATES_MCS_1_STREAM;
1880 rate1++, rate2++) 1878 rate1++, rate2++)
1881 pi->txpwr_limit[rate1] = 1879 pi->txpwr_limit[rate1] =
1882 min(txpwr_ptr2[rate2], 1880 min(txpwr_ptr2[rate2],
@@ -1897,7 +1895,7 @@ wlc_phy_txpower_reg_limit_calc(struct brcms_phy *pi, struct txpwr_limits *txpwr,
1897 break; 1895 break;
1898 } 1896 }
1899 for (rate1 = rate_start_index, rate2 = 0; 1897 for (rate1 = rate_start_index, rate2 = 0;
1900 rate2 < WLC_NUM_RATES_MCS_1_STREAM; 1898 rate2 < BRCMS_NUM_RATES_MCS_1_STREAM;
1901 rate1++, rate2++) 1899 rate1++, rate2++)
1902 pi->txpwr_limit[rate1] = txpwr_ptr1[rate2]; 1900 pi->txpwr_limit[rate1] = txpwr_ptr1[rate2];
1903 } 1901 }
@@ -1916,7 +1914,7 @@ wlc_phy_txpower_reg_limit_calc(struct brcms_phy *pi, struct txpwr_limits *txpwr,
1916 break; 1914 break;
1917 } 1915 }
1918 for (rate1 = rate_start_index, rate2 = 0; 1916 for (rate1 = rate_start_index, rate2 = 0;
1919 rate2 < WLC_NUM_RATES_MCS_2_STREAM; 1917 rate2 < BRCMS_NUM_RATES_MCS_2_STREAM;
1920 rate1++, rate2++) 1918 rate1++, rate2++)
1921 pi->txpwr_limit[rate1] = txpwr_ptr1[rate2]; 1919 pi->txpwr_limit[rate1] = txpwr_ptr1[rate2];
1922 } 1920 }
@@ -1986,7 +1984,7 @@ wlc_phy_txpower_limit_set(struct brcms_phy_pub *ppi, struct txpwr_limits *txpwr,
1986 if (ISLCNPHY(pi)) { 1984 if (ISLCNPHY(pi)) {
1987 int i, j; 1985 int i, j;
1988 for (i = TXP_FIRST_OFDM_20_CDD, j = 0; 1986 for (i = TXP_FIRST_OFDM_20_CDD, j = 0;
1989 j < WLC_NUM_RATES_MCS_1_STREAM; i++, j++) { 1987 j < BRCMS_NUM_RATES_MCS_1_STREAM; i++, j++) {
1990 if (txpwr->mcs_20_siso[j]) 1988 if (txpwr->mcs_20_siso[j])
1991 pi->txpwr_limit[i] = txpwr->mcs_20_siso[j]; 1989 pi->txpwr_limit[i] = txpwr->mcs_20_siso[j];
1992 else 1990 else
@@ -2052,7 +2050,7 @@ void wlc_phy_txpower_update_shm(struct brcms_phy *pi)
2052 } 2050 }
2053 2051
2054 wlapi_bmac_mhf(pi->sh->physhim, MHF2, MHF2_HWPWRCTL, 2052 wlapi_bmac_mhf(pi->sh->physhim, MHF2, MHF2_HWPWRCTL,
2055 MHF2_HWPWRCTL, WLC_BAND_ALL); 2053 MHF2_HWPWRCTL, BRCM_BAND_ALL);
2056 } else { 2054 } else {
2057 int i; 2055 int i;
2058 2056
@@ -2300,10 +2298,10 @@ void wlc_phy_ant_rxdiv_set(struct brcms_phy_pub *ppi, u8 val)
2300 if (!(ISNPHY(pi) && D11REV_IS(pi->sh->corerev, 16))) { 2298 if (!(ISNPHY(pi) && D11REV_IS(pi->sh->corerev, 16))) {
2301 if (val > ANT_RX_DIV_FORCE_1) 2299 if (val > ANT_RX_DIV_FORCE_1)
2302 wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_ANTDIV, 2300 wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_ANTDIV,
2303 MHF1_ANTDIV, WLC_BAND_ALL); 2301 MHF1_ANTDIV, BRCM_BAND_ALL);
2304 else 2302 else
2305 wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_ANTDIV, 0, 2303 wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_ANTDIV, 0,
2306 WLC_BAND_ALL); 2304 BRCM_BAND_ALL);
2307 } 2305 }
2308 2306
2309 if (ISNPHY(pi)) { 2307 if (ISNPHY(pi)) {
@@ -2689,13 +2687,13 @@ void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, void *ctx)
2689 struct brcms_phy *pi = (struct brcms_phy *) pih; 2687 struct brcms_phy *pi = (struct brcms_phy *) pih;
2690 2688
2691 if (NORADIO_ENAB(pi->pubpi)) { 2689 if (NORADIO_ENAB(pi->pubpi)) {
2692 rssi = WLC_RSSI_INVALID; 2690 rssi = BRCMS_RSSI_INVALID;
2693 goto end; 2691 goto end;
2694 } 2692 }
2695 2693
2696 if ((pi->sh->corerev >= 11) 2694 if ((pi->sh->corerev >= 11)
2697 && !(le16_to_cpu(rxh->RxStatus2) & RXS_PHYRXST_VALID)) { 2695 && !(le16_to_cpu(rxh->RxStatus2) & RXS_PHYRXST_VALID)) {
2698 rssi = WLC_RSSI_INVALID; 2696 rssi = BRCMS_RSSI_INVALID;
2699 goto end; 2697 goto end;
2700 } 2698 }
2701 2699
@@ -3191,7 +3189,7 @@ static void wlc_phy_upd_env_txpwr_rate_limits(struct brcms_phy *pi, u32 band)
3191 s8 temp, vbat; 3189 s8 temp, vbat;
3192 3190
3193 for (i = 0; i < TXP_NUM_RATES; i++) 3191 for (i = 0; i < TXP_NUM_RATES; i++)
3194 pi->txpwr_env_limit[i] = WLC_TXPWR_MAX; 3192 pi->txpwr_env_limit[i] = BRCMS_TXPWR_MAX;
3195 3193
3196 vbat = wlc_phy_env_measure_vbat(pi); 3194 vbat = wlc_phy_env_measure_vbat(pi);
3197 temp = wlc_phy_env_measure_temperature(pi); 3195 temp = wlc_phy_env_measure_temperature(pi);
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h b/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h
index e327a570a8c..e27d9e95a2d 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h
@@ -87,40 +87,40 @@
87#define PHY_MODE_CAL 0x0002 87#define PHY_MODE_CAL 0x0002
88#define PHY_MODE_NOISEM 0x0004 88#define PHY_MODE_NOISEM 0x0004
89 89
90#define WLC_TXPWR_DB_FACTOR 4 90#define BRCMS_TXPWR_DB_FACTOR 4
91 91
92/* a large TX Power as an init value to factor out of min() calculations, 92/* a large TX Power as an init value to factor out of min() calculations,
93 * keep low enough to fit in an s8, units are .25 dBm 93 * keep low enough to fit in an s8, units are .25 dBm
94 */ 94 */
95#define WLC_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */ 95#define BRCMS_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */
96 96
97#define WLC_NUM_RATES_CCK 4 97#define BRCMS_NUM_RATES_CCK 4
98#define WLC_NUM_RATES_OFDM 8 98#define BRCMS_NUM_RATES_OFDM 8
99#define WLC_NUM_RATES_MCS_1_STREAM 8 99#define BRCMS_NUM_RATES_MCS_1_STREAM 8
100#define WLC_NUM_RATES_MCS_2_STREAM 8 100#define BRCMS_NUM_RATES_MCS_2_STREAM 8
101#define WLC_NUM_RATES_MCS_3_STREAM 8 101#define BRCMS_NUM_RATES_MCS_3_STREAM 8
102#define WLC_NUM_RATES_MCS_4_STREAM 8 102#define BRCMS_NUM_RATES_MCS_4_STREAM 8
103 103
104#define WLC_RSSI_INVALID 0 /* invalid RSSI value */ 104#define BRCMS_RSSI_INVALID 0 /* invalid RSSI value */
105 105
106struct txpwr_limits { 106struct txpwr_limits {
107 u8 cck[WLC_NUM_RATES_CCK]; 107 u8 cck[BRCMS_NUM_RATES_CCK];
108 u8 ofdm[WLC_NUM_RATES_OFDM]; 108 u8 ofdm[BRCMS_NUM_RATES_OFDM];
109 109
110 u8 ofdm_cdd[WLC_NUM_RATES_OFDM]; 110 u8 ofdm_cdd[BRCMS_NUM_RATES_OFDM];
111 111
112 u8 ofdm_40_siso[WLC_NUM_RATES_OFDM]; 112 u8 ofdm_40_siso[BRCMS_NUM_RATES_OFDM];
113 u8 ofdm_40_cdd[WLC_NUM_RATES_OFDM]; 113 u8 ofdm_40_cdd[BRCMS_NUM_RATES_OFDM];
114 114
115 u8 mcs_20_siso[WLC_NUM_RATES_MCS_1_STREAM]; 115 u8 mcs_20_siso[BRCMS_NUM_RATES_MCS_1_STREAM];
116 u8 mcs_20_cdd[WLC_NUM_RATES_MCS_1_STREAM]; 116 u8 mcs_20_cdd[BRCMS_NUM_RATES_MCS_1_STREAM];
117 u8 mcs_20_stbc[WLC_NUM_RATES_MCS_1_STREAM]; 117 u8 mcs_20_stbc[BRCMS_NUM_RATES_MCS_1_STREAM];
118 u8 mcs_20_mimo[WLC_NUM_RATES_MCS_2_STREAM]; 118 u8 mcs_20_mimo[BRCMS_NUM_RATES_MCS_2_STREAM];
119 119
120 u8 mcs_40_siso[WLC_NUM_RATES_MCS_1_STREAM]; 120 u8 mcs_40_siso[BRCMS_NUM_RATES_MCS_1_STREAM];
121 u8 mcs_40_cdd[WLC_NUM_RATES_MCS_1_STREAM]; 121 u8 mcs_40_cdd[BRCMS_NUM_RATES_MCS_1_STREAM];
122 u8 mcs_40_stbc[WLC_NUM_RATES_MCS_1_STREAM]; 122 u8 mcs_40_stbc[BRCMS_NUM_RATES_MCS_1_STREAM];
123 u8 mcs_40_mimo[WLC_NUM_RATES_MCS_2_STREAM]; 123 u8 mcs_40_mimo[BRCMS_NUM_RATES_MCS_2_STREAM];
124 u8 mcs32; 124 u8 mcs32;
125}; 125};
126 126
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
index 46595039f58..a01b01ccd9f 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
@@ -1159,7 +1159,7 @@ extern void wlc_phy_table_write_nphy(struct brcms_phy *pi, u32, u32, u32,
1159 ((pi->ipa2g_on && CHSPEC_IS2G(pi->radio_chanspec)) || \ 1159 ((pi->ipa2g_on && CHSPEC_IS2G(pi->radio_chanspec)) || \
1160 (pi->ipa5g_on && CHSPEC_IS5G(pi->radio_chanspec))) 1160 (pi->ipa5g_on && CHSPEC_IS5G(pi->radio_chanspec)))
1161 1161
1162#define WLC_PHY_WAR_PR51571(pi) \ 1162#define BRCMS_PHY_WAR_PR51571(pi) \
1163 if (((pi)->sh->bustype == PCI_BUS) && NREV_LT((pi)->pubpi.phy_rev, 3)) \ 1163 if (((pi)->sh->bustype == PCI_BUS) && NREV_LT((pi)->pubpi.phy_rev, 3)) \
1164 (void)R_REG(&(pi)->regs->maccontrol) 1164 (void)R_REG(&(pi)->regs->maccontrol)
1165 1165
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
index 70e79fc00e7..8e98d8f8a7e 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -1606,15 +1606,15 @@ static void wlc_lcnphy_txpower_reset_npt(struct brcms_phy *pi)
1606void wlc_lcnphy_txpower_recalc_target(struct brcms_phy *pi) 1606void wlc_lcnphy_txpower_recalc_target(struct brcms_phy *pi)
1607{ 1607{
1608 struct phytbl_info tab; 1608 struct phytbl_info tab;
1609 u32 rate_table[WLC_NUM_RATES_CCK + WLC_NUM_RATES_OFDM + 1609 u32 rate_table[BRCMS_NUM_RATES_CCK + BRCMS_NUM_RATES_OFDM +
1610 WLC_NUM_RATES_MCS_1_STREAM]; 1610 BRCMS_NUM_RATES_MCS_1_STREAM];
1611 uint i, j; 1611 uint i, j;
1612 if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) 1612 if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi))
1613 return; 1613 return;
1614 1614
1615 for (i = 0, j = 0; i < ARRAY_SIZE(rate_table); i++, j++) { 1615 for (i = 0, j = 0; i < ARRAY_SIZE(rate_table); i++, j++) {
1616 1616
1617 if (i == WLC_NUM_RATES_CCK + WLC_NUM_RATES_OFDM) 1617 if (i == BRCMS_NUM_RATES_CCK + BRCMS_NUM_RATES_OFDM)
1618 j = TXP_FIRST_MCS_20_SISO; 1618 j = TXP_FIRST_MCS_20_SISO;
1619 1619
1620 rate_table[i] = (u32) ((s32) (-pi->tx_power_offset[j])); 1620 rate_table[i] = (u32) ((s32) (-pi->tx_power_offset[j]));
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
index 2a8c9ffa27e..8e19bd05233 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
@@ -14470,7 +14470,7 @@ bool wlc_phy_attach_nphy(struct brcms_phy *pi)
14470 14470
14471 pi->n_preamble_override = AUTO; 14471 pi->n_preamble_override = AUTO;
14472 if (NREV_IS(pi->pubpi.phy_rev, 3) || NREV_IS(pi->pubpi.phy_rev, 4)) 14472 if (NREV_IS(pi->pubpi.phy_rev, 3) || NREV_IS(pi->pubpi.phy_rev, 4))
14473 pi->n_preamble_override = WLC_N_PREAMBLE_MIXEDMODE; 14473 pi->n_preamble_override = BRCMS_N_PREAMBLE_MIXEDMODE;
14474 14474
14475 pi->nphy_txrx_chain = AUTO; 14475 pi->nphy_txrx_chain = AUTO;
14476 pi->phy_scraminit = AUTO; 14476 pi->phy_scraminit = AUTO;
@@ -14929,9 +14929,8 @@ static void wlc_phy_update_mimoconfig_nphy(struct brcms_phy *pi, s32 preamble)
14929 bool gf_preamble = false; 14929 bool gf_preamble = false;
14930 u16 val; 14930 u16 val;
14931 14931
14932 if (preamble == WLC_N_PREAMBLE_GF) { 14932 if (preamble == BRCMS_N_PREAMBLE_GF)
14933 gf_preamble = true; 14933 gf_preamble = true;
14934 }
14935 14934
14936 val = read_phy_reg(pi, 0xed); 14935 val = read_phy_reg(pi, 0xed);
14937 14936
@@ -14995,14 +14994,14 @@ void wlc_phy_stf_chain_upd_nphy(struct brcms_phy *pi)
14995 (NPHY_RfseqCoreActv_TxRxChain0 | NPHY_RfseqCoreActv_TxRxChain1); 14994 (NPHY_RfseqCoreActv_TxRxChain0 | NPHY_RfseqCoreActv_TxRxChain1);
14996 bool CoreActv_override = false; 14995 bool CoreActv_override = false;
14997 14996
14998 if (pi->nphy_txrx_chain == WLC_N_TXRX_CHAIN0) { 14997 if (pi->nphy_txrx_chain == BRCMS_N_TXRX_CHAIN0) {
14999 txrx_chain = NPHY_RfseqCoreActv_TxRxChain0; 14998 txrx_chain = NPHY_RfseqCoreActv_TxRxChain0;
15000 CoreActv_override = true; 14999 CoreActv_override = true;
15001 15000
15002 if (NREV_LE(pi->pubpi.phy_rev, 2)) { 15001 if (NREV_LE(pi->pubpi.phy_rev, 2)) {
15003 and_phy_reg(pi, 0xa0, ~0x20); 15002 and_phy_reg(pi, 0xa0, ~0x20);
15004 } 15003 }
15005 } else if (pi->nphy_txrx_chain == WLC_N_TXRX_CHAIN1) { 15004 } else if (pi->nphy_txrx_chain == BRCMS_N_TXRX_CHAIN1) {
15006 txrx_chain = NPHY_RfseqCoreActv_TxRxChain1; 15005 txrx_chain = NPHY_RfseqCoreActv_TxRxChain1;
15007 CoreActv_override = true; 15006 CoreActv_override = true;
15008 15007
@@ -16215,8 +16214,8 @@ static void wlc_phy_workarounds_nphy(struct brcms_phy *pi)
16215 16214
16216 if (pi->sh->boardflags2 & BFL2_SINGLEANT_CCK) { 16215 if (pi->sh->boardflags2 & BFL2_SINGLEANT_CCK) {
16217 wlapi_bmac_mhf(pi->sh->physhim, MHF4, 16216 wlapi_bmac_mhf(pi->sh->physhim, MHF4,
16218 MHF4_BPHY_TXCORE0, 16217 MHF4_BPHY_TXCORE0,
16219 MHF4_BPHY_TXCORE0, WLC_BAND_ALL); 16218 MHF4_BPHY_TXCORE0, BRCM_BAND_ALL);
16220 } 16219 }
16221 } 16220 }
16222 } else { 16221 } else {
@@ -16284,7 +16283,7 @@ static void wlc_phy_workarounds_nphy(struct brcms_phy *pi)
16284 wlapi_bmac_mhf(pi->sh->physhim, MHF3, 16283 wlapi_bmac_mhf(pi->sh->physhim, MHF3,
16285 MHF3_NPHY_MLADV_WAR, 16284 MHF3_NPHY_MLADV_WAR,
16286 MHF3_NPHY_MLADV_WAR, 16285 MHF3_NPHY_MLADV_WAR,
16287 WLC_BAND_ALL); 16286 BRCM_BAND_ALL);
16288 16287
16289 } else if (NREV_IS(pi->pubpi.phy_rev, 2)) { 16288 } else if (NREV_IS(pi->pubpi.phy_rev, 2)) {
16290 write_phy_reg(pi, 0x1e3, 0x0); 16289 write_phy_reg(pi, 0x1e3, 0x0);
@@ -17798,21 +17797,21 @@ wlc_phy_chanspec_radio2055_setup(struct brcms_phy *pi,
17798 write_radio_reg(pi, RADIO_2055_RF_PLL_MOD1, ci->RF_rf_pll_mod1); 17797 write_radio_reg(pi, RADIO_2055_RF_PLL_MOD1, ci->RF_rf_pll_mod1);
17799 write_radio_reg(pi, RADIO_2055_VCO_CAP_TAIL, ci->RF_vco_cap_tail); 17798 write_radio_reg(pi, RADIO_2055_VCO_CAP_TAIL, ci->RF_vco_cap_tail);
17800 17799
17801 WLC_PHY_WAR_PR51571(pi); 17800 BRCMS_PHY_WAR_PR51571(pi);
17802 17801
17803 write_radio_reg(pi, RADIO_2055_VCO_CAL1, ci->RF_vco_cal1); 17802 write_radio_reg(pi, RADIO_2055_VCO_CAL1, ci->RF_vco_cal1);
17804 write_radio_reg(pi, RADIO_2055_VCO_CAL2, ci->RF_vco_cal2); 17803 write_radio_reg(pi, RADIO_2055_VCO_CAL2, ci->RF_vco_cal2);
17805 write_radio_reg(pi, RADIO_2055_PLL_LF_C1, ci->RF_pll_lf_c1); 17804 write_radio_reg(pi, RADIO_2055_PLL_LF_C1, ci->RF_pll_lf_c1);
17806 write_radio_reg(pi, RADIO_2055_PLL_LF_R1, ci->RF_pll_lf_r1); 17805 write_radio_reg(pi, RADIO_2055_PLL_LF_R1, ci->RF_pll_lf_r1);
17807 17806
17808 WLC_PHY_WAR_PR51571(pi); 17807 BRCMS_PHY_WAR_PR51571(pi);
17809 17808
17810 write_radio_reg(pi, RADIO_2055_PLL_LF_C2, ci->RF_pll_lf_c2); 17809 write_radio_reg(pi, RADIO_2055_PLL_LF_C2, ci->RF_pll_lf_c2);
17811 write_radio_reg(pi, RADIO_2055_LGBUF_CEN_BUF, ci->RF_lgbuf_cen_buf); 17810 write_radio_reg(pi, RADIO_2055_LGBUF_CEN_BUF, ci->RF_lgbuf_cen_buf);
17812 write_radio_reg(pi, RADIO_2055_LGEN_TUNE1, ci->RF_lgen_tune1); 17811 write_radio_reg(pi, RADIO_2055_LGEN_TUNE1, ci->RF_lgen_tune1);
17813 write_radio_reg(pi, RADIO_2055_LGEN_TUNE2, ci->RF_lgen_tune2); 17812 write_radio_reg(pi, RADIO_2055_LGEN_TUNE2, ci->RF_lgen_tune2);
17814 17813
17815 WLC_PHY_WAR_PR51571(pi); 17814 BRCMS_PHY_WAR_PR51571(pi);
17816 17815
17817 write_radio_reg(pi, RADIO_2055_CORE1_LGBUF_A_TUNE, 17816 write_radio_reg(pi, RADIO_2055_CORE1_LGBUF_A_TUNE,
17818 ci->RF_core1_lgbuf_a_tune); 17817 ci->RF_core1_lgbuf_a_tune);
@@ -17822,7 +17821,7 @@ wlc_phy_chanspec_radio2055_setup(struct brcms_phy *pi,
17822 write_radio_reg(pi, RADIO_2055_CORE1_TX_PGA_PAD_TN, 17821 write_radio_reg(pi, RADIO_2055_CORE1_TX_PGA_PAD_TN,
17823 ci->RF_core1_tx_pga_pad_tn); 17822 ci->RF_core1_tx_pga_pad_tn);
17824 17823
17825 WLC_PHY_WAR_PR51571(pi); 17824 BRCMS_PHY_WAR_PR51571(pi);
17826 17825
17827 write_radio_reg(pi, RADIO_2055_CORE1_TX_MX_BGTRIM, 17826 write_radio_reg(pi, RADIO_2055_CORE1_TX_MX_BGTRIM,
17828 ci->RF_core1_tx_mx_bgtrim); 17827 ci->RF_core1_tx_mx_bgtrim);
@@ -17832,7 +17831,7 @@ wlc_phy_chanspec_radio2055_setup(struct brcms_phy *pi,
17832 ci->RF_core2_lgbuf_g_tune); 17831 ci->RF_core2_lgbuf_g_tune);
17833 write_radio_reg(pi, RADIO_2055_CORE2_RXRF_REG1, ci->RF_core2_rxrf_reg1); 17832 write_radio_reg(pi, RADIO_2055_CORE2_RXRF_REG1, ci->RF_core2_rxrf_reg1);
17834 17833
17835 WLC_PHY_WAR_PR51571(pi); 17834 BRCMS_PHY_WAR_PR51571(pi);
17836 17835
17837 write_radio_reg(pi, RADIO_2055_CORE2_TX_PGA_PAD_TN, 17836 write_radio_reg(pi, RADIO_2055_CORE2_TX_PGA_PAD_TN,
17838 ci->RF_core2_tx_pga_pad_tn); 17837 ci->RF_core2_tx_pga_pad_tn);
@@ -17844,7 +17843,7 @@ wlc_phy_chanspec_radio2055_setup(struct brcms_phy *pi,
17844 write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x05); 17843 write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x05);
17845 write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x45); 17844 write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x45);
17846 17845
17847 WLC_PHY_WAR_PR51571(pi); 17846 BRCMS_PHY_WAR_PR51571(pi);
17848 17847
17849 write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x65); 17848 write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x65);
17850 17849
@@ -28697,7 +28696,7 @@ void wlc_phy_txpwrctrl_enable_nphy(struct brcms_phy *pi, u8 ctrl_type)
28697 28696
28698 if (NREV_LT(pi->pubpi.phy_rev, 2) && IS40MHZ(pi)) 28697 if (NREV_LT(pi->pubpi.phy_rev, 2) && IS40MHZ(pi))
28699 wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_IQSWAP_WAR, 28698 wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_IQSWAP_WAR,
28700 MHF1_IQSWAP_WAR, WLC_BAND_ALL); 28699 MHF1_IQSWAP_WAR, BRCM_BAND_ALL);
28701 28700
28702 } else { 28701 } else {
28703 28702
@@ -28756,7 +28755,7 @@ void wlc_phy_txpwrctrl_enable_nphy(struct brcms_phy *pi, u8 ctrl_type)
28756 28755
28757 if (NREV_LT(pi->pubpi.phy_rev, 2) && IS40MHZ(pi)) 28756 if (NREV_LT(pi->pubpi.phy_rev, 2) && IS40MHZ(pi))
28758 wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_IQSWAP_WAR, 28757 wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_IQSWAP_WAR,
28759 0x0, WLC_BAND_ALL); 28758 0x0, BRCM_BAND_ALL);
28760 28759
28761 if (PHY_IPA(pi)) { 28760 if (PHY_IPA(pi)) {
28762 mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x297 : 28761 mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x297 :
diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.c b/drivers/staging/brcm80211/brcmsmac/phy_shim.c
index 12defaa087a..82ecdcda271 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy_shim.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.c
@@ -178,13 +178,13 @@ void wlapi_bmac_core_phypll_reset(struct phy_shim_info *physhim)
178void wlapi_bmac_ucode_wake_override_phyreg_set(struct phy_shim_info *physhim) 178void wlapi_bmac_ucode_wake_override_phyreg_set(struct phy_shim_info *physhim)
179{ 179{
180 brcms_c_ucode_wake_override_set(physhim->wlc_hw, 180 brcms_c_ucode_wake_override_set(physhim->wlc_hw,
181 WLC_WAKE_OVERRIDE_PHYREG); 181 BRCMS_WAKE_OVERRIDE_PHYREG);
182} 182}
183 183
184void wlapi_bmac_ucode_wake_override_phyreg_clear(struct phy_shim_info *physhim) 184void wlapi_bmac_ucode_wake_override_phyreg_clear(struct phy_shim_info *physhim)
185{ 185{
186 brcms_c_ucode_wake_override_clear(physhim->wlc_hw, 186 brcms_c_ucode_wake_override_clear(physhim->wlc_hw,
187 WLC_WAKE_OVERRIDE_PHYREG); 187 BRCMS_WAKE_OVERRIDE_PHYREG);
188} 188}
189 189
190void 190void
diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.h b/drivers/staging/brcm80211/brcmsmac/phy_shim.h
index 0ac7fa5c2b3..2d12bb4400f 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy_shim.h
+++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.h
@@ -63,9 +63,9 @@
63#define WL_ANT_IDX_2 1 /* antenna index 2 */ 63#define WL_ANT_IDX_2 1 /* antenna index 2 */
64 64
65/* values for n_preamble_type */ 65/* values for n_preamble_type */
66#define WLC_N_PREAMBLE_MIXEDMODE 0 66#define BRCMS_N_PREAMBLE_MIXEDMODE 0
67#define WLC_N_PREAMBLE_GF 1 67#define BRCMS_N_PREAMBLE_GF 1
68#define WLC_N_PREAMBLE_GF_BRCM 2 68#define BRCMS_N_PREAMBLE_GF_BRCM 2
69 69
70#define WL_TX_POWER_RATES_LEGACY 45 70#define WL_TX_POWER_RATES_LEGACY 45
71#define WL_TX_POWER_MCS20_FIRST 12 71#define WL_TX_POWER_MCS20_FIRST 12
@@ -105,8 +105,8 @@
105#define WL_TX_POWER_F_SISO 8 105#define WL_TX_POWER_F_SISO 8
106 106
107/* values to force tx/rx chain */ 107/* values to force tx/rx chain */
108#define WLC_N_TXRX_CHAIN0 0 108#define BRCMS_N_TXRX_CHAIN0 0
109#define WLC_N_TXRX_CHAIN1 1 109#define BRCMS_N_TXRX_CHAIN1 1
110 110
111extern struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw, 111extern struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw,
112 void *wl, void *wlc); 112 void *wl, void *wlc);
diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h
index c1f2fdcc247..01d74609560 100644
--- a/drivers/staging/brcm80211/brcmsmac/pub.h
+++ b/drivers/staging/brcm80211/brcmsmac/pub.h
@@ -21,7 +21,7 @@
21#include "types.h" 21#include "types.h"
22#include "defs.h" 22#include "defs.h"
23 23
24#define WLC_NUMRATES 16 /* max # of rates in a rateset */ 24#define BRCMS_NUMRATES 16 /* max # of rates in a rateset */
25#define MAXMULTILIST 32 /* max # multicast addresses */ 25#define MAXMULTILIST 32 /* max # multicast addresses */
26#define D11_PHY_HDR_LEN 6 /* Phy header length - 6 bytes */ 26#define D11_PHY_HDR_LEN 6 /* Phy header length - 6 bytes */
27 27
@@ -36,36 +36,37 @@
36#define PHY_TYPE_HT 7 /* Phy type 3-Stream N */ 36#define PHY_TYPE_HT 7 /* Phy type 3-Stream N */
37 37
38/* bw */ 38/* bw */
39#define WLC_10_MHZ 10 /* 10Mhz nphy channel bandwidth */ 39#define BRCMS_10_MHZ 10 /* 10Mhz nphy channel bandwidth */
40#define WLC_20_MHZ 20 /* 20Mhz nphy channel bandwidth */ 40#define BRCMS_20_MHZ 20 /* 20Mhz nphy channel bandwidth */
41#define WLC_40_MHZ 40 /* 40Mhz nphy channel bandwidth */ 41#define BRCMS_40_MHZ 40 /* 40Mhz nphy channel bandwidth */
42 42
43#define CHSPEC_WLC_BW(chanspec) (CHSPEC_IS40(chanspec) ? WLC_40_MHZ : \ 43#define CHSPEC_WLC_BW(chanspec) (CHSPEC_IS40(chanspec) ? BRCMS_40_MHZ : \
44 CHSPEC_IS20(chanspec) ? WLC_20_MHZ : \ 44 CHSPEC_IS20(chanspec) ? BRCMS_20_MHZ : \
45 WLC_10_MHZ) 45 BRCMS_10_MHZ)
46 46
47#define WLC_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */ 47#define BRCMS_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */
48#define WLC_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */ 48#define BRCMS_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */
49#define WLC_RSSI_VERY_LOW -80 /* Very low quality cutoffs */ 49#define BRCMS_RSSI_VERY_LOW -80 /* Very low quality cutoffs */
50#define WLC_RSSI_LOW -70 /* Low quality cutoffs */ 50#define BRCMS_RSSI_LOW -70 /* Low quality cutoffs */
51#define WLC_RSSI_GOOD -68 /* Good quality cutoffs */ 51#define BRCMS_RSSI_GOOD -68 /* Good quality cutoffs */
52#define WLC_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */ 52#define BRCMS_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */
53#define WLC_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */ 53#define BRCMS_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */
54 54
55#define WLC_PHYTYPE(_x) (_x) /* macro to perform WLC PHY -> D11 PHY TYPE, currently 1:1 */ 55/* macro to perform PHY -> D11 PHY TYPE, currently 1:1 */
56#define BRCMS_PHYTYPE(_x) (_x)
56 57
57#define MA_WINDOW_SZ 8 /* moving average window size */ 58#define MA_WINDOW_SZ 8 /* moving average window size */
58 59
59#define WLC_SNR_INVALID 0 /* invalid SNR value */ 60#define BRCMS_SNR_INVALID 0 /* invalid SNR value */
60 61
61/* a large TX Power as an init value to factor out of min() calculations, 62/* a large TX Power as an init value to factor out of min() calculations,
62 * keep low enough to fit in an s8, units are .25 dBm 63 * keep low enough to fit in an s8, units are .25 dBm
63 */ 64 */
64#define WLC_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */ 65#define BRCMS_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */
65 66
66/* rate related definitions */ 67/* rate related definitions */
67#define WLC_RATE_FLAG 0x80 /* Flag to indicate it is a basic rate */ 68#define BRCMS_RATE_FLAG 0x80 /* Flag to indicate it is a basic rate */
68#define WLC_RATE_MASK 0x7f /* Rate value mask w/o basic rate flag */ 69#define BRCMS_RATE_MASK 0x7f /* Rate value mask w/o basic rate flag */
69 70
70/* legacy rx Antenna diversity for SISO rates */ 71/* legacy rx Antenna diversity for SISO rates */
71#define ANT_RX_DIV_FORCE_0 0 /* Use antenna 0 */ 72#define ANT_RX_DIV_FORCE_0 0 /* Use antenna 0 */
@@ -126,7 +127,8 @@ struct brcms_tunables {
126 127
127struct brcms_rateset { 128struct brcms_rateset {
128 uint count; /* number of rates in rates[] */ 129 uint count; /* number of rates in rates[] */
129 u8 rates[WLC_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */ 130 /* rates in 500kbps units w/hi bit set if basic */
131 u8 rates[BRCMS_NUMRATES];
130 u8 htphy_membership; /* HT PHY Membership */ 132 u8 htphy_membership; /* HT PHY Membership */
131 u8 mcs[MCSSET_LEN]; /* supported mcs index bit map */ 133 u8 mcs[MCSSET_LEN]; /* supported mcs index bit map */
132}; 134};
@@ -175,7 +177,7 @@ struct brcms_bss_info {
175 u8 dtim_period; /* DTIM period */ 177 u8 dtim_period; /* DTIM period */
176 s8 phy_noise; /* noise right after tx (in dBm) */ 178 s8 phy_noise; /* noise right after tx (in dBm) */
177 u16 capability; /* Capability information */ 179 u16 capability; /* Capability information */
178 u8 wme_qosinfo; /* QoS Info from WME IE; valid if WLC_BSS_WME flag set */ 180 u8 wme_qosinfo; /* QoS Info from WME IE; valid if BSS_WME flag set */
179 struct rsn_parms wpa; 181 struct rsn_parms wpa;
180 struct rsn_parms wpa2; 182 struct rsn_parms wpa2;
181 u16 qbss_load_aac; /* qbss load available admission capacity */ 183 u16 qbss_load_aac; /* qbss load available admission capacity */
@@ -185,17 +187,6 @@ struct brcms_bss_info {
185 u8 wpacfg; /* wpa config index */ 187 u8 wpacfg; /* wpa config index */
186}; 188};
187 189
188/* brcms_c_ioctl error codes */
189#define WLC_ENOIOCTL 1 /* No such Ioctl */
190#define WLC_EINVAL 2 /* Invalid value */
191#define WLC_ETOOSMALL 3 /* Value too small */
192#define WLC_ETOOBIG 4 /* Value too big */
193#define WLC_ERANGE 5 /* Out of range */
194#define WLC_EDOWN 6 /* Down */
195#define WLC_EUP 7 /* Up */
196#define WLC_ENOMEM 8 /* No Memory */
197#define WLC_EBUSY 9 /* Busy */
198
199/* IOVar flags for common error checks */ 190/* IOVar flags for common error checks */
200#define IOVF_MFG (1<<3) /* flag for mfgtest iovars */ 191#define IOVF_MFG (1<<3) /* flag for mfgtest iovars */
201#define IOVF_WHL (1<<4) /* value must be whole (0-max) */ 192#define IOVF_WHL (1<<4) /* value must be whole (0-max) */
@@ -312,7 +303,7 @@ struct brcms_pub {
312 303
313 u16 boardrev; /* version # of particular board */ 304 u16 boardrev; /* version # of particular board */
314 u8 sromrev; /* version # of the srom */ 305 u8 sromrev; /* version # of the srom */
315 char srom_ccode[WLC_CNTRY_BUF_SZ]; /* Country Code in SROM */ 306 char srom_ccode[BRCM_CNTRY_BUF_SZ]; /* Country Code in SROM */
316 u32 boardflags; /* Board specific flags from srom */ 307 u32 boardflags; /* Board specific flags from srom */
317 u32 boardflags2; /* More board flags if sromrev >= 4 */ 308 u32 boardflags2; /* More board flags if sromrev >= 4 */
318 bool tempsense_disable; /* disable periodic tempsense check */ 309 bool tempsense_disable; /* disable periodic tempsense check */
@@ -427,62 +418,64 @@ enum wlc_par_id {
427 418
428#define PROMISC_ENAB(wlc) ((wlc)->promisc) 419#define PROMISC_ENAB(wlc) ((wlc)->promisc)
429 420
430#define WLC_PREC_COUNT 16 /* Max precedence level implemented */ 421#define BRCMS_PREC_COUNT 16 /* Max precedence level implemented */
431 422
432/* pri is priority encoded in the packet. This maps the Packet priority to 423/* pri is priority encoded in the packet. This maps the Packet priority to
433 * enqueue precedence as defined in wlc_prec_map 424 * enqueue precedence as defined in wlc_prec_map
434 */ 425 */
435extern const u8 wlc_prio2prec_map[]; 426extern const u8 wlc_prio2prec_map[];
436#define WLC_PRIO_TO_PREC(pri) wlc_prio2prec_map[(pri) & 7] 427#define BRCMS_PRIO_TO_PREC(pri) wlc_prio2prec_map[(pri) & 7]
437 428
438/* This maps priority to one precedence higher - Used by PS-Poll response packets to 429/* This maps priority to one precedence higher - Used by PS-Poll response packets to
439 * simulate enqueue-at-head operation, but still maintain the order on the queue 430 * simulate enqueue-at-head operation, but still maintain the order on the queue
440 */ 431 */
441#define WLC_PRIO_TO_HI_PREC(pri) min(WLC_PRIO_TO_PREC(pri) + 1, WLC_PREC_COUNT - 1) 432#define BRCMS_PRIO_TO_HI_PREC(pri) min(BRCMS_PRIO_TO_PREC(pri) + 1,\
433 BRCMS_PREC_COUNT - 1)
442 434
443extern const u8 wme_fifo2ac[]; 435extern const u8 wme_fifo2ac[];
444#define WME_PRIO2AC(prio) wme_fifo2ac[prio2fifo[(prio)]] 436#define WME_PRIO2AC(prio) wme_fifo2ac[prio2fifo[(prio)]]
445 437
446/* Mask to describe all precedence levels */ 438/* Mask to describe all precedence levels */
447#define WLC_PREC_BMP_ALL MAXBITVAL(WLC_PREC_COUNT) 439#define BRCMS_PREC_BMP_ALL MAXBITVAL(BRCMS_PREC_COUNT)
448 440
449/* Define a bitmap of precedences comprised by each AC */ 441/* Define a bitmap of precedences comprised by each AC */
450#define WLC_PREC_BMP_AC_BE (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_BE)) | \ 442#define BRCMS_PREC_BMP_AC_BE (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BE)) | \
451 NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_BE)) | \ 443 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BE)) | \
452 NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_EE)) | \ 444 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_EE)) | \
453 NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_EE))) 445 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_EE)))
454#define WLC_PREC_BMP_AC_BK (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_BK)) | \ 446#define BRCMS_PREC_BMP_AC_BK (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BK)) | \
455 NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_BK)) | \ 447 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BK)) | \
456 NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_NONE)) | \ 448 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NONE)) | \
457 NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_NONE))) 449 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NONE)))
458#define WLC_PREC_BMP_AC_VI (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_CL)) | \ 450#define BRCMS_PREC_BMP_AC_VI (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_CL)) | \
459 NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_CL)) | \ 451 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_CL)) | \
460 NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_VI)) | \ 452 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VI)) | \
461 NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_VI))) 453 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VI)))
462#define WLC_PREC_BMP_AC_VO (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_VO)) | \ 454#define BRCMS_PREC_BMP_AC_VO (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VO)) | \
463 NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_VO)) | \ 455 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VO)) | \
464 NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_NC)) | \ 456 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NC)) | \
465 NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_NC))) 457 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NC)))
466 458
467/* WME Support */ 459/* WME Support */
468#define WME_ENAB(pub) ((pub)->_wme != OFF) 460#define WME_ENAB(pub) ((pub)->_wme != OFF)
469#define WME_AUTO(wlc) ((wlc)->pub->_wme == AUTO) 461#define WME_AUTO(wlc) ((wlc)->pub->_wme == AUTO)
470 462
471#define WLC_USE_COREFLAGS 0xffffffff /* invalid core flags, use the saved coreflags */ 463/* invalid core flags, use the saved coreflags */
464#define BRCMS_USE_COREFLAGS 0xffffffff
472 465
473 466
474/* network protection config */ 467/* network protection config */
475#define WLC_PROT_G_SPEC 1 /* SPEC g protection */ 468#define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */
476#define WLC_PROT_G_OVR 2 /* SPEC g prot override */ 469#define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */
477#define WLC_PROT_G_USER 3 /* gmode specified by user */ 470#define BRCMS_PROT_G_USER 3 /* gmode specified by user */
478#define WLC_PROT_OVERLAP 4 /* overlap */ 471#define BRCMS_PROT_OVERLAP 4 /* overlap */
479#define WLC_PROT_N_USER 10 /* nmode specified by user */ 472#define BRCMS_PROT_N_USER 10 /* nmode specified by user */
480#define WLC_PROT_N_CFG 11 /* n protection */ 473#define BRCMS_PROT_N_CFG 11 /* n protection */
481#define WLC_PROT_N_CFG_OVR 12 /* n protection override */ 474#define BRCMS_PROT_N_CFG_OVR 12 /* n protection override */
482#define WLC_PROT_N_NONGF 13 /* non-GF protection */ 475#define BRCMS_PROT_N_NONGF 13 /* non-GF protection */
483#define WLC_PROT_N_NONGF_OVR 14 /* non-GF protection override */ 476#define BRCMS_PROT_N_NONGF_OVR 14 /* non-GF protection override */
484#define WLC_PROT_N_PAM_OVR 15 /* n preamble override */ 477#define BRCMS_PROT_N_PAM_OVR 15 /* n preamble override */
485#define WLC_PROT_N_OBSS 16 /* non-HT OBSS present */ 478#define BRCMS_PROT_N_OBSS 16 /* non-HT OBSS present */
486 479
487/* 480/*
488 * 54g modes (basic bits may still be overridden) 481 * 54g modes (basic bits may still be overridden)
@@ -519,36 +512,36 @@ extern const u8 wme_fifo2ac[];
519#define GMODE_MAX 6 512#define GMODE_MAX 6
520 513
521/* values for PLCPHdr_override */ 514/* values for PLCPHdr_override */
522#define WLC_PLCP_AUTO -1 515#define BRCMS_PLCP_AUTO -1
523#define WLC_PLCP_SHORT 0 516#define BRCMS_PLCP_SHORT 0
524#define WLC_PLCP_LONG 1 517#define BRCMS_PLCP_LONG 1
525 518
526/* values for g_protection_override and n_protection_override */ 519/* values for g_protection_override and n_protection_override */
527#define WLC_PROTECTION_AUTO -1 520#define BRCMS_PROTECTION_AUTO -1
528#define WLC_PROTECTION_OFF 0 521#define BRCMS_PROTECTION_OFF 0
529#define WLC_PROTECTION_ON 1 522#define BRCMS_PROTECTION_ON 1
530#define WLC_PROTECTION_MMHDR_ONLY 2 523#define BRCMS_PROTECTION_MMHDR_ONLY 2
531#define WLC_PROTECTION_CTS_ONLY 3 524#define BRCMS_PROTECTION_CTS_ONLY 3
532 525
533/* values for g_protection_control and n_protection_control */ 526/* values for g_protection_control and n_protection_control */
534#define WLC_PROTECTION_CTL_OFF 0 527#define BRCMS_PROTECTION_CTL_OFF 0
535#define WLC_PROTECTION_CTL_LOCAL 1 528#define BRCMS_PROTECTION_CTL_LOCAL 1
536#define WLC_PROTECTION_CTL_OVERLAP 2 529#define BRCMS_PROTECTION_CTL_OVERLAP 2
537 530
538/* values for n_protection */ 531/* values for n_protection */
539#define WLC_N_PROTECTION_OFF 0 532#define BRCMS_N_PROTECTION_OFF 0
540#define WLC_N_PROTECTION_OPTIONAL 1 533#define BRCMS_N_PROTECTION_OPTIONAL 1
541#define WLC_N_PROTECTION_20IN40 2 534#define BRCMS_N_PROTECTION_20IN40 2
542#define WLC_N_PROTECTION_MIXEDMODE 3 535#define BRCMS_N_PROTECTION_MIXEDMODE 3
543 536
544/* values for band specific 40MHz capabilities */ 537/* values for band specific 40MHz capabilities */
545#define WLC_N_BW_20ALL 0 538#define BRCMS_N_BW_20ALL 0
546#define WLC_N_BW_40ALL 1 539#define BRCMS_N_BW_40ALL 1
547#define WLC_N_BW_20IN2G_40IN5G 2 540#define BRCMS_N_BW_20IN2G_40IN5G 2
548 541
549/* bitflags for SGI support (sgi_rx iovar) */ 542/* bitflags for SGI support (sgi_rx iovar) */
550#define WLC_N_SGI_20 0x01 543#define BRCMS_N_SGI_20 0x01
551#define WLC_N_SGI_40 0x02 544#define BRCMS_N_SGI_40 0x02
552 545
553/* defines used by the nrate iovar */ 546/* defines used by the nrate iovar */
554#define NRATE_MCS_INUSE 0x00000080 /* MSC in use,indicates b0-6 holds an mcs */ 547#define NRATE_MCS_INUSE 0x00000080 /* MSC in use,indicates b0-6 holds an mcs */
@@ -667,6 +660,6 @@ extern bool brcms_c_radio_monitor_stop(struct brcms_c_info *wlc);
667#define BAND_5G_NAME "5G" 660#define BAND_5G_NAME "5G"
668 661
669/* BMAC RPC: 7 u32 params: pkttotlen, fifo, commit, fid, txpktpend, pktflag, rpc_id */ 662/* BMAC RPC: 7 u32 params: pkttotlen, fifo, commit, fid, txpktpend, pktflag, rpc_id */
670#define WLC_RPCTX_PARAMS 32 663#define BRCMS_RPCTX_PARAMS 32
671 664
672#endif /* _BRCM_PUB_H_ */ 665#endif /* _BRCM_PUB_H_ */
diff --git a/drivers/staging/brcm80211/brcmsmac/rate.c b/drivers/staging/brcm80211/brcmsmac/rate.c
index 487523eaa96..f0e4b99c256 100644
--- a/drivers/staging/brcm80211/brcmsmac/rate.c
+++ b/drivers/staging/brcm80211/brcmsmac/rate.c
@@ -22,7 +22,7 @@
22#include "rate.h" 22#include "rate.h"
23 23
24/* Rate info per rate: It tells whether a rate is ofdm or not and its phy_rate value */ 24/* Rate info per rate: It tells whether a rate is ofdm or not and its phy_rate value */
25const u8 rate_info[WLC_MAXRATE + 1] = { 25const u8 rate_info[BRCM_MAXRATE + 1] = {
26 /* 0 1 2 3 4 5 6 7 8 9 */ 26 /* 0 1 2 3 4 5 6 7 8 9 */
27/* 0 */ 0x00, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 27/* 0 */ 0x00, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
28/* 10 */ 0x00, 0x37, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x00, 28/* 10 */ 0x00, 0x37, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x00,
@@ -41,102 +41,102 @@ const u8 rate_info[WLC_MAXRATE + 1] = {
41const struct brcms_mcs_info mcs_table[MCS_TABLE_SIZE] = { 41const struct brcms_mcs_info mcs_table[MCS_TABLE_SIZE] = {
42 /* MCS 0: SS 1, MOD: BPSK, CR 1/2 */ 42 /* MCS 0: SS 1, MOD: BPSK, CR 1/2 */
43 {6500, 13500, CEIL(6500 * 10, 9), CEIL(13500 * 10, 9), 0x00, 43 {6500, 13500, CEIL(6500 * 10, 9), CEIL(13500 * 10, 9), 0x00,
44 WLC_RATE_6M}, 44 BRCM_RATE_6M},
45 /* MCS 1: SS 1, MOD: QPSK, CR 1/2 */ 45 /* MCS 1: SS 1, MOD: QPSK, CR 1/2 */
46 {13000, 27000, CEIL(13000 * 10, 9), CEIL(27000 * 10, 9), 0x08, 46 {13000, 27000, CEIL(13000 * 10, 9), CEIL(27000 * 10, 9), 0x08,
47 WLC_RATE_12M}, 47 BRCM_RATE_12M},
48 /* MCS 2: SS 1, MOD: QPSK, CR 3/4 */ 48 /* MCS 2: SS 1, MOD: QPSK, CR 3/4 */
49 {19500, 40500, CEIL(19500 * 10, 9), CEIL(40500 * 10, 9), 0x0A, 49 {19500, 40500, CEIL(19500 * 10, 9), CEIL(40500 * 10, 9), 0x0A,
50 WLC_RATE_18M}, 50 BRCM_RATE_18M},
51 /* MCS 3: SS 1, MOD: 16QAM, CR 1/2 */ 51 /* MCS 3: SS 1, MOD: 16QAM, CR 1/2 */
52 {26000, 54000, CEIL(26000 * 10, 9), CEIL(54000 * 10, 9), 0x10, 52 {26000, 54000, CEIL(26000 * 10, 9), CEIL(54000 * 10, 9), 0x10,
53 WLC_RATE_24M}, 53 BRCM_RATE_24M},
54 /* MCS 4: SS 1, MOD: 16QAM, CR 3/4 */ 54 /* MCS 4: SS 1, MOD: 16QAM, CR 3/4 */
55 {39000, 81000, CEIL(39000 * 10, 9), CEIL(81000 * 10, 9), 0x12, 55 {39000, 81000, CEIL(39000 * 10, 9), CEIL(81000 * 10, 9), 0x12,
56 WLC_RATE_36M}, 56 BRCM_RATE_36M},
57 /* MCS 5: SS 1, MOD: 64QAM, CR 2/3 */ 57 /* MCS 5: SS 1, MOD: 64QAM, CR 2/3 */
58 {52000, 108000, CEIL(52000 * 10, 9), CEIL(108000 * 10, 9), 0x19, 58 {52000, 108000, CEIL(52000 * 10, 9), CEIL(108000 * 10, 9), 0x19,
59 WLC_RATE_48M}, 59 BRCM_RATE_48M},
60 /* MCS 6: SS 1, MOD: 64QAM, CR 3/4 */ 60 /* MCS 6: SS 1, MOD: 64QAM, CR 3/4 */
61 {58500, 121500, CEIL(58500 * 10, 9), CEIL(121500 * 10, 9), 0x1A, 61 {58500, 121500, CEIL(58500 * 10, 9), CEIL(121500 * 10, 9), 0x1A,
62 WLC_RATE_54M}, 62 BRCM_RATE_54M},
63 /* MCS 7: SS 1, MOD: 64QAM, CR 5/6 */ 63 /* MCS 7: SS 1, MOD: 64QAM, CR 5/6 */
64 {65000, 135000, CEIL(65000 * 10, 9), CEIL(135000 * 10, 9), 0x1C, 64 {65000, 135000, CEIL(65000 * 10, 9), CEIL(135000 * 10, 9), 0x1C,
65 WLC_RATE_54M}, 65 BRCM_RATE_54M},
66 /* MCS 8: SS 2, MOD: BPSK, CR 1/2 */ 66 /* MCS 8: SS 2, MOD: BPSK, CR 1/2 */
67 {13000, 27000, CEIL(13000 * 10, 9), CEIL(27000 * 10, 9), 0x40, 67 {13000, 27000, CEIL(13000 * 10, 9), CEIL(27000 * 10, 9), 0x40,
68 WLC_RATE_6M}, 68 BRCM_RATE_6M},
69 /* MCS 9: SS 2, MOD: QPSK, CR 1/2 */ 69 /* MCS 9: SS 2, MOD: QPSK, CR 1/2 */
70 {26000, 54000, CEIL(26000 * 10, 9), CEIL(54000 * 10, 9), 0x48, 70 {26000, 54000, CEIL(26000 * 10, 9), CEIL(54000 * 10, 9), 0x48,
71 WLC_RATE_12M}, 71 BRCM_RATE_12M},
72 /* MCS 10: SS 2, MOD: QPSK, CR 3/4 */ 72 /* MCS 10: SS 2, MOD: QPSK, CR 3/4 */
73 {39000, 81000, CEIL(39000 * 10, 9), CEIL(81000 * 10, 9), 0x4A, 73 {39000, 81000, CEIL(39000 * 10, 9), CEIL(81000 * 10, 9), 0x4A,
74 WLC_RATE_18M}, 74 BRCM_RATE_18M},
75 /* MCS 11: SS 2, MOD: 16QAM, CR 1/2 */ 75 /* MCS 11: SS 2, MOD: 16QAM, CR 1/2 */
76 {52000, 108000, CEIL(52000 * 10, 9), CEIL(108000 * 10, 9), 0x50, 76 {52000, 108000, CEIL(52000 * 10, 9), CEIL(108000 * 10, 9), 0x50,
77 WLC_RATE_24M}, 77 BRCM_RATE_24M},
78 /* MCS 12: SS 2, MOD: 16QAM, CR 3/4 */ 78 /* MCS 12: SS 2, MOD: 16QAM, CR 3/4 */
79 {78000, 162000, CEIL(78000 * 10, 9), CEIL(162000 * 10, 9), 0x52, 79 {78000, 162000, CEIL(78000 * 10, 9), CEIL(162000 * 10, 9), 0x52,
80 WLC_RATE_36M}, 80 BRCM_RATE_36M},
81 /* MCS 13: SS 2, MOD: 64QAM, CR 2/3 */ 81 /* MCS 13: SS 2, MOD: 64QAM, CR 2/3 */
82 {104000, 216000, CEIL(104000 * 10, 9), CEIL(216000 * 10, 9), 0x59, 82 {104000, 216000, CEIL(104000 * 10, 9), CEIL(216000 * 10, 9), 0x59,
83 WLC_RATE_48M}, 83 BRCM_RATE_48M},
84 /* MCS 14: SS 2, MOD: 64QAM, CR 3/4 */ 84 /* MCS 14: SS 2, MOD: 64QAM, CR 3/4 */
85 {117000, 243000, CEIL(117000 * 10, 9), CEIL(243000 * 10, 9), 0x5A, 85 {117000, 243000, CEIL(117000 * 10, 9), CEIL(243000 * 10, 9), 0x5A,
86 WLC_RATE_54M}, 86 BRCM_RATE_54M},
87 /* MCS 15: SS 2, MOD: 64QAM, CR 5/6 */ 87 /* MCS 15: SS 2, MOD: 64QAM, CR 5/6 */
88 {130000, 270000, CEIL(130000 * 10, 9), CEIL(270000 * 10, 9), 0x5C, 88 {130000, 270000, CEIL(130000 * 10, 9), CEIL(270000 * 10, 9), 0x5C,
89 WLC_RATE_54M}, 89 BRCM_RATE_54M},
90 /* MCS 16: SS 3, MOD: BPSK, CR 1/2 */ 90 /* MCS 16: SS 3, MOD: BPSK, CR 1/2 */
91 {19500, 40500, CEIL(19500 * 10, 9), CEIL(40500 * 10, 9), 0x80, 91 {19500, 40500, CEIL(19500 * 10, 9), CEIL(40500 * 10, 9), 0x80,
92 WLC_RATE_6M}, 92 BRCM_RATE_6M},
93 /* MCS 17: SS 3, MOD: QPSK, CR 1/2 */ 93 /* MCS 17: SS 3, MOD: QPSK, CR 1/2 */
94 {39000, 81000, CEIL(39000 * 10, 9), CEIL(81000 * 10, 9), 0x88, 94 {39000, 81000, CEIL(39000 * 10, 9), CEIL(81000 * 10, 9), 0x88,
95 WLC_RATE_12M}, 95 BRCM_RATE_12M},
96 /* MCS 18: SS 3, MOD: QPSK, CR 3/4 */ 96 /* MCS 18: SS 3, MOD: QPSK, CR 3/4 */
97 {58500, 121500, CEIL(58500 * 10, 9), CEIL(121500 * 10, 9), 0x8A, 97 {58500, 121500, CEIL(58500 * 10, 9), CEIL(121500 * 10, 9), 0x8A,
98 WLC_RATE_18M}, 98 BRCM_RATE_18M},
99 /* MCS 19: SS 3, MOD: 16QAM, CR 1/2 */ 99 /* MCS 19: SS 3, MOD: 16QAM, CR 1/2 */
100 {78000, 162000, CEIL(78000 * 10, 9), CEIL(162000 * 10, 9), 0x90, 100 {78000, 162000, CEIL(78000 * 10, 9), CEIL(162000 * 10, 9), 0x90,
101 WLC_RATE_24M}, 101 BRCM_RATE_24M},
102 /* MCS 20: SS 3, MOD: 16QAM, CR 3/4 */ 102 /* MCS 20: SS 3, MOD: 16QAM, CR 3/4 */
103 {117000, 243000, CEIL(117000 * 10, 9), CEIL(243000 * 10, 9), 0x92, 103 {117000, 243000, CEIL(117000 * 10, 9), CEIL(243000 * 10, 9), 0x92,
104 WLC_RATE_36M}, 104 BRCM_RATE_36M},
105 /* MCS 21: SS 3, MOD: 64QAM, CR 2/3 */ 105 /* MCS 21: SS 3, MOD: 64QAM, CR 2/3 */
106 {156000, 324000, CEIL(156000 * 10, 9), CEIL(324000 * 10, 9), 0x99, 106 {156000, 324000, CEIL(156000 * 10, 9), CEIL(324000 * 10, 9), 0x99,
107 WLC_RATE_48M}, 107 BRCM_RATE_48M},
108 /* MCS 22: SS 3, MOD: 64QAM, CR 3/4 */ 108 /* MCS 22: SS 3, MOD: 64QAM, CR 3/4 */
109 {175500, 364500, CEIL(175500 * 10, 9), CEIL(364500 * 10, 9), 0x9A, 109 {175500, 364500, CEIL(175500 * 10, 9), CEIL(364500 * 10, 9), 0x9A,
110 WLC_RATE_54M}, 110 BRCM_RATE_54M},
111 /* MCS 23: SS 3, MOD: 64QAM, CR 5/6 */ 111 /* MCS 23: SS 3, MOD: 64QAM, CR 5/6 */
112 {195000, 405000, CEIL(195000 * 10, 9), CEIL(405000 * 10, 9), 0x9B, 112 {195000, 405000, CEIL(195000 * 10, 9), CEIL(405000 * 10, 9), 0x9B,
113 WLC_RATE_54M}, 113 BRCM_RATE_54M},
114 /* MCS 24: SS 4, MOD: BPSK, CR 1/2 */ 114 /* MCS 24: SS 4, MOD: BPSK, CR 1/2 */
115 {26000, 54000, CEIL(26000 * 10, 9), CEIL(54000 * 10, 9), 0xC0, 115 {26000, 54000, CEIL(26000 * 10, 9), CEIL(54000 * 10, 9), 0xC0,
116 WLC_RATE_6M}, 116 BRCM_RATE_6M},
117 /* MCS 25: SS 4, MOD: QPSK, CR 1/2 */ 117 /* MCS 25: SS 4, MOD: QPSK, CR 1/2 */
118 {52000, 108000, CEIL(52000 * 10, 9), CEIL(108000 * 10, 9), 0xC8, 118 {52000, 108000, CEIL(52000 * 10, 9), CEIL(108000 * 10, 9), 0xC8,
119 WLC_RATE_12M}, 119 BRCM_RATE_12M},
120 /* MCS 26: SS 4, MOD: QPSK, CR 3/4 */ 120 /* MCS 26: SS 4, MOD: QPSK, CR 3/4 */
121 {78000, 162000, CEIL(78000 * 10, 9), CEIL(162000 * 10, 9), 0xCA, 121 {78000, 162000, CEIL(78000 * 10, 9), CEIL(162000 * 10, 9), 0xCA,
122 WLC_RATE_18M}, 122 BRCM_RATE_18M},
123 /* MCS 27: SS 4, MOD: 16QAM, CR 1/2 */ 123 /* MCS 27: SS 4, MOD: 16QAM, CR 1/2 */
124 {104000, 216000, CEIL(104000 * 10, 9), CEIL(216000 * 10, 9), 0xD0, 124 {104000, 216000, CEIL(104000 * 10, 9), CEIL(216000 * 10, 9), 0xD0,
125 WLC_RATE_24M}, 125 BRCM_RATE_24M},
126 /* MCS 28: SS 4, MOD: 16QAM, CR 3/4 */ 126 /* MCS 28: SS 4, MOD: 16QAM, CR 3/4 */
127 {156000, 324000, CEIL(156000 * 10, 9), CEIL(324000 * 10, 9), 0xD2, 127 {156000, 324000, CEIL(156000 * 10, 9), CEIL(324000 * 10, 9), 0xD2,
128 WLC_RATE_36M}, 128 BRCM_RATE_36M},
129 /* MCS 29: SS 4, MOD: 64QAM, CR 2/3 */ 129 /* MCS 29: SS 4, MOD: 64QAM, CR 2/3 */
130 {208000, 432000, CEIL(208000 * 10, 9), CEIL(432000 * 10, 9), 0xD9, 130 {208000, 432000, CEIL(208000 * 10, 9), CEIL(432000 * 10, 9), 0xD9,
131 WLC_RATE_48M}, 131 BRCM_RATE_48M},
132 /* MCS 30: SS 4, MOD: 64QAM, CR 3/4 */ 132 /* MCS 30: SS 4, MOD: 64QAM, CR 3/4 */
133 {234000, 486000, CEIL(234000 * 10, 9), CEIL(486000 * 10, 9), 0xDA, 133 {234000, 486000, CEIL(234000 * 10, 9), CEIL(486000 * 10, 9), 0xDA,
134 WLC_RATE_54M}, 134 BRCM_RATE_54M},
135 /* MCS 31: SS 4, MOD: 64QAM, CR 5/6 */ 135 /* MCS 31: SS 4, MOD: 64QAM, CR 5/6 */
136 {260000, 540000, CEIL(260000 * 10, 9), CEIL(540000 * 10, 9), 0xDB, 136 {260000, 540000, CEIL(260000 * 10, 9), CEIL(540000 * 10, 9), 0xDB,
137 WLC_RATE_54M}, 137 BRCM_RATE_54M},
138 /* MCS 32: SS 1, MOD: BPSK, CR 1/2 */ 138 /* MCS 32: SS 1, MOD: BPSK, CR 1/2 */
139 {0, 6000, 0, CEIL(6000 * 10, 9), 0x00, WLC_RATE_6M}, 139 {0, 6000, 0, CEIL(6000 * 10, 9), 0x00, BRCM_RATE_6M},
140}; 140};
141 141
142/* phycfg for legacy OFDM frames: code rate, modulation scheme, spatial streams 142/* phycfg for legacy OFDM frames: code rate, modulation scheme, spatial streams
@@ -155,18 +155,26 @@ struct legacy_phycfg {
155/* 0 = 1Mbps; 1 = 2Mbps; 2 = 5.5Mbps; 3 = 11Mbps */ 155/* 0 = 1Mbps; 1 = 2Mbps; 2 = 5.5Mbps; 3 = 11Mbps */
156static const struct 156static const struct
157legacy_phycfg legacy_phycfg_table[LEGACY_PHYCFG_TABLE_SIZE] = { 157legacy_phycfg legacy_phycfg_table[LEGACY_PHYCFG_TABLE_SIZE] = {
158 {WLC_RATE_1M, 0x00}, /* CCK 1Mbps, data rate 0 */ 158 {BRCM_RATE_1M, 0x00}, /* CCK 1Mbps, data rate 0 */
159 {WLC_RATE_2M, 0x08}, /* CCK 2Mbps, data rate 1 */ 159 {BRCM_RATE_2M, 0x08}, /* CCK 2Mbps, data rate 1 */
160 {WLC_RATE_5M5, 0x10}, /* CCK 5.5Mbps, data rate 2 */ 160 {BRCM_RATE_5M5, 0x10}, /* CCK 5.5Mbps, data rate 2 */
161 {WLC_RATE_11M, 0x18}, /* CCK 11Mbps, data rate 3 */ 161 {BRCM_RATE_11M, 0x18}, /* CCK 11Mbps, data rate 3 */
162 {WLC_RATE_6M, 0x00}, /* OFDM 6Mbps, code rate 1/2, BPSK, 1 spatial stream */ 162 /* OFDM 6Mbps, code rate 1/2, BPSK, 1 spatial stream */
163 {WLC_RATE_9M, 0x02}, /* OFDM 9Mbps, code rate 3/4, BPSK, 1 spatial stream */ 163 {BRCM_RATE_6M, 0x00},
164 {WLC_RATE_12M, 0x08}, /* OFDM 12Mbps, code rate 1/2, QPSK, 1 spatial stream */ 164 /* OFDM 9Mbps, code rate 3/4, BPSK, 1 spatial stream */
165 {WLC_RATE_18M, 0x0A}, /* OFDM 18Mbps, code rate 3/4, QPSK, 1 spatial stream */ 165 {BRCM_RATE_9M, 0x02},
166 {WLC_RATE_24M, 0x10}, /* OFDM 24Mbps, code rate 1/2, 16-QAM, 1 spatial stream */ 166 /* OFDM 12Mbps, code rate 1/2, QPSK, 1 spatial stream */
167 {WLC_RATE_36M, 0x12}, /* OFDM 36Mbps, code rate 3/4, 16-QAM, 1 spatial stream */ 167 {BRCM_RATE_12M, 0x08},
168 {WLC_RATE_48M, 0x19}, /* OFDM 48Mbps, code rate 2/3, 64-QAM, 1 spatial stream */ 168 /* OFDM 18Mbps, code rate 3/4, QPSK, 1 spatial stream */
169 {WLC_RATE_54M, 0x1A}, /* OFDM 54Mbps, code rate 3/4, 64-QAM, 1 spatial stream */ 169 {BRCM_RATE_18M, 0x0A},
170 /* OFDM 24Mbps, code rate 1/2, 16-QAM, 1 spatial stream */
171 {BRCM_RATE_24M, 0x10},
172 /* OFDM 36Mbps, code rate 3/4, 16-QAM, 1 spatial stream */
173 {BRCM_RATE_36M, 0x12},
174 /* OFDM 48Mbps, code rate 2/3, 64-QAM, 1 spatial stream */
175 {BRCM_RATE_48M, 0x19},
176 /* OFDM 54Mbps, code rate 3/4, 64-QAM, 1 spatial stream */
177 {BRCM_RATE_54M, 0x1A},
170}; 178};
171 179
172/* Hardware rates (also encodes default basic rates) */ 180/* Hardware rates (also encodes default basic rates) */
@@ -262,7 +270,7 @@ static bool brcms_c_rateset_valid(wlc_rateset_t *rs, bool check_brate)
262 270
263 /* error if no basic rates */ 271 /* error if no basic rates */
264 for (idx = 0; idx < rs->count; idx++) { 272 for (idx = 0; idx < rs->count; idx++) {
265 if (rs->rates[idx] & WLC_RATE_FLAG) 273 if (rs->rates[idx] & BRCMS_RATE_FLAG)
266 return true; 274 return true;
267 } 275 }
268 return false; 276 return false;
@@ -283,7 +291,7 @@ brcms_c_rate_hwrs_filter_sort_validate(wlc_rateset_t *rs,
283 const wlc_rateset_t *hw_rs, 291 const wlc_rateset_t *hw_rs,
284 bool check_brate, u8 txstreams) 292 bool check_brate, u8 txstreams)
285{ 293{
286 u8 rateset[WLC_MAXRATE + 1]; 294 u8 rateset[BRCM_MAXRATE + 1];
287 u8 r; 295 u8 r;
288 uint count; 296 uint count;
289 uint i; 297 uint i;
@@ -292,18 +300,17 @@ brcms_c_rate_hwrs_filter_sort_validate(wlc_rateset_t *rs,
292 count = rs->count; 300 count = rs->count;
293 301
294 for (i = 0; i < count; i++) { 302 for (i = 0; i < count; i++) {
295 /* mask off "basic rate" bit, WLC_RATE_FLAG */ 303 /* mask off "basic rate" bit, BRCMS_RATE_FLAG */
296 r = (int)rs->rates[i] & WLC_RATE_MASK; 304 r = (int)rs->rates[i] & BRCMS_RATE_MASK;
297 if ((r > WLC_MAXRATE) || (rate_info[r] == 0)) { 305 if ((r > BRCM_MAXRATE) || (rate_info[r] == 0))
298 continue; 306 continue;
299 }
300 rateset[r] = rs->rates[i]; /* preserve basic bit! */ 307 rateset[r] = rs->rates[i]; /* preserve basic bit! */
301 } 308 }
302 309
303 /* fill out the rates in order, looking at only supported rates */ 310 /* fill out the rates in order, looking at only supported rates */
304 count = 0; 311 count = 0;
305 for (i = 0; i < hw_rs->count; i++) { 312 for (i = 0; i < hw_rs->count; i++) {
306 r = hw_rs->rates[i] & WLC_RATE_MASK; 313 r = hw_rs->rates[i] & BRCMS_RATE_MASK;
307 if (rateset[r]) 314 if (rateset[r])
308 rs->rates[count++] = rateset[r]; 315 rs->rates[count++] = rateset[r];
309 } 316 }
@@ -395,18 +402,18 @@ brcms_c_rateset_filter(wlc_rateset_t *src, wlc_rateset_t *dst, bool basic_only,
395 count = 0; 402 count = 0;
396 for (i = 0; i < src->count; i++) { 403 for (i = 0; i < src->count; i++) {
397 r = src->rates[i]; 404 r = src->rates[i];
398 if (basic_only && !(r & WLC_RATE_FLAG)) 405 if (basic_only && !(r & BRCMS_RATE_FLAG))
399 continue; 406 continue;
400 if ((rates == WLC_RATES_CCK) && IS_OFDM((r & WLC_RATE_MASK))) 407 if (rates == BRCMS_RATES_CCK && IS_OFDM((r & BRCMS_RATE_MASK)))
401 continue; 408 continue;
402 if ((rates == WLC_RATES_OFDM) && IS_CCK((r & WLC_RATE_MASK))) 409 if (rates == BRCMS_RATES_OFDM && IS_CCK((r & BRCMS_RATE_MASK)))
403 continue; 410 continue;
404 dst->rates[count++] = r & xmask; 411 dst->rates[count++] = r & xmask;
405 } 412 }
406 dst->count = count; 413 dst->count = count;
407 dst->htphy_membership = src->htphy_membership; 414 dst->htphy_membership = src->htphy_membership;
408 415
409 if (mcsallow && rates != WLC_RATES_CCK) 416 if (mcsallow && rates != BRCMS_RATES_CCK)
410 memcpy(&dst->mcs[0], &src->mcs[0], MCSSET_LEN); 417 memcpy(&dst->mcs[0], &src->mcs[0], MCSSET_LEN);
411 else 418 else
412 brcms_c_rateset_mcs_clear(dst); 419 brcms_c_rateset_mcs_clear(dst);
@@ -427,10 +434,10 @@ brcms_c_rateset_default(wlc_rateset_t *rs_tgt, const wlc_rateset_t *rs_hw,
427 (PHYTYPE_IS(phy_type, PHY_TYPE_LCN)) || 434 (PHYTYPE_IS(phy_type, PHY_TYPE_LCN)) ||
428 (PHYTYPE_IS(phy_type, PHY_TYPE_SSN))) { 435 (PHYTYPE_IS(phy_type, PHY_TYPE_SSN))) {
429 if (BAND_5G(bandtype)) { 436 if (BAND_5G(bandtype)) {
430 rs_dflt = (bw == WLC_20_MHZ ? 437 rs_dflt = (bw == BRCMS_20_MHZ ?
431 &ofdm_mimo_rates : &ofdm_40bw_mimo_rates); 438 &ofdm_mimo_rates : &ofdm_40bw_mimo_rates);
432 } else { 439 } else {
433 rs_dflt = (bw == WLC_20_MHZ ? 440 rs_dflt = (bw == BRCMS_20_MHZ ?
434 &cck_ofdm_mimo_rates : 441 &cck_ofdm_mimo_rates :
435 &cck_ofdm_40bw_mimo_rates); 442 &cck_ofdm_40bw_mimo_rates);
436 } 443 }
@@ -452,7 +459,7 @@ brcms_c_rateset_default(wlc_rateset_t *rs_tgt, const wlc_rateset_t *rs_hw,
452 brcms_c_rateset_copy(rs_dflt, &rs_sel); 459 brcms_c_rateset_copy(rs_dflt, &rs_sel);
453 brcms_c_rateset_mcs_upd(&rs_sel, txstreams); 460 brcms_c_rateset_mcs_upd(&rs_sel, txstreams);
454 brcms_c_rateset_filter(&rs_sel, rs_tgt, false, 461 brcms_c_rateset_filter(&rs_sel, rs_tgt, false,
455 cck_only ? WLC_RATES_CCK : WLC_RATES_CCK_OFDM, 462 cck_only ? BRCMS_RATES_CCK : BRCMS_RATES_CCK_OFDM,
456 rate_mask, mcsallow); 463 rate_mask, mcsallow);
457 brcms_c_rate_hwrs_filter_sort_validate(rs_tgt, rs_hw, false, 464 brcms_c_rate_hwrs_filter_sort_validate(rs_tgt, rs_hw, false,
458 mcsallow ? txstreams : 1); 465 mcsallow ? txstreams : 1);
@@ -484,7 +491,7 @@ void brcms_c_rateset_mcs_build(wlc_rateset_t *rateset, u8 txstreams)
484/* Based on bandwidth passed, allow/disallow MCS 32 in the rateset */ 491/* Based on bandwidth passed, allow/disallow MCS 32 in the rateset */
485void brcms_c_rateset_bw_mcs_filter(wlc_rateset_t *rateset, u8 bw) 492void brcms_c_rateset_bw_mcs_filter(wlc_rateset_t *rateset, u8 bw)
486{ 493{
487 if (bw == WLC_40_MHZ) 494 if (bw == BRCMS_40_MHZ)
488 setbit(rateset->mcs, 32); 495 setbit(rateset->mcs, 32);
489 else 496 else
490 clrbit(rateset->mcs, 32); 497 clrbit(rateset->mcs, 32);
diff --git a/drivers/staging/brcm80211/brcmsmac/rate.h b/drivers/staging/brcm80211/brcmsmac/rate.h
index c3dec35beac..dbfd3e5816d 100644
--- a/drivers/staging/brcm80211/brcmsmac/rate.h
+++ b/drivers/staging/brcm80211/brcmsmac/rate.h
@@ -14,8 +14,8 @@
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#ifndef _WLC_RATE_H_ 17#ifndef _BRCM_RATE_H_
18#define _WLC_RATE_H_ 18#define _BRCM_RATE_H_
19 19
20#include "types.h" 20#include "types.h"
21 21
@@ -38,7 +38,7 @@ struct brcms_mcs_info {
38 u8 leg_ofdm; /* matching legacy ofdm rate in 500bkps */ 38 u8 leg_ofdm; /* matching legacy ofdm rate in 500bkps */
39}; 39};
40 40
41#define WLC_MAXMCS 32 /* max valid mcs index */ 41#define BRCMS_MAXMCS 32 /* max valid mcs index */
42#define MCS_TABLE_SIZE 33 /* Number of mcs entries in the table */ 42#define MCS_TABLE_SIZE 33 /* Number of mcs entries in the table */
43extern const struct brcms_mcs_info mcs_table[]; 43extern const struct brcms_mcs_info mcs_table[];
44 44
@@ -57,9 +57,10 @@ extern const struct brcms_mcs_info mcs_table[];
57#define VALID_MCS(_mcs) ((_mcs < MCS_TABLE_SIZE)) 57#define VALID_MCS(_mcs) ((_mcs < MCS_TABLE_SIZE))
58 58
59/* Macro to use the rate_info table */ 59/* Macro to use the rate_info table */
60#define WLC_RATE_MASK_FULL 0xff /* Rate value mask with basic rate flag */ 60#define BRCMS_RATE_MASK_FULL 0xff /* Rate value mask with basic rate flag */
61 61
62#define WLC_RATE_500K_TO_BPS(rate) ((rate) * 500000) /* convert 500kbps to bps */ 62/* convert 500kbps to bps */
63#define BRCMS_RATE_500K_TO_BPS(rate) ((rate) * 500000)
63 64
64/* rate spec : holds rate and mode specific information required to generate a tx frame. */ 65/* rate spec : holds rate and mode specific information required to generate a tx frame. */
65/* Legacy CCK and OFDM information is held in the same manner as was done in the past */ 66/* Legacy CCK and OFDM information is held in the same manner as was done in the past */
@@ -81,7 +82,7 @@ extern const struct brcms_mcs_info mcs_table[];
81#define RSPEC_OVERRIDE 0x80000000 /* bit indicates override both rate & mode */ 82#define RSPEC_OVERRIDE 0x80000000 /* bit indicates override both rate & mode */
82#define RSPEC_OVERRIDE_MCS_ONLY 0x40000000 /* bit indicates override rate only */ 83#define RSPEC_OVERRIDE_MCS_ONLY 0x40000000 /* bit indicates override rate only */
83 84
84#define WLC_HTPHY 127 /* HT PHY Membership */ 85#define BRCMS_HTPHY 127 /* HT PHY Membership */
85 86
86#define RSPEC_ACTIVE(rspec) (rspec & (RSPEC_RATE_MASK | RSPEC_MIMORATE)) 87#define RSPEC_ACTIVE(rspec) (rspec & (RSPEC_RATE_MASK | RSPEC_MIMORATE))
87#define RSPEC2RATE(rspec) ((rspec & RSPEC_MIMORATE) ? \ 88#define RSPEC2RATE(rspec) ((rspec & RSPEC_MIMORATE) ? \
@@ -112,12 +113,13 @@ extern const struct brcms_mcs_info mcs_table[];
112 113
113/* Rate info table; takes a legacy rate or ratespec_t */ 114/* Rate info table; takes a legacy rate or ratespec_t */
114#define IS_MCS(r) (r & RSPEC_MIMORATE) 115#define IS_MCS(r) (r & RSPEC_MIMORATE)
115#define IS_OFDM(r) (!IS_MCS(r) && (rate_info[(r) & RSPEC_RATE_MASK] & WLC_RATE_FLAG)) 116#define IS_OFDM(r) (!IS_MCS(r) && (rate_info[(r) & RSPEC_RATE_MASK] & \
117 BRCMS_RATE_FLAG))
116#define IS_CCK(r) (!IS_MCS(r) && ( \ 118#define IS_CCK(r) (!IS_MCS(r) && ( \
117 ((r) & WLC_RATE_MASK) == WLC_RATE_1M || \ 119 ((r) & BRCMS_RATE_MASK) == BRCM_RATE_1M || \
118 ((r) & WLC_RATE_MASK) == WLC_RATE_2M || \ 120 ((r) & BRCMS_RATE_MASK) == BRCM_RATE_2M || \
119 ((r) & WLC_RATE_MASK) == WLC_RATE_5M5 || \ 121 ((r) & BRCMS_RATE_MASK) == BRCM_RATE_5M5 || \
120 ((r) & WLC_RATE_MASK) == WLC_RATE_11M)) 122 ((r) & BRCMS_RATE_MASK) == BRCM_RATE_11M))
121#define IS_SINGLE_STREAM(mcs) (((mcs) <= HIGHEST_SINGLE_STREAM_MCS) || ((mcs) == 32)) 123#define IS_SINGLE_STREAM(mcs) (((mcs) <= HIGHEST_SINGLE_STREAM_MCS) || ((mcs) == 32))
122#define CCK_RSPEC(cck) ((cck) & RSPEC_RATE_MASK) 124#define CCK_RSPEC(cck) ((cck) & RSPEC_RATE_MASK)
123#define OFDM_RSPEC(ofdm) (((ofdm) & RSPEC_RATE_MASK) |\ 125#define OFDM_RSPEC(ofdm) (((ofdm) & RSPEC_RATE_MASK) |\
@@ -134,9 +136,9 @@ extern const u8 ofdm_rate_lookup[];
134#define CCK_PHY2MAC_RATE(signal) (signal/5) 136#define CCK_PHY2MAC_RATE(signal) (signal/5)
135 137
136/* Rates specified in brcms_c_rateset_filter() */ 138/* Rates specified in brcms_c_rateset_filter() */
137#define WLC_RATES_CCK_OFDM 0 139#define BRCMS_RATES_CCK_OFDM 0
138#define WLC_RATES_CCK 1 140#define BRCMS_RATES_CCK 1
139#define WLC_RATES_OFDM 2 141#define BRCMS_RATES_OFDM 2
140 142
141/* sanitize, and sort a rateset with the basic bit(s) preserved, validate rateset */ 143/* sanitize, and sort a rateset with the basic bit(s) preserved, validate rateset */
142extern bool 144extern bool
@@ -168,4 +170,4 @@ extern void brcms_c_rateset_mcs_build(struct brcms_rateset *rateset,
168 u8 txstreams); 170 u8 txstreams);
169extern void brcms_c_rateset_bw_mcs_filter(struct brcms_rateset *rateset, u8 bw); 171extern void brcms_c_rateset_bw_mcs_filter(struct brcms_rateset *rateset, u8 bw);
170 172
171#endif /* _WLC_RATE_H_ */ 173#endif /* _BRCM_RATE_H_ */
diff --git a/drivers/staging/brcm80211/brcmsmac/stf.c b/drivers/staging/brcm80211/brcmsmac/stf.c
index 6bece8eecc6..a55ff010178 100644
--- a/drivers/staging/brcm80211/brcmsmac/stf.c
+++ b/drivers/staging/brcm80211/brcmsmac/stf.c
@@ -28,7 +28,7 @@
28#define MIN_SPATIAL_EXPANSION 0 28#define MIN_SPATIAL_EXPANSION 0
29#define MAX_SPATIAL_EXPANSION 1 29#define MAX_SPATIAL_EXPANSION 1
30 30
31#define WLC_STF_SS_STBC_RX(wlc) (WLCISNPHY(wlc->band) && \ 31#define BRCMS_STF_SS_STBC_RX(wlc) (BRCMS_ISNPHY(wlc->band) && \
32 NREV_GT(wlc->band->phyrev, 3) && NREV_LE(wlc->band->phyrev, 6)) 32 NREV_GT(wlc->band->phyrev, 3) && NREV_LE(wlc->band->phyrev, 6))
33 33
34static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val); 34static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val);
@@ -55,7 +55,7 @@ const u8 txcore_default[5] = {
55static void brcms_c_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val) 55static void brcms_c_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val)
56{ 56{
57 /* MIMOPHYs rev3-6 cannot receive STBC with only one rx core active */ 57 /* MIMOPHYs rev3-6 cannot receive STBC with only one rx core active */
58 if (WLC_STF_SS_STBC_RX(wlc)) { 58 if (BRCMS_STF_SS_STBC_RX(wlc)) {
59 if ((wlc->stf->rxstreams == 1) && (val != HT_CAP_RX_STBC_NO)) 59 if ((wlc->stf->rxstreams == 1) && (val != HT_CAP_RX_STBC_NO))
60 return; 60 return;
61 } 61 }
@@ -145,7 +145,7 @@ static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val)
145 return false; 145 return false;
146 146
147 if ((int_val == OFF) || (wlc->stf->txstreams == 1) 147 if ((int_val == OFF) || (wlc->stf->txstreams == 1)
148 || !WLC_STBC_CAP_PHY(wlc)) 148 || !BRCMS_STBC_CAP_PHY(wlc))
149 wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_TX_STBC; 149 wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_TX_STBC;
150 else 150 else
151 wlc->ht_cap.cap_info |= IEEE80211_HT_CAP_TX_STBC; 151 wlc->ht_cap.cap_info |= IEEE80211_HT_CAP_TX_STBC;
@@ -163,7 +163,7 @@ bool brcms_c_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val)
163 return false; 163 return false;
164 } 164 }
165 165
166 if (WLC_STF_SS_STBC_RX(wlc)) { 166 if (BRCMS_STF_SS_STBC_RX(wlc)) {
167 if ((int_val != HT_CAP_RX_STBC_NO) 167 if ((int_val != HT_CAP_RX_STBC_NO)
168 && (wlc->stf->rxstreams == 1)) 168 && (wlc->stf->rxstreams == 1))
169 return false; 169 return false;
@@ -179,11 +179,11 @@ static int brcms_c_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts,
179 BCMMSG(wlc->wiphy, "wl%d: Nsts %d core_mask %x\n", 179 BCMMSG(wlc->wiphy, "wl%d: Nsts %d core_mask %x\n",
180 wlc->pub->unit, Nsts, core_mask); 180 wlc->pub->unit, Nsts, core_mask);
181 181
182 if (WLC_BITSCNT(core_mask) > wlc->stf->txstreams) { 182 if (BRCMS_BITSCNT(core_mask) > wlc->stf->txstreams) {
183 core_mask = 0; 183 core_mask = 0;
184 } 184 }
185 185
186 if ((WLC_BITSCNT(core_mask) == wlc->stf->txstreams) && 186 if ((BRCMS_BITSCNT(core_mask) == wlc->stf->txstreams) &&
187 ((core_mask & ~wlc->stf->txchain) 187 ((core_mask & ~wlc->stf->txchain)
188 || !(core_mask & wlc->stf->txchain))) { 188 || !(core_mask & wlc->stf->txchain))) {
189 core_mask = wlc->stf->txchain; 189 core_mask = wlc->stf->txchain;
@@ -237,7 +237,7 @@ int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force)
237 return -EINVAL; 237 return -EINVAL;
238 238
239 /* if nrate override is configured to be non-SISO STF mode, reject reducing txchain to 1 */ 239 /* if nrate override is configured to be non-SISO STF mode, reject reducing txchain to 1 */
240 txstreams = (u8) WLC_BITSCNT(txchain); 240 txstreams = (u8) BRCMS_BITSCNT(txchain);
241 if (txstreams > MAX_STREAMS_SUPPORTED) 241 if (txstreams > MAX_STREAMS_SUPPORTED)
242 return -EINVAL; 242 return -EINVAL;
243 243
@@ -299,7 +299,7 @@ int brcms_c_stf_ss_update(struct brcms_c_info *wlc, struct brcms_band *band)
299 prev_stf_ss = wlc->stf->ss_opmode; 299 prev_stf_ss = wlc->stf->ss_opmode;
300 300
301 /* NOTE: opmode can only be SISO or CDD as STBC is decided on a per-packet basis */ 301 /* NOTE: opmode can only be SISO or CDD as STBC is decided on a per-packet basis */
302 if (WLC_STBC_CAP_PHY(wlc) && 302 if (BRCMS_STBC_CAP_PHY(wlc) &&
303 wlc->stf->ss_algosel_auto 303 wlc->stf->ss_algosel_auto
304 && (wlc->stf->ss_algo_channel != (u16) -1)) { 304 && (wlc->stf->ss_algo_channel != (u16) -1)) {
305 upd_stf_ss = (wlc->stf->no_cddstbc || (wlc->stf->txstreams == 1) 305 upd_stf_ss = (wlc->stf->no_cddstbc || (wlc->stf->txstreams == 1)
@@ -327,7 +327,7 @@ int brcms_c_stf_attach(struct brcms_c_info *wlc)
327 wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_SISO; 327 wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_SISO;
328 wlc->bandstate[BAND_5G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_CDD; 328 wlc->bandstate[BAND_5G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_CDD;
329 329
330 if (WLCISNPHY(wlc->band) && 330 if (BRCMS_ISNPHY(wlc->band) &&
331 (wlc_phy_txpower_hw_ctrl_get(wlc->band->pi) != PHY_TPC_HW_ON)) 331 (wlc_phy_txpower_hw_ctrl_get(wlc->band->pi) != PHY_TPC_HW_ON))
332 wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = 332 wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode =
333 PHY_TXC1_MODE_CDD; 333 PHY_TXC1_MODE_CDD;
@@ -338,7 +338,7 @@ int brcms_c_stf_attach(struct brcms_c_info *wlc)
338 wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = OFF; 338 wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = OFF;
339 wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = OFF; 339 wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = OFF;
340 340
341 if (WLC_STBC_CAP_PHY(wlc)) { 341 if (BRCMS_STBC_CAP_PHY(wlc)) {
342 wlc->stf->ss_algosel_auto = true; 342 wlc->stf->ss_algosel_auto = true;
343 wlc->stf->ss_algo_channel = (u16) -1; /* Init the default value */ 343 wlc->stf->ss_algo_channel = (u16) -1; /* Init the default value */
344 } 344 }
@@ -368,19 +368,20 @@ static void _brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc)
368 s8 txant; 368 s8 txant;
369 369
370 txant = (s8) wlc->stf->txant; 370 txant = (s8) wlc->stf->txant;
371 if (WLC_PHY_11N_CAP(wlc->band)) { 371 if (BRCMS_PHY_11N_CAP(wlc->band)) {
372 if (txant == ANT_TX_FORCE_0) { 372 if (txant == ANT_TX_FORCE_0) {
373 wlc->stf->phytxant = PHY_TXC_ANT_0; 373 wlc->stf->phytxant = PHY_TXC_ANT_0;
374 } else if (txant == ANT_TX_FORCE_1) { 374 } else if (txant == ANT_TX_FORCE_1) {
375 wlc->stf->phytxant = PHY_TXC_ANT_1; 375 wlc->stf->phytxant = PHY_TXC_ANT_1;
376 376
377 if (WLCISNPHY(wlc->band) && 377 if (BRCMS_ISNPHY(wlc->band) &&
378 NREV_GE(wlc->band->phyrev, 3) 378 NREV_GE(wlc->band->phyrev, 3)
379 && NREV_LT(wlc->band->phyrev, 7)) { 379 && NREV_LT(wlc->band->phyrev, 7)) {
380 wlc->stf->phytxant = PHY_TXC_ANT_2; 380 wlc->stf->phytxant = PHY_TXC_ANT_2;
381 } 381 }
382 } else { 382 } else {
383 if (WLCISLCNPHY(wlc->band) || WLCISSSLPNPHY(wlc->band)) 383 if (BRCMS_ISLCNPHY(wlc->band) ||
384 BRCMS_ISSSLPNPHY(wlc->band))
384 wlc->stf->phytxant = PHY_TXC_LCNPHY_ANT_LAST; 385 wlc->stf->phytxant = PHY_TXC_LCNPHY_ANT_LAST;
385 else { 386 else {
386 /* catch out of sync wlc->stf->txcore */ 387 /* catch out of sync wlc->stf->txcore */
@@ -414,7 +415,7 @@ void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc)
414 415
415 /* these parameter are intended to be used for all PHY types */ 416 /* these parameter are intended to be used for all PHY types */
416 if (wlc->stf->hw_txchain == 0 || wlc->stf->hw_txchain == 0xf) { 417 if (wlc->stf->hw_txchain == 0 || wlc->stf->hw_txchain == 0xf) {
417 if (WLCISNPHY(wlc->band)) { 418 if (BRCMS_ISNPHY(wlc->band)) {
418 wlc->stf->hw_txchain = TXCHAIN_DEF_NPHY; 419 wlc->stf->hw_txchain = TXCHAIN_DEF_NPHY;
419 } else { 420 } else {
420 wlc->stf->hw_txchain = TXCHAIN_DEF; 421 wlc->stf->hw_txchain = TXCHAIN_DEF;
@@ -422,10 +423,10 @@ void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc)
422 } 423 }
423 424
424 wlc->stf->txchain = wlc->stf->hw_txchain; 425 wlc->stf->txchain = wlc->stf->hw_txchain;
425 wlc->stf->txstreams = (u8) WLC_BITSCNT(wlc->stf->hw_txchain); 426 wlc->stf->txstreams = (u8) BRCMS_BITSCNT(wlc->stf->hw_txchain);
426 427
427 if (wlc->stf->hw_rxchain == 0 || wlc->stf->hw_rxchain == 0xf) { 428 if (wlc->stf->hw_rxchain == 0 || wlc->stf->hw_rxchain == 0xf) {
428 if (WLCISNPHY(wlc->band)) { 429 if (BRCMS_ISNPHY(wlc->band)) {
429 wlc->stf->hw_rxchain = RXCHAIN_DEF_NPHY; 430 wlc->stf->hw_rxchain = RXCHAIN_DEF_NPHY;
430 } else { 431 } else {
431 wlc->stf->hw_rxchain = RXCHAIN_DEF; 432 wlc->stf->hw_rxchain = RXCHAIN_DEF;
@@ -433,7 +434,7 @@ void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc)
433 } 434 }
434 435
435 wlc->stf->rxchain = wlc->stf->hw_rxchain; 436 wlc->stf->rxchain = wlc->stf->hw_rxchain;
436 wlc->stf->rxstreams = (u8) WLC_BITSCNT(wlc->stf->hw_rxchain); 437 wlc->stf->rxstreams = (u8) BRCMS_BITSCNT(wlc->stf->hw_rxchain);
437 438
438 /* initialize the txcore table */ 439 /* initialize the txcore table */
439 memcpy(wlc->stf->txcore, txcore_default, sizeof(wlc->stf->txcore)); 440 memcpy(wlc->stf->txcore, txcore_default, sizeof(wlc->stf->txcore));
@@ -467,7 +468,7 @@ u16 brcms_c_stf_d11hdrs_phyctl_txant(struct brcms_c_info *wlc, ratespec_t rspec)
467 u16 mask = PHY_TXC_ANT_MASK; 468 u16 mask = PHY_TXC_ANT_MASK;
468 469
469 /* for non-siso rates or default setting, use the available chains */ 470 /* for non-siso rates or default setting, use the available chains */
470 if (WLCISNPHY(wlc->band)) { 471 if (BRCMS_ISNPHY(wlc->band)) {
471 phytxant = _brcms_c_stf_phytxchain_sel(wlc, rspec); 472 phytxant = _brcms_c_stf_phytxchain_sel(wlc, rspec);
472 mask = PHY_TXC_HTANT_MASK; 473 mask = PHY_TXC_HTANT_MASK;
473 } 474 }
diff --git a/drivers/staging/brcm80211/brcmsmac/types.h b/drivers/staging/brcm80211/brcmsmac/types.h
index 17c1d8a16a3..d8514c3d150 100644
--- a/drivers/staging/brcm80211/brcmsmac/types.h
+++ b/drivers/staging/brcm80211/brcmsmac/types.h
@@ -191,11 +191,11 @@
191 PHYTYPE_IS(phytype, PHY_TYPE_SSN)) 191 PHYTYPE_IS(phytype, PHY_TYPE_SSN))
192 192
193/* Last but not least: shorter wlc-specific var checks */ 193/* Last but not least: shorter wlc-specific var checks */
194#define WLCISNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_N) 194#define BRCMS_ISNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_N)
195#define WLCISLCNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_LCN) 195#define BRCMS_ISLCNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_LCN)
196#define WLCISSSLPNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_SSN) 196#define BRCMS_ISSSLPNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_SSN)
197 197
198#define WLC_PHY_11N_CAP(band) PHYTYPE_11N_CAP((band)->phytype) 198#define BRCMS_PHY_11N_CAP(band) PHYTYPE_11N_CAP((band)->phytype)
199 199
200/********************************************************************** 200/**********************************************************************
201 * ------------- End of Core phy/rev configuration. ----------------- * 201 * ------------- End of Core phy/rev configuration. ----------------- *
@@ -227,12 +227,18 @@
227#define MAXPKTCB MAXSCB /* Max number of packet callbacks */ 227#define MAXPKTCB MAXSCB /* Max number of packet callbacks */
228 228
229/* NetBSD also needs to keep track of this */ 229/* NetBSD also needs to keep track of this */
230#define WLC_MAX_UCODE_BSS (16) /* Number of BSS handled in ucode bcn/prb */ 230
231#define WLC_MAX_UCODE_BSS4 (4) /* Number of BSS handled in sw bcn/prb */ 231/* Number of BSS handled in ucode bcn/prb */
232#define WLC_MAXBSSCFG (1) /* max # BSS configs */ 232#define BRCMS_MAX_UCODE_BSS (16)
233#define MAXBSS 64 /* max # available networks */ 233/* Number of BSS handled in sw bcn/prb */
234#define WLC_DATAHIWAT 50 /* data msg txq hiwat mark */ 234#define BRCMS_MAX_UCODE_BSS4 (4)
235#define WLC_AMPDUDATAHIWAT 255 235/* max # BSS configs */
236#define BRCMS_MAXBSSCFG (1)
237/* max # available networks */
238#define MAXBSS 64
239/* data msg txq hiwat mark */
240#define BRCMS_DATAHIWAT 50
241#define BRCMS_AMPDUDATAHIWAT 255
236 242
237/* bounded rx loops */ 243/* bounded rx loops */
238#define RXBND 8 /* max # frames to process in brcms_c_recv() */ 244#define RXBND 8 /* max # frames to process in brcms_c_recv() */
@@ -240,8 +246,8 @@
240 246
241#define WLBANDINITFN(_fn) _fn 247#define WLBANDINITFN(_fn) _fn
242 248
243#define BAND_5G(bt) ((bt) == WLC_BAND_5G) 249#define BAND_5G(bt) ((bt) == BRCM_BAND_5G)
244#define BAND_2G(bt) ((bt) == WLC_BAND_2G) 250#define BAND_2G(bt) ((bt) == BRCM_BAND_2G)
245 251
246#define BCMMSG(dev, fmt, args...) \ 252#define BCMMSG(dev, fmt, args...) \
247do { \ 253do { \
diff --git a/drivers/staging/brcm80211/include/brcmu_wifi.h b/drivers/staging/brcm80211/include/brcmu_wifi.h
index 72013a40247..fde592bd917 100644
--- a/drivers/staging/brcm80211/include/brcmu_wifi.h
+++ b/drivers/staging/brcm80211/include/brcmu_wifi.h
@@ -31,7 +31,7 @@ typedef u16 chanspec_t;
31#define CH_10MHZ_APART 2 31#define CH_10MHZ_APART 2
32#define CH_5MHZ_APART 1 /* 2G band channels are 5 Mhz apart */ 32#define CH_5MHZ_APART 1 /* 2G band channels are 5 Mhz apart */
33#define CH_MAX_2G_CHANNEL 14 /* Max channel in 2G band */ 33#define CH_MAX_2G_CHANNEL 14 /* Max channel in 2G band */
34#define WLC_MAX_2G_CHANNEL CH_MAX_2G_CHANNEL /* legacy define */ 34#define BRCM_MAX_2G_CHANNEL CH_MAX_2G_CHANNEL /* legacy define */
35#define MAXCHANNEL 224 /* max # supported channels. The max channel no is 216, 35#define MAXCHANNEL 224 /* max # supported channels. The max channel no is 216,
36 * this is that + 1 rounded up to a multiple of NBBY (8). 36 * this is that + 1 rounded up to a multiple of NBBY (8).
37 * DO NOT MAKE it > 255: channels are u8's all over 37 * DO NOT MAKE it > 255: channels are u8's all over
@@ -67,7 +67,8 @@ typedef u16 chanspec_t;
67#define LOWER_20_SB(channel) (((channel) > CH_10MHZ_APART) ? ((channel) - CH_10MHZ_APART) : 0) 67#define LOWER_20_SB(channel) (((channel) > CH_10MHZ_APART) ? ((channel) - CH_10MHZ_APART) : 0)
68#define UPPER_20_SB(channel) (((channel) < (MAXCHANNEL - CH_10MHZ_APART)) ? \ 68#define UPPER_20_SB(channel) (((channel) < (MAXCHANNEL - CH_10MHZ_APART)) ? \
69 ((channel) + CH_10MHZ_APART) : 0) 69 ((channel) + CH_10MHZ_APART) : 0)
70#define CHSPEC_WLCBANDUNIT(chspec) (CHSPEC_IS5G(chspec) ? BAND_5G_INDEX : BAND_2G_INDEX) 70#define CHSPEC_BANDUNIT(chspec) (CHSPEC_IS5G(chspec) ? BAND_5G_INDEX : \
71 BAND_2G_INDEX)
71#define CH20MHZ_CHSPEC(channel) (chanspec_t)((chanspec_t)(channel) | WL_CHANSPEC_BW_20 | \ 72#define CH20MHZ_CHSPEC(channel) (chanspec_t)((chanspec_t)(channel) | WL_CHANSPEC_BW_20 | \
72 WL_CHANSPEC_CTL_SB_NONE | (((channel) <= CH_MAX_2G_CHANNEL) ? \ 73 WL_CHANSPEC_CTL_SB_NONE | (((channel) <= CH_MAX_2G_CHANNEL) ? \
73 WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G)) 74 WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G))
@@ -110,26 +111,26 @@ typedef u16 chanspec_t;
110#define CHSPEC_CTL_CHAN(chspec) ((CHSPEC_SB_LOWER(chspec)) ? \ 111#define CHSPEC_CTL_CHAN(chspec) ((CHSPEC_SB_LOWER(chspec)) ? \
111 (LOWER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK))) : \ 112 (LOWER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK))) : \
112 (UPPER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK)))) 113 (UPPER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK))))
113#define CHSPEC2WLC_BAND(chspec) (CHSPEC_IS5G(chspec) ? WLC_BAND_5G : WLC_BAND_2G) 114#define CHSPEC2BAND(chspec) (CHSPEC_IS5G(chspec) ? BRCM_BAND_5G : BRCM_BAND_2G)
114 115
115#define CHANSPEC_STR_LEN 8 116#define CHANSPEC_STR_LEN 8
116 117
117/* defined rate in 500kbps */ 118/* defined rate in 500kbps */
118#define WLC_MAXRATE 108 /* in 500kbps units */ 119#define BRCM_MAXRATE 108 /* in 500kbps units */
119#define WLC_RATE_1M 2 /* in 500kbps units */ 120#define BRCM_RATE_1M 2 /* in 500kbps units */
120#define WLC_RATE_2M 4 /* in 500kbps units */ 121#define BRCM_RATE_2M 4 /* in 500kbps units */
121#define WLC_RATE_5M5 11 /* in 500kbps units */ 122#define BRCM_RATE_5M5 11 /* in 500kbps units */
122#define WLC_RATE_11M 22 /* in 500kbps units */ 123#define BRCM_RATE_11M 22 /* in 500kbps units */
123#define WLC_RATE_6M 12 /* in 500kbps units */ 124#define BRCM_RATE_6M 12 /* in 500kbps units */
124#define WLC_RATE_9M 18 /* in 500kbps units */ 125#define BRCM_RATE_9M 18 /* in 500kbps units */
125#define WLC_RATE_12M 24 /* in 500kbps units */ 126#define BRCM_RATE_12M 24 /* in 500kbps units */
126#define WLC_RATE_18M 36 /* in 500kbps units */ 127#define BRCM_RATE_18M 36 /* in 500kbps units */
127#define WLC_RATE_24M 48 /* in 500kbps units */ 128#define BRCM_RATE_24M 48 /* in 500kbps units */
128#define WLC_RATE_36M 72 /* in 500kbps units */ 129#define BRCM_RATE_36M 72 /* in 500kbps units */
129#define WLC_RATE_48M 96 /* in 500kbps units */ 130#define BRCM_RATE_48M 96 /* in 500kbps units */
130#define WLC_RATE_54M 108 /* in 500kbps units */ 131#define BRCM_RATE_54M 108 /* in 500kbps units */
131 132
132#define WLC_2G_25MHZ_OFFSET 5 /* 2.4GHz band channel offset */ 133#define BRCM_2G_25MHZ_OFFSET 5 /* 2.4GHz band channel offset */
133 134
134#define MCSSET_LEN 16 135#define MCSSET_LEN 16
135 136
diff --git a/drivers/staging/brcm80211/include/defs.h b/drivers/staging/brcm80211/include/defs.h
index 20e1407c68b..8b3e17dec15 100644
--- a/drivers/staging/brcm80211/include/defs.h
+++ b/drivers/staging/brcm80211/include/defs.h
@@ -59,16 +59,16 @@ typedef struct wl_rateset {
59 u8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */ 59 u8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */
60} wl_rateset_t; 60} wl_rateset_t;
61 61
62#define WLC_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NUL */ 62#define BRCM_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NUL */
63 63
64#define WLC_SET_CHANNEL 30 64#define BRCM_SET_CHANNEL 30
65#define WLC_SET_SRL 32 65#define BRCM_SET_SRL 32
66#define WLC_SET_LRL 34 66#define BRCM_SET_LRL 34
67 67
68#define WLC_SET_RATESET 72 68#define BRCM_SET_RATESET 72
69#define WLC_SET_BCNPRD 76 69#define BRCM_SET_BCNPRD 76
70#define WLC_GET_CURR_RATESET 114 /* current rateset */ 70#define BRCM_GET_CURR_RATESET 114 /* current rateset */
71#define WLC_GET_PHYLIST 180 71#define BRCM_GET_PHYLIST 180
72 72
73/* Bit masks for radio disabled status - returned by WL_GET_RADIO */ 73/* Bit masks for radio disabled status - returned by WL_GET_RADIO */
74#define WL_RADIO_SW_DISABLE (1<<0) 74#define WL_RADIO_SW_DISABLE (1<<0)
@@ -76,14 +76,14 @@ typedef struct wl_rateset {
76#define WL_RADIO_MPC_DISABLE (1<<2) 76#define WL_RADIO_MPC_DISABLE (1<<2)
77#define WL_RADIO_COUNTRY_DISABLE (1<<3) /* some countries don't support any channel */ 77#define WL_RADIO_COUNTRY_DISABLE (1<<3) /* some countries don't support any channel */
78 78
79/* Override bit for WLC_SET_TXPWR. if set, ignore other level limits */ 79/* Override bit for SET_TXPWR. if set, ignore other level limits */
80#define WL_TXPWR_OVERRIDE (1U<<31) 80#define WL_TXPWR_OVERRIDE (1U<<31)
81 81
82/* band types */ 82/* band types */
83#define WLC_BAND_AUTO 0 /* auto-select */ 83#define BRCM_BAND_AUTO 0 /* auto-select */
84#define WLC_BAND_5G 1 /* 5 Ghz */ 84#define BRCM_BAND_5G 1 /* 5 Ghz */
85#define WLC_BAND_2G 2 /* 2.4 Ghz */ 85#define BRCM_BAND_2G 2 /* 2.4 Ghz */
86#define WLC_BAND_ALL 3 /* all bands */ 86#define BRCM_BAND_ALL 3 /* all bands */
87 87
88/* Values for PM */ 88/* Values for PM */
89#define PM_OFF 0 89#define PM_OFF 0