clocksource/drivers/renesas-ostm: Avoid reprobe after successful early probe
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 20 Mar 2024 10:30:07 +0000 (11:30 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Fri, 10 May 2024 08:41:52 +0000 (10:41 +0200)
commit37385c0772a4fc6b89605b9701fa934fa2beb2cc
tree2f4ef0ed2080f87e8f5da75612e0a86344901bb4
parent0f63c95aebf11d87b166a5dfd389957c67fef9c0
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 <geert+renesas@glider.be>
Reviwed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/bd027379713cbaafa21ffe9e848ebb7f475ca0e7.1710930542.git.geert+renesas@glider.be
drivers/clocksource/renesas-ostm.c