]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ARM: OMAP2+: omap_device: create clock alias purely from DT data
authorTero Kristo <t-kristo@ti.com>
Thu, 30 Jun 2016 13:14:59 +0000 (16:14 +0300)
committerTony Lindgren <tony@atomide.com>
Mon, 4 Jul 2016 06:42:53 +0000 (23:42 -0700)
This avoids the need to add most of the clock aliases under
drivers/clk/ti/clk-xyz.c files.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/omap_device.c

index a7be05d83ec7657bc4be19afe06c7777f239bd8c..c2626f83e0c22542f6fc1aaeffde238d02940584 100644 (file)
@@ -63,7 +63,22 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
                return;
        }
 
-       rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), clk_name, NULL);
+       r = clk_get_sys(NULL, clk_name);
+
+       if (IS_ERR(r) && of_have_populated_dt()) {
+               struct of_phandle_args clkspec;
+
+               clkspec.np = of_find_node_by_name(NULL, clk_name);
+
+               r = of_clk_get_from_provider(&clkspec);
+
+               rc = clk_register_clkdev(r, clk_alias,
+                                        dev_name(&od->pdev->dev));
+       } else {
+               rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev),
+                                  clk_name, NULL);
+       }
+
        if (rc) {
                if (rc == -ENODEV || rc == -ENOMEM)
                        dev_err(&od->pdev->dev,