[PATCH v3] imx: syscounter: allow timer_init for SPL build

Oleksandr Suvorov oleksandr.suvorov at foundries.io
Thu Aug 3 17:25:20 CEST 2023


From: Michael Scott <mike at foundries.io>

With enabled SKIP_LOWLEVEL_INIT, the weak function timer_init() is
used in the SPL build. For iMX6 SoC, this leads MMC to fail once
u-boot proper is booted due to a timing issue.
Always use iMX-specific timer_init() in SPL to fix timing issues.

Fixes: be277c3a89 ("imx: mx7: avoid some initialization if low level is skipped")
Signed-off-by: Michael Scott <mike at foundries.io>
Co-developed-by: Oleksandr Suvorov <oleksandr.suvorov at foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov at foundries.io>
Reviewed-by: Peng Fan <peng.fan at nxp.com>
---

Changes in v3:
- add Reviewed-by from https://patchwork.ozlabs.org/project/uboot/patch/20210925151812.58480-1-oleksandr.suvorov@foundries.io/

Changes in v2:
- rebased on top of a2ac2b964b ("Convert CONFIG_SKIP_LOWLEVEL_INIT et al to Kconfig")

 arch/arm/mach-imx/syscounter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/syscounter.c b/arch/arm/mach-imx/syscounter.c
index 129efac6fa6..16df1186759 100644
--- a/arch/arm/mach-imx/syscounter.c
+++ b/arch/arm/mach-imx/syscounter.c
@@ -59,7 +59,7 @@ static inline unsigned long long us_to_tick(unsigned long long usec)
 	return usec;
 }
 
-#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
+#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) || IS_ENABLED(CONFIG_SPL_BUILD)
 int timer_init(void)
 {
 	struct sctr_regs *sctr = (struct sctr_regs *)SCTR_BASE_ADDR;
-- 
2.40.1



More information about the U-Boot mailing list