41a8294aff27a42751ce1b039590126057741add
[openwrt/openwrt.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 @@ -8185,6 +8185,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 @@ -8271,7 +8292,10 @@ static int rt2800_probe_hw_mode(struct r
32 case RF5390:
33 case RF5392:
34 spec->num_channels = 14;
35 - spec->channels = rf_vals_3x;
36 + if (spec->clk_is_20mhz)
37 + spec->channels = rf_vals_xtal20mhz_3x;
38 + else
39 + spec->channels = rf_vals_3x;
40 break;
41
42 case RF3052:
43 @@ -8455,6 +8479,19 @@ static int rt2800_probe_rt(struct rt2x00
44 return 0;
45 }
46
47 +int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
48 +{
49 + struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
50 + struct hw_mode_spec *spec = &rt2x00dev->spec;
51 +
52 + if (!pdata)
53 + return -EINVAL;
54 +
55 + spec->clk_is_20mhz = pdata->clk_is_20mhz;
56 +
57 + return 0;
58 +}
59 +
60 int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
61 {
62 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
63 @@ -8497,6 +8534,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
64 rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
65
66 /*
67 + * Probe SoC clock.
68 + */
69 + if (rt2x00_is_soc(rt2x00dev)) {
70 + retval = rt2800_probe_clk(rt2x00dev);
71 + if (retval)
72 + return retval;
73 + }
74 +
75 + /*
76 * Initialize hw specifications.
77 */
78 retval = rt2800_probe_hw_mode(rt2x00dev);
79 --- a/drivers/net/wireless/rt2x00/rt2x00.h
80 +++ b/drivers/net/wireless/rt2x00/rt2x00.h
81 @@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
82 * @channels: Device/chipset specific channel values (See &struct rf_channel).
83 * @channels_info: Additional information for channels (See &struct channel_info).
84 * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
85 + * @clk_is_20mhz: External crystal of WiSoC is 20MHz instead of 40MHz
86 */
87 struct hw_mode_spec {
88 unsigned int supported_bands;
89 @@ -416,6 +417,7 @@ struct hw_mode_spec {
90 const struct channel_info *channels_info;
91
92 struct ieee80211_sta_ht_cap ht;
93 + int clk_is_20mhz;
94 };
95
96 /*
97 --- a/include/linux/rt2x00_platform.h
98 +++ b/include/linux/rt2x00_platform.h
99 @@ -18,6 +18,7 @@ struct rt2x00_platform_data {
100
101 int disable_2ghz;
102 int disable_5ghz;
103 + int clk_is_20mhz;
104 };
105
106 #endif /* _RT2X00_PLATFORM_H */