Skip to content

Commit d02747e

Browse files
tmlindbebarino
authored andcommitted
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>
1 parent 51f661e commit d02747e

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

drivers/clk/ti/clkctrl.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,32 @@ static void __init _clkctrl_add_provider(void *data,
469469
of_clk_add_hw_provider(np, _ti_omap4_clkctrl_xlate, data);
470470
}
471471

472-
/* Get clock name based on compatible string for clkctrl */
473-
static char * __init clkctrl_get_name(struct device_node *np)
472+
/*
473+
* Get clock name based on "clock-output-names" property or the
474+
* compatible property for clkctrl.
475+
*/
476+
static const char * __init clkctrl_get_name(struct device_node *np)
474477
{
475478
struct property *prop;
476479
const int prefix_len = 11;
477480
const char *compat;
481+
const char *output;
478482
char *name;
479483

484+
if (!of_property_read_string_index(np, "clock-output-names", 0,
485+
&output)) {
486+
const char *end;
487+
int len;
488+
489+
len = strlen(output);
490+
end = strstr(output, "_clkctrl");
491+
if (end)
492+
len -= strlen(end);
493+
name = kstrndup(output, len, GFP_KERNEL);
494+
495+
return name;
496+
}
497+
480498
of_property_for_each_string(np, "compatible", prop, compat) {
481499
if (!strncmp("ti,clkctrl-", compat, prefix_len)) {
482500
/* Two letter minimum name length for l3, l4 etc */

0 commit comments

Comments
 (0)