From 76192dc8873f724361c1bf8a90b37abc7dfed7ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?Emilio=20L=C3=B3pez?= Date: Mon, 23 Dec 2013 00:32:40 -0300 Subject: [PATCH] clk: sunxi: support better factor DT nodes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The DT nodes should look like abc_clk: clk@deadbeef { ... clock-output-names = "abc"; } But our old DT nodes look like abc: abc@deadbeef { ... } So, let's support both formats, until we can transition everything to the new, correct one. Signed-off-by: Emilio López Acked-by: Mike Turquette --- drivers/clk/sunxi/clk-sunxi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c index 75fbc48129be..124113e33f06 100644 --- a/drivers/clk/sunxi/clk-sunxi.c +++ b/drivers/clk/sunxi/clk-sunxi.c @@ -441,6 +441,15 @@ static struct clk * __init sunxi_factors_clk_setup(struct device_node *node, (parents[i] = of_clk_get_parent_name(node, i)) != NULL) i++; + /* Nodes should be providing the name via clock-output-names + * but originally our dts didn't, and so we used node->name. + * The new, better nodes look like clk@deadbeef, so we pull the + * name just in this case */ + if (!strcmp("clk", clk_name)) { + of_property_read_string_index(node, "clock-output-names", + 0, &clk_name); + } + factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL); if (!factors) return NULL; -- 2.20.1