]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/brcmfmac-sdio-disable-auto-tuning-around-commands-expected-to-fail.patch
4.19-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.19 / brcmfmac-sdio-disable-auto-tuning-around-commands-expected-to-fail.patch
1 From 2de0b42da263c97d330d276f5ccf7c4470e3324f Mon Sep 17 00:00:00 2001
2 From: Douglas Anderson <dianders@chromium.org>
3 Date: Mon, 17 Jun 2019 10:56:51 -0700
4 Subject: brcmfmac: sdio: Disable auto-tuning around commands expected to fail
5
6 From: Douglas Anderson <dianders@chromium.org>
7
8 commit 2de0b42da263c97d330d276f5ccf7c4470e3324f upstream.
9
10 There are certain cases, notably when transitioning between sleep and
11 active state, when Broadcom SDIO WiFi cards will produce errors on the
12 SDIO bus. This is evident from the source code where you can see that
13 we try commands in a loop until we either get success or we've tried
14 too many times. The comment in the code reinforces this by saying
15 "just one write attempt may fail"
16
17 Unfortunately these failures sometimes end up causing an "-EILSEQ"
18 back to the core which triggers a retuning of the SDIO card and that
19 blocks all traffic to the card until it's done.
20
21 Let's disable retuning around the commands we expect might fail.
22
23 Cc: stable@vger.kernel.org #v4.18+
24 Signed-off-by: Douglas Anderson <dianders@chromium.org>
25 Acked-by: Adrian Hunter <adrian.hunter@intel.com>
26 Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
27 Acked-by: Kalle Valo <kvalo@codeaurora.org>
28 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30
31 ---
32 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 ++++
33 1 file changed, 4 insertions(+)
34
35 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
36 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
37 @@ -667,6 +667,8 @@ brcmf_sdio_kso_control(struct brcmf_sdio
38
39 brcmf_dbg(TRACE, "Enter: on=%d\n", on);
40
41 + sdio_retune_crc_disable(bus->sdiodev->func1);
42 +
43 wr_val = (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT);
44 /* 1st KSO write goes to AOS wake up core if device is asleep */
45 brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, wr_val, &err);
46 @@ -719,6 +721,8 @@ brcmf_sdio_kso_control(struct brcmf_sdio
47 if (try_cnt > MAX_KSO_ATTEMPTS)
48 brcmf_err("max tries: rd_val=0x%x err=%d\n", rd_val, err);
49
50 + sdio_retune_crc_enable(bus->sdiodev->func1);
51 +
52 return err;
53 }
54