On Tue, 2017-10-10 at 11:12 +0300, Luca Coelho wrote: > From: Luca Coelho <luciano.coelho@xxxxxxxxx> > > commit 01a9c948a09348950515bf2abb6113ed83e696d8 upstream. > > The OTP in some SKUs have erroneously allowed 40MHz and 80MHz channels > in the 5.2GHz band. The firmware has been modified to not allow this > in those SKUs, so the driver needs to do the same otherwise the > firmware will assert when we try to use it. > > Signed-off-by: Luca Coelho <luciano.coelho@xxxxxxxxx> > --- > drivers/net/wireless/iwlwifi/iwl-nvm-parse.c | 65 +++++++++++++++++++++++----- > 1 file changed, 55 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c > index d82984912e04..e7f58e00b5fb 100644 > --- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c > +++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c > @@ -73,6 +73,7 @@ > /* NVM offsets (in words) definitions */ > enum wkp_nvm_offsets { > /* NVM HW-Section offset (in words) definitions */ > + SUBSYSTEM_ID = 0x0A, > HW_ADDR = 0x15, > > /* NVM SW-Section offset (in words) definitions */ > @@ -257,13 +258,12 @@ static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, bool is_5ghz, > static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, > struct iwl_nvm_data *data, > const __le16 * const nvm_ch_flags, > - bool lar_supported) > + bool lar_supported, bool no_wide_in_5ghz) > { > int ch_idx; > int n_channels = 0; > struct ieee80211_channel *channel; > u16 ch_flags; > - bool is_5ghz; > int num_of_ch, num_2ghz_channels; > const u8 *nvm_chan; > > @@ -278,12 +278,20 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, > } > > for (ch_idx = 0; ch_idx < num_of_ch; ch_idx++) { > + bool is_5ghz = (ch_idx >= num_2ghz_channels); > + > ch_flags = __le16_to_cpup(nvm_ch_flags + ch_idx); > > - if (ch_idx >= num_2ghz_channels && > - !data->sku_cap_band_52GHz_enable) > + if (is_5ghz && !data->sku_cap_band_52GHz_enable) > continue; > > + /* workaround to disable wide channels in 5GHz */ > + if (no_wide_in_5ghz && is_5ghz) { > + ch_flags &= ~(NVM_CHANNEL_40MHZ | > + NVM_CHANNEL_80MHZ | > + NVM_CHANNEL_160MHZ); > + } > + > if (!lar_supported && !(ch_flags & NVM_CHANNEL_VALID)) { > /* > * Channels might become valid later if lar is > @@ -303,7 +311,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, > n_channels++; > > channel->hw_value = nvm_chan[ch_idx]; > - channel->band = (ch_idx < num_2ghz_channels) ? > + channel->band = is_5ghz ? > IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; Ooops, sorry, I made a mistake here. I'll send v2. -- Luca.