Skip to content

Commit a40b960

Browse files
dberlinmarcan
authored andcommitted
Add support for 6G bands.
This includes the firmware side work, cleaning up the invalid chanspec errors that currently occur on 4388. The netinfo scan still needs updating to support 6G Signed-off-by: Daniel Berlin <[email protected]>
1 parent b039679 commit a40b960

4 files changed

Lines changed: 178 additions & 32 deletions

File tree

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

Lines changed: 97 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,22 @@ static struct ieee80211_rate __wl_rates[] = {
181181
.max_power = 30, \
182182
}
183183

184+
#define CHAN6G(_channel) { \
185+
.band = NL80211_BAND_6GHZ, \
186+
.center_freq = 5950 + (5 * (_channel)), \
187+
.hw_value = (_channel), \
188+
.max_antenna_gain = 0, \
189+
.max_power = 30, \
190+
}
191+
192+
#define CHAN6G_CHAN2() { \
193+
.band = NL80211_BAND_6GHZ, \
194+
.center_freq = 5935, \
195+
.hw_value = 0x5002, \
196+
.max_antenna_gain = 0, \
197+
.max_power = 30, \
198+
}
199+
184200
static struct ieee80211_channel __wl_2ghz_channels[] = {
185201
CHAN2G(1, 2412), CHAN2G(2, 2417), CHAN2G(3, 2422), CHAN2G(4, 2427),
186202
CHAN2G(5, 2432), CHAN2G(6, 2437), CHAN2G(7, 2442), CHAN2G(8, 2447),
@@ -197,6 +213,21 @@ static struct ieee80211_channel __wl_5ghz_channels[] = {
197213
CHAN5G(153), CHAN5G(157), CHAN5G(161), CHAN5G(165)
198214
};
199215

216+
static struct ieee80211_channel __wl_6ghz_channels[] = {
217+
CHAN6G_CHAN2(), CHAN6G(1), CHAN6G(5), CHAN6G(9), CHAN6G(13),
218+
CHAN6G(17), CHAN6G(21), CHAN6G(25), CHAN6G(29), CHAN6G(33),
219+
CHAN6G(37), CHAN6G(41), CHAN6G(45), CHAN6G(49), CHAN6G(53),
220+
CHAN6G(57), CHAN6G(61), CHAN6G(65), CHAN6G(69), CHAN6G(73),
221+
CHAN6G(77), CHAN6G(81), CHAN6G(85), CHAN6G(89), CHAN6G(93),
222+
CHAN6G(97), CHAN6G(101), CHAN6G(105), CHAN6G(109), CHAN6G(113),
223+
CHAN6G(117), CHAN6G(121), CHAN6G(125), CHAN6G(129), CHAN6G(133),
224+
CHAN6G(137), CHAN6G(141), CHAN6G(145), CHAN6G(149), CHAN6G(153),
225+
CHAN6G(157), CHAN6G(161), CHAN6G(165), CHAN6G(169), CHAN6G(173),
226+
CHAN6G(177), CHAN6G(181), CHAN6G(185), CHAN6G(189), CHAN6G(193),
227+
CHAN6G(197), CHAN6G(201), CHAN6G(205), CHAN6G(209), CHAN6G(213),
228+
CHAN6G(217), CHAN6G(221), CHAN6G(225), CHAN6G(229), CHAN6G(233),
229+
};
230+
200231
/* Band templates duplicated per wiphy. The channel info
201232
* above is added to the band during setup.
202233
*/
@@ -212,6 +243,12 @@ static const struct ieee80211_supported_band __wl_band_5ghz = {
212243
.n_bitrates = wl_a_rates_size,
213244
};
214245

246+
static const struct ieee80211_supported_band __wl_band_6ghz = {
247+
.band = NL80211_BAND_6GHZ,
248+
.bitrates = wl_a_rates,
249+
.n_bitrates = wl_a_rates_size,
250+
};
251+
215252
/* This is to override regulatory domains defined in cfg80211 module (reg.c)
216253
* By default world regulatory domain defined in reg.c puts the flags
217254
* NL80211_RRF_NO_IR for 5GHz channels (for * 36..48 and 149..165).
@@ -319,6 +356,8 @@ static u8 nl80211_band_to_fwil(enum nl80211_band band)
319356
return WLC_BAND_2G;
320357
case NL80211_BAND_5GHZ:
321358
return WLC_BAND_5G;
359+
case NL80211_BAND_6GHZ:
360+
return WLC_BAND_6G;
322361
default:
323362
WARN_ON(1);
324363
break;
@@ -392,6 +431,9 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf,
392431
case NL80211_BAND_5GHZ:
393432
ch_inf.band = BRCMU_CHAN_BAND_5G;
394433
break;
434+
case NL80211_BAND_6GHZ:
435+
ch_inf.band = BRCMU_CHAN_BAND_6G;
436+
break;
395437
case NL80211_BAND_60GHZ:
396438
default:
397439
WARN_ON_ONCE(1);
@@ -3405,12 +3447,27 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
34053447
}
34063448
channel = bi->ctl_ch;
34073449

3408-
if (channel <= CH_MAX_2G_CHANNEL)
3409-
band = NL80211_BAND_2GHZ;
3410-
else
3450+
if (CHSPEC_IS6G(bi->chanspec))
3451+
band = NL80211_BAND_6GHZ;
3452+
else if (CHSPEC_IS5G(bi->chanspec))
34113453
band = NL80211_BAND_5GHZ;
3454+
else
3455+
band = NL80211_BAND_2GHZ;
34123456

34133457
freq = ieee80211_channel_to_frequency(channel, band);
3458+
if (!freq) {
3459+
brcmf_err(
3460+
"Invalid frequency %d returned for channel %d, band %d. chanspec was %04x\n",
3461+
freq, channel, band, bi->chanspec);
3462+
3463+
/* We ignore this BSS ID rather than try to continue on.
3464+
Otherwise we will cause an OOPs because our frequency is 0.
3465+
The main case this occurs is some new frequency band
3466+
we have not seen before, and if we return an error,
3467+
we will cause the scan to fail. It seems better to
3468+
report the error, skip this BSS, and move on.*/
3469+
return 0;
3470+
}
34143471
bss_data.chan = ieee80211_get_channel(wiphy, freq);
34153472
bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20;
34163473
bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime());
@@ -3520,8 +3577,10 @@ static s32 brcmf_inform_ibss(struct brcmf_cfg80211_info *cfg,
35203577

35213578
if (ch.band == BRCMU_CHAN_BAND_2G)
35223579
band = wiphy->bands[NL80211_BAND_2GHZ];
3523-
else
3580+
else if (ch.band == BRCMU_CHAN_BAND_5G)
35243581
band = wiphy->bands[NL80211_BAND_5GHZ];
3582+
else
3583+
band = wiphy->bands[NL80211_BAND_6GHZ];
35253584

35263585
freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band);
35273586
cfg->channel = freq;
@@ -4105,6 +4164,7 @@ brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e,
41054164
memcpy(cfg->wowl.nd->ssid.ssid, netinfo->SSID, netinfo->SSID_len);
41064165
cfg->wowl.nd->ssid.ssid_len = netinfo->SSID_len;
41074166
cfg->wowl.nd->n_channels = 1;
4167+
/* TODO - need to store band so we can handle 6G */
41084168
cfg->wowl.nd->channels[0] =
41094169
ieee80211_channel_to_frequency(netinfo->channel,
41104170
netinfo->channel <= CH_MAX_2G_CHANNEL ?
@@ -5754,6 +5814,9 @@ static int brcmf_cfg80211_get_channel(struct wiphy *wiphy,
57545814
case BRCMU_CHAN_BAND_5G:
57555815
band = NL80211_BAND_5GHZ;
57565816
break;
5817+
case BRCMU_CHAN_BAND_6G:
5818+
band = NL80211_BAND_6GHZ;
5819+
break;
57575820
}
57585821

57595822
switch (ch.bw) {
@@ -6433,8 +6496,10 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
64336496

64346497
if (ch.band == BRCMU_CHAN_BAND_2G)
64356498
band = wiphy->bands[NL80211_BAND_2GHZ];
6436-
else
6499+
else if (ch.band == BRCMU_CHAN_BAND_5G)
64376500
band = wiphy->bands[NL80211_BAND_5GHZ];
6501+
else
6502+
band = wiphy->bands[NL80211_BAND_6GHZ];
64386503

64396504
freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band);
64406505
notify_channel = ieee80211_get_channel(wiphy, freq);
@@ -7012,6 +7077,10 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
70127077
for (i = 0; i < band->n_channels; i++)
70137078
band->channels[i].flags = IEEE80211_CHAN_DISABLED;
70147079
band = wiphy->bands[NL80211_BAND_5GHZ];
7080+
if (band)
7081+
for (i = 0; i < band->n_channels; i++)
7082+
band->channels[i].flags = IEEE80211_CHAN_DISABLED;
7083+
band = wiphy->bands[NL80211_BAND_6GHZ];
70157084
if (band)
70167085
for (i = 0; i < band->n_channels; i++)
70177086
band->channels[i].flags = IEEE80211_CHAN_DISABLED;
@@ -7032,6 +7101,8 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
70327101
band = wiphy->bands[NL80211_BAND_2GHZ];
70337102
} else if (ch.band == BRCMU_CHAN_BAND_5G) {
70347103
band = wiphy->bands[NL80211_BAND_5GHZ];
7104+
} else if (ch.band == BRCMU_CHAN_BAND_6G) {
7105+
band = wiphy->bands[NL80211_BAND_6GHZ];
70357106
} else {
70367107
bphy_err(drvr, "Invalid channel Spec. 0x%x.\n",
70377108
ch.chspec);
@@ -7746,6 +7817,23 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
77467817
wiphy->bands[NL80211_BAND_5GHZ] = band;
77477818
}
77487819
}
7820+
if (bandlist[i] == cpu_to_le32(WLC_BAND_6G)) {
7821+
band = kmemdup(&__wl_band_6ghz, sizeof(__wl_band_6ghz),
7822+
GFP_KERNEL);
7823+
if (!band)
7824+
return -ENOMEM;
7825+
7826+
band->channels = kmemdup(&__wl_6ghz_channels,
7827+
sizeof(__wl_6ghz_channels),
7828+
GFP_KERNEL);
7829+
if (!band->channels) {
7830+
kfree(band);
7831+
return -ENOMEM;
7832+
}
7833+
7834+
band->n_channels = ARRAY_SIZE(__wl_6ghz_channels);
7835+
wiphy->bands[NL80211_BAND_6GHZ] = band;
7836+
}
77497837

77507838
if (wiphy->bands[NL80211_BAND_5GHZ] &&
77517839
brcmf_feat_is_enabled(ifp, BRCMF_FEAT_DOT11H))
@@ -8287,6 +8375,10 @@ static void brcmf_free_wiphy(struct wiphy *wiphy)
82878375
kfree(wiphy->bands[NL80211_BAND_5GHZ]->channels);
82888376
kfree(wiphy->bands[NL80211_BAND_5GHZ]);
82898377
}
8378+
if (wiphy->bands[NL80211_BAND_6GHZ]) {
8379+
kfree(wiphy->bands[NL80211_BAND_6GHZ]->channels);
8380+
kfree(wiphy->bands[NL80211_BAND_6GHZ]);
8381+
}
82908382
#if IS_ENABLED(CONFIG_PM)
82918383
if (wiphy->wowlan != &brcmf_wowlan_support)
82928384
kfree(wiphy->wowlan);

drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ static void brcmu_d11n_decchspec(struct brcmu_chan *ch)
117117
}
118118
break;
119119
default:
120-
WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec);
120+
WARN_ONCE(1,
121+
"Invalid chanspec - unknown 11n bandwidth 0x%04x\n",
122+
ch->chspec);
121123
break;
122124
}
123125

@@ -129,7 +131,8 @@ static void brcmu_d11n_decchspec(struct brcmu_chan *ch)
129131
ch->band = BRCMU_CHAN_BAND_2G;
130132
break;
131133
default:
132-
WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec);
134+
WARN_ONCE(1, "Invalid chanspec - unknown 11n band 0x%04x\n",
135+
ch->chspec);
133136
break;
134137
}
135138
}
@@ -156,7 +159,10 @@ static void brcmu_d11ac_decchspec(struct brcmu_chan *ch)
156159
ch->sb = BRCMU_CHAN_SB_U;
157160
ch->control_ch_num += CH_10MHZ_APART;
158161
} else {
159-
WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec);
162+
WARN_ONCE(
163+
1,
164+
"Invalid chanspec - unknown 11ac channel distance 0x%04x\n",
165+
ch->chspec);
160166
}
161167
break;
162168
case BRCMU_CHSPEC_D11AC_BW_80:
@@ -177,7 +183,10 @@ static void brcmu_d11ac_decchspec(struct brcmu_chan *ch)
177183
ch->control_ch_num += CH_30MHZ_APART;
178184
break;
179185
default:
180-
WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec);
186+
WARN_ONCE(
187+
1,
188+
"Invalid chanspec - unknown 11ac channel distance 0x%04x\n",
189+
ch->chspec);
181190
break;
182191
}
183192
break;
@@ -211,25 +220,37 @@ static void brcmu_d11ac_decchspec(struct brcmu_chan *ch)
211220
ch->control_ch_num += CH_70MHZ_APART;
212221
break;
213222
default:
214-
WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec);
223+
WARN_ONCE(
224+
1,
225+
"Invalid chanspec - unknown 11ac channel distance 0x%04x\n",
226+
ch->chspec);
215227
break;
216228
}
217229
break;
218230
case BRCMU_CHSPEC_D11AC_BW_8080:
219231
default:
220-
WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec);
232+
WARN_ONCE(
233+
1,
234+
"Invalid chanspec - unknown 11ac channel bandwidth 0x%04x\n",
235+
ch->chspec);
221236
break;
222237
}
223238

224239
switch (ch->chspec & BRCMU_CHSPEC_D11AC_BND_MASK) {
240+
case BRCMU_CHSPEC_D11AC_BND_6G:
241+
ch->band = BRCMU_CHAN_BAND_6G;
242+
break;
225243
case BRCMU_CHSPEC_D11AC_BND_5G:
226244
ch->band = BRCMU_CHAN_BAND_5G;
227245
break;
228246
case BRCMU_CHSPEC_D11AC_BND_2G:
229247
ch->band = BRCMU_CHAN_BAND_2G;
230248
break;
231249
default:
232-
WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec);
250+
WARN_ONCE(
251+
1,
252+
"Invalid chanspec - unknown 11ac channel band 0x%04x\n",
253+
ch->chspec);
233254
break;
234255
}
235256
}

drivers/net/wireless/broadcom/brcm80211/include/brcmu_d11.h

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,44 @@
6969
#define BRCMU_CHSPEC_D11AC_SB_UU BRCMU_CHSPEC_D11AC_SB_LUU
7070
#define BRCMU_CHSPEC_D11AC_SB_L BRCMU_CHSPEC_D11AC_SB_LLL
7171
#define BRCMU_CHSPEC_D11AC_SB_U BRCMU_CHSPEC_D11AC_SB_LLU
72+
/* channel sideband indication for frequency >= 240MHz */
73+
#define BRCMU_CHSPEC_D11AC_320_SB_MASK 0x0780
74+
#define BRCMU_CHSPEC_D11AC_320_SB_SHIFT 7
75+
#define BRCMU_CHSPEC_D11AC_SB_LLLL 0x0000
76+
#define BRCMU_CHSPEC_D11AC_SB_LLLU 0x0080
77+
#define BRCMU_CHSPEC_D11AC_SB_LLUL 0x0100
78+
#define BRCMU_CHSPEC_D11AC_SB_LLUU 0x0180
79+
#define BRCMU_CHSPEC_D11AC_SB_LULL 0x0200
80+
#define BRCMU_CHSPEC_D11AC_SB_LULU 0x0280
81+
#define BRCMU_CHSPEC_D11AC_SB_LUUL 0x0300
82+
#define BRCMU_CHSPEC_D11AC_SB_LUUU 0x0380
83+
#define BRCMU_CHSPEC_D11AC_SB_ULLL 0x0400
84+
#define BRCMU_CHSPEC_D11AC_SB_ULLU 0x0480
85+
#define BRCMU_CHSPEC_D11AC_SB_ULUL 0x0500
86+
#define BRCMU_CHSPEC_D11AC_SB_ULUU 0x0580
87+
#define BRCMU_CHSPEC_D11AC_SB_UULL 0x0600
88+
#define BRCMU_CHSPEC_D11AC_SB_UULU 0x0680
89+
#define BRCMU_CHSPEC_D11AC_SB_UUUL 0x0700
90+
#define BRCMU_CHSPEC_D11AC_SB_UUUU 0x0780
7291
#define BRCMU_CHSPEC_D11AC_BW_MASK 0x3800
7392
#define BRCMU_CHSPEC_D11AC_BW_SHIFT 11
74-
#define BRCMU_CHSPEC_D11AC_BW_5 0x0000
75-
#define BRCMU_CHSPEC_D11AC_BW_10 0x0800
76-
#define BRCMU_CHSPEC_D11AC_BW_20 0x1000
77-
#define BRCMU_CHSPEC_D11AC_BW_40 0x1800
78-
#define BRCMU_CHSPEC_D11AC_BW_80 0x2000
79-
#define BRCMU_CHSPEC_D11AC_BW_160 0x2800
80-
#define BRCMU_CHSPEC_D11AC_BW_8080 0x3000
81-
#define BRCMU_CHSPEC_D11AC_BND_MASK 0xc000
82-
#define BRCMU_CHSPEC_D11AC_BND_SHIFT 14
83-
#define BRCMU_CHSPEC_D11AC_BND_2G 0x0000
84-
#define BRCMU_CHSPEC_D11AC_BND_3G 0x4000
85-
#define BRCMU_CHSPEC_D11AC_BND_4G 0x8000
86-
#define BRCMU_CHSPEC_D11AC_BND_5G 0xc000
93+
#define BRCMU_CHSPEC_D11AC_BW_10 0x0800
94+
#define BRCMU_CHSPEC_D11AC_BW_20 0x1000
95+
#define BRCMU_CHSPEC_D11AC_BW_40 0x1800
96+
#define BRCMU_CHSPEC_D11AC_BW_80 0x2000
97+
#define BRCMU_CHSPEC_D11AC_BW_160 0x2800
98+
#define BRCMU_CHSPEC_D11AC_BW_320 0x0000
99+
#define BRCMU_CHSPEC_D11AC_BW_8080 0x3000
100+
#define BRCMU_CHSPEC_D11AC_BND_MASK 0xc000
101+
#define BRCMU_CHSPEC_D11AC_BND_SHIFT 14
102+
#define BRCMU_CHSPEC_D11AC_BND_2G 0x0000
103+
#define BRCMU_CHSPEC_D11AC_BND_4G 0x8000
104+
#define BRCMU_CHSPEC_D11AC_BND_5G 0xc000
105+
#define BRCMU_CHSPEC_D11AC_BND_6G 0x4000
87106

88107
#define BRCMU_CHAN_BAND_2G 0
89108
#define BRCMU_CHAN_BAND_5G 1
109+
#define BRCMU_CHAN_BAND_6G 2
90110

91111
enum brcmu_chan_bw {
92112
BRCMU_CHAN_BW_20,

0 commit comments

Comments
 (0)