timer: orion-timer: Fix problem in early_init_done()
PATCH 1/1 timer: orion-timer: Fix problem in early_init_done()
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.
--- drivers/timer/orion-timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/timer/orion-timer.c +2 -1
@@ -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; }
Signature · 1 line
2.39.0
Quoted 9 lines · On Monday 16 January 2023 16:34:45 Stefan Roese wrote:
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.
Quoted 5 lines
Signed-off-by Stefan Roese <[email protected]>Cc Martin Rowe <[email protected]>Cc Tony Dinh <[email protected]>Cc Pali Rohár <[email protected]>Cc Michael Walle <[email protected]>
Looks good.
Maybe you should also fixed line:
Quoted 21 lines
--- drivers/timer/orion-timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/timer/orion-timer.c +2
-1@@ -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; }Signature · 1 line
2.39.0
Hi Pali,
Quoted 16 lines · Pali Rohár
Quoted 9 lines · On Monday 16 January 2023 16:34:45 Stefan Roese wrote:
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.
Quoted 5 lines
Signed-off-by Stefan Roese <[email protected]>Cc Martin Rowe <[email protected]>Cc Tony Dinh <[email protected]>Cc Pali Rohár <[email protected]>Cc Michael Walle <[email protected]>
Quoted 7 lines
Looks good.
Acked-by Pali Rohár <[email protected]>Maybe you should also fixed line:
Fixes 5387b093cb79 ("timer: orion-timer: Fix problem with early static variable")
Will do when applying. Thanks.
Thanks,
Stefan
Quoted 10 lines
Quoted 10 lines
--- drivers/timer/orion-timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/timer/orion-timer.c +0
-0@@ -25,7 +25,8 @@ struct orion_timer_priv {
Quoted 11 lines
Quoted 11 lines
drivers/timer/orion-timer.c +2
-1static 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; }Signature · 1 line
2.39.0
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Quoted 16 lines · Pali Rohár
Quoted 9 lines · On Monday 16 January 2023 16:34:45 Stefan Roese wrote:
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.
Quoted 5 lines
Signed-off-by Stefan Roese <[email protected]>Cc Martin Rowe <[email protected]>Cc Tony Dinh <[email protected]>Cc Pali Rohár <[email protected]>Cc Michael Walle <[email protected]>
Quoted 7 lines
Looks good.
Acked-by Pali Rohár <[email protected]>Maybe you should also fixed line:
Fixes 5387b093cb79 ("timer: orion-timer: Fix problem with early static variable")
Applied to u-boot-marvell/master
Thanks,
Stefan
Quoted 10 lines
Quoted 10 lines
--- drivers/timer/orion-timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/timer/orion-timer.c +0
-0@@ -25,7 +25,8 @@ struct orion_timer_priv {
Quoted 11 lines
Quoted 11 lines
drivers/timer/orion-timer.c +2
-1static 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; }Signature · 1 line
2.39.0
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]