upgrade 3.13 targets to 3.13.2, refresh patches
[15.05/openwrt.git] / target / linux / sunxi / patches-3.13 / 121-clk-sunxi-better-factor-dt-nodes.patch
1 From 7d47b009bf287bf5e0817f47c40e32b7ec0e8151 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= <emilio@elopez.com.ar>
3 Date: Mon, 23 Dec 2013 00:32:40 -0300
4 Subject: [PATCH] clk: sunxi: support better factor DT nodes
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 The DT nodes should look like
10
11     abc_clk: clk@deadbeef {
12         ...
13         clock-output-names = "abc";
14     }
15
16 But our old DT nodes look like
17
18     abc: abc@deadbeef {
19         ...
20     }
21
22 So, let's support both formats, until we can transition everything
23 to the new, correct one.
24
25 Signed-off-by: Emilio López <emilio@elopez.com.ar>
26 ---
27  drivers/clk/sunxi/clk-sunxi.c | 9 +++++++++
28  1 file changed, 9 insertions(+)
29
30 --- a/drivers/clk/sunxi/clk-sunxi.c
31 +++ b/drivers/clk/sunxi/clk-sunxi.c
32 @@ -441,6 +441,15 @@ static struct clk * __init sunxi_factors
33                (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
34                 i++;
35  
36 +       /* Nodes should be providing the name via clock-output-names
37 +        * but originally our dts didn't, and so we used node->name.
38 +        * The new, better nodes look like clk@deadbeef, so we pull the
39 +        * name just in this case */
40 +       if (!strcmp("clk", clk_name)) {
41 +               of_property_read_string_index(node, "clock-output-names",
42 +                                             0, &clk_name);
43 +       }
44 +
45         factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL);
46         if (!factors)
47                 return NULL;