clk: sunxi: support better factor DT nodes
authorEmilio López <emilio@elopez.com.ar>
Mon, 23 Dec 2013 03:32:40 +0000 (00:32 -0300)
committerEmilio López <emilio@elopez.com.ar>
Sat, 28 Dec 2013 20:08:25 +0000 (17:08 -0300)
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 <emilio@elopez.com.ar>
Acked-by: Mike Turquette <mturquette@linaro.org>
drivers/clk/sunxi/clk-sunxi.c

index 75fbc48129bea461ffbcdf04b1acf5ea08bc0438..124113e33f06e3b5e3817c7fcdfde24af08dc11e 100644 (file)
@@ -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;