Skip to content

Commit ad3ac13

Browse files
uditkumartibebarino
authored andcommitted
clk: keystone: sci-clk: Adding support for non contiguous clocks
Most of clocks and their parents are defined in contiguous range, But in few cases, there is gap in clock numbers[0]. Driver assumes clocks to be in contiguous range, and add their clock ids incrementally. New firmware started returning error while calling get_freq and is_on API for non-available clock ids. In this fix, driver checks and adds only valid clock ids. [0] https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/j7200/clocks.html Section Clocks for NAVSS0_CPTS_0 Device, clock id 12-15 not present. Fixes: 3c13933 ("clk: keystone: sci-clk: add support for dynamically probing clocks") Signed-off-by: Udit Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Nishanth Menon <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 6613476 commit ad3ac13

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/clk/keystone/sci-clk.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider)
516516
struct sci_clk *sci_clk, *prev;
517517
int num_clks = 0;
518518
int num_parents;
519+
bool state;
519520
int clk_id;
520521
const char * const clk_names[] = {
521522
"clocks", "assigned-clocks", "assigned-clock-parents", NULL
@@ -586,6 +587,15 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider)
586587
clk_id = args.args[1] + 1;
587588

588589
while (num_parents--) {
590+
/* Check if this clock id is valid */
591+
ret = provider->ops->is_auto(provider->sci,
592+
sci_clk->dev_id, clk_id, &state);
593+
594+
if (ret) {
595+
clk_id++;
596+
continue;
597+
}
598+
589599
sci_clk = devm_kzalloc(dev,
590600
sizeof(*sci_clk),
591601
GFP_KERNEL);

0 commit comments

Comments
 (0)