AA: mac80211: merge ath9k fixes from bb
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 543-ath9k-allow-to-disable-bands-via-platform-data.patch
1 --- a/include/linux/ath9k_platform.h
2 +++ b/include/linux/ath9k_platform.h
3 @@ -34,6 +34,8 @@ struct ath9k_platform_data {
4 bool endian_check;
5 bool is_clk_25mhz;
6 bool tx_gain_buffalo;
7 + bool disable_2ghz;
8 + bool disable_5ghz;
9
10 int (*get_mac_revision)(void);
11 int (*external_reset)(void);
12 --- a/drivers/net/wireless/ath/ath9k/hw.c
13 +++ b/drivers/net/wireless/ath/ath9k/hw.c
14 @@ -2331,17 +2331,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw
15 }
16
17 eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
18 - if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) {
19 - ath_err(common,
20 - "no band has been marked as supported in EEPROM\n");
21 - return -EINVAL;
22 +
23 + if (eeval & AR5416_OPFLAGS_11A) {
24 + if (ah->disable_5ghz)
25 + ath_warn(common, "disabling 5GHz band\n");
26 + else
27 + pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
28 }
29
30 - if (eeval & AR5416_OPFLAGS_11A)
31 - pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
32 + if (eeval & AR5416_OPFLAGS_11G) {
33 + if (ah->disable_2ghz)
34 + ath_warn(common, "disabling 2GHz band\n");
35 + else
36 + pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
37 + }
38
39 - if (eeval & AR5416_OPFLAGS_11G)
40 - pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
41 + if ((pCap->hw_caps & (ATH9K_HW_CAP_2GHZ | ATH9K_HW_CAP_5GHZ)) == 0) {
42 + ath_err(common, "both bands are disabled\n");
43 + return -EINVAL;
44 + }
45
46 if (AR_SREV_9485(ah) ||
47 AR_SREV_9285(ah) ||
48 --- a/drivers/net/wireless/ath/ath9k/hw.h
49 +++ b/drivers/net/wireless/ath/ath9k/hw.h
50 @@ -932,6 +932,8 @@ struct ath_hw {
51 bool is_clk_25mhz;
52 int (*get_mac_revision)(void);
53 int (*external_reset)(void);
54 + bool disable_2ghz;
55 + bool disable_5ghz;
56
57 const struct firmware *eeprom_blob;
58 };
59 --- a/drivers/net/wireless/ath/ath9k/init.c
60 +++ b/drivers/net/wireless/ath/ath9k/init.c
61 @@ -518,6 +518,8 @@ static int ath9k_init_softc(u16 devid, s
62 ah->is_clk_25mhz = pdata->is_clk_25mhz;
63 ah->get_mac_revision = pdata->get_mac_revision;
64 ah->external_reset = pdata->external_reset;
65 + ah->disable_2ghz = pdata->disable_2ghz;
66 + ah->disable_5ghz = pdata->disable_5ghz;
67 if (!pdata->endian_check)
68 ah->ah_flags |= AH_NO_EEP_SWAP;
69 }