Commit 274d6798 authored by Tony Lindgren's avatar Tony Lindgren Committed by Stephen Boyd
Browse files

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: default avatarTony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20220204071449.16762-4-tony@atomide.com


Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 80864594
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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,9 +286,13 @@ 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);
		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;
	reg->ptr = NULL;