560-ath9k_pcoem_optional.patch 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. --- a/drivers/net/wireless/ath/ath9k/Kconfig
  2. +++ b/drivers/net/wireless/ath/ath9k/Kconfig
  3. @@ -151,6 +151,11 @@ config ATH9K_CHANNEL_CONTEXT
  4. for multi-channel concurrency. Enable this if P2P PowerSave support
  5. is required.
  6. +config ATH9K_PCOEM
  7. + bool "Atheros ath9k support for PC OEM cards" if EXPERT
  8. + depends on ATH9K
  9. + default y
  10. +
  11. config ATH9K_HTC
  12. tristate "Atheros HTC based wireless cards support"
  13. depends on m
  14. --- a/drivers/net/wireless/ath/ath9k/Makefile
  15. +++ b/drivers/net/wireless/ath/ath9k/Makefile
  16. @@ -32,7 +32,6 @@ ath9k_hw-y:= \
  17. ar5008_phy.o \
  18. ar9002_calib.o \
  19. ar9003_calib.o \
  20. - ar9003_rtt.o \
  21. calib.o \
  22. eeprom.o \
  23. eeprom_def.o \
  24. @@ -50,6 +49,8 @@ ath9k_hw-$(CPTCFG_ATH9K_WOW) += ar9003_w
  25. ath9k_hw-$(CPTCFG_ATH9K_BTCOEX_SUPPORT) += btcoex.o \
  26. ar9003_mci.o
  27. +ath9k_hw-$(CPTCFG_ATH9K_PCOEM) += ar9003_rtt.o
  28. +
  29. ath9k_hw-$(CPTCFG_ATH9K_DYNACK) += dynack.o
  30. obj-$(CPTCFG_ATH9K_HW) += ath9k_hw.o
  31. --- a/drivers/net/wireless/ath/ath9k/ar9003_rtt.h
  32. +++ b/drivers/net/wireless/ath/ath9k/ar9003_rtt.h
  33. @@ -17,6 +17,7 @@
  34. #ifndef AR9003_RTT_H
  35. #define AR9003_RTT_H
  36. +#ifdef CPTCFG_ATH9K_PCOEM
  37. void ar9003_hw_rtt_enable(struct ath_hw *ah);
  38. void ar9003_hw_rtt_disable(struct ath_hw *ah);
  39. void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask);
  40. @@ -25,5 +26,40 @@ void ar9003_hw_rtt_load_hist(struct ath_
  41. void ar9003_hw_rtt_fill_hist(struct ath_hw *ah);
  42. void ar9003_hw_rtt_clear_hist(struct ath_hw *ah);
  43. bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan);
  44. +#else
  45. +static inline void ar9003_hw_rtt_enable(struct ath_hw *ah)
  46. +{
  47. +}
  48. +
  49. +static inline void ar9003_hw_rtt_disable(struct ath_hw *ah)
  50. +{
  51. +}
  52. +
  53. +static inline void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask)
  54. +{
  55. +}
  56. +
  57. +static inline bool ar9003_hw_rtt_force_restore(struct ath_hw *ah)
  58. +{
  59. + return false;
  60. +}
  61. +
  62. +static inline void ar9003_hw_rtt_load_hist(struct ath_hw *ah)
  63. +{
  64. +}
  65. +
  66. +static inline void ar9003_hw_rtt_fill_hist(struct ath_hw *ah)
  67. +{
  68. +}
  69. +
  70. +static inline void ar9003_hw_rtt_clear_hist(struct ath_hw *ah)
  71. +{
  72. +}
  73. +
  74. +static inline bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan)
  75. +{
  76. + return false;
  77. +}
  78. +#endif
  79. #endif
  80. --- a/drivers/net/wireless/ath/ath9k/hw.h
  81. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  82. @@ -245,13 +245,20 @@ enum ath9k_hw_caps {
  83. ATH9K_HW_CAP_2GHZ = BIT(11),
  84. ATH9K_HW_CAP_5GHZ = BIT(12),
  85. ATH9K_HW_CAP_APM = BIT(13),
  86. +#ifdef CPTCFG_ATH9K_PCOEM
  87. ATH9K_HW_CAP_RTT = BIT(14),
  88. ATH9K_HW_CAP_MCI = BIT(15),
  89. - ATH9K_HW_CAP_DFS = BIT(16),
  90. - ATH9K_HW_WOW_DEVICE_CAPABLE = BIT(17),
  91. - ATH9K_HW_CAP_PAPRD = BIT(18),
  92. - ATH9K_HW_CAP_FCC_BAND_SWITCH = BIT(19),
  93. - ATH9K_HW_CAP_BT_ANT_DIV = BIT(20),
  94. + ATH9K_HW_WOW_DEVICE_CAPABLE = BIT(16),
  95. + ATH9K_HW_CAP_BT_ANT_DIV = BIT(17),
  96. +#else
  97. + ATH9K_HW_CAP_RTT = 0,
  98. + ATH9K_HW_CAP_MCI = 0,
  99. + ATH9K_HW_WOW_DEVICE_CAPABLE = 0,
  100. + ATH9K_HW_CAP_BT_ANT_DIV = 0,
  101. +#endif
  102. + ATH9K_HW_CAP_DFS = BIT(18),
  103. + ATH9K_HW_CAP_PAPRD = BIT(19),
  104. + ATH9K_HW_CAP_FCC_BAND_SWITCH = BIT(20),
  105. };
  106. /*
  107. --- a/drivers/net/wireless/ath/ath9k/init.c
  108. +++ b/drivers/net/wireless/ath/ath9k/init.c
  109. @@ -362,6 +362,9 @@ static void ath9k_init_pcoem_platform(st
  110. struct ath9k_hw_capabilities *pCap = &ah->caps;
  111. struct ath_common *common = ath9k_hw_common(ah);
  112. + if (!IS_ENABLED(CPTCFG_ATH9K_PCOEM))
  113. + return;
  114. +
  115. if (common->bus_ops->ath_bus_type != ATH_PCI)
  116. return;
  117. --- a/drivers/net/wireless/ath/ath9k/pci.c
  118. +++ b/drivers/net/wireless/ath/ath9k/pci.c
  119. @@ -30,6 +30,7 @@ static const struct pci_device_id ath_pc
  120. { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI */
  121. { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */
  122. +#ifdef CPTCFG_ATH9K_PCOEM
  123. { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
  124. 0x002A,
  125. PCI_VENDOR_ID_AZWAVE,
  126. @@ -82,6 +83,7 @@ static const struct pci_device_id ath_pc
  127. PCI_VENDOR_ID_AZWAVE,
  128. 0x2C37),
  129. .driver_data = ATH9K_PCI_BT_ANT_DIV },
  130. +#endif
  131. { PCI_VDEVICE(ATHEROS, 0x002B) }, /* PCI-E */
  132. { PCI_VDEVICE(ATHEROS, 0x002C) }, /* PCI-E 802.11n bonded out */
  133. @@ -102,6 +104,7 @@ static const struct pci_device_id ath_pc
  134. { PCI_VDEVICE(ATHEROS, 0x0030) }, /* PCI-E AR9300 */
  135. +#ifdef CPTCFG_ATH9K_PCOEM
  136. /* PCI-E CUS198 */
  137. { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
  138. 0x0032,
  139. @@ -294,10 +297,12 @@ static const struct pci_device_id ath_pc
  140. PCI_VENDOR_ID_ASUSTEK,
  141. 0x850D),
  142. .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
  143. +#endif
  144. { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */
  145. { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */
  146. +#ifdef CPTCFG_ATH9K_PCOEM
  147. /* PCI-E CUS217 */
  148. { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
  149. 0x0034,
  150. @@ -657,6 +662,7 @@ static const struct pci_device_id ath_pc
  151. /* PCI-E AR9565 (WB335) */
  152. { PCI_VDEVICE(ATHEROS, 0x0036),
  153. .driver_data = ATH9K_PCI_BT_ANT_DIV },
  154. +#endif
  155. { PCI_VDEVICE(ATHEROS, 0xabcd) }, /* PCI-E internal chip default ID */
  156. { 0 }
  157. --- a/drivers/net/wireless/ath/ath9k/reg.h
  158. +++ b/drivers/net/wireless/ath/ath9k/reg.h
  159. @@ -892,10 +892,21 @@
  160. (AR_SREV_9330((_ah)) && \
  161. ((_ah)->hw_version.macRev == AR_SREV_REVISION_9330_12))
  162. +#ifdef CPTCFG_ATH9K_PCOEM
  163. +#define AR_SREV_9462(_ah) \
  164. + (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462))
  165. #define AR_SREV_9485(_ah) \
  166. (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485))
  167. +#define AR_SREV_9565(_ah) \
  168. + (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565))
  169. +#else
  170. +#define AR_SREV_9462(_ah) 0
  171. +#define AR_SREV_9485(_ah) 0
  172. +#define AR_SREV_9565(_ah) 0
  173. +#endif
  174. +
  175. #define AR_SREV_9485_11_OR_LATER(_ah) \
  176. - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485) && \
  177. + (AR_SREV_9485(_ah) && \
  178. ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9485_11))
  179. #define AR_SREV_9485_OR_LATER(_ah) \
  180. (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9485))
  181. @@ -911,34 +922,30 @@
  182. (AR_SREV_9285_12_OR_LATER(_ah) && \
  183. ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1))
  184. -#define AR_SREV_9462(_ah) \
  185. - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462))
  186. #define AR_SREV_9462_20(_ah) \
  187. - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
  188. + (AR_SREV_9462(_ah) && \
  189. ((_ah)->hw_version.macRev == AR_SREV_REVISION_9462_20))
  190. #define AR_SREV_9462_21(_ah) \
  191. - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
  192. + (AR_SREV_9462(_ah) && \
  193. ((_ah)->hw_version.macRev == AR_SREV_REVISION_9462_21))
  194. #define AR_SREV_9462_20_OR_LATER(_ah) \
  195. - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
  196. + (AR_SREV_9462(_ah) && \
  197. ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9462_20))
  198. #define AR_SREV_9462_21_OR_LATER(_ah) \
  199. - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
  200. + (AR_SREV_9462(_ah) && \
  201. ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9462_21))
  202. -#define AR_SREV_9565(_ah) \
  203. - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565))
  204. #define AR_SREV_9565_10(_ah) \
  205. - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
  206. + (AR_SREV_9565(_ah) && \
  207. ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_10))
  208. #define AR_SREV_9565_101(_ah) \
  209. - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
  210. + (AR_SREV_9565(_ah) && \
  211. ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_101))
  212. #define AR_SREV_9565_11(_ah) \
  213. - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
  214. + (AR_SREV_9565(_ah) && \
  215. ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_11))
  216. #define AR_SREV_9565_11_OR_LATER(_ah) \
  217. - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
  218. + (AR_SREV_9565(_ah) && \
  219. ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9565_11))
  220. #define AR_SREV_9550(_ah) \
  221. --- a/.local-symbols
  222. +++ b/.local-symbols
  223. @@ -124,6 +124,7 @@ ATH9K_HW=
  224. ATH9K_COMMON=
  225. ATH9K_DFS_DEBUGFS=
  226. ATH9K_BTCOEX_SUPPORT=
  227. +ATH9K_PCOEM=
  228. ATH9K=
  229. ATH9K_PCI=
  230. ATH9K_AHB=