AA: mac80211: backport package from trunk r39886
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 905-wlcore-sdio-add-wilink-clock-providers.patch
1 Add refclock and tcxoclock as clock providers in WiLink. These clocks
2 are not accesible outside the WiLink module, but they are registered
3 in the clock framework anyway. Only the WiLink chip consumes these
4 clocks.
5
6 In theory, the WiLink chip could be connected to external clocks
7 instead of using these internal clocks, so make the clock consumer
8 code generic enough. If external clocks are used, then the internal
9 clock device tree nodes are not necessary, but the external ones must
10 be specified.
11
12 Signed-off-by: Luciano Coelho <coelho@ti.com>
13 Reviewed-by: Felipe Balbi <balbi@ti.com>
14
15 --- a/drivers/net/wireless/ti/wlcore/sdio.c
16 +++ b/drivers/net/wireless/ti/wlcore/sdio.c
17 @@ -34,6 +34,7 @@
18 #include <linux/wl12xx.h>
19 #include <linux/pm_runtime.h>
20 #include <linux/printk.h>
21 +#include <linux/clk-provider.h>
22
23 #include "wlcore.h"
24 #include "wl12xx_80211.h"
25 @@ -214,10 +215,15 @@ static struct wl1271_if_operations sdio_
26 .set_block_size = wl1271_sdio_set_block_size,
27 };
28
29 +static const struct of_device_id wlcore_sdio_of_clk_match_table[] = {
30 + { .compatible = "ti,wilink-clock" },
31 +};
32 +
33 static struct wl12xx_platform_data *wlcore_get_pdata_from_of(struct device *dev)
34 {
35 struct wl12xx_platform_data *pdata;
36 struct device_node *np = dev->of_node;
37 + struct device_node *clock_node;
38
39 if (!np) {
40 np = of_find_matching_node(NULL, dev->driver->of_match_table);
41 @@ -241,6 +247,9 @@ static struct wl12xx_platform_data *wlco
42 goto out_free;
43 }
44
45 + for_each_matching_node(clock_node, wlcore_sdio_of_clk_match_table)
46 + of_fixed_clk_setup(clock_node);
47 +
48 goto out;
49
50 out_free: