2024-03-25 20:58:24

by Nishanth Menon

[permalink] [raw]
Subject: [PATCH V2] arm64: dts: ti: k3-am625-beagleplay: Use mmc-pwrseq for wl18xx enable

From: Sukrut Bellary <[email protected]>

BeaglePlay SBC[1] has Texas Instrument's WL18xx WiFi chipset[2].

Currently, WLAN_EN is configured as regulator and regulator-always-on.
However, the timing and wlan_en sequencing is not correctly modelled.

This causes the sdio access to fail during runtime-pm power operations
saving or during system suspend/resume/hibernation/freeze operations.
This is because the WLAN_EN line is not deasserted to low '0' to power
down the WiFi. So during restore, the WiFi driver tries to load the FW
without following correct power sequence. WLAN_EN => '1'/assert (high)
to power-up the chipset.

Use mmc-pwrseq-simple to drive TI's WiFi (WL18xx) chipset enable
'WLAN_EN'. mmc-pwrseq-simple provides power sequence flexibility with
support for post power-on and power-off delays.

Typical log signature that indicates this bug is:
wl1271_sdio mmc2:0001:2: sdio write failed (-110)

Followed by possibly a kernel warning (depending on firmware present):
WARNING: CPU: 1 PID: 45 at drivers/net/wireless/ti/wlcore/sdio.c:123 wl12xx_sdio_raw_write+0xe4/0x168 [wlcore_sdio]

[1] https://www.beagleboard.org/boards/beagleplay
[2] https://www.ti.com/lit/ds/symlink/wl1807mod.pdf

Fixes: f5a731f0787f ("arm64: dts: ti: Add k3-am625-beagleplay")
Suggested-by: Shengyu Qu <[email protected]>
Signed-off-by: Sukrut Bellary <[email protected]>
Signed-off-by: Nishanth Menon <[email protected]>
---
Picking this patch up since Sukrut was not able to refresh the patch in
the list and it does'nt make much sense to hold off this critical fixup.

Boot log:
https://gist.github.com/nmenon/a34abd03a6aaf84a39ffa569df248285
(includes defconfig change to make iwd work)

Changes Since v1:
* Update the power-on-time to 10ms (same as used in:
arch/arm64/boot/dts/xilinx/zynqmp-zcu100-revC.dts
arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
)
* Add in-code documentation pointing at timing diagram for the values
used.
* Fixup fail log and commit message and make it generic to indicate
various other usecases of failure.
* Re-test on v6.9-rc1

V1: https://lore.kernel.org/all/[email protected]/

.../arm64/boot/dts/ti/k3-am625-beagleplay.dts | 27 +++++++++----------
1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts b/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts
index a34e0df2ab86..ffc613543968 100644
--- a/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts
+++ b/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts
@@ -82,6 +82,17 @@ wkup_r5fss0_core0_dma_memory_region: r5f-dma-memory@9db00000 {
};
};

+ sdio_pwrseq: sdio-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ pinctrl-names = "default";
+ pinctrl-0 = <&wifi_en_pins_default>;
+ /* Interal power on time(Figure 8-3) * 2 */
+ post-power-on-delay-ms = <10>;
+ /* Re-enable time(Figure 8-2) + 20uS */
+ power-off-delay-us = <80>;
+ reset-gpios = <&main_gpio0 38 GPIO_ACTIVE_LOW>;
+ };
+
vsys_5v0: regulator-1 {
bootph-all;
compatible = "regulator-fixed";
@@ -104,20 +115,6 @@ vdd_3v3: regulator-2 {
regulator-boot-on;
};

- wlan_en: regulator-3 {
- /* OUTPUT of SN74AVC2T244DQMR */
- compatible = "regulator-fixed";
- regulator-name = "wlan_en";
- regulator-min-microvolt = <1800000>;
- regulator-max-microvolt = <1800000>;
- enable-active-high;
- regulator-always-on;
- vin-supply = <&vdd_3v3>;
- gpio = <&main_gpio0 38 GPIO_ACTIVE_HIGH>;
- pinctrl-names = "default";
- pinctrl-0 = <&wifi_en_pins_default>;
- };
-
vdd_3v3_sd: regulator-4 {
/* output of TPS22918DBVR-U21 */
bootph-all;
@@ -839,13 +836,13 @@ &sdhci1 {
};

&sdhci2 {
- vmmc-supply = <&wlan_en>;
pinctrl-names = "default";
pinctrl-0 = <&wifi_pins_default>, <&wifi_32k_clk>;
non-removable;
ti,fails-without-test-cd;
cap-power-off-card;
keep-power-in-suspend;
+ mmc-pwrseq = <&sdio_pwrseq>;
assigned-clocks = <&k3_clks 157 158>;
assigned-clock-parents = <&k3_clks 157 160>;
#address-cells = <1>;

base-commit: 4cece764965020c22cff7665b18a012006359095
--
2.43.0



2024-03-26 14:27:17

by Robert Nelson

[permalink] [raw]
Subject: Re: [PATCH V2] arm64: dts: ti: k3-am625-beagleplay: Use mmc-pwrseq for wl18xx enable

On Mon, Mar 25, 2024 at 9:35 AM Nishanth Menon <[email protected]> wrote:
>
> From: Sukrut Bellary <[email protected]>
>
> BeaglePlay SBC[1] has Texas Instrument's WL18xx WiFi chipset[2].
>
> Currently, WLAN_EN is configured as regulator and regulator-always-on.
> However, the timing and wlan_en sequencing is not correctly modelled.
>
> This causes the sdio access to fail during runtime-pm power operations
> saving or during system suspend/resume/hibernation/freeze operations.
> This is because the WLAN_EN line is not deasserted to low '0' to power
> down the WiFi. So during restore, the WiFi driver tries to load the FW
> without following correct power sequence. WLAN_EN => '1'/assert (high)
> to power-up the chipset.
>
> Use mmc-pwrseq-simple to drive TI's WiFi (WL18xx) chipset enable
> 'WLAN_EN'. mmc-pwrseq-simple provides power sequence flexibility with
> support for post power-on and power-off delays.
>
> Typical log signature that indicates this bug is:
> wl1271_sdio mmc2:0001:2: sdio write failed (-110)
>
> Followed by possibly a kernel warning (depending on firmware present):
> WARNING: CPU: 1 PID: 45 at drivers/net/wireless/ti/wlcore/sdio.c:123 wl12xx_sdio_raw_write+0xe4/0x168 [wlcore_sdio]
>
> [1] https://www.beagleboard.org/boards/beagleplay
> [2] https://www.ti.com/lit/ds/symlink/wl1807mod.pdf
>
> Fixes: f5a731f0787f ("arm64: dts: ti: Add k3-am625-beagleplay")
> Suggested-by: Shengyu Qu <[email protected]>
> Signed-off-by: Sukrut Bellary <[email protected]>
> Signed-off-by: Nishanth Menon <[email protected]>

Tested-by: Robert Nelson <[email protected]>

With v6.9.0-rc1 on BeaglePlay..

debian@BeaglePlay-57:~$ uname -r
6.9.0-rc1-dirty
debian@BeaglePlay-57:~$ dmesg | grep wl
[ 12.621555] wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11)
[ 12.623215] wlcore: WARNING Detected unconfigured mac address in
nvs, derive from fuse instead.
[ 12.623253] wlcore: WARNING This default nvs file can be removed
from the file system
[ 12.630813] wlcore: loaded
[ 13.061833] wlcore: using inverted interrupt logic: 2
[ 13.120366] wlcore: PHY firmware version: Rev 8.2.0.0.243
[ 13.218832] wlcore: firmware booted (Rev 8.9.0.0.83)
[ 13.795189] wlan0: no VHT support on 5 GHz, limiting to HT
[ 13.795232] wlan0: determined local STA to be HT, BW limited to 40 MHz
[ 13.795303] wlan0: determined AP ba:fb:e4:f5:7b:d2 to be HT
[ 13.799461] wlan0: connecting with HT mode, max bandwidth 40 MHz
[ 13.802189] wlan0: authenticate with ba:fb:e4:f5:7b:d2 (local
address=6c:30:2a:2a:84:f0)
[ 13.802246] wlan0: send auth to ba:fb:e4:f5:7b:d2 (try 1/3)
[ 13.873457] wlan0: authenticated
[ 13.873746] wlan0: no VHT support on 5 GHz, limiting to HT
[ 13.873764] wlan0: determined local STA to be HT, BW limited to 40 MHz
[ 13.875500] wlan0: associate with ba:fb:e4:f5:7b:d2 (try 1/3)
[ 13.881981] wlan0: RX AssocResp from ba:fb:e4:f5:7b:d2
(capab=0x1511 status=0 aid=3)
[ 13.889436] wlan0: associated
[ 13.889660] wlan0: Limiting TX power to 30 (30 - 0) dBm as
advertised by ba:fb:e4:f5:7b:d2
[ 13.990788] wlcore: Association completed.

--
Robert Nelson
https://rcn-ee.com/

2024-04-09 19:39:01

by Nishanth Menon

[permalink] [raw]
Subject: Re: [PATCH V2] arm64: dts: ti: k3-am625-beagleplay: Use mmc-pwrseq for wl18xx enable

Hi Nishanth Menon,

On Mon, 25 Mar 2024 09:35:10 -0500, Nishanth Menon wrote:
> BeaglePlay SBC[1] has Texas Instrument's WL18xx WiFi chipset[2].
>
> Currently, WLAN_EN is configured as regulator and regulator-always-on.
> However, the timing and wlan_en sequencing is not correctly modelled.
>
> This causes the sdio access to fail during runtime-pm power operations
> saving or during system suspend/resume/hibernation/freeze operations.
> This is because the WLAN_EN line is not deasserted to low '0' to power
> down the WiFi. So during restore, the WiFi driver tries to load the FW
> without following correct power sequence. WLAN_EN => '1'/assert (high)
> to power-up the chipset.
>
> [...]

I have applied the following to branch ti-k3-dts-next on [1].
Thank you!

[1/1] arm64: dts: ti: k3-am625-beagleplay: Use mmc-pwrseq for wl18xx enable
commit: 31d5c43719bbd147d7e2c53ad2ef17953c68f458

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent up the chain during
the next merge window (or sooner if it is a relevant bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
--
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D