mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: microchip: Save the periodic output flags and index
@ 2026-09-14  8:33 Bastien Curutchet (Schneider Electric)
  2026-09-16  8:35 ` netdev-bot+sashiko
  2026-09-17 12:41 ` Paolo Abeni
  0 siblings, 2 replies; 3+ messages in thread
From: Bastien Curutchet (Schneider Electric) @ 2026-09-14  8:33 UTC (permalink / raw)
  To: Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Richard Cochran, Christian Eggers, Arun Ramadoss
  Cc: Pascal Eberhard, Miquèl Raynal, Thomas Petazzoni, netdev,
	linux-kernel, stable, Bastien Curutchet (Schneider Electric)

When the periodic output is restarted, the request flags and index are
always set to 0. So if a pin other than the first one was used, or if a
flag was set in the request that triggered the periodic output, it is
lost when the output is restarted.

Save the request's flags and index when the periodic output is
initialized.
Use the save flags and index when the periodic output is reset

Cc: stable@vger.kernel.org
Fixes: 1f12ae5b6760 ("net: dsa: microchip: ptp: add periodic output signal")
Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
---
 drivers/net/dsa/microchip/ksz_ptp.c | 6 ++++--
 drivers/net/dsa/microchip/ksz_ptp.h | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchip/ksz_ptp.c
index 39cc70d65900..4f924df9e32b 100644
--- a/drivers/net/dsa/microchip/ksz_ptp.c
+++ b/drivers/net/dsa/microchip/ksz_ptp.c
@@ -222,6 +222,8 @@ static int ksz_ptp_enable_perout(struct ksz_device *dev,
 		return 0;
 	}
 
+	ptp_data->perout_flags = request->flags;
+	ptp_data->perout_index = request->index;
 	ptp_data->perout_target_time_first.tv_sec  = request->start.sec;
 	ptp_data->perout_target_time_first.tv_nsec = request->start.nsec;
 
@@ -795,8 +797,8 @@ static int ksz_ptp_restart_perout(struct ksz_device *dev)
 	request.start.nsec = next.tv_nsec;
 	request.period.sec  = ptp_data->perout_period.tv_sec;
 	request.period.nsec = ptp_data->perout_period.tv_nsec;
-	request.index = 0;
-	request.flags = 0;
+	request.index = ptp_data->perout_index;
+	request.flags = ptp_data->perout_flags;
 
 	return ksz_ptp_enable_perout(dev, &request, 1);
 }
diff --git a/drivers/net/dsa/microchip/ksz_ptp.h b/drivers/net/dsa/microchip/ksz_ptp.h
index 7067ec9bd1e6..da6a2efb23d7 100644
--- a/drivers/net/dsa/microchip/ksz_ptp.h
+++ b/drivers/net/dsa/microchip/ksz_ptp.h
@@ -31,6 +31,8 @@ struct ksz_ptp_data {
 	enum ksz_ptp_tou_mode tou_mode;
 	struct timespec64 perout_target_time_first;  /* start of first pulse */
 	struct timespec64 perout_period;
+	unsigned int perout_flags;
+	unsigned int perout_index;
 };
 
 int ksz_ptp_clock_register(struct dsa_switch *ds);

---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260914-fix-perout-c8c972b89d7f

Best regards,
-- 
Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-17 12:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14  8:33 [PATCH net] net: dsa: microchip: Save the periodic output flags and index Bastien Curutchet (Schneider Electric)
2026-09-16  8:35 ` netdev-bot+sashiko
2026-09-17 12:41 ` Paolo Abeni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®