879462b76657216b8cd1444881187d65bc8c7db7
[openwrt/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 diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
23 index 0ed9794..7a2ed98 100644
24 --- a/drivers/clk/sunxi/clk-sunxi.c
25 +++ b/drivers/clk/sunxi/clk-sunxi.c
26 @@ -389,6 +389,7 @@ struct factors_data {
27 int mux;
28 struct clk_factors_config *table;
29 void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p);
30 + const char *name;
31 };
32
33 static struct clk_factors_config sun4i_pll1_config = {
34 @@ -457,6 +458,14 @@ static const struct factors_data sun4i_pll5_data __initconst = {
35 .enable = 31,
36 .table = &sun4i_pll5_config,
37 .getter = sun4i_get_pll5_factors,
38 + .name = "pll5",
39 +};
40 +
41 +static const struct factors_data sun4i_pll6_data __initconst = {
42 + .enable = 31,
43 + .table = &sun4i_pll5_config,
44 + .getter = sun4i_get_pll5_factors,
45 + .name = "pll6",
46 };
47
48 static const struct factors_data sun4i_apb1_data __initconst = {
49 @@ -499,14 +508,14 @@ static struct clk * __init sunxi_factors_clk_setup(struct device_node *node,
50 (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
51 i++;
52
53 - /* Nodes should be providing the name via clock-output-names
54 - * but originally our dts didn't, and so we used node->name.
55 - * The new, better nodes look like clk@deadbeef, so we pull the
56 - * name just in this case */
57 - if (!strcmp("clk", clk_name)) {
58 - of_property_read_string_index(node, "clock-output-names",
59 - 0, &clk_name);
60 - }
61 + /*
62 + * some factor clocks, such as pll5 and pll6, may have multiple
63 + * outputs, and have their name designated in factors_data
64 + */
65 + if (data->name)
66 + clk_name = data->name;
67 + else
68 + of_property_read_string(node, "clock-output-names", &clk_name);
69
70 factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL);
71 if (!factors)
72 @@ -838,7 +847,7 @@ static const struct divs_data pll5_divs_data __initconst = {
73 };
74
75 static const struct divs_data pll6_divs_data __initconst = {
76 - .factors = &sun4i_pll5_data,
77 + .factors = &sun4i_pll6_data,
78 .div = {
79 { .shift = 0, .table = pll6_sata_tbl, .gate = 14 }, /* M, SATA */
80 { .fixed = 2 }, /* P, other */
81 --
82 2.0.3
83