Re: [bug] timer: orion-timer: static variable patch breaks armada-388-clearfog boot

2023-01-16 Thread Martin Rowe
Stefan,

> Could you please test with this attached patch, if this fixes this issue
> on your clearfog?

Your patch resolves the issue. Thanks for your fast work!

Regards

Martin


Re: [bug] timer: orion-timer: static variable patch breaks armada-388-clearfog boot

2023-01-16 Thread Stefan Roese

Hi Martin,

On 1/16/23 06:20, Martin Rowe wrote:

Tony,


Did you build this clearfog board as is? i.e. did you make any change
in the clearfog_defconfig?


clearfog_defconfig with:
CONFIG_MVEBU_SPL_BOOT_DEVICE_SATA=y
CONFIG_SPL_SATA=y

Plus a dts patch to sdhci@d8000 to make it work for eMMC (swap
cd-gpios for non-removable)
Plus a workaround that's not yet merged for a build failure with SATA from [1]

Shouldn't be anything that affects the timer, but I can try a fully
clean build with the defconfig if you need it.


No need for this.

Could you please test with this attached patch, if this fixes this issue
on your clearfog?

Thanks,
StefanFrom 9ba26205434f2406d6c8a5dd30e1c065185748d0 Mon Sep 17 00:00:00 2001
From: Stefan Roese 
Date: Mon, 16 Jan 2023 09:01:48 +0100
Subject: [PATCH] timer: orion-timer: Fix problem in early_init_done()

todo

Signed-off-by: Stefan Roese 
---
 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



Re: [bug] timer: orion-timer: static variable patch breaks armada-388-clearfog boot

2023-01-15 Thread Martin Rowe
Tony,

> Did you build this clearfog board as is? i.e. did you make any change
> in the clearfog_defconfig?

clearfog_defconfig with:
CONFIG_MVEBU_SPL_BOOT_DEVICE_SATA=y
CONFIG_SPL_SATA=y

Plus a dts patch to sdhci@d8000 to make it work for eMMC (swap
cd-gpios for non-removable)
Plus a workaround that's not yet merged for a build failure with SATA from [1]

Shouldn't be anything that affects the timer, but I can try a fully
clean build with the defconfig if you need it.

Regards

Martin

[1] https://lore.kernel.org/u-boot/20230110161946.3816866-8-tr...@konsulko.com/


Re: [bug] timer: orion-timer: static variable patch breaks armada-388-clearfog boot

2023-01-15 Thread Tony Dinh
Hi Martin,

On Sat, Jan 14, 2023 at 9:31 PM Martin Rowe  wrote:
>
> Hi,
>
> Commit 5387b093 was a fix for early_init_done causing issues on Pogo
> v4 [1]. The fix breaks armada-388-clearfog because the boot hangs
> indefinitely.
>
> It appears that the cause is an infinite loop in __udelay due to
> get_ticks() always returning 0. After adding some printf statements it
> became apparent that the timer was never getting initialised.
>
> git-blame identified the "timer: orion-timer: Fix problem with early
> static variable" patch as a likely issue. Reverting the commit
> restores boot for armada-388-clearfog.

Did you build this clearfog board as is? i.e. did you make any change
in the clearfog_defconfig?

Thanks,
Tony


Tony

>
> Patching the issue is a bit beyond me without understanding the Pogo
> v4 issue, but I'm happy to test any patches that are developed.
>
> Regards
>
> Martin
>
> [1] https://lore.kernel.org/u-boot/20221221091849.1018783-1...@denx.de/