Skip to content

Commit 3efe64e

Browse files
Alain Volmatbebarino
authored andcommitted
clk: st: clkgen-fsyn: search reg within node or parent
In order to avoid having duplicated addresses within the DT, only have one unit-address per clockgen and each driver within the clockgen should look at the parent node (overall clockgen) to figure out the reg property. Such behavior is already in place in other STi platform clock drivers such as clk-flexgen and clkgen-pll. Keep backward compatibility by first looking at reg within the node before looking into the parent node. Signed-off-by: Alain Volmat <avolmat@me.com> Link: https://lore.kernel.org/r/20211218211157.188214-2-avolmat@me.com Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent fa55b7d commit 3efe64e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

drivers/clk/st/clkgen-fsyn.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,9 +988,18 @@ static void __init st_of_quadfs_setup(struct device_node *np,
988988
void __iomem *reg;
989989
spinlock_t *lock;
990990

991+
/*
992+
* First check for reg property within the node to keep backward
993+
* compatibility, then if reg doesn't exist look at the parent node
994+
*/
991995
reg = of_iomap(np, 0);
992-
if (!reg)
993-
return;
996+
if (!reg) {
997+
reg = of_iomap(of_get_parent(np), 0);
998+
if (!reg) {
999+
pr_err("%s: Failed to get base address\n", __func__);
1000+
return;
1001+
}
1002+
}
9941003

9951004
clk_parent_name = of_clk_get_parent_name(np, 0);
9961005
if (!clk_parent_name)

0 commit comments

Comments
 (0)