sunxi: add support for infra receiver on A20, along with IR-related backports from...
[openwrt.git] / target / linux / sunxi / patches-3.14 / 181-clk-sunxi-add-names-for-pll56.patch
1 From 8f3156f3f2b70128b2761526c208c8e3bfda694e Mon Sep 17 00:00:00 2001
2 From: Chen-Yu Tsai <wens@csie.org>
3 Date: Mon, 3 Feb 2014 09:51:39 +0800
4 Subject: [PATCH] clk: sunxi: add names for pll5, pll6 parent clocks to
5  factors_data
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Some factor clocks, such as the parent clock of pll5 and pll6, have
11 multiple output names. Add the corresponding names to factors_data
12 tied to compatible string.
13
14 Signed-off-by: Chen-Yu Tsai <wens@csie.org>
15 Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
16 Acked-by: Mike Turquette <mturquette@linaro.org>
17 Signed-off-by: Emilio López <emilio@elopez.com.ar>
18 ---
19  drivers/clk/sunxi/clk-sunxi.c | 27 ++++++++++++++++++---------
20  1 file changed, 18 insertions(+), 9 deletions(-)
21
22 --- a/drivers/clk/sunxi/clk-sunxi.c
23 +++ b/drivers/clk/sunxi/clk-sunxi.c
24 @@ -389,6 +389,7 @@ struct factors_data {
25         int mux;
26         struct clk_factors_config *table;
27         void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p);
28 +       const char *name;
29  };
30  
31  static struct clk_factors_config sun4i_pll1_config = {
32 @@ -457,6 +458,14 @@ static const struct factors_data sun4i_p
33         .enable = 31,
34         .table = &sun4i_pll5_config,
35         .getter = sun4i_get_pll5_factors,
36 +       .name = "pll5",
37 +};
38 +
39 +static const struct factors_data sun4i_pll6_data __initconst = {
40 +       .enable = 31,
41 +       .table = &sun4i_pll5_config,
42 +       .getter = sun4i_get_pll5_factors,
43 +       .name = "pll6",
44  };
45  
46  static const struct factors_data sun4i_apb1_data __initconst = {
47 @@ -499,14 +508,14 @@ static struct clk * __init sunxi_factors
48                (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
49                 i++;
50  
51 -       /* Nodes should be providing the name via clock-output-names
52 -        * but originally our dts didn't, and so we used node->name.
53 -        * The new, better nodes look like clk@deadbeef, so we pull the
54 -        * name just in this case */
55 -       if (!strcmp("clk", clk_name)) {
56 -               of_property_read_string_index(node, "clock-output-names",
57 -                                             0, &clk_name);
58 -       }
59 +       /*
60 +        * some factor clocks, such as pll5 and pll6, may have multiple
61 +        * outputs, and have their name designated in factors_data
62 +        */
63 +       if (data->name)
64 +               clk_name = data->name;
65 +       else
66 +               of_property_read_string(node, "clock-output-names", &clk_name);
67  
68         factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL);
69         if (!factors)
70 @@ -838,7 +847,7 @@ static const struct divs_data pll5_divs_
71  };
72  
73  static const struct divs_data pll6_divs_data __initconst = {
74 -       .factors = &sun4i_pll5_data,
75 +       .factors = &sun4i_pll6_data,
76         .div = {
77                 { .shift = 0, .table = pll6_sata_tbl, .gate = 14 }, /* M, SATA */
78                 { .fixed = 2 }, /* P, other */