Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alain Volmat and committed by
Stephen Boyd
3efe64ef fa55b7dc

+11 -2
+11 -2
drivers/clk/st/clkgen-fsyn.c
··· 988 988 void __iomem *reg; 989 989 spinlock_t *lock; 990 990 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 + */ 991 995 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 + } 994 1003 995 1004 clk_parent_name = of_clk_get_parent_name(np, 0); 996 1005 if (!clk_parent_name)