@@ -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);
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(+)