mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v7 0/7] ptp: fix OCP routes and SJA1105 pin direction
@ 2026-11-27 19:22 Ahmad Byagowi
  2026-11-27 19:22 ` [PATCH net v7 1/7] net: dsa: sja1105: keep pin function on EXTTS disable Ahmad Byagowi
  2026-11-27 19:22 ` [PATCH net v7 2/7] net: dsa: sja1105: keep pin function on PEROUT disable Ahmad Byagowi
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Byagowi @ 2026-11-27 19:22 UTC (permalink / raw)
  To: netdev
  Cc: andrew+netdev, arkadiusz.kubalewski, davem, edumazet, jiri,
	jonathan.lemon, kuba, linux-kernel, milena.olech, olteanv,
	pabeni, richardcochran, vadim.fedorenko

These driver fixes apply without the PTP-core series. The OCP detach
path and the shared-PPS shortcut are unchanged.

Changes since v6:
  - Drop patch 8. Removing OCP's early timestamp disable needs the core
    cleanup change and separate validation before it can be proposed.
  - Serialize OCP route changes across sysfs, PTP pin configuration
    and DPLL. Reject unrepresentable 10 MHz plus auxiliary routes
    without writing the mux. Document the selector encoding and the
    nominal-frequency readback rules, including ART.
  - Decode both input and output enable bits when binding configurable
    FB and ADVA pins. Leave fixed-direction boards unchanged.
  - Put SJA1105 PEROUT pin selection inside the existing enable block.
    Existing SJA1105 enable and timer lifecycle concerns are not part
    of these enable-only mux fixes.
  - Correct the disabled-selector explanation, align the author name,
    use contiguous trailers, and retain the DCF Reviewed-by on the
    unchanged code.

Validation (local fixtures): strict PTP and SJA1105 PTP builds on x86_64
and i386, allmodconfig and allyesconfig. Source-derived tests exercise
serialized selector changes, nominal-frequency readback, rejected and
accepted 10 MHz requests, 768 rebind states and SJA1105 pin behavior.
No physical card or switch test was performed.

Coding-assistant support was used to review the reports, refine the
SMA changes and tests, and prepare changelogs.

v6: https://lore.kernel.org/r/20261126-timecard-driver-v6-0-ahmadexp@gmail.com/

Ahmad Byagowi (7):
  net: dsa: sja1105: keep pin function on EXTTS disable
  net: dsa: sja1105: keep pin function on PEROUT disable
  ptp: ocp: preserve timestamp routes on DPLL frequency changes
  ptp: ocp: recover SMA direction from both enable bits on bind
  ptp: ocp: report disabled SMA inputs as zero Hz
  ptp: ocp: correct the DCF output frequency
  ptp: ocp: match ART DPLL frequencies to selectors

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

* [PATCH net v7 1/7] net: dsa: sja1105: keep pin function on EXTTS disable
  2026-11-27 19:22 [PATCH net v7 0/7] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
@ 2026-11-27 19:22 ` Ahmad Byagowi
  2026-11-27 19:22 ` [PATCH net v7 2/7] net: dsa: sja1105: keep pin function on PEROUT disable Ahmad Byagowi
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Byagowi @ 2026-11-27 19:22 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, linux-kernel, olteanv, pabeni,
	richardcochran

An EXTTS disable request programs the shared PTP_CLK pin as an input
even if the pin is driving periodic output. Select input mode only
when enabling EXTTS. Keep the existing disable and timer drain.

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@gmail.com>
---
 drivers/net/dsa/sja1105/sja1105_ptp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dsa/sja1105/sja1105_ptp.c b/drivers/net/dsa/sja1105/sja1105_ptp.c
index 350f958dcb2a..da35805152e0 100644
--- a/drivers/net/dsa/sja1105/sja1105_ptp.c
+++ b/drivers/net/dsa/sja1105/sja1105_ptp.c
@@ -816,9 +816,11 @@ static int sja1105_extts_enable(struct sja1105_private *priv,
 	    (extts->flags & PTP_EXTTS_EDGES) != PTP_EXTTS_EDGES)
 		return -EOPNOTSUPP;
 
-	rc = sja1105_change_ptp_clk_pin_func(priv, PTP_PF_EXTTS);
-	if (rc)
-		return rc;
+	if (on) {
+		rc = sja1105_change_ptp_clk_pin_func(priv, PTP_PF_EXTTS);
+		if (rc)
+			return rc;
+	}
 
 	priv->ptp_data.extts_enabled = on;
 

base-commit: 4392bb809812ac79449cd0cf1f5e00469ee102d1
-- 
2.54.0 (Apple Git-157)


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

* [PATCH net v7 2/7] net: dsa: sja1105: keep pin function on PEROUT disable
  2026-11-27 19:22 [PATCH net v7 0/7] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
  2026-11-27 19:22 ` [PATCH net v7 1/7] net: dsa: sja1105: keep pin function on EXTTS disable Ahmad Byagowi
@ 2026-11-27 19:22 ` Ahmad Byagowi
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Byagowi @ 2026-11-27 19:22 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, linux-kernel, olteanv, pabeni,
	richardcochran

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@gmail.com>
---
 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)


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

end of thread, other threads:[~2026-11-27 19:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27 19:22 [PATCH net v7 0/7] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
2026-11-27 19:22 ` [PATCH net v7 1/7] net: dsa: sja1105: keep pin function on EXTTS disable Ahmad Byagowi
2026-11-27 19:22 ` [PATCH net v7 2/7] net: dsa: sja1105: keep pin function on PEROUT disable Ahmad Byagowi

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®