From: netdev-bot+sashiko@kernel.org
To: ahmadexp@gmail.com
Cc: netdev@vger.kernel.org, andrew@lunn.ch,
arkadiusz.kubalewski@intel.com, arnd@arndb.de,
davem@davemloft.net, edumazet@kernel.org, jiri@resnulli.us,
john.stultz@linaro.org, jonathan.lemon@gmail.com,
kuba@kernel.org, linux-kernel@vger.kernel.org, olteanv@gmail.com,
pabeni@redhat.com, richardcochran@gmail.com,
rmk+kernel@armlinux.org.uk, vadim.fedorenko@linux.dev
Subject: Re: [PATCH net v5 2/8] net: dsa: sja1105: leave the pin function unchanged on EXTTS disable
Date: Wed, 25 Nov 2026 04:44:44 +0000 [thread overview]
Message-ID: <179558188491.3135.14757848220793182596@kernel.org> (raw)
In-Reply-To: <20261123-timecard-common-v5-d669cfa034-2-ahmadexp@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] This patch fixes only one direction of the shared PTP_CLK pin
problem.
--
net: dsa: sja1105: leave the pin function unchanged on EXTTS disable
This patch makes sja1105_extts_enable() switch the shared PTP_CLK pin to
the EXTTS function only when timestamp capture is being enabled. Disabling
EXTTS previously turned an output pin back into an input and stopped the
periodic output.
Link: https://lore.kernel.org/r/179548551283.3135.17206659598806657887@kernel.org
> diff --git a/drivers/net/dsa/sja1105/sja1105_ptp.c b/drivers/net/dsa/sja1105/sja1105_ptp.c
> index 350f958dcb2af..da35805152e05 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;
> + }
[Severity: High]
Should sja1105_per_out_enable() in the same file get the same guard? It
still switches the pin before it looks at on:
drivers/net/dsa/sja1105/sja1105_ptp.c:sja1105_per_out_enable() {
...
mutex_lock(&ptp_data->lock);
rc = sja1105_change_ptp_clk_pin_func(priv, PTP_PF_PEROUT);
if (rc)
goto out;
if (on) {
...
}
On SJA1105P/Q/R/S and SJA1110, avb->cas_master is 0 when PTP_CLK is an
input. This is the boot default, and it is also the state after an EXTTS
enable:
drivers/net/dsa/sja1105/sja1105_main.c:sja1105_init_avb_params() {
...
/* On P/Q/R/S, configure the direction of the PTP_CLK pin as input by
* default. This is because there might be boards with a hardware
* layout where enabling the pin as output might cause an electrical
* clash. ...
*/
avb->cas_master = false;
...
}
In that state, sja1105_change_ptp_clk_pin_func() computes
old_func = PTP_PF_EXTTS. It then sets avb->cas_master = 1 and writes
BLK_IDX_AVB_PARAMS. As a result, a PEROUT disable turns the pin into an
output, and the disable branch only issues stopptpcp after that.
Userspace can trigger this through two paths:
ptp_ioctl(PTP_PEROUT_REQUEST) with a zero period
-> ptp_perout_request()
-> ops->enable(ops, &req, 0)
-> sja1105_per_out_enable(on = false)
-> sja1105_change_ptp_clk_pin_func(priv, PTP_PF_PEROUT)
ptp_ioctl(PTP_PIN_SETFUNC) moving pin 0 away from PTP_PF_PEROUT
-> ptp_set_pinfunc()
-> ptp_disable_pinfunc(info, PTP_PF_PEROUT, chan)
-> enable(PEROUT, 0)
Neither path checks whether PEROUT was ever started. That means this can
happen even on a freshly booted switch.
Could the switch then drive a line that an external source, such as a PPS
input, is also driving? Avoiding that is the reason for the boot default
above.
If EXTTS was active, capture also stops in hardware. However,
priv->ptp_data.extts_enabled stays true and extts_timer keeps polling. A
retained PTP_PF_EXTTS pin assignment would no longer match the hardware.
The commit message says "EXTTS and PEROUT share PTP_CLK". The same
mechanism is still reachable through this mirror call site. No later patch
in the series changes sja1105_per_out_enable().
Would it make sense to call
sja1105_change_ptp_clk_pin_func(priv, PTP_PF_PEROUT) there only when on is
true, as part of this patch?
>
> priv->ptp_data.extts_enabled = on;
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123-timecard-common-v5-d669cfa034-0-ahmadexp%40gmail.com
next prev parent reply other threads:[~2026-11-25 4:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 4:42 [PATCH net v5 0/8] ptp: fix request serialization, teardown and SMA reporting Ahmad Byagowi
2026-11-24 4:42 ` [PATCH net v5 1/8] ptp: serialize sysfs requests with the ioctl paths Ahmad Byagowi
2026-11-24 4:42 ` [PATCH net v5 2/8] net: dsa: sja1105: leave the pin function unchanged on EXTTS disable Ahmad Byagowi
2026-11-25 4:44 ` netdev-bot+sashiko [this message]
2026-11-24 4:42 ` [PATCH net v5 3/8] ptp: disable all timestamp channels after removing the user interfaces Ahmad Byagowi
2026-11-24 4:42 ` [PATCH net v5 4/8] ptp: ocp: handle hardware selectors and combined DPLL input routes Ahmad Byagowi
2026-11-25 4:44 ` netdev-bot+sashiko
2026-11-24 4:42 ` [PATCH net v5 5/8] ptp: ocp: recover disabled SMA inputs when binding the driver Ahmad Byagowi
2026-11-24 4:42 ` [PATCH net v5 6/8] ptp: ocp: report zero frequency for disabled SMA inputs Ahmad Byagowi
2026-11-24 4:42 ` [PATCH net v5 7/8] ptp: ocp: correct the DCF output frequency Ahmad Byagowi
2026-11-24 4:42 ` [PATCH net v5 8/8] ptp: ocp: correct the ART 10 MHz input frequency Ahmad Byagowi
2026-11-25 4:44 ` netdev-bot+sashiko
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=179558188491.3135.14757848220793182596@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=ahmadexp@gmail.com \
--cc=andrew@lunn.ch \
--cc=arkadiusz.kubalewski@intel.com \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=jiri@resnulli.us \
--cc=john.stultz@linaro.org \
--cc=jonathan.lemon@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=vadim.fedorenko@linux.dev \
/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