summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
diff options
context:
space:
mode:
authorJohannes Zink <j.zink@pengutronix.de>2023-10-18 09:09:56 +0200
committerPaolo Abeni <pabeni@redhat.com>2023-10-19 13:01:33 +0200
commit7d3077482578fcc6eef6faeef7b8174fd32b7619 (patch)
tree77545588a0efce69eca32dbf5f151fbeb507dcc3 /drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
parent1dbfe73bd648bdc3a2d8c9e5b23ae70e3333b592 (diff)
net: stmmac: ptp: stmmac_enable(): move change of plat->flags into mutex
This is a preparation patch. The next patch will check if an external TS is active and return with an error. So we have to move the change of the plat->flags that tracks if external timestamping is enabled after that check. Prepare for this change and move the plat->flags change into the mutex and the if (on). Signed-off-by: Johannes Zink <j.zink@pengutronix.de> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 300e673d2a36..6b639b62f778 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -192,17 +192,17 @@ static int stmmac_enable(struct ptp_clock_info *ptp,
write_unlock_irqrestore(&priv->ptp_lock, flags);
break;
case PTP_CLK_REQ_EXTTS:
- if (on)
- priv->plat->flags |= STMMAC_FLAG_EXT_SNAPSHOT_EN;
- else
- priv->plat->flags &= ~STMMAC_FLAG_EXT_SNAPSHOT_EN;
mutex_lock(&priv->aux_ts_lock);
acr_value = readl(ptpaddr + PTP_ACR);
acr_value &= ~PTP_ACR_MASK;
if (on) {
+ priv->plat->flags |= STMMAC_FLAG_EXT_SNAPSHOT_EN;
+
/* Enable External snapshot trigger */
acr_value |= PTP_ACR_ATSEN(rq->extts.index);
acr_value |= PTP_ACR_ATSFC;
+ } else {
+ priv->plat->flags &= ~STMMAC_FLAG_EXT_SNAPSHOT_EN;
}
netdev_dbg(priv->dev, "Auxiliary Snapshot %d %s.\n",
rq->extts.index, on ? "enabled" : "disabled");