c43f0668e95e824362d741b80382fc351ea19afa
[oweals/openwrt.git] /
1 From f95a8d9c6aca196f1ace5b2e53a3dd3bc491b1b3 Mon Sep 17 00:00:00 2001
2 From: Naveen Gupta <naveen.gupta@cypress.com>
3 Date: Wed, 21 Nov 2018 07:53:49 +0000
4 Subject: [PATCH] brcmfmac: update 43012 F2 watermark setting to fix DMA Error
5  during UDP RX Traffic
6
7 The number of words that the read FIFO has to contain except
8 the end of frame before sends data back to the host.
9 Max watermark = (512B - 2* (BurstLength))/4 =
10 (512 - 128)/4 = 384/4 = 0x60
11 so if burst length (i.e. BurstLength = 64) is increased,
12 watermark has to be reduced. This is the optimal setting for this chip.
13
14 Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
15 Signed-off-by: Naveen Gupta <naveen.gupta@cypress.com>
16 Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
17 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
18 ---
19  .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c  | 12 ++++++++++++
20  1 file changed, 12 insertions(+)
21
22 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
23 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
24 @@ -52,6 +52,7 @@
25  /* watermark expressed in number of words */
26  #define DEFAULT_F2_WATERMARK    0x8
27  #define CY_4373_F2_WATERMARK    0x40
28 +#define CY_43012_F2_WATERMARK    0x60
29  
30  #ifdef DEBUG
31  
32 @@ -4184,6 +4185,17 @@ static void brcmf_sdio_firmware_callback
33                                            CY_4373_F2_WATERMARK |
34                                            SBSDIO_MESBUSYCTRL_ENAB, &err);
35                         break;
36 +               case SDIO_DEVICE_ID_CYPRESS_43012:
37 +                       brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n",
38 +                                 CY_43012_F2_WATERMARK);
39 +                       brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK,
40 +                                          CY_43012_F2_WATERMARK, &err);
41 +                       devctl = brcmf_sdiod_readb(sdiod, SBSDIO_DEVICE_CTL,
42 +                                                  &err);
43 +                       devctl |= SBSDIO_DEVCTL_F2WM_ENAB;
44 +                       brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl,
45 +                                          &err);
46 +                       break;
47                 default:
48                         brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK,
49                                            DEFAULT_F2_WATERMARK, &err);