Re: [RFC 1/9] ARM: OMAP2+: omap_device: create clock alias purely from DT data

2015-12-18 Thread Tony Lindgren
* Tero Kristo  [151218 05:57]:
> This avoids the need to add most of the clock aliases under
> drivers/clk/ti/clk-xyz.c files.

Yup is badly needed. Right now we have strange hidden dependencies
in multiple subsystems to enable a single device driver:

1. Add a clock alias for a device
2. Add hwmod entries for a device
3. Add dts entries for a device
4. Add a device driver

We really should only need steps 3 and 4 to do that, hopefully
this takes out #1 on the list above.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 1/9] ARM: OMAP2+: omap_device: create clock alias purely from DT data

2015-12-18 Thread Tero Kristo
This avoids the need to add most of the clock aliases under
drivers/clk/ti/clk-xyz.c files.

Signed-off-by: Tero Kristo 
---
 arch/arm/mach-omap2/omap_device.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_device.c 
b/arch/arm/mach-omap2/omap_device.c
index 72ebc4c..3389ce7 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -62,6 +62,18 @@ static void _add_clkdev(struct omap_device *od, const char 
*clk_alias,
return;
}
 
+   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);
+
+   clk_register_clkdev(r, clk_name, NULL);
+   }
+
rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), clk_name, NULL);
if (rc) {
if (rc == -ENODEV || rc == -ENOMEM)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html