344-0011-brcmfmac-remove-pcie-gen1-support.patch 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. From: Hante Meuleman <meuleman@broadcom.com>
  2. Date: Wed, 17 Feb 2016 11:27:00 +0100
  3. Subject: [PATCH] brcmfmac: remove pcie gen1 support
  4. The PCIE bus driver supports older gen1 (v1) chips, but there is no
  5. actual device which is using this older pcie core which is supported
  6. by brcmfmac. Remove all gen1 related code.
  7. Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  8. Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9. Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10. Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11. Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13. ---
  14. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  15. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  16. @@ -100,9 +100,6 @@ static struct brcmf_firmware_mapping brc
  17. #define BRCMF_PCIE_PCIE2REG_CONFIGDATA 0x124
  18. #define BRCMF_PCIE_PCIE2REG_H2D_MAILBOX 0x140
  19. -#define BRCMF_PCIE_GENREV1 1
  20. -#define BRCMF_PCIE_GENREV2 2
  21. -
  22. #define BRCMF_PCIE2_INTA 0x01
  23. #define BRCMF_PCIE2_INTB 0x02
  24. @@ -257,9 +254,7 @@ struct brcmf_pciedev_info {
  25. u32 ram_size;
  26. struct brcmf_chip *ci;
  27. u32 coreid;
  28. - u32 generic_corerev;
  29. struct brcmf_pcie_shared_info shared;
  30. - void (*ringbell)(struct brcmf_pciedev_info *devinfo);
  31. wait_queue_head_t mbdata_resp_wait;
  32. bool mbdata_completed;
  33. bool irq_allocated;
  34. @@ -746,68 +741,22 @@ static void brcmf_pcie_bus_console_read(
  35. }
  36. -static __used void brcmf_pcie_ringbell_v1(struct brcmf_pciedev_info *devinfo)
  37. -{
  38. - u32 reg_value;
  39. -
  40. - brcmf_dbg(PCIE, "RING !\n");
  41. - reg_value = brcmf_pcie_read_reg32(devinfo,
  42. - BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  43. - reg_value |= BRCMF_PCIE2_INTB;
  44. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  45. - reg_value);
  46. -}
  47. -
  48. -
  49. -static void brcmf_pcie_ringbell_v2(struct brcmf_pciedev_info *devinfo)
  50. -{
  51. - brcmf_dbg(PCIE, "RING !\n");
  52. - /* Any arbitrary value will do, lets use 1 */
  53. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX, 1);
  54. -}
  55. -
  56. -
  57. static void brcmf_pcie_intr_disable(struct brcmf_pciedev_info *devinfo)
  58. {
  59. - if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1)
  60. - pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTMASK,
  61. - 0);
  62. - else
  63. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  64. - 0);
  65. + brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK, 0);
  66. }
  67. static void brcmf_pcie_intr_enable(struct brcmf_pciedev_info *devinfo)
  68. {
  69. - if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1)
  70. - pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTMASK,
  71. - BRCMF_PCIE_INT_DEF);
  72. - else
  73. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  74. - BRCMF_PCIE_MB_INT_D2H_DB |
  75. - BRCMF_PCIE_MB_INT_FN0_0 |
  76. - BRCMF_PCIE_MB_INT_FN0_1);
  77. + brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  78. + BRCMF_PCIE_MB_INT_D2H_DB |
  79. + BRCMF_PCIE_MB_INT_FN0_0 |
  80. + BRCMF_PCIE_MB_INT_FN0_1);
  81. }
  82. -static irqreturn_t brcmf_pcie_quick_check_isr_v1(int irq, void *arg)
  83. -{
  84. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  85. - u32 status;
  86. -
  87. - status = 0;
  88. - pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  89. - if (status) {
  90. - brcmf_pcie_intr_disable(devinfo);
  91. - brcmf_dbg(PCIE, "Enter\n");
  92. - return IRQ_WAKE_THREAD;
  93. - }
  94. - return IRQ_NONE;
  95. -}
  96. -
  97. -
  98. -static irqreturn_t brcmf_pcie_quick_check_isr_v2(int irq, void *arg)
  99. +static irqreturn_t brcmf_pcie_quick_check_isr(int irq, void *arg)
  100. {
  101. struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  102. @@ -820,29 +769,7 @@ static irqreturn_t brcmf_pcie_quick_chec
  103. }
  104. -static irqreturn_t brcmf_pcie_isr_thread_v1(int irq, void *arg)
  105. -{
  106. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  107. - const struct pci_dev *pdev = devinfo->pdev;
  108. - u32 status;
  109. -
  110. - devinfo->in_irq = true;
  111. - status = 0;
  112. - pci_read_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  113. - brcmf_dbg(PCIE, "Enter %x\n", status);
  114. - if (status) {
  115. - pci_write_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, status);
  116. - if (devinfo->state == BRCMFMAC_PCIE_STATE_UP)
  117. - brcmf_proto_msgbuf_rx_trigger(&devinfo->pdev->dev);
  118. - }
  119. - if (devinfo->state == BRCMFMAC_PCIE_STATE_UP)
  120. - brcmf_pcie_intr_enable(devinfo);
  121. - devinfo->in_irq = false;
  122. - return IRQ_HANDLED;
  123. -}
  124. -
  125. -
  126. -static irqreturn_t brcmf_pcie_isr_thread_v2(int irq, void *arg)
  127. +static irqreturn_t brcmf_pcie_isr_thread(int irq, void *arg)
  128. {
  129. struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  130. u32 status;
  131. @@ -879,28 +806,14 @@ static int brcmf_pcie_request_irq(struct
  132. brcmf_pcie_intr_disable(devinfo);
  133. brcmf_dbg(PCIE, "Enter\n");
  134. - /* is it a v1 or v2 implementation */
  135. +
  136. pci_enable_msi(pdev);
  137. - if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1) {
  138. - if (request_threaded_irq(pdev->irq,
  139. - brcmf_pcie_quick_check_isr_v1,
  140. - brcmf_pcie_isr_thread_v1,
  141. - IRQF_SHARED, "brcmf_pcie_intr",
  142. - devinfo)) {
  143. - pci_disable_msi(pdev);
  144. - brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  145. - return -EIO;
  146. - }
  147. - } else {
  148. - if (request_threaded_irq(pdev->irq,
  149. - brcmf_pcie_quick_check_isr_v2,
  150. - brcmf_pcie_isr_thread_v2,
  151. - IRQF_SHARED, "brcmf_pcie_intr",
  152. - devinfo)) {
  153. - pci_disable_msi(pdev);
  154. - brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  155. - return -EIO;
  156. - }
  157. + if (request_threaded_irq(pdev->irq, brcmf_pcie_quick_check_isr,
  158. + brcmf_pcie_isr_thread, IRQF_SHARED,
  159. + "brcmf_pcie_intr", devinfo)) {
  160. + pci_disable_msi(pdev);
  161. + brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  162. + return -EIO;
  163. }
  164. devinfo->irq_allocated = true;
  165. return 0;
  166. @@ -931,16 +844,9 @@ static void brcmf_pcie_release_irq(struc
  167. if (devinfo->in_irq)
  168. brcmf_err("Still in IRQ (processing) !!!\n");
  169. - if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1) {
  170. - status = 0;
  171. - pci_read_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  172. - pci_write_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, status);
  173. - } else {
  174. - status = brcmf_pcie_read_reg32(devinfo,
  175. - BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  176. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  177. - status);
  178. - }
  179. + status = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  180. + brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT, status);
  181. +
  182. devinfo->irq_allocated = false;
  183. }
  184. @@ -989,7 +895,9 @@ static int brcmf_pcie_ring_mb_ring_bell(
  185. if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  186. return -EIO;
  187. - devinfo->ringbell(devinfo);
  188. + brcmf_dbg(PCIE, "RING !\n");
  189. + /* Any arbitrary value will do, lets use 1 */
  190. + brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX, 1);
  191. return 0;
  192. }
  193. @@ -1503,9 +1411,6 @@ static int brcmf_pcie_download_fw_nvram(
  194. u32 address;
  195. u32 resetintr;
  196. - devinfo->ringbell = brcmf_pcie_ringbell_v2;
  197. - devinfo->generic_corerev = BRCMF_PCIE_GENREV2;
  198. -
  199. brcmf_dbg(PCIE, "Halt ARM.\n");
  200. err = brcmf_pcie_enter_download_state(devinfo);
  201. if (err)