344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From: Hante Meuleman <meuleman@broadcom.com>
  2. Date: Wed, 17 Feb 2016 11:26:58 +0100
  3. Subject: [PATCH] brcmfmac: use bar1 window size as provided by pci subsystem
  4. The PCIE bar1 window size is specified by chip. Currently the
  5. ioremap of bar1 was using a define which always matched the size
  6. of bar1, but newer chips can have a different bar1 sizes. With
  7. this patch the ioremap will be called with the by chip provided
  8. window size.
  9. Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10. Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11. Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12. Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13. Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15. ---
  16. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  17. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  18. @@ -72,7 +72,6 @@ static struct brcmf_firmware_mapping brc
  19. #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  20. -#define BRCMF_PCIE_TCM_MAP_SIZE (4096 * 1024)
  21. #define BRCMF_PCIE_REG_MAP_SIZE (32 * 1024)
  22. /* backplane addres space accessed by BAR0 */
  23. @@ -252,7 +251,6 @@ struct brcmf_pciedev_info {
  24. char nvram_name[BRCMF_FW_NAME_LEN];
  25. void __iomem *regs;
  26. void __iomem *tcm;
  27. - u32 tcm_size;
  28. u32 ram_base;
  29. u32 ram_size;
  30. struct brcmf_chip *ci;
  31. @@ -1592,8 +1590,7 @@ static int brcmf_pcie_get_resource(struc
  32. }
  33. devinfo->regs = ioremap_nocache(bar0_addr, BRCMF_PCIE_REG_MAP_SIZE);
  34. - devinfo->tcm = ioremap_nocache(bar1_addr, BRCMF_PCIE_TCM_MAP_SIZE);
  35. - devinfo->tcm_size = BRCMF_PCIE_TCM_MAP_SIZE;
  36. + devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size);
  37. if (!devinfo->regs || !devinfo->tcm) {
  38. brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs,
  39. @@ -1602,8 +1599,9 @@ static int brcmf_pcie_get_resource(struc
  40. }
  41. brcmf_dbg(PCIE, "Phys addr : reg space = %p base addr %#016llx\n",
  42. devinfo->regs, (unsigned long long)bar0_addr);
  43. - brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx\n",
  44. - devinfo->tcm, (unsigned long long)bar1_addr);
  45. + brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx size 0x%x\n",
  46. + devinfo->tcm, (unsigned long long)bar1_addr,
  47. + (unsigned int)bar1_size);
  48. return 0;
  49. }