🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19369

[PATCH net v2 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations

#19369
From: Ahmad Byagowi
Date: Thu, 19 Nov 2026 21:19
49 lines
12892 bytes
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) {
Technical Details
Message-ID: <20261119-timecard-common-v2-078fe69f33-2-ahmadexp@gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367323-linux-kernel-netdev=dewy.ru
References: <20261119-timecard-common-v2-078fe69f33-0-ahmadexp@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367323-linux-kernel-netdev=dewy.ru
From: ahmadexp@gmail.com (Ahmad Byagowi)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations
Date: Thu, 19 Nov 2026 13:19:51 -0800
Organization: Usenet Network
Message-ID: <20261119-timecard-common-v2-078fe69f33-2-ahmadexp@gmail.com>
References: <20261119-timecard-common-v2-078fe69f33-0-ahmadexp@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2982898"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ulrGzXtc7bpURmeCQVG4CP6EyMI= sha256:8bbHrXM74q/ESw6C/LQfHLro/cVm1jHwNSEtAByhcUo=
	sha1:7GizrE/7ijMdac6WToA4ZhdPgRw= sha256:FdFKguYVuakJ2UwLOT4INqBNpUJZ5mo5Egtq6F1zLBQ=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id AE82B115784; Fri, 20 Nov 2026 00:20:17 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id z2nrviZUwaz0;
	Fri, 20 Nov 2026 00:20:14 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-367323-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id C82C6115780; Fri, 20 Nov 2026 00:20:05 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 15C232621C5; Thu, 19 Nov 2026 21:19:55 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795123195;
	b=JmTFHHEhKNIMKCqSdlkfS0eUkobCFanH5ykP9ePDJx9N2lrMQ3JSOKRHrtIwQFhBCkGm
	 mf2TnyHZC3L8ER8OPThS8yCi/USDS2bJXgWRrzjqxQzktlwHyDcYU7Mai285VMv6PDCzL
	 DEnjq5Xd5gm9rfkcCdoI1MpEyGseTP2/9p4Ej7hFoeL4pbymKJ1qmKd1F61icmTuRiKAU
	 yQUeVHqucCz3ij0LiXp9P4UkJWm1WHrlkbxUX7dyBFr7W9F9v/hcB7CBJ6Dxce32+vVP5
	 zdAR4RukAjnAOhU6x3mY//he7A8z9Uho4TNrLct1NPZXe9laYiLD7vLXSwjpAPLYMwg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795123195;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=lDt8R/fL9/b2BKYlgJuHImg5pzcUatfwwpYByRaaI+A=;
	b=Pts9TdVIztYm75K4c2hfc2tE7Hre1oXfgOmt/I58R78yPRKgTSLFwgYG/owccwm7w0fC
	 5lbxachQdUln4fuVBq28csKMdi8vnzQbWs7vyjob2Hrg29GRhzL272SRoE70eIVreyn7Z
	 BqDrzDzXYN/aNnksFpmIkz+A0ygsfZEiv0pGvTqJZie8dhIAHRtXfeiVv2coYKURISYSN
	 0PT7qGISret9eoktpn9/7f3J87i8F0FYYhIeVxSnbKxxHRdopy9EGy+mNRLd6XHHfMjOZ
	 JcEdECOAWLbcZbWlIIvjETffiZsU7V/wc9E9Mx6W7njHM2Uiyh7fhErDy7anvyJ5U+Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=YZ5BbNsd;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id E0C28606A320;
	Thu, 19 Nov 2026 21:19:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=YZ5BbNsd
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.169
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795123194;
	b=IQyRbhFqNvoWUdKNLznfzsChxsbvHGMWL2uUzpvY5rDd3maFn0DqFlHO1umNf2uPEYgG
	 SLjRGg6esA5Qhil37eoy1EBFOGmxfUEhy2FBUAfIyAVJdIEjy/m1NjfhmFuK3Ztgd7Cqg
	 cGR/xZphRmvGO7ngZ0TzMewPihc3M9aYVI3mScaCbQCvjzfe9sDkbf674i2AARA/Jy4ub
	 gJcgQdd+bmU71M4zuCDvlsBa6Q4BSXIb7Xst8tNYGBDxKsbI8cfL/Q1IUI3JrP6Og9XOI
	 MA23fkOBAOgqEEenxa2OCOudFTnBYISl+/TRiC5M7lqKOYuISUGS1FWfsffv1B1aUrQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795123194;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=lDt8R/fL9/b2BKYlgJuHImg5pzcUatfwwpYByRaaI+A=;
	b=1tAbOVzz/ERDig3pdv5uBn5dqJg+CCo+YogR3YIubGu4w7766cA7ETOnsNoUjIZEzytk
	 c4UbjDJQzVPDtV9WSpZLEOoz001WpKaBQS9X6xbLViokxA8igfY+jB0DkkCBE1F1vt9MB
	 oGkYbkCygVnFT/zdnXSbHr71DlbZHBlpG1lpeSBsHW/l4YvhbvgRYz4O9EcJ8MGbSqQ0e
	 SR04gwaq1Fds18tQK1FXkj9DroyVIQmfIAiKxwDDM+uLvDE8QyiCdv0OqpLdy+fKayYOt
	 gQtBj8gC9FciGpkjPbLWHTMIEObwroFlibOM9EEjfGFqfBFqN29+tvcjWz4w0kgPmiw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=YZ5BbNsd;
	arc=none smtp.remote-ip=74.125.82.169
X-Received: from mail-dy1-f169.google.com (mail-dy1-f169.google.com [74.125.82.169])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B48EF606A33C
	for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 21:19:53 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B48EF606A33C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy1-f169.google.com with SMTP id 5a478bee46e88-33fb4680717so364417eec.1
        for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 13:19:53 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795123193; x=1795727993; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=lDt8R/fL9/b2BKYlgJuHImg5pzcUatfwwpYByRaaI+A=;
        b=YZ5BbNsdryzciFagOspWEc71oEEQAJLB3n0IVxyH9fAGZEgGpy0byBtKNmJwqLymNe
         abp7o5Ec0/DHEhVtoun2H167ENuLDoqDT2Q9KfT9tRna6oqIEw5F/iIMYd5ziVJiwiLk
         q62kcRxqHKg/aVUWrqb3OomJyS7JmU1UF2M0fQuUTx80A7Q53YrsHSVzZb3u9mcKL5Qb
         eIGCb4Xz9uAplR5zzGK2ng5juTIigPytMgf1UjDpHQF43ETRj7qauwm1nR6Aa4NkPmrC
         NxU8p/a+PhGe2vuugS3Hqz5iXyw45E+DtQFEtGoVfSeOiZsmF89JzRkPMxJlTa+KwKbL
         zLTA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795123193; x=1795727993;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=lDt8R/fL9/b2BKYlgJuHImg5pzcUatfwwpYByRaaI+A=;
        b=WYHivAaX82Q/HTXf9DtEP8Z5ncmdGEhVPToJdvdhGDaPugIc+VWkW4OCSTp/fOUkbp
         f/l6zSJQ2RLNUmAphRuEWqD3IfT7jMx/siuam3ULIU3Z6huE/RAOjWA3gSx3xbgt5pOO
         VgntryRZYe1dtEusN0v7o2Lzy+Np/5S1Oxbs+CuamSUrllhCjMl1waLH8sAp9vaZOrdw
         q8fPxjNdha7prIXVzQy1Mibhv/B5e74Qa5jhD/aYT1TmMgiR7SRY1sFZHIYpRoLpX1Xe
         dwL7icXTiIYGXixCxVKMtjYmVe0NNxsyOFxKckywChTt5xG9Ab9nTUiki+tFXfp3UtGI
         5WPQ==
X-Gm-Message-State: APuU4Z/qZE5XCtbdJtQYzaDDUfyfyld4EMDT+hBQ85IgdjoCF7DDsnHa
	RhTwfQCv4muIddD+hUtfwCMYS3C6xJatzJ+ZPCwntZ8Y8Z92wns2JIXKQzdl7t4m
X-Gm-Gg: AZFdTZeBcdgh4qn6gvsMo2il6YumuIfeWQGG9nkFPg23xyUdxnWW3JZ1/TlgNRheNa9
	HGKMBSUjlneEtEXkjTvSgBISp855rR1cafAikR+hQ0YcAODwzJDYwgoRTCbQcQ1iaKhqaHNyadR
	bucNgUPJFdMhdP3vS6QvU65r+uajsyJ7FM3vSLdThYkU2YWC6dllp+fWw3aPqn4bk0GZbDjqku7
	P1DU445Hbsgb1IBURHyaAz1KiRdS5se7eudDjQ6yFfLTW0+hyY1CBkg5uIpQVntS6cL6NhRoMNB
	vWqRJQPReaBJlwzGdGL2GeIez4qp68NQgNmmhclTrjbBN9jt11JTcdrbYAAetHuv8D8+hk7Zo+F
	gnFHBUnAsGCdRgCyRU2uJhz83JrigjTks8HnsVsFSnlQ9AHpygnXbad9bYKSewgTC+/RlUJw2kD
	LtMYXST+4tu3WJkMhEVJWV8ZV3bdD0EBcFH6boWNAPzZcEnq4yL+YzfQYmMXR0QC5Okmu8DdwJx
	ve6PUh8eeyxQpvCMpEeWGSuGYBmrXzFdU3sPe1UDX3WHheI38Fi1i0DQ1QHOiK1O0AxvCEg3Fl+
	1EL+f0l5td2541t7ysfbfU+pn8jVefI3QQD8M+08YBscbo6GJLfICQjkyv3UdwwmXgvsn50j9ZU
	KrdXurlaBwFl/F/GajFrrOPTpgnISmJy9DLr4g1n4a6HpxrWqMGbzsTkRFmg7zVJhheImHxVW
X-Received: by 2002:a05:7301:6582:b0:374:e25e:a533 with SMTP id 5a478bee46e88-38570154017mr968431eec.35.1795123192877;
        Thu, 19 Nov 2026 13:19:52 -0800 (PST)
X-Received: from Mac.localdomain (198-27-228-154.fiber.dynamic.sonic.net. [198.27.228.154])
        by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1373147eec.0.2026.11.19.13.19.51
        (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
        Thu, 19 Nov 2026 13:19:52 -0800 (PST)
X-Cc: andrew+netdev@lunn.ch,
	arkadiusz.kubalewski@intel.com,
	davem@davemloft.net,
	edumazet@kernel.org,
	jiri@resnulli.us,
	kuba@kernel.org,
	pabeni@redhat.com
X-Mailer: git-send-email 2.54.0
X-In-Reply-To: <20261119-timecard-common-v2-078fe69f33-0-ahmadexp@gmail.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list