summaryrefslogtreecommitdiffstats
path: root/drivers/clk/ti/clk.c
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2016-09-29 12:05:00 +0300
committerTero Kristo <t-kristo@ti.com>2017-03-08 12:57:45 +0200
commitc17435c56bb1feb7365ebffcfbe98baae50a0fb4 (patch)
tree9ab61d299724441120062382fd913afef0a68829 /drivers/clk/ti/clk.c
parent21f0bf2d3dcc7b18cebe2fa3da700e3263c3a3ce (diff)
downloadlinux-c17435c56bb1feb7365ebffcfbe98baae50a0fb4.tar.bz2
clk: ti: add API for creating aliases automatically for simple clock types
This API generates clock aliases automatically for simple clock types (fixed-clock, fixed-factor-clock), so that we don't need to add the data for these statically into tables. Shall be called from the SoC specific clock init. Signed-off-by: Tero Kristo <t-kristo@ti.com> Acked-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/clk/ti/clk.c')
-rw-r--r--drivers/clk/ti/clk.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
index 91bad55cfd5a..193862ed27c7 100644
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -355,6 +355,12 @@ struct clk __init *ti_clk_register_clk(struct ti_clk *setup)
return clk;
}
+static const struct of_device_id simple_clk_match_table[] __initconst = {
+ { .compatible = "fixed-clock" },
+ { .compatible = "fixed-factor-clock" },
+ { }
+};
+
int __init ti_clk_register_legacy_clks(struct ti_clk_alias *clks)
{
struct clk *clk;
@@ -409,6 +415,26 @@ int __init ti_clk_register_legacy_clks(struct ti_clk_alias *clks)
#endif
/**
+ * ti_clk_add_aliases - setup clock aliases
+ *
+ * Sets up any missing clock aliases. No return value.
+ */
+void __init ti_clk_add_aliases(void)
+{
+ struct device_node *np;
+ struct clk *clk;
+
+ for_each_matching_node(np, simple_clk_match_table) {
+ struct of_phandle_args clkspec;
+
+ clkspec.np = np;
+ clk = of_clk_get_from_provider(&clkspec);
+
+ ti_clk_add_alias(NULL, clk, np->name);
+ }
+}
+
+/**
* ti_clk_setup_features - setup clock features flags
* @features: features definition to use
*