From: Emanuele Ghidoli <ghidoliemanuele@gmail.com>
To: Marek Vasut <marek.vasut@mailbox.org>,
Tom Rini <trini@konsulko.com>,
Patrice Chotard <patrice.chotard@foss.st.com>,
"u-boot@lists.denx.de" <u-boot@lists.denx.de>,
Peng Fan <peng.fan@nxp.com>,
u-boot@lists.u-boot-project.org
Cc: Stefan Roese <stefan.roese@mailbox.org>,
Rasmus Villemoes <rv@rasmusvillemoes.dk>
Subject: Re: Regression on colibri-imx7 due to commit 9c1b13b3fd27 ("cyclic: reduce get_timer_us() calls inside hlist_for_each_entry_safe()")
Date: Tue, 28 Jul 2026 11:46:26 +0200 [thread overview]
Message-ID: <ee20cf64-0541-4d63-b00e-6c9ac5e2382b@gmail.com> (raw)
In-Reply-To: <af758a22-b8c0-470a-90b8-a3ea92db1783@mailbox.org>
On 7/26/26 08:41, Marek Vasut wrote:
> On 7/24/26 9:36 AM, Emanuele Ghidoli wrote:
>
> Hello everyone,
>
>>> Regarding the timer, how come the timer is initialized so late on MX7 ?
>> timer_init() called in initcall_run_f().>
>>> The Cortex-A7 should have its own ARM timer, that should be available right
>>> from the beginning. Is that ARM timer in use on your system, or does your
>>> system use GPT timer ?
>> iMX7 uses arch/arm/mach-imx/syscounter.c.
>>
>> udelay() is called in initcall_run_f(), before timer_init().
>> arch_cpu_init() (arch/arm/mach-imx/mx7/soc.c) -> imx_gpcv2_init -> udelay
>> (which runs schedule/cyclic).
>
> Yikes.
>
>> And this is interesting, udelay() before timer_init() leads to a 0 us delay,
>> so there is another bug.
>>
>> I have verified that removing this udelay(65) the board boots.
> Can we start the syscounter sooner ? Something like this:
>
> diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/
> arch-mx6/sys_proto.h
> index 7845fa8e569..5f6759a3306 100644
> --- a/arch/arm/include/asm/arch-mx6/sys_proto.h
> +++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
> @@ -36,4 +36,6 @@ static inline void iomuxc_set_rgmii_io_voltage(int io_vol)
> __raw_writel(io_vol, IOMUXC_SW_PAD_CTL_GRP_DDR_TYPE_RGMII);
> }
>
> +void syscounter_init(void);
> +
> #endif /* __SYS_PROTO_IMX6_ */
> diff --git a/arch/arm/include/asm/arch-mx7/sys_proto.h b/arch/arm/include/asm/
> arch-mx7/sys_proto.h
> index 5da0037b2c6..765764cf1bc 100644
> --- a/arch/arm/include/asm/arch-mx7/sys_proto.h
> +++ b/arch/arm/include/asm/arch-mx7/sys_proto.h
> @@ -11,4 +11,6 @@ struct wdog_regs;
>
> void set_wdog_reset(struct wdog_regs *wdog);
>
> +void syscounter_init(void);
> +
> #endif /* __SYS_PROTO_IMX7_ */
> diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
> index 02df86156d4..641b5d813ea 100644
> --- a/arch/arm/mach-imx/mx6/soc.c
> +++ b/arch/arm/mach-imx/mx6/soc.c
> @@ -437,6 +437,8 @@ int arch_cpu_init(void)
> */
> if (mxc_get_clock(MXC_ARM_CLK) == 396000000)
> set_ahb_rate(132000000);
> + } else {
> + syscounter_init();
> }
>
> if (is_mx6ul()) {
> diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c
> index e504c1fd52a..82d851b7817 100644
> --- a/arch/arm/mach-imx/mx7/soc.c
> +++ b/arch/arm/mach-imx/mx7/soc.c
> @@ -331,6 +331,8 @@ int arch_cpu_init(void)
>
> init_snvs();
>
> + syscounter_init();
> +
> imx_gpcv2_init();
>
> enable_ca7_smp();
> diff --git a/arch/arm/mach-imx/syscounter.c b/arch/arm/mach-imx/syscounter.c
> index 96fe2c7c17b..7b902540737 100644
> --- a/arch/arm/mach-imx/syscounter.c
> +++ b/arch/arm/mach-imx/syscounter.c
> @@ -60,7 +60,7 @@ static inline unsigned long long us_to_tick(unsigned long
> long usec)
> }
>
> #if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) || IS_ENABLED(CONFIG_XPL_BUILD)
> -int timer_init(void)
> +void syscounter_init(void)
> {
> struct sctr_regs *sctr = (struct sctr_regs *)SCTR_BASE_ADDR;
> unsigned long val, freq;
> @@ -80,6 +80,12 @@ int timer_init(void)
> gd->arch.tbu = 0;
>
> gd->arch.timer_rate_hz = freq;
> +
> + return 0;
> +}
> +
> +int timer_init(void)
> +{
> return 0;
> }
> #endif
Hello Marek,
thanks for the suggestion.
It works, build and tested on Colibri iMX7.
But imx6 is obviously broken:
/home/emanuele/tdx/u-boot-build/u-boot/arch/arm/mach-imx/mx6/soc.c:441:
undefined reference to `syscounter_init'
Emanuele
next prev parent reply other threads:[~2026-07-28 9:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 14:53 Regression on colibri-imx7 due to commit 9c1b13b3fd27 ("cyclic: reduce get_timer_us() calls inside hlist_for_each_entry_safe()") Emanuele Ghidoli
2026-07-23 18:35 ` Marek Vasut via U-Boot
2026-07-23 20:41 ` Emanuele Ghidoli
2026-07-24 0:00 ` Marek Vasut via U-Boot
2026-07-24 7:05 ` Rasmus Villemoes
2026-07-24 7:36 ` Emanuele Ghidoli
2026-07-26 6:41 ` Marek Vasut via U-Boot
2026-07-28 9:46 ` Emanuele Ghidoli [this message]
2026-07-28 11:53 ` Marek Vasut via U-Boot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee20cf64-0541-4d63-b00e-6c9ac5e2382b@gmail.com \
--to=ghidoliemanuele@gmail.com \
--cc=marek.vasut@mailbox.org \
--cc=patrice.chotard@foss.st.com \
--cc=peng.fan@nxp.com \
--cc=rv@rasmusvillemoes.dk \
--cc=stefan.roese@mailbox.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=u-boot@lists.u-boot-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox