Commit c17435c5 authored by Tero Kristo's avatar Tero Kristo

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: default avatarTero Kristo <t-kristo@ti.com>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
parent 21f0bf2d
...@@ -355,6 +355,12 @@ struct clk __init *ti_clk_register_clk(struct ti_clk *setup) ...@@ -355,6 +355,12 @@ struct clk __init *ti_clk_register_clk(struct ti_clk *setup)
return clk; 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) int __init ti_clk_register_legacy_clks(struct ti_clk_alias *clks)
{ {
struct clk *clk; struct clk *clk;
...@@ -408,6 +414,26 @@ int __init ti_clk_register_legacy_clks(struct ti_clk_alias *clks) ...@@ -408,6 +414,26 @@ int __init ti_clk_register_legacy_clks(struct ti_clk_alias *clks)
} }
#endif #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 * ti_clk_setup_features - setup clock features flags
* @features: features definition to use * @features: features definition to use
......
...@@ -192,6 +192,7 @@ struct clk *ti_clk_register_dpll(struct ti_clk *setup); ...@@ -192,6 +192,7 @@ struct clk *ti_clk_register_dpll(struct ti_clk *setup);
struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw, struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw,
const char *con); const char *con);
int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con); int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con);
void ti_clk_add_aliases(void);
struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup); struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup);
struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup); struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment