diff options
author | Tony Lindgren <tony@atomide.com> | 2022-02-04 09:14:46 +0200 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2022-03-10 18:55:59 -0800 |
commit | d02747e9894c66940db6859c273ab3000c730a93 (patch) | |
tree | 2c8ab494f55042a5df75181fe0910e227a79bfea /drivers/clk/ti | |
parent | 51f661ef9a106e908097262ff5034a85ce15b122 (diff) |
clk: ti: Use clock-output-names for clkctrl
Use clock-output-names devicetree property for clkctrl clocks if
available.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20220204071449.16762-6-tony@atomide.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/ti')
-rw-r--r-- | drivers/clk/ti/clkctrl.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c index 0049828db0e9..535f35b21204 100644 --- a/drivers/clk/ti/clkctrl.c +++ b/drivers/clk/ti/clkctrl.c @@ -469,14 +469,32 @@ static void __init _clkctrl_add_provider(void *data, of_clk_add_hw_provider(np, _ti_omap4_clkctrl_xlate, data); } -/* Get clock name based on compatible string for clkctrl */ -static char * __init clkctrl_get_name(struct device_node *np) +/* + * Get clock name based on "clock-output-names" property or the + * compatible property for clkctrl. + */ +static const char * __init clkctrl_get_name(struct device_node *np) { struct property *prop; const int prefix_len = 11; const char *compat; + const char *output; char *name; + if (!of_property_read_string_index(np, "clock-output-names", 0, + &output)) { + const char *end; + int len; + + len = strlen(output); + end = strstr(output, "_clkctrl"); + if (end) + len -= strlen(end); + name = kstrndup(output, len, GFP_KERNEL); + + return name; + } + of_property_for_each_string(np, "compatible", prop, compat) { if (!strncmp("ti,clkctrl-", compat, prefix_len)) { /* Two letter minimum name length for l3, l4 etc */ |