83a8aae83b34a762c9e3350ed33eb14bd50ac749
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 607-rt2x00-allow_disabling_bands_through_platform_data.patch
1 --- a/include/linux/rt2x00_platform.h
2 +++ b/include/linux/rt2x00_platform.h
3 @@ -14,6 +14,9 @@
4
5 struct rt2x00_platform_data {
6 char *eeprom_file_name;
7 +
8 + int disable_2ghz;
9 + int disable_5ghz;
10 };
11
12 #endif /* _RT2X00_PLATFORM_H */
13 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
14 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
15 @@ -842,6 +842,22 @@ static int rt2x00lib_probe_hw_modes(stru
16 unsigned int num_rates;
17 unsigned int i;
18
19 + if (rt2x00dev->dev->platform_data) {
20 + struct rt2x00_platform_data *pdata;
21 +
22 + pdata = rt2x00dev->dev->platform_data;
23 + if (pdata->disable_2ghz)
24 + spec->supported_bands &= ~SUPPORT_BAND_2GHZ;
25 + if (pdata->disable_5ghz)
26 + spec->supported_bands &= ~SUPPORT_BAND_5GHZ;
27 + }
28 +
29 + if ((spec->supported_bands & SUPPORT_BAND_BOTH) == 0) {
30 + ERROR(rt2x00dev, "No supported bands\n");
31 + return -EINVAL;
32 + }
33 +
34 +
35 num_rates = 0;
36 if (spec->supported_rates & SUPPORT_RATE_CCK)
37 num_rates += 4;
38 --- a/drivers/net/wireless/rt2x00/rt2x00.h
39 +++ b/drivers/net/wireless/rt2x00/rt2x00.h
40 @@ -426,6 +426,7 @@ struct hw_mode_spec {
41 unsigned int supported_bands;
42 #define SUPPORT_BAND_2GHZ 0x00000001
43 #define SUPPORT_BAND_5GHZ 0x00000002
44 +#define SUPPORT_BAND_BOTH (SUPPORT_BAND_2GHZ | SUPPORT_BAND_5GHZ)
45
46 unsigned int supported_rates;
47 #define SUPPORT_RATE_CCK 0x00000001