Skip to content

Commit 59dcfc4

Browse files
Tero Kristotmlind
authored andcommitted
ARM: OMAP2+: omap_device: create clock alias purely from DT data
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>
1 parent b3bf289 commit 59dcfc4

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

arch/arm/mach-omap2/omap_device.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,22 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
6363
return;
6464
}
6565

66-
rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), clk_name, NULL);
66+
r = clk_get_sys(NULL, clk_name);
67+
68+
if (IS_ERR(r) && of_have_populated_dt()) {
69+
struct of_phandle_args clkspec;
70+
71+
clkspec.np = of_find_node_by_name(NULL, clk_name);
72+
73+
r = of_clk_get_from_provider(&clkspec);
74+
75+
rc = clk_register_clkdev(r, clk_alias,
76+
dev_name(&od->pdev->dev));
77+
} else {
78+
rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev),
79+
clk_name, NULL);
80+
}
81+
6782
if (rc) {
6883
if (rc == -ENODEV || rc == -ENOMEM)
6984
dev_err(&od->pdev->dev,

0 commit comments

Comments
 (0)