[PATCHv6 40/45] ARM: OMAP2+: omap_device: use dt aware clk_get to lookup clk

Tero Kristo t-kristo at ti.com
Thu Aug 29 09:16:32 EDT 2013


From: Nishanth Menon <nm at ti.com>

clk_get does a check to find nodes on DT prior to trying clk_get_sys.

To make omap_device dt clock node aware, use clk_get instead of
clk_get_sys.

As part of this, add warnings for device node entries which do not
declare their own clock nodes for the expected aliases.

Signed-off-by: Nishanth Menon <nm at ti.com>
Signed-off-by: Tero Kristo <t-kristo at ti.com>
---
 arch/arm/mach-omap2/omap_device.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index 7c796e2..9946900 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -48,19 +48,25 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
 	int ret;
 	struct clk *r;
 	struct device *dev = &od->pdev->dev;
+	struct device_node *node = dev->of_node;
 
 	if (!clk_alias || !clk_name)
 		return;
 
 	dev_dbg(dev, "Creating %s -> %s\n", clk_alias, clk_name);
 
-	r = clk_get_sys(dev_name(dev), clk_alias);
+	r = clk_get(dev, clk_alias);
 	if (!IS_ERR(r)) {
-		dev_warn(dev, "alias %s already exists\n", clk_alias);
+		if (!node)
+			dev_warn(dev, "alias '%s' already exists\n", clk_alias);
 		clk_put(r);
 		return;
 	}
 
+	if (node)
+		dev_err(dev, "FIXME: clock-name '%s' DOES NOT exist in dt!\n",
+			clk_alias);
+
 	ret = clk_add_alias(clk_alias, dev_name(dev), (char *)clk_name, dev);
 	if (ret)
 		dev_err(dev, "Failed to alias %s to %s: %d\n", clk_alias,
-- 
1.7.9.5




More information about the linux-arm-kernel mailing list