It was noticed that Clearfog is currently broken with this newly introduced early_init_done() function. Apparently the timer is enabled here when U-Boot is run but not configured - at least not correctly. Resulting in a hangup in the timer reading functions.
To fix this, also read the value of the reload register and check it's value with the one written to by U-Boot. Only if this matches, the init has already been done. Signed-off-by: Stefan Roese <s...@denx.de> Cc: Martin Rowe <martin.p.r...@gmail.com> Cc: Tony Dinh <mibo...@gmail.com> Cc: Pali Rohár <p...@kernel.org> Cc: Michael Walle <mich...@walle.cc> --- drivers/timer/orion-timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c index 810a03d54960..9cab27f2e48b 100644 --- a/drivers/timer/orion-timer.c +++ b/drivers/timer/orion-timer.c @@ -25,7 +25,8 @@ struct orion_timer_priv { static bool early_init_done(void *base) { - if (readl(base + TIMER_CTRL) & TIMER0_EN) + if ((readl(base + TIMER_CTRL) & TIMER0_EN) && + (readl(base + TIMER0_RELOAD) == ~0)) return true; return false; } -- 2.39.0