mac80211: update to wireless-testing 2013-06-27, fix ATH_USER_REGD handling
[openwrt/svn-archive/archive.git] / package / kernel / mac80211 / patches / 611-rt2x00-rf_vals-rt3352-xtal20.patch
1 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
2 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
3 @@ -6156,6 +6156,27 @@ static const struct rf_channel rf_vals_5
4 {196, 83, 0, 12, 1},
5 };
6
7 +/*
8 + * RF value list for rt3xxx with Xtal20MHz
9 + * Supports: 2.4 GHz (all) (RF3322)
10 + */
11 +static const struct rf_channel rf_vals_xtal20mhz_3x[] = {
12 + {1, 0xE2, 2, 0x14},
13 + {2, 0xE3, 2, 0x14},
14 + {3, 0xE4, 2, 0x14},
15 + {4, 0xE5, 2, 0x14},
16 + {5, 0xE6, 2, 0x14},
17 + {6, 0xE7, 2, 0x14},
18 + {7, 0xE8, 2, 0x14},
19 + {8, 0xE9, 2, 0x14},
20 + {9, 0xEA, 2, 0x14},
21 + {10, 0xEB, 2, 0x14},
22 + {11, 0xEC, 2, 0x14},
23 + {12, 0xED, 2, 0x14},
24 + {13, 0xEE, 2, 0x14},
25 + {14, 0xF0, 2, 0x18},
26 +};
27 +
28 static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
29 {
30 struct hw_mode_spec *spec = &rt2x00dev->spec;
31 @@ -6234,7 +6255,6 @@ static int rt2800_probe_hw_mode(struct r
32 rt2x00_rf(rt2x00dev, RF3022) ||
33 rt2x00_rf(rt2x00dev, RF3290) ||
34 rt2x00_rf(rt2x00dev, RF3320) ||
35 - rt2x00_rf(rt2x00dev, RF3322) ||
36 rt2x00_rf(rt2x00dev, RF5360) ||
37 rt2x00_rf(rt2x00dev, RF5370) ||
38 rt2x00_rf(rt2x00dev, RF5372) ||
39 @@ -6242,6 +6262,12 @@ static int rt2800_probe_hw_mode(struct r
40 rt2x00_rf(rt2x00dev, RF5392)) {
41 spec->num_channels = 14;
42 spec->channels = rf_vals_3x;
43 + } else if (rt2x00_rf(rt2x00dev, RF3322)) {
44 + spec->num_channels = 14;
45 + if (spec->clk_is_20mhz)
46 + spec->channels = rf_vals_xtal20mhz_3x;
47 + else
48 + spec->channels = rf_vals_3x;
49 } else if (rt2x00_rf(rt2x00dev, RF3052)) {
50 spec->supported_bands |= SUPPORT_BAND_5GHZ;
51 spec->num_channels = ARRAY_SIZE(rf_vals_3x);
52 @@ -6389,6 +6415,19 @@ static int rt2800_probe_rt(struct rt2x00
53 return 0;
54 }
55
56 +int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
57 +{
58 + struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
59 + struct hw_mode_spec *spec = &rt2x00dev->spec;
60 +
61 + if (!pdata)
62 + return -EINVAL;
63 +
64 + spec->clk_is_20mhz = pdata->clk_is_20mhz;
65 +
66 + return 0;
67 +}
68 +
69 int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
70 {
71 int retval;
72 @@ -6418,6 +6457,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
73 rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
74
75 /*
76 + * Probe SoC clock.
77 + */
78 + if (rt2x00_is_soc(rt2x00dev)) {
79 + retval = rt2800_probe_clk(rt2x00dev);
80 + if (retval)
81 + return retval;
82 + }
83 +
84 + /*
85 * Initialize hw specifications.
86 */
87 retval = rt2800_probe_hw_mode(rt2x00dev);
88 --- a/drivers/net/wireless/rt2x00/rt2x00.h
89 +++ b/drivers/net/wireless/rt2x00/rt2x00.h
90 @@ -409,6 +409,7 @@ static inline struct rt2x00_intf* vif_to
91 * @channels: Device/chipset specific channel values (See &struct rf_channel).
92 * @channels_info: Additional information for channels (See &struct channel_info).
93 * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
94 + * @clk_is_20mhz: External crystal of WiSoC is 20MHz instead of 40MHz
95 */
96 struct hw_mode_spec {
97 unsigned int supported_bands;
98 @@ -425,6 +426,7 @@ struct hw_mode_spec {
99 const struct channel_info *channels_info;
100
101 struct ieee80211_sta_ht_cap ht;
102 + int clk_is_20mhz;
103 };
104
105 /*
106 --- a/include/linux/rt2x00_platform.h
107 +++ b/include/linux/rt2x00_platform.h
108 @@ -18,6 +18,7 @@ struct rt2x00_platform_data {
109
110 int disable_2ghz;
111 int disable_5ghz;
112 + int clk_is_20mhz;
113 };
114
115 #endif /* _RT2X00_PLATFORM_H */