mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v6 0/8] ptp: fix OCP routes and SJA1105 pin direction
@ 2026-11-26 16:42 Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 1/8] net: dsa: sja1105: keep pin function on EXTTS disable Ahmad Byagowi
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Ahmad Byagowi @ 2026-11-26 16:42 UTC (permalink / raw)
  To: netdev
  Cc: richardcochran, davem, edumazet, kuba, pabeni, vladimir.oltean,
	vadim.fedorenko, andrew, linux-kernel, arkadiusz.kubalewski,
	jiri, jonathan.lemon

This driver series contains the SJA1105 pin-direction fixes and OCP SMA/DPLL
corrections. It is separate from the PTP core series as requested in review.
The PTP core v6 series is a prerequisite; apply this series only after those
core changes. This series contains no ptp_chardev.c or ptp_sysfs.c changes.

Prerequisite PTP core series:
https://lore.kernel.org/r/20261126-timecard-core-v6-0-ahmadexp@gmail.com/

The teardown follow-up removes ptp_ocp's early timestamp-disable loop so the
new core unregister cleanup disables channels after user operations drain.
The existing shared-PPS map shortcut is unchanged. The DCF correction is
unchanged and retains Vadim's Reviewed-by tag; tags were not carried onto
patches changed in this revision.

Validation: strict x86_64 object build for the PTP core, OCP driver and
SJA1105 PTP object with W=1 KCFLAGS=-Werror; source-derived teardown and
sysfs/ioctl race tests; SMA routing, DPLL get/set and ART capability tests;
runtime mutations reject missing sysfs locks. Hardware register and IRQ
operations were stubbed. No physical card or switch was tested.

A coding assistant helped identify the issues, develop the fixes and
regression tests, and prepare changelog text.

Ahmad Byagowi (8):
  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: restore disabled SMA inputs when binding
  ptp: ocp: report disabled SMA inputs as zero Hz
  ptp: ocp: correct the DCF output frequency
  ptp: ocp: match ART DPLL frequencies to selectors
  ptp: ocp: defer timestamp shutdown to clock unregister

 drivers/net/dsa/sja1105/sja1105_ptp.c | 16 ++++--
 drivers/ptp/ptp_ocp.c                 | 83 ++++++++++++++++++++-------
 2 files changed, 71 insertions(+), 28 deletions(-)


base-commit: 4392bb809812ac79449cd0cf1f5e00469ee102d1
prerequisite-patch-id: 6bad78c955ada1724510b31a0276a3208ce76a5c
prerequisite-patch-id: dc638755165b24f907f718a498e20d4aa1c6190a
-- 
2.54.0 (Apple Git-157)


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

* [PATCH net v6 1/8] net: dsa: sja1105: keep pin function on EXTTS disable
  2026-11-26 16:42 [PATCH net v6 0/8] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
@ 2026-11-26 16:42 ` Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 2/8] net: dsa: sja1105: keep pin function on PEROUT disable Ahmad Byagowi
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ahmad Byagowi @ 2026-11-26 16:42 UTC (permalink / raw)
  To: netdev
  Cc: richardcochran, davem, edumazet, kuba, pabeni, vladimir.oltean,
	vadim.fedorenko, andrew, linux-kernel, arkadiusz.kubalewski,
	jiri, jonathan.lemon

From: ahmadexp <ahmadexp@gmail.com>

Disabling EXTTS currently selects PTP_PF_EXTTS, changing the shared PTP_CLK pin from periodic output to timestamp input. Only select the EXTTS function while enabling capture; disable continues to clear the state and synchronously stop the timer.

A coding assistant helped analyze the teardown side effect, develop the correction and source-derived regression test, and prepare this changelog. The test exercises the actual function with configuration writes stubbed.

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;
 
-- 
2.54.0 (Apple Git-157)


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

* [PATCH net v6 2/8] net: dsa: sja1105: keep pin function on PEROUT disable
  2026-11-26 16:42 [PATCH net v6 0/8] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 1/8] net: dsa: sja1105: keep pin function on EXTTS disable Ahmad Byagowi
@ 2026-11-26 16:42 ` Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 3/8] ptp: ocp: preserve timestamp routes on DPLL frequency changes Ahmad Byagowi
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ahmad Byagowi @ 2026-11-26 16:42 UTC (permalink / raw)
  To: netdev
  Cc: richardcochran, davem, edumazet, kuba, pabeni, vladimir.oltean,
	vadim.fedorenko, andrew, linux-kernel, arkadiusz.kubalewski,
	jiri, jonathan.lemon

From: ahmadexp <ahmadexp@gmail.com>

Disabling periodic output currently selects PTP_PF_PEROUT even when the shared PTP_CLK pin is configured for external timestamping. Only select the PEROUT function when enabling the output; disable should stop the generator without reprogramming the pin.

A coding assistant helped identify this related pin-direction side effect, develop the correction and regression test, and prepare this changelog. The source-derived test checks the actual callback behavior with configuration writes stubbed.

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 da35805152e0..7c07f76caccf 100644
--- a/drivers/net/dsa/sja1105/sja1105_ptp.c
+++ b/drivers/net/dsa/sja1105/sja1105_ptp.c
@@ -733,9 +733,11 @@ 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) {
+		rc = sja1105_change_ptp_clk_pin_func(priv, PTP_PF_PEROUT);
+		if (rc)
+			goto out;
+	}
 
 	if (on) {
 		struct timespec64 pin_duration_ts = {
-- 
2.54.0 (Apple Git-157)


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

* [PATCH net v6 3/8] ptp: ocp: preserve timestamp routes on DPLL frequency changes
  2026-11-26 16:42 [PATCH net v6 0/8] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 1/8] net: dsa: sja1105: keep pin function on EXTTS disable Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 2/8] net: dsa: sja1105: keep pin function on PEROUT disable Ahmad Byagowi
@ 2026-11-26 16:42 ` Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 4/8] ptp: ocp: restore disabled SMA inputs when binding Ahmad Byagowi
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ahmad Byagowi @ 2026-11-26 16:42 UTC (permalink / raw)
  To: netdev
  Cc: richardcochran, davem, edumazet, kuba, pabeni, vladimir.oltean,
	vadim.fedorenko, andrew, linux-kernel, arkadiusz.kubalewski,
	jiri, jonathan.lemon

From: ahmadexp <ahmadexp@gmail.com>

DPLL frequency changes on a combined SMA input currently replace its complete selector value. This silently removes timestamp or counter destinations configured through the SMA sysfs interface.

When changing an input frequency, retain selector bits for destinations that do not define a frequency. Preserve the existing output path and continue to clear disabled inputs. This keeps the timestamp route while changing the frequency-bearing source.

A coding assistant helped identify the route-loss issue, develop the fix and regression test, and prepare this changelog. The test uses the actual selector and DPLL functions with instrumented register access.

Fixes: 09eeb3aecc6c ("ptp_ocp: implement DPLL ops")
Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>
---
 drivers/ptp/ptp_ocp.c | 47 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 42 insertions(+), 5 deletions(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 625a85b2dc7e..284908c6abc2 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -5873,16 +5873,31 @@ static int ptp_ocp_dpll_frequency_set(const struct dpll_pin *pin,
 	struct ptp_ocp_sma_connector *sma = pin_priv;
 	struct ptp_ocp *bp = dpll_priv;
 	const struct ocp_selector *tbl;
+	u32 val, aux = 0;
 	int sma_nr = (sma - bp->sma);
-	int i;
+	int i, j;
 
 	if (sma->fixed_fcn)
 		return -EOPNOTSUPP;
 
 	tbl = bp->sma_op->tbl[sma->mode];
-	for (i = 0; tbl[i].name; i++)
-		if (tbl[i].frequency == frequency)
-			return ptp_ocp_sma_store_val(bp, i, sma->mode, sma_nr + 1);
+	for (i = 0; tbl[i].name; i++) {
+		if (tbl[i].frequency != frequency)
+			continue;
+
+		if (sma->mode == SMA_MODE_IN) {
+			val = bp->sma_op->get(bp, sma_nr + 1) & SMA_SELECT_MASK;
+			if (sma->disabled)
+				val = 0;
+
+			for (j = 0; tbl[j].name; j++) {
+				if (!tbl[j].frequency && (val & tbl[j].value))
+					aux |= tbl[j].value;
+			}
+		}
+		return ptp_ocp_sma_store_val(bp, tbl[i].value | aux,
+					     sma->mode, sma_nr + 1);
+	}
 	return -EINVAL;
 }
 
@@ -5900,6 +5915,7 @@ static int ptp_ocp_dpll_frequency_get(const struct dpll_pin *pin,
 	int i;
 
 	val = bp->sma_op->get(bp, sma_nr + 1);
+	val &= SMA_SELECT_MASK;
 	tbl = bp->sma_op->tbl[sma->mode];
 	for (i = 0; tbl[i].name; i++)
 		if (val == tbl[i].value) {
@@ -5907,7 +5923,28 @@ static int ptp_ocp_dpll_frequency_get(const struct dpll_pin *pin,
 			return 0;
 		}
 
-	return -EINVAL;
+	if (sma->mode == SMA_MODE_OUT)
+		return -EINVAL;
+
+	/* Inputs can feed several destinations, including timestampers. */
+	*frequency = 0;
+	for (i = 0; tbl[i].name; i++) {
+		if (!(val & tbl[i].value))
+			continue;
+		val &= ~tbl[i].value;
+		if (!tbl[i].frequency)
+			continue;
+		if (*frequency && *frequency != tbl[i].frequency) {
+			*frequency = 0;
+			return 0;
+		}
+		*frequency = tbl[i].frequency;
+	}
+	/* Unknown destinations do not establish a frequency either. */
+	if (val)
+		*frequency = 0;
+
+	return 0;
 }
 
 static const struct dpll_device_ops dpll_ops = {
-- 
2.54.0 (Apple Git-157)


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

* [PATCH net v6 4/8] ptp: ocp: restore disabled SMA inputs when binding
  2026-11-26 16:42 [PATCH net v6 0/8] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
                   ` (2 preceding siblings ...)
  2026-11-26 16:42 ` [PATCH net v6 3/8] ptp: ocp: preserve timestamp routes on DPLL frequency changes Ahmad Byagowi
@ 2026-11-26 16:42 ` Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 5/8] ptp: ocp: report disabled SMA inputs as zero Hz Ahmad Byagowi
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ahmad Byagowi @ 2026-11-26 16:42 UTC (permalink / raw)
  To: netdev
  Cc: richardcochran, davem, edumazet, kuba, pabeni, vladimir.oltean,
	vadim.fedorenko, andrew, linux-kernel, arkadiusz.kubalewski,
	jiri, jonathan.lemon

From: ahmadexp <ahmadexp@gmail.com>

The SMA disable state is stored in software and is lost when the driver is unbound. The hardware selector may therefore route an input after a rebind even though userspace had disabled it.

Apply the disabled state during SMA initialization so the hardware mux and software state agree after binding. This fix is independent of DPLL reporting.

A coding assistant helped validate the rebind behavior and prepare the source-derived regression test and changelog.

Fixes: b2c4f0ac53f3 ("ptp: ocp: Add ability to disable input selectors.")
Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>
---
 drivers/ptp/ptp_ocp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 284908c6abc2..aa18c5e5eba4 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -2932,6 +2932,14 @@ ptp_ocp_sma_fb_init(struct ptp_ocp *bp)
 		reg = ioread32(&bp->sma_map1->gpio2);
 		bp->sma[2].mode = reg & BIT(15) ? SMA_MODE_OUT : SMA_MODE_IN;
 		bp->sma[3].mode = reg & BIT(31) ? SMA_MODE_OUT : SMA_MODE_IN;
+
+		for (i = 0; i < OCP_SMA_NUM; i++) {
+			reg = ptp_ocp_sma_fb_get(bp, i + 1);
+			bp->sma[i].disabled = !(reg & SMA_ENABLE);
+			/* Both buffers disabled: report None. */
+			if (bp->sma[i].disabled)
+				bp->sma[i].mode = SMA_MODE_IN;
+		}
 	}
 }
 
-- 
2.54.0 (Apple Git-157)


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

* [PATCH net v6 5/8] ptp: ocp: report disabled SMA inputs as zero Hz
  2026-11-26 16:42 [PATCH net v6 0/8] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
                   ` (3 preceding siblings ...)
  2026-11-26 16:42 ` [PATCH net v6 4/8] ptp: ocp: restore disabled SMA inputs when binding Ahmad Byagowi
@ 2026-11-26 16:42 ` Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 6/8] ptp: ocp: correct the DCF output frequency Ahmad Byagowi
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ahmad Byagowi @ 2026-11-26 16:42 UTC (permalink / raw)
  To: netdev
  Cc: richardcochran, davem, edumazet, kuba, pabeni, vladimir.oltean,
	vadim.fedorenko, andrew, linux-kernel, arkadiusz.kubalewski,
	jiri, jonathan.lemon

From: ahmadexp <ahmadexp@gmail.com>

A disabled SMA input has no active signal and should report zero frequency through DPLL. The DPLL core reads the current frequency before applying a new value, so reporting the stale selector frequency can prevent a disabled input from being re-enabled.

Report zero for disabled input pins while leaving output and enabled-input reporting unchanged. This complements the separate initialization fix for preserving disabled state across rebind.

A coding assistant helped check the DPLL get-before-set behavior, develop the regression test and prepare this changelog.

Fixes: 09eeb3aecc6c ("ptp_ocp: implement DPLL ops")
Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>
---
 drivers/ptp/ptp_ocp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index aa18c5e5eba4..3457c351958d 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -5924,6 +5924,8 @@ static int ptp_ocp_dpll_frequency_get(const struct dpll_pin *pin,
 
 	val = bp->sma_op->get(bp, sma_nr + 1);
 	val &= SMA_SELECT_MASK;
+	if (sma->mode == SMA_MODE_IN && sma->disabled)
+		val = SMA_DISABLE;
 	tbl = bp->sma_op->tbl[sma->mode];
 	for (i = 0; tbl[i].name; i++)
 		if (val == tbl[i].value) {
-- 
2.54.0 (Apple Git-157)


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

* [PATCH net v6 6/8] ptp: ocp: correct the DCF output frequency
  2026-11-26 16:42 [PATCH net v6 0/8] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
                   ` (4 preceding siblings ...)
  2026-11-26 16:42 ` [PATCH net v6 5/8] ptp: ocp: report disabled SMA inputs as zero Hz Ahmad Byagowi
@ 2026-11-26 16:42 ` Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 7/8] ptp: ocp: match ART DPLL frequencies to selectors Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 8/8] ptp: ocp: defer timestamp shutdown to clock unregister Ahmad Byagowi
  7 siblings, 0 replies; 9+ messages in thread
From: Ahmad Byagowi @ 2026-11-26 16:42 UTC (permalink / raw)
  To: netdev
  Cc: richardcochran, davem, edumazet, kuba, pabeni, vladimir.oltean,
	vadim.fedorenko, andrew, linux-kernel, arkadiusz.kubalewski,
	jiri, jonathan.lemon

From: ahmadexp <ahmadexp@gmail.com>

The output selector table uses 77000 Hz for DCF, while the input table and DPLL frequency list use 77500 Hz. Requests for the advertised DCF77 output frequency consequently fail, and reading the output reports an unsupported frequency.

Use 77500 Hz for the DCF output selector.

A coding assistant helped identify and verify the selector mismatch and prepare the regression test and changelog.

Fixes: 09eeb3aecc6c ("ptp_ocp: implement DPLL ops")

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>
---
 drivers/ptp/ptp_ocp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 3457c351958d..6bfd5792768e 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -1373,7 +1373,7 @@ static const struct ocp_selector ptp_ocp_sma_out[] = {
 	{ .name = "GNSS1",	.value = 0x0004,  .frequency = 1 },
 	{ .name = "GNSS2",	.value = 0x0008,  .frequency = 1 },
 	{ .name = "IRIG",	.value = 0x0010,  .frequency = 10000 },
-	{ .name = "DCF",	.value = 0x0020,  .frequency = 77000 },
+	{ .name = "DCF",	.value = 0x0020,  .frequency = 77500 },
 	{ .name = "GEN1",	.value = 0x0040 },
 	{ .name = "GEN2",	.value = 0x0080 },
 	{ .name = "GEN3",	.value = 0x0100 },
-- 
2.54.0 (Apple Git-157)


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

* [PATCH net v6 7/8] ptp: ocp: match ART DPLL frequencies to selectors
  2026-11-26 16:42 [PATCH net v6 0/8] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
                   ` (5 preceding siblings ...)
  2026-11-26 16:42 ` [PATCH net v6 6/8] ptp: ocp: correct the DCF output frequency Ahmad Byagowi
@ 2026-11-26 16:42 ` Ahmad Byagowi
  2026-11-26 16:42 ` [PATCH net v6 8/8] ptp: ocp: defer timestamp shutdown to clock unregister Ahmad Byagowi
  7 siblings, 0 replies; 9+ messages in thread
From: Ahmad Byagowi @ 2026-11-26 16:42 UTC (permalink / raw)
  To: netdev
  Cc: richardcochran, davem, edumazet, kuba, pabeni, vladimir.oltean,
	vadim.fedorenko, andrew, linux-kernel, arkadiusz.kubalewski,
	jiri, jonathan.lemon

From: ahmadexp <ahmadexp@gmail.com>

The ART input selector named 10Mhz is recorded as 1 MHz, although the pin advertises 10 MHz. In addition, ART pins share a generic capability list that advertises IRIG-B and DCF77 frequencies which the ART selector tables cannot select.

Record the ART input as 10 MHz and give ART pins a supported-frequency list containing only 1 PPS and 10 MHz. This makes DPLL capability validation agree with the available selectors.

A coding assistant helped identify both capability mismatches, develop the source-derived regression tests and prepare this changelog. The tests use the actual ART accessors and DPLL validation with stubbed registers; no physical card was used.

Fixes: 09eeb3aecc6c ("ptp_ocp: implement DPLL ops")
Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>
---
 drivers/ptp/ptp_ocp.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 6bfd5792768e..040518895176 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -299,6 +299,11 @@ static struct dpll_pin_frequency ptp_ocp_sma_freq[] = {
 	DPLL_PIN_FREQUENCY_DCF77,
 };
 
+static struct dpll_pin_frequency ptp_ocp_art_sma_freq[] = {
+	DPLL_PIN_FREQUENCY_1PPS,
+	DPLL_PIN_FREQUENCY_10MHZ,
+};
+
 struct ptp_ocp_sma_connector {
 	enum	ptp_ocp_sma_mode mode;
 	bool	fixed_fcn;
@@ -1385,7 +1390,7 @@ static const struct ocp_selector ptp_ocp_sma_out[] = {
 
 static const struct ocp_selector ptp_ocp_art_sma_in[] = {
 	{ .name = "PPS1",	.value = 0x0001,  .frequency = 1 },
-	{ .name = "10Mhz",	.value = 0x0008,  .frequency = 1000000 },
+	{ .name = "10Mhz",	.value = 0x0008,  .frequency = 10000000 },
 	{ }
 };
 
@@ -3138,8 +3143,8 @@ ptp_ocp_art_sma_init(struct ptp_ocp *bp)
 		.board_label = NULL,
 		.type = DPLL_PIN_TYPE_EXT,
 		.capabilities = 0,
-		.freq_supported_num = ARRAY_SIZE(ptp_ocp_sma_freq),
-		.freq_supported = ptp_ocp_sma_freq,
+		.freq_supported_num = ARRAY_SIZE(ptp_ocp_art_sma_freq),
+		.freq_supported = ptp_ocp_art_sma_freq,
 
 	};
 	u32 reg;
-- 
2.54.0 (Apple Git-157)


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

* [PATCH net v6 8/8] ptp: ocp: defer timestamp shutdown to clock unregister
  2026-11-26 16:42 [PATCH net v6 0/8] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
                   ` (6 preceding siblings ...)
  2026-11-26 16:42 ` [PATCH net v6 7/8] ptp: ocp: match ART DPLL frequencies to selectors Ahmad Byagowi
@ 2026-11-26 16:42 ` Ahmad Byagowi
  7 siblings, 0 replies; 9+ messages in thread
From: Ahmad Byagowi @ 2026-11-26 16:42 UTC (permalink / raw)
  To: netdev
  Cc: richardcochran, davem, edumazet, kuba, pabeni, vladimir.oltean,
	vadim.fedorenko, andrew, linux-kernel, arkadiusz.kubalewski,
	jiri, jonathan.lemon

From: ahmadexp <ahmadexp@gmail.com>

ptp_ocp_detach() disables timestamp sources before ptp_clock_unregister() removes the user interfaces. An in-flight request can rearm a source after that early disable.

Rely on the PTP core unregister cleanup to disable timestamp channels after userspace operations have been removed and drained. Keep the shared PPS subscription-map shortcut unchanged. This driver patch depends on the separate PTP core teardown series.

A coding assistant helped trace the detach race, prepare this driver-side change and develop the combined teardown regression test. The test uses the actual callback and cleanup functions with register and IRQ operations stubbed.

Fixes: 627366c51145 ("ptp: ocp: fix resource freeing order")

Link: https://lore.kernel.org/r/179548551283.3135.17206659598806657887@kernel.org
Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>
---
 drivers/ptp/ptp_ocp.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 040518895176..27cf3ab3327c 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -5768,19 +5768,6 @@ ptp_ocp_detach(struct ptp_ocp *bp)
 	ptp_ocp_detach_sysfs(bp);
 	ptp_ocp_attr_group_del(bp);
 	timer_delete_sync(&bp->watchdog);
-	/* Disable interrupts on all timestampers */
-	if (bp->ts0)
-		ptp_ocp_ts_enable(bp->ts0, 0, false);
-	if (bp->ts1)
-		ptp_ocp_ts_enable(bp->ts1, 0, false);
-	if (bp->ts2)
-		ptp_ocp_ts_enable(bp->ts2, 0, false);
-	if (bp->ts3)
-		ptp_ocp_ts_enable(bp->ts3, 0, false);
-	if (bp->ts4)
-		ptp_ocp_ts_enable(bp->ts4, 0, false);
-	if (bp->pps)
-		ptp_ocp_ts_enable(bp->pps, ~0, false);
 	if (bp->ptp)
 		ptp_clock_unregister(bp->ptp);
 	kfree(bp->ptp_info.pin_config);
-- 
2.54.0 (Apple Git-157)


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

end of thread, other threads:[~2026-11-26 16:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26 16:42 [PATCH net v6 0/8] ptp: fix OCP routes and SJA1105 pin direction Ahmad Byagowi
2026-11-26 16:42 ` [PATCH net v6 1/8] net: dsa: sja1105: keep pin function on EXTTS disable Ahmad Byagowi
2026-11-26 16:42 ` [PATCH net v6 2/8] net: dsa: sja1105: keep pin function on PEROUT disable Ahmad Byagowi
2026-11-26 16:42 ` [PATCH net v6 3/8] ptp: ocp: preserve timestamp routes on DPLL frequency changes Ahmad Byagowi
2026-11-26 16:42 ` [PATCH net v6 4/8] ptp: ocp: restore disabled SMA inputs when binding Ahmad Byagowi
2026-11-26 16:42 ` [PATCH net v6 5/8] ptp: ocp: report disabled SMA inputs as zero Hz Ahmad Byagowi
2026-11-26 16:42 ` [PATCH net v6 6/8] ptp: ocp: correct the DCF output frequency Ahmad Byagowi
2026-11-26 16:42 ` [PATCH net v6 7/8] ptp: ocp: match ART DPLL frequencies to selectors Ahmad Byagowi
2026-11-26 16:42 ` [PATCH net v6 8/8] ptp: ocp: defer timestamp shutdown to clock unregister 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®