]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
brcmfmac: sdio: Disable auto-tuning around commands expected to fail
authorDouglas Anderson <dianders@chromium.org>
Mon, 17 Jun 2019 17:56:51 +0000 (10:56 -0700)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 18 Jun 2019 11:30:29 +0000 (13:30 +0200)
There are certain cases, notably when transitioning between sleep and
active state, when Broadcom SDIO WiFi cards will produce errors on the
SDIO bus.  This is evident from the source code where you can see that
we try commands in a loop until we either get success or we've tried
too many times.  The comment in the code reinforces this by saying
"just one write attempt may fail"

Unfortunately these failures sometimes end up causing an "-EILSEQ"
back to the core which triggers a retuning of the SDIO card and that
blocks all traffic to the card until it's done.

Let's disable retuning around the commands we expect might fail.

Cc: stable@vger.kernel.org #v4.18+
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Acked-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c

index b6466f3b38f446fdd2ed669c829674b37478cbc3..2ad8bdb7e0737b0f97fb1a8fb66e00719b0f7d3d 100644 (file)
@@ -678,6 +678,8 @@ brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on)
 
        brcmf_dbg(TRACE, "Enter: on=%d\n", on);
 
+       sdio_retune_crc_disable(bus->sdiodev->func1);
+
        wr_val = (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT);
        /* 1st KSO write goes to AOS wake up core if device is asleep  */
        brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, wr_val, &err);
@@ -738,6 +740,8 @@ brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on)
        if (try_cnt > MAX_KSO_ATTEMPTS)
                brcmf_err("max tries: rd_val=0x%x err=%d\n", rd_val, err);
 
+       sdio_retune_crc_enable(bus->sdiodev->func1);
+
        return err;
 }