| From 4eefba9364607ae07c877c877d2c445a3b552859 Mon Sep 17 00:00:00 2001 |
| From: Brian Norris <briannorris@chromium.org> |
| Date: Mon, 21 Dec 2020 14:36:20 -0800 |
| Subject: [PATCH] CHROMIUM: mwifiex: ignore EEPROM country code |
| |
| Marvell firmware determines country codes by the following: |
| |
| 1. 'region_code' is set in OTP |
| 2. 'region_code' is specified in cal_data config file: User can provide |
| 'region_code' in a config file, via the module_param 'cal_data_cfg'. |
| (This can also be configured via Device Tree, "marvell,caldata*".) |
| In this case, firmware will return the configured value. |
| 3. A default 'region_code' set in firmware: As of now, default |
| 'region_code' is set to 'US' in the firmware. |
| |
| Option 1: |
| We have a variety of systems shipping Marvell WiFi, but data suggests |
| none of them have a country code programmed to the module EEPROM/OTP. |
| |
| Option 2: |
| This format isn't documented, although we use it for other purposes (TX |
| power tables). |
| |
| So we're hitting Option 3, where we default to US. |
| |
| For many systems (Veyron, Oak families), we shipped systems before |
| mwifiex started defaulting to US. |
| |
| For others (Gru family), we were always stuck using US rules, but didn't |
| realize the implications. |
| |
| For US (and a few other strict countries), we enforce restrictions via |
| /etc/init/regulatory-domain.conf, but otherwise want to default to |
| "world" (00) code, which initially provides lowest-common-denominator |
| settings and allows the system to adapt to the environment. |
| |
| This effectively reverts commit 658cb59232b1 ("mwifiex: set regulatory |
| info from EEPROM"). |
| |
| Alternative: upstream something like https://crrev.com/c/699801, so that |
| the Device Tree can help us target only those boards that are known to |
| be configured inconsistently with the latest mwifiex behavior. That's |
| not likely to go over very well upstream, and this works just as well. |
| |
| BUG=b:175917715, b:36431366 |
| TEST=`vpd -i RO_VPD -s region=au; reboot; iw reg get`, connect to |
| Australian AP at channel 13 |
| TEST=`tast run ${HOST} network.WlanRegulatory` |
| |
| Signed-off-by: Brian Norris <briannorris@chromium.org> |
| Change-Id: I075ebd04fb2cb6d64b03fcb49559906906d2f2f8 |
| Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2618760 |
| Reviewed-by: Abhishek Kumar <kuabhs@chromium.org> |
| --- |
| drivers/net/wireless/marvell/mwifiex/cfg80211.c | 13 ++++++------- |
| 1 file changed, 6 insertions(+), 7 deletions(-) |
| |
| diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
| index a2ed268ce0da..c8698f382c8a 100644 |
| --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
| +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
| @@ -4450,16 +4450,15 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) |
| mwifiex_dbg(adapter, WARN, |
| "Ignore world regulatory domain\n"); |
| } else { |
| - wiphy->regulatory_flags |= |
| - REGULATORY_DISABLE_BEACON_HINTS | |
| - REGULATORY_COUNTRY_IE_IGNORE; |
| country_code = |
| mwifiex_11d_code_2_region( |
| adapter->region_code); |
| - if (country_code && |
| - regulatory_hint(wiphy, country_code)) |
| - mwifiex_dbg(priv->adapter, ERROR, |
| - "regulatory_hint() failed\n"); |
| + if (country_code) { |
| + mwifiex_dbg(priv->adapter, MSG, |
| + "ignoring EEPROM country code: %c%c\n", |
| + country_code[0], |
| + country_code[1]); |
| + } |
| } |
| } |
| } |
| -- |
| 2.17.1 |
| |