lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220210084335.1979778-3-jian.jiang@nxp.com>
Date:   Thu, 10 Feb 2022 16:43:34 +0800
From:   Kane Jiang <jian.jiang@....com>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Shawn Guo <shawnguo@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        NXP Linux Team <linux-imx@....com>,
        Steve Longerbeam <slongerbeam@...il.com>,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        Rob Herring <robh+dt@...nel.org>, devicetree@...r.kernel.org
Cc:     Kane Jiang <jian.jiang@....com>
Subject: [PATCH 2/3] Change to cyclecounter for GPT input capture. Add support for i.MX8MM.

Modify the timestamp to cyclecounter in i.MX GPT driver
for input capture function.
Add compatible support for NXP i.MX8MM chip in driver.

Signed-off-by: Kane Jiang <jian.jiang@....com>
---
 drivers/clocksource/timer-imx-gpt.c | 11 +++++++----
 include/linux/mxc_icap.h            |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c
index c6aa1462e441..816bf4e123c3 100644
--- a/drivers/clocksource/timer-imx-gpt.c
+++ b/drivers/clocksource/timer-imx-gpt.c
@@ -417,22 +417,23 @@ static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)
 
 	for (i = 0; i < 2; i++) {
 		struct icap_channel *ic = &icap_channel[i];
-		ktime_t timestamp;
+		u64 cyclecounter;
 
 		if (!imxtm->gpt->gpt_is_ic_irq(ic, tstat))
 			continue;
 
 		imxtm->gpt->gpt_ic_irq_acknowledge(ic);
 
-		timestamp = ns_to_ktime(timecounter_read(&ic->tc));
+		cyclecounter = ic->cc.read(&ic->cc);
 
 		if (ic->handler)
-			ic->handler(ic->chan, ic->dev_id, timestamp);
+			ic->handler(ic->chan, ic->dev_id, cyclecounter);
 	}
 
 	if (imxtm->gpt->gpt_is_oc_irq(imxtm, tstat)) {
 		imxtm->gpt->gpt_oc_irq_acknowledge(imxtm);
-		ced->event_handler(ced);
+		if (ced->event_handler)
+			ced->event_handler(ced);
 	}
 
 	return IRQ_HANDLED;
@@ -802,6 +803,7 @@ static const struct of_device_id timer_of_match[] = {
 	{ .compatible = "fsl,imx6dl-gpt" },
 	{ .compatible = "fsl,imx6sl-gpt" },
 	{ .compatible = "fsl,imx6sx-gpt" },
+	{ .compatible = "fsl,imx8mm-gpt" },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, timer_of_match);
@@ -901,3 +903,4 @@ TIMER_OF_DECLARE(imx6q_timer, "fsl,imx6q-gpt", imx31_timer_init_dt);
 TIMER_OF_DECLARE(imx6dl_timer, "fsl,imx6dl-gpt", imx6dl_timer_init_dt);
 TIMER_OF_DECLARE(imx6sl_timer, "fsl,imx6sl-gpt", imx6dl_timer_init_dt);
 TIMER_OF_DECLARE(imx6sx_timer, "fsl,imx6sx-gpt", imx6dl_timer_init_dt);
+TIMER_OF_DECLARE(imx8mm_timer, "fsl,imx8mm-gpt", imx6dl_timer_init_dt);
diff --git a/include/linux/mxc_icap.h b/include/linux/mxc_icap.h
index fa5ffdf3b589..292c15b6b028 100644
--- a/include/linux/mxc_icap.h
+++ b/include/linux/mxc_icap.h
@@ -7,7 +7,7 @@
 #ifndef __MXC_ICAP_H__
 #define __MXC_ICAP_H__
 
-typedef void (*mxc_icap_handler_t)(int, void *, ktime_t);
+typedef void (*mxc_icap_handler_t)(int, void *, u64);
 
 int mxc_request_input_capture(unsigned int chan, mxc_icap_handler_t handler,
 			      unsigned long capflags, void *dev_id);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ