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