Subject: [tip: timers/core] clocksource/drivers/renesas-ostm: Avoid reprobe after successful early probe

The following commit has been merged into the timers/core branch of tip:

Commit-ID: 37385c0772a4fc6b89605b9701fa934fa2beb2cc
Gitweb: https://git.kernel.org/tip/37385c0772a4fc6b89605b9701fa934fa2beb2cc
Author: Geert Uytterhoeven <[email protected]>
AuthorDate: Wed, 20 Mar 2024 11:30:07 +01:00
Committer: Daniel Lezcano <[email protected]>
CommitterDate: Fri, 10 May 2024 10:41:52 +02:00

clocksource/drivers/renesas-ostm: Avoid reprobe after successful early probe

The Renesas OS Timer (OSTM) driver contains two probe points, of which
only one should complete:
1. Early probe, using TIMER_OF_DECLARE(), to provide the sole
clocksource on (arm32) RZ/A1 and RZ/A2 SoCs,
2. Normal probe, using a platform driver, to provide additional timers
on (arm64 + riscv) RZ/G2L and similar SoCs.

The latter is needed because using OSTM on RZ/G2L requires manipulation
of its reset signal, which is not yet available at the time of early
probe, causing early probe to fail with -EPROBE_DEFER. It is only
enabled when building a kernel with support for the RZ/G2L family, so it
does not impact RZ/A1 and RZ/A2. Hence only one probe method can
complete on all affected systems.

As relying on the order of initialization of subsystems inside the
kernel is fragile, set the DT node's OF_POPULATED flag after a succesful
early probe. This makes sure the platform driver's probe is never
called after a successful early probe.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Reviwed-by: Lad Prabhakar <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
Link: https://lore.kernel.org/r/bd027379713cbaafa21ffe9e848ebb7f475ca0e7.1710930542.git.geert+renesas@glider.be
---
drivers/clocksource/renesas-ostm.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/renesas-ostm.c b/drivers/clocksource/renesas-ostm.c
index 39487d0..3fcbd02 100644
--- a/drivers/clocksource/renesas-ostm.c
+++ b/drivers/clocksource/renesas-ostm.c
@@ -210,6 +210,7 @@ static int __init ostm_init(struct device_node *np)
pr_info("%pOF: used for clock events\n", np);
}

+ of_node_set_flag(np, OF_POPULATED);
return 0;

err_cleanup: