diff mbox series

[2/5] brcmfmac: fix 4339 CRC error under SDIO 3.0 SDR104 mode

Message ID 20200521034838.57371-3-chi-hsien.lin@cypress.com (mailing list archive)
State Superseded
Delegated to: Kalle Valo
Headers show
Series brcmfmac: SDIO parameter change series | expand

Commit Message

Chi-Hsien Lin May 21, 2020, 3:48 a.m. UTC
From: Double Lo <double.lo@cypress.com>

This patch fixes 4339 CRC error while running Tput test with
suspend/resume test script.

The continuous failure messages before system crash:
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 25600 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 24576 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame

Signed-off-by: Double Lo <double.lo@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
---
 .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

--
2.25.0


This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index dce22cd2279d..491b635e72b1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -43,6 +43,10 @@ 
 #define CY_4373_F2_WATERMARK    0x40
 #define CY_4373_F1_MESBUSYCTRL  (CY_4373_F2_WATERMARK | SBSDIO_MESBUSYCTRL_ENAB)
 #define CY_43012_F2_WATERMARK    0x60
+#define CY_4339_F2_WATERMARK    48
+#define CY_4339_MES_WATERMARK  80
+#define CY_4339_MESBUSYCTRL    (CY_4339_MES_WATERMARK | \
+                                SBSDIO_MESBUSYCTRL_ENAB)
 #define CY_4359_F2_WATERMARK   0x40
 #define CY_4359_F1_MESBUSYCTRL (CY_4359_F2_WATERMARK | SBSDIO_MESBUSYCTRL_ENAB)

@@ -4209,6 +4213,19 @@  static void brcmf_sdio_firmware_callback(struct device *dev, int err,
                        brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl,
                                           &err);
                        break;
+               case SDIO_DEVICE_ID_BROADCOM_4339:
+                       brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes for 4339\n",
+                                 CY_4339_F2_WATERMARK);
+                       brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK,
+                                          CY_4339_F2_WATERMARK, &err);
+                       devctl = brcmf_sdiod_readb(sdiod, SBSDIO_DEVICE_CTL,
+                                                  &err);
+                       devctl |= SBSDIO_DEVCTL_F2WM_ENAB;
+                       brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl,
+                                          &err);
+                       brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_MESBUSYCTRL,
+                                          CY_4339_MESBUSYCTRL, &err);
+                       break;
                case SDIO_DEVICE_ID_BROADCOM_4359:
                        brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n",
                                  CY_4359_F2_WATERMARK);