23a5887a1d99b2a6f437e3f5950985d3ea57c69f
[openwrt-10.03/.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 @@ -538,8 +538,14 @@ static int ath9k_init_softc(u16 devid, s
4         ah->hw_version.subsysid = subsysid;
5         sc->sc_ah = ah;
6  
7 -       if (!pdata)
8 +       if (!pdata) {
9                 ah->ah_flags |= AH_USE_EEPROM;
10 +               sc->sc_ah->led_pin = -1;
11 +       } else {
12 +               sc->sc_ah->gpio_mask = pdata->gpio_mask;
13 +               sc->sc_ah->gpio_val = pdata->gpio_val;
14 +               sc->sc_ah->led_pin = pdata->led_pin;
15 +       }
16  
17         common = ath9k_hw_common(ah);
18         common->ops = &ath9k_common_ops;
19 --- a/drivers/net/wireless/ath/ath9k/hw.h
20 +++ b/drivers/net/wireless/ath/ath9k/hw.h
21 @@ -794,7 +794,7 @@ struct ath_hw {
22         u32 originalGain[22];
23         int initPDADC;
24         int PDADCdelta;
25 -       u8 led_pin;
26 +       int led_pin;
27         u32 gpio_mask;
28         u32 gpio_val;
29  
30 --- a/drivers/net/wireless/ath/ath9k/gpio.c
31 +++ b/drivers/net/wireless/ath/ath9k/gpio.c
32 @@ -139,10 +139,12 @@ void ath_init_leds(struct ath_softc *sc)
33         if (AR_SREV_9100(sc->sc_ah))
34                 return;
35  
36 -       if (AR_SREV_9287(sc->sc_ah))
37 -               sc->sc_ah->led_pin = ATH_LED_PIN_9287;
38 -       else
39 -               sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
40 +       if (sc->sc_ah->led_pin < 0) {
41 +               if (AR_SREV_9287(sc->sc_ah))
42 +                       sc->sc_ah->led_pin = ATH_LED_PIN_9287;
43 +               else
44 +                       sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
45 +       }
46  
47         /* Configure gpio 1 for output */
48         ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin,
49 --- a/include/linux/ath9k_platform.h
50 +++ b/include/linux/ath9k_platform.h
51 @@ -24,6 +24,10 @@
52  struct ath9k_platform_data {
53         u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
54         u8 *macaddr;
55 +
56 +       int led_pin;
57 +       u32 gpio_mask;
58 +       u32 gpio_val;
59  };
60  
61  #endif /* _LINUX_ATH9K_PLATFORM_H */