mac80211: add initial support for AR9330
[openwrt/openwrt.git] / package / mac80211 / patches / 542-ath9k-add-MAC-revision-detection-for-AR9330.patch
1 diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
2 index 05c2ba2..ade8655 100644
3 --- a/drivers/net/wireless/ath/ath9k/hw.c
4 +++ b/drivers/net/wireless/ath/ath9k/hw.c
5 @@ -251,6 +251,15 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah)
6 case AR5416_AR9100_DEVID:
7 ah->hw_version.macVersion = AR_SREV_VERSION_9100;
8 break;
9 + case AR9300_DEVID_AR9330:
10 + ah->hw_version.macVersion = AR_SREV_VERSION_9330;
11 + if (ah->get_mac_revision) {
12 + ah->hw_version.macRev = ah->get_mac_revision();
13 + } else {
14 + val = REG_READ(ah, AR_SREV);
15 + ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
16 + }
17 + return;
18 case AR9300_DEVID_AR9340:
19 ah->hw_version.macVersion = AR_SREV_VERSION_9340;
20 val = REG_READ(ah, AR_SREV);
21 diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
22 index 9f23451..8d9ac49 100644
23 --- a/drivers/net/wireless/ath/ath9k/hw.h
24 +++ b/drivers/net/wireless/ath/ath9k/hw.h
25 @@ -863,6 +863,7 @@ struct ath_hw {
26 u32 ent_mode;
27
28 bool is_clk_25mhz;
29 + int (*get_mac_revision)(void);
30 };
31
32 struct ath_bus_ops {
33 diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
34 index 45c585a..c2defa2 100644
35 --- a/drivers/net/wireless/ath/ath9k/init.c
36 +++ b/drivers/net/wireless/ath/ath9k/init.c
37 @@ -575,6 +575,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
38 sc->sc_ah->gpio_val = pdata->gpio_val;
39 sc->sc_ah->led_pin = pdata->led_pin;
40 ah->is_clk_25mhz = pdata->is_clk_25mhz;
41 + ah->get_mac_revision = pdata->get_mac_revision;
42 }
43
44 common = ath9k_hw_common(ah);
45 diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
46 index 60a7c49..c207607 100644
47 --- a/include/linux/ath9k_platform.h
48 +++ b/include/linux/ath9k_platform.h
49 @@ -30,6 +30,7 @@ struct ath9k_platform_data {
50 u32 gpio_val;
51
52 bool is_clk_25mhz;
53 + int (*get_mac_revision)(void);
54 };
55
56 #endif /* _LINUX_ATH9K_PLATFORM_H */
57