Skip to content

Commit 274d679

Browse files
tmlindbebarino
authored andcommitted
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>
1 parent 8086459 commit 274d679

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

drivers/clk/ti/clk.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ int ti_clk_get_reg_addr(struct device_node *node, int index,
274274
for (i = 0; i < CLK_MAX_MEMMAPS; i++) {
275275
if (clocks_node_ptr[i] == node->parent)
276276
break;
277+
if (clocks_node_ptr[i] == node->parent->parent)
278+
break;
277279
}
278280

279281
if (i == CLK_MAX_MEMMAPS) {
@@ -284,8 +286,12 @@ int ti_clk_get_reg_addr(struct device_node *node, int index,
284286
reg->index = i;
285287

286288
if (of_property_read_u32_index(node, "reg", index, &val)) {
287-
pr_err("%pOFn must have reg[%d]!\n", node, index);
288-
return -EINVAL;
289+
if (of_property_read_u32_index(node->parent, "reg",
290+
index, &val)) {
291+
pr_err("%pOFn or parent must have reg[%d]!\n",
292+
node, index);
293+
return -EINVAL;
294+
}
289295
}
290296

291297
reg->offset = val;

0 commit comments

Comments
 (0)