From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: daniel.lezcano@linaro.org, tglx@linutronix.de,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de,
kernel@pengutronix.de, linux-imx@nxp.com
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 2/2] clocksource: timer-imx-sysctr: support i.MX95
Date: Mon, 22 Jan 2024 17:22:25 +0800 [thread overview]
Message-ID: <20240122092225.2083191-2-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20240122092225.2083191-1-peng.fan@oss.nxp.com>
From: Peng Fan <peng.fan@nxp.com>
To i.MX95 System counter module, we use Read register space to get
the counter, not the Control register space to get the counter, because
System Manager firmware not allow Linux to read Control register space.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/clocksource/timer-imx-sysctr.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c
index 5a7a951c4efc..3d3bc16388ed 100644
--- a/drivers/clocksource/timer-imx-sysctr.c
+++ b/drivers/clocksource/timer-imx-sysctr.c
@@ -8,9 +8,12 @@
#include "timer-of.h"
#define CMP_OFFSET 0x10000
+#define RD_OFFSET 0x20000
#define CNTCV_LO 0x8
#define CNTCV_HI 0xc
+#define CNTCV_LO_IMX95 (RD_OFFSET + 0x8)
+#define CNTCV_HI_IMX95 (RD_OFFSET + 0xc)
#define CMPCV_LO (CMP_OFFSET + 0x20)
#define CMPCV_HI (CMP_OFFSET + 0x24)
#define CMPCR (CMP_OFFSET + 0x2c)
@@ -22,6 +25,8 @@
static void __iomem *sys_ctr_base __ro_after_init;
static u32 cmpcr __ro_after_init;
+static u32 cntcv_hi = CNTCV_HI;
+static u32 cntcv_lo = CNTCV_LO;
static void sysctr_timer_enable(bool enable)
{
@@ -43,9 +48,9 @@ static inline u64 sysctr_read_counter(void)
u32 cnt_hi, tmp_hi, cnt_lo;
do {
- cnt_hi = readl_relaxed(sys_ctr_base + CNTCV_HI);
- cnt_lo = readl_relaxed(sys_ctr_base + CNTCV_LO);
- tmp_hi = readl_relaxed(sys_ctr_base + CNTCV_HI);
+ cnt_hi = readl_relaxed(sys_ctr_base + cntcv_hi);
+ cnt_lo = readl_relaxed(sys_ctr_base + cntcv_lo);
+ tmp_hi = readl_relaxed(sys_ctr_base + cntcv_hi);
} while (tmp_hi != cnt_hi);
return ((u64) cnt_hi << 32) | cnt_lo;
@@ -139,6 +144,11 @@ static int __init sysctr_timer_init(struct device_node *np)
to_sysctr.of_clk.rate /= SYS_CTR_CLK_DIV;
}
+ if (of_device_is_compatible(np, "nxp,imx95-sysctr-timer")) {
+ cntcv_hi = CNTCV_HI_IMX95;
+ cntcv_lo = CNTCV_LO_IMX95;
+ }
+
sys_ctr_base = timer_of_base(&to_sysctr);
cmpcr = readl(sys_ctr_base + CMPCR);
cmpcr &= ~SYS_CTR_EN;
--
2.37.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-01-22 9:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 9:22 [PATCH 1/2] dt-bindings: timer: nxp,sysctr-timer: support i.MX95 Peng Fan (OSS)
2024-01-22 9:22 ` Peng Fan (OSS) [this message]
2024-01-23 9:52 ` [PATCH 2/2] clocksource: timer-imx-sysctr: " Marco Felsch
2024-01-22 18:08 ` [PATCH 1/2] dt-bindings: timer: nxp,sysctr-timer: " Conor Dooley
2024-01-23 20:50 ` Rob Herring
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=20240122092225.2083191-2-peng.fan@oss.nxp.com \
--to=peng.fan@oss.nxp.com \
--cc=conor+dt@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=kernel@pengutronix.de \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=tglx@linutronix.de \
/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