]> git.baikalelectronics.ru Git - kernel.git/commitdiff
brcmfmac: set F2 blocksize and watermark for 4354/4356 SDIO
authorFrank Kao <frank.kao@cypress.com>
Fri, 29 May 2020 03:49:36 +0000 (22:49 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 29 May 2020 17:39:38 +0000 (20:39 +0300)
Set F2 blocksize to 256 bytes and watermark to 0x40 for 4354/4356 SDIO.
Also enable and configure F1 MesBusyCtrl. It would resolve random driver
crash issue.

Signed-off-by: Frank Kao <frank.kao@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200529034938.124533-4-chi-hsien.lin@cypress.com
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c

index bb3196cba683a4604154ced8ab1b52b9a421671d..b1a66320ba544c24b2dd0578c496e5eab4d8c8dd 100644 (file)
@@ -44,7 +44,7 @@
 #define SDIO_FUNC1_BLOCKSIZE           64
 #define SDIO_FUNC2_BLOCKSIZE           512
 #define SDIO_4373_FUNC2_BLOCKSIZE      256
-#define SDIO_4359_FUNC2_BLOCKSIZE      256
+#define SDIO_435X_FUNC2_BLOCKSIZE      256
 /* Maximum milliseconds to wait for F2 to come up */
 #define SDIO_WAIT_F2RDY        3000
 
@@ -916,7 +916,11 @@ static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
                f2_blksz = SDIO_4373_FUNC2_BLOCKSIZE;
                break;
        case SDIO_DEVICE_ID_BROADCOM_4359:
-               f2_blksz = SDIO_4359_FUNC2_BLOCKSIZE;
+               /* fallthrough */
+       case SDIO_DEVICE_ID_BROADCOM_4354:
+               /* fallthrough */
+       case SDIO_DEVICE_ID_BROADCOM_4356:
+               f2_blksz = SDIO_435X_FUNC2_BLOCKSIZE;
                break;
        default:
                break;
index 491b635e72b183fbbea81e4bfe3e0d87a24e483b..037a4efef924ac96ad47528416b7944411a7327f 100644 (file)
@@ -47,9 +47,9 @@
 #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)
-
+#define CY_435X_F2_WATERMARK   0x40
+#define CY_435X_F1_MESBUSYCTRL (CY_435X_F2_WATERMARK | \
+                                SBSDIO_MESBUSYCTRL_ENAB)
 #ifdef DEBUG
 
 #define BRCMF_TRAP_INFO_SIZE   80
@@ -4227,17 +4227,21 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,
                                           CY_4339_MESBUSYCTRL, &err);
                        break;
                case SDIO_DEVICE_ID_BROADCOM_4359:
+                       /* fallthrough */
+               case SDIO_DEVICE_ID_BROADCOM_4354:
+                       /* fallthrough */
+               case SDIO_DEVICE_ID_BROADCOM_4356:
                        brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n",
-                                 CY_4359_F2_WATERMARK);
+                                 CY_435X_F2_WATERMARK);
                        brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK,
-                                          CY_4359_F2_WATERMARK, &err);
+                                          CY_435X_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_4359_F1_MESBUSYCTRL, &err);
+                                          CY_435X_F1_MESBUSYCTRL, &err);
                        break;
                default:
                        brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK,