[include] rename PATCH to KPATCH
[openwrt.git] / package / mac80211 / patches / 409-ath9k-add-wndr3700-antenna-initialization.patch
1 --- a/drivers/net/wireless/ath/ath9k/init.c
2 +++ b/drivers/net/wireless/ath/ath9k/init.c
3 @@ -16,6 +16,7 @@
4
5 #include <linux/slab.h>
6
7 +#include "linux/ath9k_platform.h"
8 #include "ath9k.h"
9
10 static char *dev_info = "ath9k";
11 @@ -555,6 +556,8 @@ static int ath9k_init_softc(u16 devid, s
12 pdata = (struct ath9k_platform_data *) sc->dev->platform_data;
13 if (!pdata)
14 ah->ah_flags |= AH_USE_EEPROM;
15 + else
16 + sc->quirk_wndr3700 = pdata->quirk_wndr3700;
17
18 common = ath9k_hw_common(ah);
19 common->ops = &ath9k_common_ops;
20 @@ -680,6 +683,24 @@ void ath9k_set_hw_capab(struct ath_softc
21 SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
22 }
23
24 +#ifdef CONFIG_ATHEROS_AR71XX
25 +static void wndr3700_init_antenna(struct ath_hw *ah)
26 +{
27 + ath9k_hw_cfg_output(ah, 6, AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
28 + ath9k_hw_cfg_output(ah, 7, AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
29 + ath9k_hw_cfg_output(ah, 8, AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
30 + ath9k_hw_cfg_output(ah, 9, AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
31 +
32 + /* select the first antenna group */
33 + ath9k_hw_set_gpio(ah, 6, 0);
34 + ath9k_hw_set_gpio(ah, 7, 1);
35 + ath9k_hw_set_gpio(ah, 8, 0);
36 + ath9k_hw_set_gpio(ah, 9, 1);
37 +}
38 +#else
39 +static inline void wndr3700_init_antenna(struct ath_hw *ah) {}
40 +#endif /* CONFIG_ATHEROS_AR71XX */
41 +
42 int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
43 const struct ath_bus_ops *bus_ops)
44 {
45 @@ -698,6 +719,9 @@ int ath9k_init_device(u16 devid, struct
46 common = ath9k_hw_common(ah);
47 ath9k_set_hw_capab(sc, hw);
48
49 + if (sc->quirk_wndr3700)
50 + wndr3700_init_antenna(ah);
51 +
52 /* Initialize regulatory */
53 error = ath_regd_init(&common->regulatory, sc->hw->wiphy,
54 ath9k_reg_notifier);
55 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
56 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
57 @@ -641,6 +641,8 @@ struct ath_softc {
58
59 int beacon_interval;
60
61 + bool quirk_wndr3700;
62 +
63 #ifdef CONFIG_ATH9K_DEBUGFS
64 struct ath9k_debug debug;
65 #endif
66 --- a/include/linux/ath9k_platform.h
67 +++ b/include/linux/ath9k_platform.h
68 @@ -24,6 +24,8 @@
69 struct ath9k_platform_data {
70 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
71 u8 *macaddr;
72 +
73 + bool quirk_wndr3700;
74 };
75
76 #endif /* _LINUX_ATH9K_PLATFORM_H */
This page took 0.047621 seconds and 5 git commands to generate.