308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From: Miaoqing Pan <miaoqing@codeaurora.org>
  2. Date: Fri, 15 Jan 2016 18:17:21 +0800
  3. Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580
  4. One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
  5. the data bus error, due to RTC_RC reg write not happen properly.
  6. Warm Reset trigger in continuous beacon stuck for one of the customer for
  7. other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
  8. DMA did not complete when RTC was put in reset.
  9. So, before resetting the MAC need to make sure there are no pending DMA
  10. transactions because this reset does not reset all parts of the chip.
  11. The 12th and 11th bit of MAC _DMA_CFG register used to do that.
  12. 12 cfg_halt_ack 0x0
  13. 0 DMA has not yet halted
  14. 1 DMA has halted
  15. 11 cfg_halt_req 0x0
  16. 0 DMA logic operates normally
  17. 1 Request DMA logic to stop so software can reset the MAC
  18. The Bit [12] of this register indicates when the halt has taken effect or
  19. not. the DMA halt IS NOT recoverable; once software sets bit [11] to
  20. request a DMA halt, software must wait for bit [12] to be set and reset
  21. the MAC.
  22. So, the same thing we implemented for ar9580 chip.
  23. Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  24. ---
  25. --- a/drivers/net/wireless/ath/ath9k/hw.c
  26. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  27. @@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at
  28. if (ath9k_hw_mci_is_enabled(ah))
  29. ar9003_mci_check_gpm_offset(ah);
  30. + /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  31. + * RTC_RC reg read
  32. + */
  33. + if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  34. + REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  35. + ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  36. + 20 * AH_WAIT_TIMEOUT);
  37. + REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  38. + }
  39. +
  40. REG_WRITE(ah, AR_RTC_RC, rst_flags);
  41. REGWRITE_BUFFER_FLUSH(ah);
  42. --- a/drivers/net/wireless/ath/ath9k/reg.h
  43. +++ b/drivers/net/wireless/ath/ath9k/reg.h
  44. @@ -34,8 +34,10 @@
  45. #define AR_CFG_SWRG 0x00000010
  46. #define AR_CFG_AP_ADHOC_INDICATION 0x00000020
  47. #define AR_CFG_PHOK 0x00000100
  48. -#define AR_CFG_CLK_GATE_DIS 0x00000400
  49. #define AR_CFG_EEBS 0x00000200
  50. +#define AR_CFG_CLK_GATE_DIS 0x00000400
  51. +#define AR_CFG_HALT_REQ 0x00000800
  52. +#define AR_CFG_HALT_ACK 0x00001000
  53. #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000
  54. #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17