mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chintan Vankar <c-vankar@ti.com>
To: Jason Reeder <jreeder@ti.com>, <vigneshr@ti.com>, <nm@ti.com>,
	"Chintan Vankar" <c-vankar@ti.com>,
	Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<srk@ti.com>, <s-vadapalli@ti.com>, <danishanwar@ti.com>,
	<m-malladi@ti.com>
Subject: [RFC PATCH 2/2] net: ethernet: ti: am65-cpts: Add support to configure GenF signal for CPTS
Date: Wed, 5 Feb 2025 21:31:19 +0530	[thread overview]
Message-ID: <20250205160119.136639-3-c-vankar@ti.com> (raw)
In-Reply-To: <20250205160119.136639-1-c-vankar@ti.com>

Add support to configure GenFx (periodic signal generator) function which
can be used by Timesync Interrupt Router to map it with CPTS_HWy_TS_PUSH,
in order to generate timestamps at 1 second intervals. This configuration
is optional for CPTS module.

Signed-off-by: Chintan Vankar <c-vankar@ti.com>
---
 drivers/net/ethernet/ti/am65-cpts.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/net/ethernet/ti/am65-cpts.c b/drivers/net/ethernet/ti/am65-cpts.c
index 59d6ab989c55..c32e6c60561d 100644
--- a/drivers/net/ethernet/ti/am65-cpts.c
+++ b/drivers/net/ethernet/ti/am65-cpts.c
@@ -171,6 +171,7 @@ struct am65_cpts {
 	u32 genf_num;
 	u32 ts_add_val;
 	int irq;
+	int genf_irq;
 	struct mutex ptp_clk_lock; /* PHC access sync */
 	u64 timestamp;
 	u32 genf_enable;
@@ -409,6 +410,11 @@ static irqreturn_t am65_cpts_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+static irqreturn_t am65_cpts_genf_interrupt(int irq, void *dev_id)
+{
+	return IRQ_HANDLED;
+}
+
 /* PTP clock operations */
 static int am65_cpts_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
 {
@@ -1216,6 +1222,21 @@ struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs,
 		goto reset_ptpclk;
 	}
 
+	/*
+	 * This API is used by Timesync Router's driver code to map
+	 * GenFx output of CPTS module with HWx_TS_PUSH input to generate PPS
+	 * signal.
+	 */
+	cpts->genf_irq = of_irq_get_byname(node, "genf");
+	if (cpts->genf_irq > 0) {
+		ret = devm_request_threaded_irq(dev, cpts->genf_irq, NULL,
+						am65_cpts_genf_interrupt,
+						0, dev_name(dev), cpts);
+		if (ret < 0)
+			dev_dbg(cpts->dev, "GENF output will not be routed via Time Sync Interrupt Router
+				%d\n", ret);
+	}
+
 	dev_info(dev, "CPTS ver 0x%08x, freq:%u, add_val:%u pps:%d\n",
 		 am65_cpts_read32(cpts, idver),
 		 cpts->refclk_freq, cpts->ts_add_val, cpts->pps_present);
-- 
2.34.1


  parent reply	other threads:[~2025-02-05 16:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 16:01 [RFC PATCH 0/2] Add support for Timesync Interrupt Router Chintan Vankar
2025-02-05 16:01 ` [RFC PATCH 1/2] irqchip: ti-tsir: " Chintan Vankar
2025-02-06 17:39   ` Simon Horman
2025-02-06 21:28   ` Thomas Gleixner
2025-02-09  8:36     ` Vankar, Chintan
2025-02-10 20:03       ` Thomas Gleixner
2025-02-13 18:45         ` Vankar, Chintan
2025-02-13 22:43           ` Thomas Gleixner
2025-02-15 11:49             ` Chintan Vankar
2025-02-17 20:17               ` Thomas Gleixner
2025-02-19 19:35                 ` Vankar, Chintan
2025-02-05 16:01 ` Chintan Vankar [this message]
2025-02-06  5:13 ` [RFC PATCH 0/2] " Vignesh Raghavendra
2025-02-06  6:18   ` Chintan Vankar

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=20250205160119.136639-3-c-vankar@ti.com \
    --to=c-vankar@ti.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jreeder@ti.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m-malladi@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=pabeni@redhat.com \
    --cc=s-vadapalli@ti.com \
    --cc=srk@ti.com \
    --cc=tglx@linutronix.de \
    --cc=vigneshr@ti.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®