aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index cb491d9278f5..5a3093d2b117 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -392,6 +392,31 @@ static u8 brcmf_mw_to_qdbm(u16 mw)
392 return qdbm; 392 return qdbm;
393} 393}
394 394
395static u16 channel_to_chanspec(struct ieee80211_channel *ch)
396{
397 u16 chanspec;
398
399 chanspec = ieee80211_frequency_to_channel(ch->center_freq);
400 chanspec &= WL_CHANSPEC_CHAN_MASK;
401
402 if (ch->band == IEEE80211_BAND_2GHZ)
403 chanspec |= WL_CHANSPEC_BAND_2G;
404 else
405 chanspec |= WL_CHANSPEC_BAND_5G;
406
407 if (ch->flags & IEEE80211_CHAN_NO_HT40) {
408 chanspec |= WL_CHANSPEC_BW_20;
409 chanspec |= WL_CHANSPEC_CTL_SB_NONE;
410 } else {
411 chanspec |= WL_CHANSPEC_BW_40;
412 if (ch->flags & IEEE80211_CHAN_NO_HT40PLUS)
413 chanspec |= WL_CHANSPEC_CTL_SB_LOWER;
414 else
415 chanspec |= WL_CHANSPEC_CTL_SB_UPPER;
416 }
417 return chanspec;
418}
419
395static void convert_key_from_CPU(struct brcmf_wsec_key *key, 420static void convert_key_from_CPU(struct brcmf_wsec_key *key,
396 struct brcmf_wsec_key_le *key_le) 421 struct brcmf_wsec_key_le *key_le)
397{ 422{
@@ -701,8 +726,6 @@ static void brcmf_escan_prep(struct brcmf_scan_params_le *params_le,
701 s32 i; 726 s32 i;
702 s32 offset; 727 s32 offset;
703 u16 chanspec; 728 u16 chanspec;
704 u16 channel;
705 struct ieee80211_channel *req_channel;
706 char *ptr; 729 char *ptr;
707 struct brcmf_ssid_le ssid_le; 730 struct brcmf_ssid_le ssid_le;
708 731
@@ -726,30 +749,9 @@ static void brcmf_escan_prep(struct brcmf_scan_params_le *params_le,
726 WL_SCAN("### List of channelspecs to scan ### %d\n", n_channels); 749 WL_SCAN("### List of channelspecs to scan ### %d\n", n_channels);
727 if (n_channels > 0) { 750 if (n_channels > 0) {
728 for (i = 0; i < n_channels; i++) { 751 for (i = 0; i < n_channels; i++) {
729 chanspec = 0; 752 chanspec = channel_to_chanspec(request->channels[i]);
730 req_channel = request->channels[i];
731 channel = ieee80211_frequency_to_channel(
732 req_channel->center_freq);
733 if (req_channel->band == IEEE80211_BAND_2GHZ)
734 chanspec |= WL_CHANSPEC_BAND_2G;
735 else
736 chanspec |= WL_CHANSPEC_BAND_5G;
737
738 if (req_channel->flags & IEEE80211_CHAN_NO_HT40) {
739 chanspec |= WL_CHANSPEC_BW_20;
740 chanspec |= WL_CHANSPEC_CTL_SB_NONE;
741 } else {
742 chanspec |= WL_CHANSPEC_BW_40;
743 if (req_channel->flags &
744 IEEE80211_CHAN_NO_HT40PLUS)
745 chanspec |= WL_CHANSPEC_CTL_SB_LOWER;
746 else
747 chanspec |= WL_CHANSPEC_CTL_SB_UPPER;
748 }
749
750 chanspec |= (channel & WL_CHANSPEC_CHAN_MASK);
751 WL_SCAN("Chan : %d, Channel spec: %x\n", 753 WL_SCAN("Chan : %d, Channel spec: %x\n",
752 channel, chanspec); 754 request->channels[i]->hw_value, chanspec);
753 params_le->channel_list[i] = cpu_to_le16(chanspec); 755 params_le->channel_list[i] = cpu_to_le16(chanspec);
754 } 756 }
755 } else { 757 } else {