1 --- a/drivers/net/wireless/ath/ath9k/init.c
2 +++ b/drivers/net/wireless/ath/ath9k/init.c
5 #include <linux/slab.h>
7 +#include "linux/ath9k_platform.h"
10 static char *dev_info = "ath9k";
11 @@ -553,6 +554,8 @@ static int ath9k_init_softc(u16 devid, s
12 pdata = (struct ath9k_platform_data *) sc->dev->platform_data;
14 ah->ah_flags |= AH_USE_EEPROM;
16 + sc->quirk_wndr3700 = pdata->quirk_wndr3700;
18 common = ath9k_hw_common(ah);
19 common->ops = &ath9k_common_ops;
20 @@ -675,6 +678,24 @@ void ath9k_set_hw_capab(struct ath_softc
21 SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
24 +#ifdef CONFIG_ATHEROS_AR71XX
25 +static void wndr3700_init_antenna(struct ath_hw *ah)
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);
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);
39 +static inline void wndr3700_init_antenna(struct ath_hw *ah) {}
40 +#endif /* CONFIG_ATHEROS_AR71XX */
42 int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
43 const struct ath_bus_ops *bus_ops)
45 @@ -693,6 +714,9 @@ int ath9k_init_device(u16 devid, struct
46 common = ath9k_hw_common(ah);
47 ath9k_set_hw_capab(sc, hw);
49 + if (sc->quirk_wndr3700)
50 + wndr3700_init_antenna(ah);
52 /* Initialize regulatory */
53 error = ath_regd_init(&common->regulatory, sc->hw->wiphy,
55 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
56 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
57 @@ -594,6 +594,8 @@ struct ath_softc {
61 + bool quirk_wndr3700;
63 #ifdef CONFIG_ATH9K_DEBUGFS
64 struct ath9k_debug debug;
66 --- a/include/linux/ath9k_platform.h
67 +++ b/include/linux/ath9k_platform.h
69 struct ath9k_platform_data {
70 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
73 + bool quirk_wndr3700;
76 #endif /* _LINUX_ATH9K_PLATFORM_H */