ar71xx: improve the wndr3700 quirks - move most of the code out of ath9k and instead...
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 409-ath9k_platform_settings.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 @@ -572,8 +573,14 @@ static int ath9k_init_softc(u16 devid, s
12 sc->sc_ah = ah;
13
14 pdata = (struct ath9k_platform_data *) sc->dev->platform_data;
15 - if (!pdata)
16 + if (!pdata) {
17 ah->ah_flags |= AH_USE_EEPROM;
18 + sc->sc_ah->led_pin = -1;
19 + } else {
20 + sc->sc_ah->gpio_mask = pdata->gpio_mask;
21 + sc->sc_ah->gpio_val = pdata->gpio_val;
22 + sc->sc_ah->led_pin = pdata->led_pin;
23 + }
24
25 common = ath9k_hw_common(ah);
26 common->ops = &ath9k_common_ops;
27 --- a/drivers/net/wireless/ath/ath9k/hw.h
28 +++ b/drivers/net/wireless/ath/ath9k/hw.h
29 @@ -742,7 +742,7 @@ struct ath_hw {
30 u32 originalGain[22];
31 int initPDADC;
32 int PDADCdelta;
33 - u8 led_pin;
34 + int led_pin;
35 u32 gpio_mask;
36 u32 gpio_val;
37
38 --- a/drivers/net/wireless/ath/ath9k/gpio.c
39 +++ b/drivers/net/wireless/ath/ath9k/gpio.c
40 @@ -147,10 +147,12 @@ void ath_init_leds(struct ath_softc *sc)
41 if (AR_SREV_9100(sc->sc_ah))
42 return;
43
44 - if (AR_SREV_9287(sc->sc_ah))
45 - sc->sc_ah->led_pin = ATH_LED_PIN_9287;
46 - else
47 - sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
48 + if (sc->sc_ah->led_pin < 0) {
49 + if (AR_SREV_9287(sc->sc_ah))
50 + sc->sc_ah->led_pin = ATH_LED_PIN_9287;
51 + else
52 + sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
53 + }
54
55 /* Configure gpio 1 for output */
56 ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin,
57 --- a/include/linux/ath9k_platform.h
58 +++ b/include/linux/ath9k_platform.h
59 @@ -24,6 +24,10 @@
60 struct ath9k_platform_data {
61 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
62 u8 *macaddr;
63 +
64 + int led_pin;
65 + u32 gpio_mask;
66 + u32 gpio_val;
67 };
68
69 #endif /* _LINUX_ATH9K_PLATFORM_H */