Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: ahmadexp@gmail.com
Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch,
	arkadiusz.kubalewski@intel.com, davem@davemloft.net,
	edumazet@kernel.org, jiri@resnulli.us, kuba@kernel.org,
	pabeni@redhat.com, richardcochran@gmail.com,
	rmk+kernel@armlinux.org.uk, vadim.fedorenko@linux.dev,
	vladimir.oltean@nxp.com
Subject: Re: [PATCH net v3 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations
Date: Tue, 24 Nov 2026 22:10:25 +0000	[thread overview]
Message-ID: <179555822538.3135.15182959488825985221@kernel.org> (raw)
In-Reply-To: <20261120-timecard-common-v3-33316bf475-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] The mask fix does not cover adva_x1 after a DPLL direction
  change to input.

--

ptp: ocp: use hardware selectors in DPLL frequency operations

This commit makes ptp_ocp_dpll_frequency_set() pass the selector table
value to ptp_ocp_sma_store_val(). Before, it passed the table index. It
also masks the direction enable bit in ptp_ocp_dpll_frequency_get()
before the table lookup, so that enabled, direction-configurable pins
resolve to a table entry.

Link: https://lore.kernel.org/r/179502617840.3136.12704245716223038161@kernel.org

> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> index b16d36c3305f9..95a4df468e793 100644
> --- a/drivers/ptp/ptp_ocp.c
> +++ b/drivers/ptp/ptp_ocp.c

[ ... ]

> @@ -5887,6 +5888,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) {

[Severity: High]
Does this mask fix the get/dump failure on adva_x1 after a DPLL direction
change to input?

ptp_ocp_dpll_direction_set() always writes selector 0, whatever the
board:

drivers/ptp/ptp_ocp.c:ptp_ocp_dpll_direction_set() {
    ...
	return ptp_ocp_sma_store_val(bp, 0, mode, sma_nr + 1);
}

On a direction-configurable pin (fixed_dir is false), the call path is
ptp_ocp_sma_store_val() -> ptp_ocp_sma_adva_set_inputs(). Along the way
SMA_ENABLE is ORed in, so 0x8000 is written to the input mux. Once the
new mask is applied in ptp_ocp_dpll_frequency_get(), that leaves 0.

On fb and adva, 0 matches the "10Mhz" entry. The adva_x1 input table has
no 0x0000 entry:

static const struct ocp_selector ptp_ocp_adva_x1_sma_in[] = {
	{ .name = "PPS1",	.value = 0x0001,      .frequency = 1 },
	{ .name = "TS1",	.value = 0x0004,      .frequency = 0 },
	...

So the lookup loop finds nothing and returns -EINVAL.

ocp_adva_x1_sma_op uses ptp_ocp_sma_fb_init(). When sma_map2->gpio2 is not
0xffffffff, the adva_x1 pins keep fixed_dir false and
DIRECTION_CAN_CHANGE, so a DPLL pin-set with direction=input reaches this
path.

After that:

- dpll_cmd_pin_get_one() fails, so PIN_GET and the change notification
  fail for that pin.
- dpll_nl_pin_get_dumpit() breaks out on any error other than -ENODEV,
  so the whole pin dump fails, not just this pin's entry.
- dpll_pin_freq_set() calls frequency_get first and stops with "unable
  to get old frequency value", so the pin cannot be recovered through
  DPLL.

The commit message says the corrections apply "to all board variants".
Would adva_x1 need a board-specific default selector in
ptp_ocp_dpll_direction_set(), or a matching entry in
ptp_ocp_adva_x1_sma_in[]?

Later patches in this series do not change this path either. Those are
"ptp: ocp: report disabled SMA inputs consistently over DPLL" and "ptp:
ocp: correct the DCF output frequency".

ptp_ocp_dpll_direction_set() clears sma->disabled, so the disabled-state
substitution added later does not trigger here. The adva_x1 input table
is unchanged at the end of the series.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120-timecard-common-v3-33316bf475-0-ahmadexp%40gmail.com

  reply	other threads:[~2026-11-24 22:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 21:21 [PATCH net v3 0/4] ptp: fix timestamp teardown and OCP DPLL routing Ahmad Byagowi
2026-11-20 21:21 ` [PATCH net v3 1/4] ptp: disable all timestamp channels after removing the user interfaces Ahmad Byagowi
2026-11-22 20:10   ` Vadim Fedorenko
2026-11-23  1:57     ` Ahmad Byagowi
2026-11-24 22:10   ` netdev-bot+sashiko
2026-11-20 21:21 ` [PATCH net v3 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations Ahmad Byagowi
2026-11-24 22:10   ` netdev-bot+sashiko [this message]
2026-11-20 21:21 ` [PATCH net v3 3/4] ptp: ocp: report disabled SMA inputs consistently over DPLL Ahmad Byagowi
2026-11-24 22:10   ` netdev-bot+sashiko
2026-11-20 21:21 ` [PATCH net v3 4/4] ptp: ocp: correct the DCF output frequency Ahmad Byagowi

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=179555822538.3135.15182959488825985221@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=ahmadexp@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=vadim.fedorenko@linux.dev \
    --cc=vladimir.oltean@nxp.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