[PATCH 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint
Georgi Valkov <[email protected]>
| Newsgroups | org.kernel.vger.linux-wireless,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
WRT3200ACM and WRT32x routers always report a fixed US regulatory domain from the mwifiex ROM, which conflicts with the platform regulatory configuration on units sold outside the US market. For example: - phy0 mwlwifi 5 GHz, hard-coded region 98 EU mapped to FR - phy1 mwlwifi 2.4 GHz, hard-coded region 98 EU mapped to FR - phy2 mwifiex 2.4 and 5 GHz, hard-coded region US When the system boots, it detects a conflict between the user selected region and the radios, e.g. BG FR US, and applies extreme restrictions, preventing use of 5 GHz and DFS channels. This also affects phy0. Add a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain. [1] https://github.com/kaloz/mwlwifi/issues/173#issuecomment-307879699 [2] https://github.com/openwrt/openwrt/issues/9956 Tested-on: WRT3200ACM, OpenWrt Cc: [email protected] Signed-off-by: Georgi Valkov <[email protected]> --- Thank you Brian and Johannes! > Just because you found it difficult doesn't mean we should accept the > wrong approach. I agree. Guidance and careful inspection helps reach a good solution. > IIUC, you're using a PCIe-based WiFi card, and that's enabled in > arch/arm/boot/dts/marvell/armada-385-linksys.dtsi: > > &pcie1 { > /* Marvell 88W8864, 5GHz-only */ > status = "okay"; > }; > > &pcie2 { > /* Marvell 88W8864, 2GHz-only */ > status = "okay"; > }; No, you are referring to the main radios, which are not part of these patch series. Would you allow me to also add the flag to them? Their driver is not part of Linux so only dt bindings need to be added. The changes here target the third radio: - phy2: Marvell 88W8887 802.11ac/b/g/n 2.4 / 5 GHz, region US - compatible = marvell,sd8897 works I cannot confirm if any other devices from the family need the fix or not, so I intentionally target the board dts, and not the include: armada-385-linksys.dtsi > Side question: did you consider Jeff's suggestion from v2, to try the > 'reg_alpha2' module param? It might already do what you need, and it > only requires you configure your OpenWrt builds properly, I think. A universal solution is better than targeting OpenWrt only. And unfortunately I have no idea how to implement this. > I'm not sure what you're saying here In v3 I wanted to reuse a flag for both drivers. Using a root flag was objected, so in v4 I added a flag for mwifiex, and I would like to add the same flag to mwlwifi later. - driver dev_name(adapter->dev) = mmc0:0001:1 dev_fwnode(adapter->dev) = wifi@1 marvell,ignore-regulatory-hint = 1 - procfs /proc/device-tree/soc/internal-regs/sdhci@d8000/wifi@1 compatible = marvell,sd8897 marvell,ignore-regulatory-hint name = wifi reg v4: 1. Add binding documentation for flag marvell,ignore-regulatory-hint 2. Add dt for sd8897 and move the flag there, I used sample from docs 3. Use device_property_read_bool in the driver v3: I implemented and tested a better approach with no board specific code: 1. check for a device-tree flag in mwifiex_register_cfg80211in() !of_property_read_bool(of_root, "marvell,ignore-regulatory-hint") 2. add this flag to the root device tree of each affected board Currently this affects only armada-385-linksys-rango.dts, because Linux has no dts for venom. OpenWrt will take care of that. This approach is more flexible and scalable, because the flag can also be used in other drivers, e.g. mwlwifi (not part of Linux). v2: Replace the compatible device names, which are currently only available on OpenWrt with board names which are available on both Linux and OpenWrt. .../devicetree/bindings/net/wireless/marvell,sd8787.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml b/Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml index 930b700b73d0..5f235cb9f3e5 100644 --- a/Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +++ b/Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml @@ -59,6 +59,12 @@ properties: description: Calibration data for sub-band 3 in the 5GHz band. maxItems: 502 + marvell,ignore-regulatory-hint: + $ref: /schemas/types.yaml#/definitions/flag + description: + Ignore an incorrect regulatory hint from ROM, + so userspace can set the correct regulatory domain. + marvell,wakeup-pin: $ref: /schemas/types.yaml#/definitions/uint32 description: -- 2.55.0