mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bastien Curutchet (Schneider Electric)" <bastien.curutchet@bootlin.com>
To: Woojung Huh <woojung.huh@microchip.com>,
	UNGLinuxDriver@microchip.com,  Andrew Lunn <andrew@lunn.ch>,
	Vladimir Oltean <olteanv@gmail.com>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	 Richard Cochran <richardcochran@gmail.com>,
	 Christian Eggers <ceggers@arri.de>,
	 Arun Ramadoss <arun.ramadoss@microchip.com>
Cc: "Pascal Eberhard" <pascal.eberhard@se.com>,
	"Miquèl Raynal" <miquel.raynal@bootlin.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org,
	"Bastien Curutchet (Schneider Electric)"
	<bastien.curutchet@bootlin.com>
Subject: [PATCH net] net: dsa: microchip: Save the periodic output flags and index
Date: Mon, 14 Sep 2026 10:33:51 +0200	[thread overview]
Message-ID: <20260914-fix-perout-v1-1-9f45531a7585@bootlin.com> (raw)

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>


             reply	other threads:[~2026-09-14  8:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14  8:33 Bastien Curutchet (Schneider Electric) [this message]
2026-09-16  8:35 ` netdev-bot+sashiko
2026-09-17 12:41 ` Paolo Abeni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260914-fix-perout-v1-1-9f45531a7585@bootlin.com \
    --to=bastien.curutchet@bootlin.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=arun.ramadoss@microchip.com \
    --cc=ceggers@arri.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=pascal.eberhard@se.com \
    --cc=richardcochran@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=woojung.huh@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®