[mac80211] several patches to make OF work on rt2x00
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 615-rt2x00-fix_20mhz_clk.patch
1 Index: compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2800lib.c
2 ===================================================================
3 --- compat-wireless-2013-02-22.orig/drivers/net/wireless/rt2x00/rt2800lib.c 2013-04-02 10:56:56.245205151 +0200
4 +++ compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2800lib.c 2013-04-02 11:24:06.057243987 +0200
5 @@ -38,6 +38,7 @@
6 #include <linux/kernel.h>
7 #include <linux/module.h>
8 #include <linux/slab.h>
9 +#include <linux/clk.h>
10
11 #include "rt2x00.h"
12 #include "rt2800lib.h"
13 @@ -5505,13 +5506,14 @@
14
15 int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
16 {
17 - struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
18 struct hw_mode_spec *spec = &rt2x00dev->spec;
19 + struct clk *clk = clk_get(rt2x00dev->dev, NULL);
20
21 - if (!pdata)
22 - return -EINVAL;
23 + if (IS_ERR(clk))
24 + return PTR_ERR(clk);
25
26 - spec->clk_is_20mhz = pdata->clk_is_20mhz;
27 + if (clk_get_rate(clk) == 20000000)
28 + spec->clk_is_20mhz = 1;
29
30 return 0;
31 }