]> git.baikalelectronics.ru Git - kernel.git/commitdiff
brcmfmac: set F2 blocksize for 4373
authorWright Feng <wright.feng@cypress.com>
Fri, 29 May 2020 03:49:34 +0000 (22:49 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 29 May 2020 17:39:35 +0000 (20:39 +0300)
Set F2 blocksize to 256 bytes for 4373. It fixes DMA error while having
UDP bi-directional traffic. Also use a defined F1 MesBusyCtrl value.

Signed-off-by: Wright Feng <wright.feng@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-2-chi-hsien.lin@cypress.com
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c

index 22a17ae09e94e2178f41404c681d011b9930d449..bb3196cba683a4604154ced8ab1b52b9a421671d 100644 (file)
@@ -43,6 +43,7 @@
 
 #define SDIO_FUNC1_BLOCKSIZE           64
 #define SDIO_FUNC2_BLOCKSIZE           512
+#define SDIO_4373_FUNC2_BLOCKSIZE      256
 #define SDIO_4359_FUNC2_BLOCKSIZE      256
 /* Maximum milliseconds to wait for F2 to come up */
 #define SDIO_WAIT_F2RDY        3000
@@ -910,13 +911,24 @@ static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
                sdio_release_host(sdiodev->func1);
                goto out;
        }
-       if (sdiodev->func2->device == SDIO_DEVICE_ID_BROADCOM_4359)
+       switch (sdiodev->func2->device) {
+       case SDIO_DEVICE_ID_CYPRESS_4373:
+               f2_blksz = SDIO_4373_FUNC2_BLOCKSIZE;
+               break;
+       case SDIO_DEVICE_ID_BROADCOM_4359:
                f2_blksz = SDIO_4359_FUNC2_BLOCKSIZE;
+               break;
+       default:
+               break;
+       }
+
        ret = sdio_set_block_size(sdiodev->func2, f2_blksz);
        if (ret) {
                brcmf_err("Failed to set F2 blocksize\n");
                sdio_release_host(sdiodev->func1);
                goto out;
+       } else {
+               brcmf_dbg(SDIO, "set F2 blocksize to %d\n", f2_blksz);
        }
 
        /* increase F2 timeout */
index ce6f152842770b342ff012e381201fb4187aa629..dce22cd2279d86497c19371c0a58b8a3d727739c 100644 (file)
@@ -41,6 +41,7 @@
 /* watermark expressed in number of words */
 #define DEFAULT_F2_WATERMARK    0x8
 #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_4359_F2_WATERMARK   0x40
 #define CY_4359_F1_MESBUSYCTRL (CY_4359_F2_WATERMARK | SBSDIO_MESBUSYCTRL_ENAB)
@@ -4195,8 +4196,7 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,
                        brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl,
                                           &err);
                        brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_MESBUSYCTRL,
-                                          CY_4373_F2_WATERMARK |
-                                          SBSDIO_MESBUSYCTRL_ENAB, &err);
+                                          CY_4373_F1_MESBUSYCTRL, &err);
                        break;
                case SDIO_DEVICE_ID_CYPRESS_43012:
                        brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n",