8c2a5e606cf63d91c66c54868e2e19e765b6ac65
[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 @@ -17,6 +17,7 @@
4 #include <linux/slab.h>
5 #include <linux/pm_qos_params.h>
6
7 +#include "linux/ath9k_platform.h"
8 #include "ath9k.h"
9
10 static char *dev_info = "ath9k";
11 @@ -522,6 +523,7 @@ static int ath9k_init_softc(u16 devid, s
12 {
13 struct ath_hw *ah = NULL;
14 struct ath_common *common;
15 + struct ath9k_platform_data *pdata;
16 int ret = 0, i;
17 int csz = 0;
18
19 @@ -533,8 +535,15 @@ static int ath9k_init_softc(u16 devid, s
20 ah->hw_version.subsysid = subsysid;
21 sc->sc_ah = ah;
22
23 - if (!sc->dev->platform_data)
24 + if (!sc->dev->platform_data) {
25 ah->ah_flags |= AH_USE_EEPROM;
26 + sc->sc_ah->led_pin = -1;
27 + } else {
28 + pdata = (struct ath9k_platform_data *) sc->dev->platform_data;
29 + sc->sc_ah->gpio_mask = pdata->gpio_mask;
30 + sc->sc_ah->gpio_val = pdata->gpio_val;
31 + sc->sc_ah->led_pin = pdata->led_pin;
32 + }
33
34 common = ath9k_hw_common(ah);
35 common->ops = &ath9k_common_ops;
36 --- a/drivers/net/wireless/ath/ath9k/hw.h
37 +++ b/drivers/net/wireless/ath/ath9k/hw.h
38 @@ -788,7 +788,7 @@ struct ath_hw {
39 u32 originalGain[22];
40 int initPDADC;
41 int PDADCdelta;
42 - u8 led_pin;
43 + int led_pin;
44 u32 gpio_mask;
45 u32 gpio_val;
46
47 --- a/drivers/net/wireless/ath/ath9k/gpio.c
48 +++ b/drivers/net/wireless/ath/ath9k/gpio.c
49 @@ -147,10 +147,12 @@ void ath_init_leds(struct ath_softc *sc)
50 if (AR_SREV_9100(sc->sc_ah))
51 return;
52
53 - if (AR_SREV_9287(sc->sc_ah))
54 - sc->sc_ah->led_pin = ATH_LED_PIN_9287;
55 - else
56 - sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
57 + if (sc->sc_ah->led_pin < 0) {
58 + if (AR_SREV_9287(sc->sc_ah))
59 + sc->sc_ah->led_pin = ATH_LED_PIN_9287;
60 + else
61 + sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
62 + }
63
64 /* Configure gpio 1 for output */
65 ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin,
66 --- a/include/linux/ath9k_platform.h
67 +++ b/include/linux/ath9k_platform.h
68 @@ -24,6 +24,10 @@
69 struct ath9k_platform_data {
70 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
71 u8 *macaddr;
72 +
73 + int led_pin;
74 + u32 gpio_mask;
75 + u32 gpio_val;
76 };
77
78 #endif /* _LINUX_ATH9K_PLATFORM_H */