diff options
author | Tony Lindgren <tony@atomide.com> | 2022-02-04 10:14:44 +0300 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2022-03-11 05:55:59 +0300 |
commit | 274d679810dab8a7dd5042826979d6ef014007a5 (patch) | |
tree | 6416854c14a71ddf1dc17314b7e92221ae16626c /drivers/clk/ti/clk.c | |
parent | 80864594ff2ad002e2755daf97d46ff0c86faf1f (diff) | |
download | linux-274d679810dab8a7dd5042826979d6ef014007a5.tar.xz |
clk: ti: Optionally parse IO address from parent clock node
If no reg property is specified for a TI clock, let's try to use the
parent clock node IO address. This way we can avoid duplicate devicetree
reg properties that cause warnings for unique_unit_address.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20220204071449.16762-4-tony@atomide.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/ti/clk.c')
-rw-r--r-- | drivers/clk/ti/clk.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index 29eafab4353e..a0ddf16f0eca 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c @@ -274,6 +274,8 @@ int ti_clk_get_reg_addr(struct device_node *node, int index, for (i = 0; i < CLK_MAX_MEMMAPS; i++) { if (clocks_node_ptr[i] == node->parent) break; + if (clocks_node_ptr[i] == node->parent->parent) + break; } if (i == CLK_MAX_MEMMAPS) { @@ -284,8 +286,12 @@ int ti_clk_get_reg_addr(struct device_node *node, int index, reg->index = i; if (of_property_read_u32_index(node, "reg", index, &val)) { - pr_err("%pOFn must have reg[%d]!\n", node, index); - return -EINVAL; + if (of_property_read_u32_index(node->parent, "reg", + index, &val)) { + pr_err("%pOFn or parent must have reg[%d]!\n", + node, index); + return -EINVAL; + } } reg->offset = val; |