1 --- a/drivers/net/wireless/ath/ath9k/Kconfig
2 +++ b/drivers/net/wireless/ath/ath9k/Kconfig
3 @@ -133,6 +133,11 @@ config ATH9K_RFKILL
4 seconds. Turn off to save power, but enable it if you have
5 a platform that can toggle the RF-Kill GPIO.
8 + bool "Atheros ath9k support for PC OEM cards" if EXPERT
13 tristate "Atheros HTC based wireless cards support"
15 --- a/drivers/net/wireless/ath/ath9k/Makefile
16 +++ b/drivers/net/wireless/ath/ath9k/Makefile
17 @@ -31,7 +31,6 @@ ath9k_hw-y:= \
25 @@ -48,6 +47,8 @@ ath9k_hw-$(CPTCFG_ATH9K_WOW) += ar9003_w
27 ath9k_hw-$(CPTCFG_ATH9K_BTCOEX_SUPPORT) += btcoex.o \
29 +ath9k-hw-$(CPTCFG_ATH9K_PCOEM) += ar9003_rtt.o
31 obj-$(CPTCFG_ATH9K_HW) += ath9k_hw.o
33 obj-$(CPTCFG_ATH9K_COMMON) += ath9k_common.o
34 --- a/drivers/net/wireless/ath/ath9k/ar9003_rtt.h
35 +++ b/drivers/net/wireless/ath/ath9k/ar9003_rtt.h
40 +#ifdef CPTCFG_ATH9K_PCOEM
41 void ar9003_hw_rtt_enable(struct ath_hw *ah);
42 void ar9003_hw_rtt_disable(struct ath_hw *ah);
43 void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask);
44 @@ -25,5 +26,40 @@ void ar9003_hw_rtt_load_hist(struct ath_
45 void ar9003_hw_rtt_fill_hist(struct ath_hw *ah);
46 void ar9003_hw_rtt_clear_hist(struct ath_hw *ah);
47 bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan);
49 +static inline void ar9003_hw_rtt_enable(struct ath_hw *ah)
53 +static inline void ar9003_hw_rtt_disable(struct ath_hw *ah)
57 +static inline void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask)
61 +static inline bool ar9003_hw_rtt_force_restore(struct ath_hw *ah)
66 +static inline void ar9003_hw_rtt_load_hist(struct ath_hw *ah)
70 +static inline void ar9003_hw_rtt_fill_hist(struct ath_hw *ah)
74 +static inline void ar9003_hw_rtt_clear_hist(struct ath_hw *ah)
78 +static inline bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan)
85 --- a/drivers/net/wireless/ath/ath9k/hw.h
86 +++ b/drivers/net/wireless/ath/ath9k/hw.h
87 @@ -244,13 +244,20 @@ enum ath9k_hw_caps {
88 ATH9K_HW_CAP_2GHZ = BIT(11),
89 ATH9K_HW_CAP_5GHZ = BIT(12),
90 ATH9K_HW_CAP_APM = BIT(13),
91 +#ifdef CPTCFG_ATH9K_PCOEM
92 ATH9K_HW_CAP_RTT = BIT(14),
93 ATH9K_HW_CAP_MCI = BIT(15),
94 - ATH9K_HW_CAP_DFS = BIT(16),
95 - ATH9K_HW_WOW_DEVICE_CAPABLE = BIT(17),
96 - ATH9K_HW_CAP_PAPRD = BIT(18),
97 - ATH9K_HW_CAP_FCC_BAND_SWITCH = BIT(19),
98 - ATH9K_HW_CAP_BT_ANT_DIV = BIT(20),
99 + ATH9K_HW_WOW_DEVICE_CAPABLE = BIT(16),
100 + ATH9K_HW_CAP_BT_ANT_DIV = BIT(17),
102 + ATH9K_HW_CAP_RTT = 0,
103 + ATH9K_HW_CAP_MCI = 0,
104 + ATH9K_HW_WOW_DEVICE_CAPABLE = 0,
105 + ATH9K_HW_CAP_BT_ANT_DIV = 0,
107 + ATH9K_HW_CAP_DFS = BIT(18),
108 + ATH9K_HW_CAP_PAPRD = BIT(19),
109 + ATH9K_HW_CAP_FCC_BAND_SWITCH = BIT(20),
113 --- a/drivers/net/wireless/ath/ath9k/init.c
114 +++ b/drivers/net/wireless/ath/ath9k/init.c
115 @@ -355,6 +355,9 @@ static void ath9k_init_pcoem_platform(st
116 struct ath9k_hw_capabilities *pCap = &ah->caps;
117 struct ath_common *common = ath9k_hw_common(ah);
119 + if (!IS_ENABLED(CPTCFG_ATH9K_PCOEM))
122 if (common->bus_ops->ath_bus_type != ATH_PCI)
125 --- a/drivers/net/wireless/ath/ath9k/pci.c
126 +++ b/drivers/net/wireless/ath/ath9k/pci.c
127 @@ -30,6 +30,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
128 { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI */
129 { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */
131 +#ifdef CPTCFG_ATH9K_PCOEM
132 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
134 PCI_VENDOR_ID_AZWAVE,
135 @@ -82,6 +83,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
136 PCI_VENDOR_ID_AZWAVE,
138 .driver_data = ATH9K_PCI_BT_ANT_DIV },
141 { PCI_VDEVICE(ATHEROS, 0x002B) }, /* PCI-E */
142 { PCI_VDEVICE(ATHEROS, 0x002C) }, /* PCI-E 802.11n bonded out */
143 @@ -102,6 +104,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
145 { PCI_VDEVICE(ATHEROS, 0x0030) }, /* PCI-E AR9300 */
147 +#ifdef CPTCFG_ATH9K_PCOEM
149 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
151 @@ -294,10 +297,12 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
152 PCI_VENDOR_ID_ASUSTEK,
154 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
157 { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */
158 { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */
160 +#ifdef CPTCFG_ATH9K_PCOEM
162 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
164 @@ -657,6 +662,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
165 /* PCI-E AR9565 (WB335) */
166 { PCI_VDEVICE(ATHEROS, 0x0036),
167 .driver_data = ATH9K_PCI_BT_ANT_DIV },
170 { PCI_VDEVICE(ATHEROS, 0xabcd) }, /* PCI-E internal chip default ID */
172 --- a/drivers/net/wireless/ath/ath9k/reg.h
173 +++ b/drivers/net/wireless/ath/ath9k/reg.h
174 @@ -891,10 +891,21 @@
175 (AR_SREV_9330((_ah)) && \
176 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9330_12))
178 +#ifdef CPTCFG_ATH9K_PCOEM
179 +#define AR_SREV_9462(_ah) \
180 + (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462))
181 #define AR_SREV_9485(_ah) \
182 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485))
183 +#define AR_SREV_9565(_ah) \
184 + (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565))
186 +#define AR_SREV_9462(_ah) 0
187 +#define AR_SREV_9485(_ah) 0
188 +#define AR_SREV_9565(_ah) 0
191 #define AR_SREV_9485_11_OR_LATER(_ah) \
192 - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485) && \
193 + (AR_SREV_9485(_ah) && \
194 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9485_11))
195 #define AR_SREV_9485_OR_LATER(_ah) \
196 (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9485))
197 @@ -910,34 +921,30 @@
198 (AR_SREV_9285_12_OR_LATER(_ah) && \
199 ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1))
201 -#define AR_SREV_9462(_ah) \
202 - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462))
203 #define AR_SREV_9462_20(_ah) \
204 - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
205 + (AR_SREV_9462(_ah) && \
206 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9462_20))
207 #define AR_SREV_9462_21(_ah) \
208 - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
209 + (AR_SREV_9462(_ah) && \
210 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9462_21))
211 #define AR_SREV_9462_20_OR_LATER(_ah) \
212 - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
213 + (AR_SREV_9462(_ah) && \
214 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9462_20))
215 #define AR_SREV_9462_21_OR_LATER(_ah) \
216 - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
217 + (AR_SREV_9462(_ah) && \
218 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9462_21))
220 -#define AR_SREV_9565(_ah) \
221 - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565))
222 #define AR_SREV_9565_10(_ah) \
223 - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
224 + (AR_SREV_9565(_ah) && \
225 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_10))
226 #define AR_SREV_9565_101(_ah) \
227 - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
228 + (AR_SREV_9565(_ah) && \
229 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_101))
230 #define AR_SREV_9565_11(_ah) \
231 - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
232 + (AR_SREV_9565(_ah) && \
233 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_11))
234 #define AR_SREV_9565_11_OR_LATER(_ah) \
235 - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
236 + (AR_SREV_9565(_ah) && \
237 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9565_11))
239 #define AR_SREV_9550(_ah) \
242 @@ -129,6 +129,7 @@ ATH9K_HW=
245 ATH9K_BTCOEX_SUPPORT=