329-v5.0-0002-brcmfmac-set-F2-watermark-to-256-for-4373.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. From e1a08730eeb0bad4d82c3bc40e74854872de618d Mon Sep 17 00:00:00 2001
  2. From: Wright Feng <[email protected]>
  3. Date: Wed, 21 Nov 2018 07:53:44 +0000
  4. Subject: [PATCH] brcmfmac: set F2 watermark to 256 for 4373
  5. We got SDIO_CRC_ERROR with 4373 on SDR104 when doing bi-directional
  6. throughput test. Enable watermark to 256 to guarantee the operation
  7. stability.
  8. Reviewed-by: Arend van Spriel <[email protected]>
  9. Signed-off-by: Wright Feng <[email protected]>
  10. Signed-off-by: Chi-Hsien Lin <[email protected]>
  11. Signed-off-by: Kalle Valo <[email protected]>
  12. ---
  13. .../broadcom/brcm80211/brcmfmac/sdio.c | 26 +++++++++++++++++--
  14. 1 file changed, 24 insertions(+), 2 deletions(-)
  15. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  16. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17. @@ -49,6 +49,10 @@
  18. #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  19. #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  20. +/* watermark expressed in number of words */
  21. +#define DEFAULT_F2_WATERMARK 0x8
  22. +#define CY_4373_F2_WATERMARK 0x40
  23. +
  24. #ifdef DEBUG
  25. #define BRCMF_TRAP_INFO_SIZE 80
  26. @@ -138,6 +142,8 @@ struct rte_console {
  27. /* 1: isolate internal sdio signals, put external pads in tri-state; requires
  28. * sdio bus power cycle to clear (rev 9) */
  29. #define SBSDIO_DEVCTL_PADS_ISO 0x08
  30. +/* 1: enable F2 Watermark */
  31. +#define SBSDIO_DEVCTL_F2WM_ENAB 0x10
  32. /* Force SD->SB reset mapping (rev 11) */
  33. #define SBSDIO_DEVCTL_SB_RST_CTL 0x30
  34. /* Determined by CoreControl bit */
  35. @@ -4046,6 +4052,7 @@ static void brcmf_sdio_firmware_callback
  36. void *nvram;
  37. u32 nvram_len;
  38. u8 saveclk;
  39. + u8 devctl;
  40. brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err);
  41. @@ -4101,8 +4108,23 @@ static void brcmf_sdio_firmware_callback
  42. brcmf_sdiod_writel(sdiod, core->base + SD_REG(hostintmask),
  43. bus->hostintmask, NULL);
  44. -
  45. - brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, 8, &err);
  46. + switch (sdiod->func1->device) {
  47. + case SDIO_DEVICE_ID_CYPRESS_4373:
  48. + brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n",
  49. + CY_4373_F2_WATERMARK);
  50. + brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK,
  51. + CY_4373_F2_WATERMARK, &err);
  52. + devctl = brcmf_sdiod_readb(sdiod, SBSDIO_DEVICE_CTL,
  53. + &err);
  54. + devctl |= SBSDIO_DEVCTL_F2WM_ENAB;
  55. + brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl,
  56. + &err);
  57. + break;
  58. + default:
  59. + brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK,
  60. + DEFAULT_F2_WATERMARK, &err);
  61. + break;
  62. + }
  63. } else {
  64. /* Disable F2 again */
  65. sdio_disable_func(sdiod->func2);