add device tree based initialization to wl12xx
[openwrt/staging/wigyori.git] / target / linux / omap / patches-3.12 / 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 ---
16 drivers/net/wireless/ti/wlcore/sdio.c | 9 +++++++++
17 1 file changed, 9 insertions(+)
18
19 --- a/drivers/net/wireless/ti/wlcore/sdio.c
20 +++ b/drivers/net/wireless/ti/wlcore/sdio.c
21 @@ -34,6 +34,7 @@
22 #include <linux/wl12xx.h>
23 #include <linux/pm_runtime.h>
24 #include <linux/printk.h>
25 +#include <linux/clk-provider.h>
26
27 #include "wlcore.h"
28 #include "wl12xx_80211.h"
29 @@ -214,10 +215,15 @@ static struct wl1271_if_operations sdio_
30 .set_block_size = wl1271_sdio_set_block_size,
31 };
32
33 +static const struct of_device_id wlcore_sdio_of_clk_match_table[] = {
34 + { .compatible = "ti,wilink-clock" },
35 +};
36 +
37 static struct wl12xx_platform_data *wlcore_get_pdata_from_of(struct device *dev)
38 {
39 struct wl12xx_platform_data *pdata;
40 struct device_node *np = dev->of_node;
41 + struct device_node *clock_node;
42
43 if (!np) {
44 np = of_find_matching_node(NULL, dev->driver->of_match_table);
45 @@ -241,6 +247,9 @@ static struct wl12xx_platform_data *wlco
46 goto out_free;
47 }
48
49 + for_each_matching_node(clock_node, wlcore_sdio_of_clk_match_table)
50 + of_fixed_clk_setup(clock_node);
51 +
52 goto out;
53
54 out_free: