mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Jacky Bai" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: stable@vger.kernel.org, Jacky Bai <ping.bai@nxp.com>,
	Peng Fan <peng.fan@nxp.com>, Ye Li <ye.li@nxp.com>,
	Jason Liu <jason.hui.liu@nxp.com>, Frank Li <Frank.Li@nxp.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/urgent] clocksource/drivers/imx-tpm: Fix next event not taking effect sometime
Date: Mon, 02 Sep 2024 10:02:39 -0000	[thread overview]
Message-ID: <172527135957.2215.13837921315515857683.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20240725193355.1436005-2-Frank.Li@nxp.com>

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     3d5c2f8e75a55cfb11a85086c71996af0354a1fb
Gitweb:        https://git.kernel.org/tip/3d5c2f8e75a55cfb11a85086c71996af0354a1fb
Author:        Jacky Bai <ping.bai@nxp.com>
AuthorDate:    Thu, 25 Jul 2024 15:33:55 -04:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Mon, 02 Sep 2024 10:04:15 +02:00

clocksource/drivers/imx-tpm: Fix next event not taking effect sometime

The value written into the TPM CnV can only be updated into the hardware
when the counter increases. Additional writes to the CnV write buffer are
ignored until the register has been updated. Therefore, we need to check
if the CnV has been updated before continuing. This may require waiting for
1 counter cycle in the worst case.

Cc: stable@vger.kernel.org
Fixes: 059ab7b82eec ("clocksource/drivers/imx-tpm: Add imx tpm timer support")
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jason Liu <jason.hui.liu@nxp.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20240725193355.1436005-2-Frank.Li@nxp.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/timer-imx-tpm.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/clocksource/timer-imx-tpm.c b/drivers/clocksource/timer-imx-tpm.c
index cd23caf..92c025b 100644
--- a/drivers/clocksource/timer-imx-tpm.c
+++ b/drivers/clocksource/timer-imx-tpm.c
@@ -91,6 +91,14 @@ static int tpm_set_next_event(unsigned long delta,
 	now = tpm_read_counter();
 
 	/*
+	 * Need to wait CNT increase at least 1 cycle to make sure
+	 * the C0V has been updated into HW.
+	 */
+	if ((next & 0xffffffff) != readl(timer_base + TPM_C0V))
+		while (now == tpm_read_counter())
+			;
+
+	/*
 	 * NOTE: We observed in a very small probability, the bus fabric
 	 * contention between GPU and A7 may results a few cycles delay
 	 * of writing CNT registers which may cause the min_delta event got

  reply	other threads:[~2024-09-02 10:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-25 19:33 [PATCH 1/2] clocksource: imx-tpm: fix return -ETIME when delta exceeds INT_MAX Frank Li
2024-07-25 19:33 ` [PATCH 2/2] clocksource: imx-tpm: fix next event not taking effect sometime Frank Li
2024-09-02 10:02   ` tip-bot2 for Jacky Bai [this message]
2024-08-14 16:47 ` [PATCH 1/2] clocksource: imx-tpm: fix return -ETIME when delta exceeds INT_MAX Frank Li
2024-08-19 13:21 ` Daniel Lezcano
2024-08-19 18:43   ` Frank Li
2024-08-21  7:20     ` Jacky Bai (OSS)
2024-09-02  9:29 ` Daniel Lezcano
2024-09-02 10:02 ` [tip: timers/urgent] clocksource/drivers/imx-tpm: Fix " tip-bot2 for Jacky Bai

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=172527135957.2215.13837921315515857683.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=Frank.Li@nxp.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=jason.hui.liu@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=ping.bai@nxp.com \
    --cc=stable@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=ye.li@nxp.com \
    /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

all inboxes | Powered by JetHome®