From: sashiko-bot@kernel.org
To: "Andreas Kemnade" <andreas@kemnade.info>
Cc: imx@lists.linux.dev, devicetree@vger.kernel.org, robh@kernel.org,
conor+dt@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH 2/3] timer-imx-gpt: Allow 32K clock to be used as a clock source
Date: Mon, 23 Nov 2026 20:45:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-230020@kernel.org> (raw)
In-Reply-To: <20261123-imx6-idlestop-v1-2-e32f1f44e46f@kemnade.info>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] clocksource/drivers/imx-gpt: 0xff min_delta in
mxc_clockevent_init() at 32kHz
--
commit 0ecf0128c84aa5f3ec6bfdf07afd50c02de8f373
Author: Andreas Kemnade <andreas@kemnade.info>
timer-imx-gpt: Allow 32K clock to be used as a clock source
This commit configures the i.MX GPT TCTL register to select the 32 kHz
clock and enable stop mode when the peripheral clock runs at 32768 Hz.
> diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c
> index 8335bd7f8c6ce..3c023da565564 100644
> --- a/drivers/clocksource/timer-imx-gpt.c
> +++ b/drivers/clocksource/timer-imx-gpt.c
[ ... ]
> @@ -314,14 +316,19 @@ static void imx6dl_gpt_setup_tctl(struct imx_timer *imxtm)
> u32 tctl_val;
>
> tctl_val = V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN;
> - if (clk_get_rate(imxtm->clk_per) == V2_TIMER_RATE_OSC_DIV8) {
> + if (clk_get_rate(imxtm->clk_per) == V2_TIMER_RATE_OSC_DIV8) {
> tctl_val |= V2_TCTL_CLK_OSC_DIV8;
> /* 24 / 8 = 3 MHz */
> writel_relaxed(7 << V2_TPRER_PRE24M, imxtm->base + MXC_TPRER);
> tctl_val |= V2_TCTL_24MEN;
> - } else {
> + } else if (clk_get_rate(imxtm->clk_per) == 32768)
> + /*
> + * if powered by that always on clock, it is feasible to let
> + * it run in stop mode, too, allowing lower idle states
> + */
> + tctl_val |= V2_TCTL_CLK_32K | V2_TCTL_STOPEN;
> + else
> tctl_val |= V2_TCTL_CLK_PER;
> - }
>
> writel_relaxed(tctl_val, imxtm->base + MXC_TCTL);
> }
[Severity: High]
Does running clk_per at 32768 Hz leave the hardcoded 0xff min_delta in
mxc_clockevent_init() too large?
drivers/clocksource/timer-imx-gpt.c:mxc_clockevent_init() {
...
clockevents_config_and_register(ced, clk_get_rate(imxtm->clk_per),
0xff, 0xfffffffe);
...
}
At 32768 Hz, 255 ticks sets min_delta_ns to ~7.78 ms, so
clockevents_program_event() clamps every shorter hrtimer and scheduler
tick (such as HZ=250 or HZ=1000) to ~7.78 ms (~128.5 Hz).
In addition, mxc_clocksource_init() unconditionally calls
register_current_timer_delay() with freq = 32768, which fails with a
pr_err() in arch/arm/lib/delay.c because a 30517 ns tick exceeds the
1000 ns resolution limit, falling back to jiffies-based calibrate_delay()
while jiffies are advancing at the clamped ~128.5 Hz rate and
miscalibrating loops_per_jiffy.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-imx6-idlestop-v1-0-e32f1f44e46f@kemnade.info?part=2
next prev parent reply other threads:[~2026-11-23 20:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 20:31 [PATCH RFC 0/3] ARM: imx: Add a more agressive idle mode on i.MX6SLL Andreas Kemnade
2026-11-23 20:31 ` [PATCH RFC 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit Andreas Kemnade
2026-11-23 20:49 ` sashiko-bot
2026-11-23 20:31 ` [PATCH 2/3] timer-imx-gpt: Allow 32K clock to be used as a clock source Andreas Kemnade
2026-11-23 20:45 ` sashiko-bot [this message]
2026-11-23 20:31 ` [PATCH 3/3] ARM: dts: imx: kobo-clarahd: Use 32K clock for the timer Andreas Kemnade
2026-11-23 20:59 ` sashiko-bot
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=sashiko-outbox-230020@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=andreas@kemnade.info \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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