diff options
author | Alain Volmat <avolmat@me.com> | 2021-12-18 22:11:57 +0100 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2022-01-05 17:21:28 -0800 |
commit | 810251b0d36af694ece65146112a2bb541f758fb (patch) | |
tree | b2a905ea41487699dca5f7cd234cfe0f7f4f0335 | |
parent | 3efe64ef5186c20c9ed4aeb771a7bc3225d0671b (diff) | |
download | lwn-810251b0d36af694ece65146112a2bb541f758fb.tar.gz lwn-810251b0d36af694ece65146112a2bb541f758fb.zip |
clk: st: clkgen-mux: 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-3-avolmat@me.com
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-rw-r--r-- | drivers/clk/st/clkgen-mux.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/clk/st/clkgen-mux.c b/drivers/clk/st/clkgen-mux.c index ce583ded968a..ee39af7a0b72 100644 --- a/drivers/clk/st/clkgen-mux.c +++ b/drivers/clk/st/clkgen-mux.c @@ -57,10 +57,17 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np, const char **parents; int num_parents = 0; + /* + * First check for reg property within the node to keep backward + * compatibility, then if reg doesn't exist look at the parent node + */ reg = of_iomap(np, 0); if (!reg) { - pr_err("%s: Failed to get base address\n", __func__); - return; + reg = of_iomap(of_get_parent(np), 0); + if (!reg) { + pr_err("%s: Failed to get base address\n", __func__); + return; + } } parents = clkgen_mux_get_parents(np, &num_parents); |