[PATCH net v7 2/7] net: dsa: sja1105: keep pin function on PEROUT disable
From: Ahmad Byagowi
Date: Fri Nov 27 2026 - 14:23:24 EST
Stopping periodic output currently switches the shared PTP_CLK pin
to output even if it is configured for EXTTS. Only select output
mode when starting the generator. Keep the existing stop command.
Developed with coding-assistant support during review and validation.
Fixes: 747e5eb31d59 ("net: dsa: sja1105: configure the PTP_CLK pin as EXT_TS or PER_OUT")
Signed-off-by: Ahmad Byagowi <ahmadexp@xxxxxxxxx>
---
drivers/net/dsa/sja1105/sja1105_ptp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/sja1105/sja1105_ptp.c b/drivers/net/dsa/sja1105/sja1105_ptp.c
index da35805152e0..5d69d083f5ec 100644
--- a/drivers/net/dsa/sja1105/sja1105_ptp.c
+++ b/drivers/net/dsa/sja1105/sja1105_ptp.c
@@ -733,10 +733,6 @@ static int sja1105_per_out_enable(struct sja1105_private *priv,
mutex_lock(&ptp_data->lock);
- rc = sja1105_change_ptp_clk_pin_func(priv, PTP_PF_PEROUT);
- if (rc)
- goto out;
-
if (on) {
struct timespec64 pin_duration_ts = {
.tv_sec = perout->period.sec,
@@ -751,6 +747,10 @@ static int sja1105_per_out_enable(struct sja1105_private *priv,
u32 pin_duration32;
u64 now;
+ rc = sja1105_change_ptp_clk_pin_func(priv, PTP_PF_PEROUT);
+ if (rc)
+ goto out;
+
/* ptppindur: 32 bit register which holds the interval between
* 2 edges on PTP_CLK. So check for truncation which happens
* at periods larger than around 68.7 seconds.
--
2.54.0 (Apple Git-157)