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