All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Ahmad Byagowi <ahmadexp@gmail.com>,
	netdev@vger.kernel.org, richardcochran@gmail.com
Cc: andrew+netdev@lunn.ch, arkadiusz.kubalewski@intel.com,
	davem@davemloft.net, edumazet@kernel.org, jiri@resnulli.us,
	kuba@kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net v2 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations
Date: Thu, 19 Nov 2026 22:23:27 +0000	[thread overview]
Message-ID: <9124e525-82ef-4d65-ae30-6676f257d8e1@linux.dev> (raw)
In-Reply-To: <20261119-timecard-common-v2-078fe69f33-2-ahmadexp@gmail.com>

On 19/11/2026 21:19, Ahmad Byagowi wrote:
> The selector table index is not the hardware selector value. Passing the
> index to the SMA setter can select unrelated signals, or fail on ART.
> Use the table value, as the sysfs path already does.
> 
> Mask the direction enable bit before the frequency lookup. Otherwise an
> enabled, direction-configurable pin has no matching table entry and its
> DPLL get or dump fails. Apply both corrections to all board variants.
> 
> Reported by the netdev Sashiko AI review and confirmed by code
> inspection. Source-derived C regression tests pass with ASan/UBSan;
> restoring the faulty selector, mask, disabled-state or DCF value makes
> the corresponding regression fail. Tests use stubbed MMIO, not hardware.
> The driver object builds on current net with W=1 and KCFLAGS=-Werror. No
> physical card was tested.
> 
> Codex prepared the fix, tests and changelog from the review and upstream
> source, at the request to separate common-driver fixes from WiWi support
> and validate removal ordering.
> 
> Fixes: 09eeb3aecc6c ("ptp_ocp: implement DPLL ops")
> Link: https://lore.kernel.org/r/179502617840.3136.12704245716223038161@kernel.org
> Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>
> ---
>   drivers/ptp/ptp_ocp.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> index 4c98558e96..f1f97c1fa0 100644
> --- a/drivers/ptp/ptp_ocp.c
> +++ b/drivers/ptp/ptp_ocp.c
> @@ -5903,7 +5903,8 @@ static int ptp_ocp_dpll_frequency_set(const struct dpll_pin *pin,
>   	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);
> +			return ptp_ocp_sma_store_val(bp, tbl[i].value,
> +						     sma->mode, sma_nr + 1);
>   	return -EINVAL;
>   }
>   
> @@ -5921,6 +5922,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) {

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

  reply	other threads:[~2026-11-19 22:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 21:19 [PATCH net v2 0/4] ptp: ocp: fix timestamp teardown and DPLL routing Ahmad Byagowi
2026-11-19 21:19 ` [PATCH net v2 1/4] ptp: ocp: prevent timestamp rearming during detach Ahmad Byagowi
2026-11-19 22:23   ` Vadim Fedorenko
2026-11-19 23:46     ` Ahmad Byagowi
2026-11-20 19:31       ` Vadim Fedorenko
2026-11-19 21:19 ` [PATCH net v2 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations Ahmad Byagowi
2026-11-19 22:23   ` Vadim Fedorenko [this message]
2026-11-19 21:19 ` [PATCH net v2 3/4] ptp: ocp: report disabled SMA inputs consistently over DPLL Ahmad Byagowi
2026-11-19 22:24   ` Vadim Fedorenko
2026-11-19 21:19 ` [PATCH net v2 4/4] ptp: ocp: correct the DCF output frequency Ahmad Byagowi
2026-11-19 22:24   ` Vadim Fedorenko

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=9124e525-82ef-4d65-ae30-6676f257d8e1@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.