Skip to content

Commit c0a1f3d

Browse files
WeiFang-NXPPaolo Abeni
authored andcommitted
net: fec: do not allow enabling PPS and PEROUT simultaneously
In the current driver, PPS and PEROUT use the same channel to generate the events, so they cannot be enabled at the same time. Otherwise, the later configuration will overwrite the earlier configuration. Therefore, when configuring PPS, the driver will check whether PEROUT is enabled. Similarly, when configuring PEROUT, the driver will check whether PPS is enabled. Fixes: 350749b ("net: fec: Add support for periodic output signal of PPS") Signed-off-by: Wei Fang <wei.fang@nxp.com> Link: https://patch.msgid.link/20251125085210.1094306-4-wei.fang@nxp.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent e97faa0 commit c0a1f3d

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/net/ethernet/freescale/fec_ptp.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable)
128128

129129
spin_lock_irqsave(&fep->tmreg_lock, flags);
130130

131+
if (fep->perout_enable) {
132+
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
133+
dev_err(&fep->pdev->dev, "PEROUT is running");
134+
return -EBUSY;
135+
}
136+
131137
if (fep->pps_enable == enable) {
132138
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
133139
return 0;
@@ -571,6 +577,12 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,
571577
}
572578
spin_lock_irqsave(&fep->tmreg_lock, flags);
573579

580+
if (fep->pps_enable) {
581+
dev_err(&fep->pdev->dev, "PPS is running");
582+
ret = -EBUSY;
583+
goto unlock;
584+
}
585+
574586
if (fep->perout_enable) {
575587
dev_err(&fep->pdev->dev,
576588
"PEROUT has been enabled\n");

0 commit comments

Comments
 (0)