diff mbox series

[3/8] clk: ti: Optionally parse IO address from parent clock node

Message ID 20220204071449.16762-4-tony@atomide.com (mailing list archive)
State New, archived
Headers show
Series Clock changes for TI dts reg and node name issues | expand

Commit Message

Tony Lindgren Feb. 4, 2022, 7:14 a.m. UTC
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>
---
 drivers/clk/ti/clk.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Stephen Boyd March 11, 2022, 3:31 a.m. UTC | #1
Quoting Tony Lindgren (2022-02-03 23:14:44)
> 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>
> ---

Applied to clk-next
diff mbox series

Patch

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
--- 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;