diff mbox series

[RFC,2/2] net: ethernet: ti: am65-cpts: Add support to configure GenF signal for CPTS

Message ID 20250205160119.136639-3-c-vankar@ti.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series Add support for Timesync Interrupt Router | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: line length of 105 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Chintan Vankar Feb. 5, 2025, 4:01 p.m. UTC
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 mbox series

Patch

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);