🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16200

Re: [PATCH net-next v8 09/11] r8152: split r8157_hw_phy_cfg into RTL8157 and RTL8159 variants

#16200
From: netdev-bot+sashiko
Date: Sat, 14 Nov 2026 09:28
117 lines
12637 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] r8159_hw_phy_cfg() (drivers/net/usb/r8152.c,
  RTL_VER_17_QFN68/QFN100 case) adds two GPHY OCP writes that neither…
- [Low] This commit makes datasheet-driven corrections to already-
  supported hardware without a Fixes: tag or any user-visible symptom.

--

r8152: split r8157_hw_phy_cfg into RTL8157 and RTL8159 variants

This splits r8157_hw_phy_cfg() into r8157_hw_phy_cfg() for RTL8157
(RTL_VER_16) and a new r8159_hw_phy_cfg() for RTL8159
(RTL_VER_17_QFN68/QFN100). It also changes some RTL8159 EEE and clock
settings per the datasheet, moves the 0xd3c8 BIT(0) clear into the shared
prologue, and adds new RTL8159 PHY tuning parameters. Finally, it adds
sram2_set_bits()/sram2_clr_bits() helpers.

> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 6adc198bc92ab..fad4473caf2a4 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c

[ ... ]

> @@ -8223,11 +8234,14 @@ static void r8157_hw_phy_cfg(struct r8152 *tp)
>  	ocp_word_clr_bits(tp, MCU_TYPE_PLA, PLA_PHY_PWR, PFM_PWM_SWITCH);
>  
>  	/* Advanced Power Saving parameter */
> -	ocp_reg_set_bits(tp, 0xa430, BIT(0) | BIT(1));
> +	ocp_reg_set_bits(tp, OCP_POWER_CFG, EN_10M_PLLOFF | EN_ALDPS_PLLOFF);
>  
>  	/* Disable ALDPS force mode */
>  	ocp_reg_clr_bits(tp, 0xa44a, BIT(2));
>  
> +	/* Disable bypass_turn_off_clk_in_aldps */
> +	ocp_byte_clr_bits(tp, MCU_TYPE_PLA, 0xd3c8, BIT(0));
> +

[Severity: Low]
With this change, r8157_hw_phy_cfg() also clears 0xd3c8 BIT(0) on RTL8157
(RTL_VER_16). Before this patch the clear only ran in the RTL_VER_17 case,
which was added by ad2a55b63b41 ("r8152: Add support for the RTL8159
chip"). The RTL8157 support in fd3c7d080df5 ("r8152: Add support for the
RTL8157 hardware") never cleared it.

The r8159_hw_phy_cfg() part of the patch also changes existing RTL8159
settings to follow the datasheet:

	ocp_reg_clr_bits(tp, OCP_DOWN_SPEED,
			 EN_EEE_100 | EN_EEE_1000 | EN_10M_CLKDIV);
	tp->ups_info._10m_ckdiv = false;
	...
	ocp_reg_clr_bits(tp, 0xa5ea, BIT(0) | BIT(1) | BIT(2));

and sram2 0x8ffe goes from 0xf450 to 0xf4ff.

If these correct hardware that is already supported, should the commit
carry Fixes: tags for fd3c7d080df5 and ad2a55b63b41, and describe the
symptom users would see? Other datasheet corrections in the same series
cite those commits, for example "r8152: fix RTL8156/RTL8156B/RTL8157/RTL8159
up and down settings", "r8152: add rtl8157_unload() for RTL8157 and
RTL8159", "r8152: add rtl8157_change_mtu() for RTL8157 and RTL8159" and
"r8152: fix flow control for RTL8156/RTL8156B/RTL8157/RTL8159".

[ ... ]

> @@ -8364,22 +8451,35 @@ static void r8157_hw_phy_cfg(struct r8152 *tp)
>  		sram_write_w0w1(tp, 0x81ae, 0xff00, 0x0f00);
>  		sram_write_w0w1(tp, 0x81b9, 0xff00, 0xb900);
>  		/* normal link TX filter */
> -		sram2_write_w0w1(tp, 0x83b0, 0x0e00, 0);
> -		sram2_write_w0w1(tp, 0x83c5, 0x0e00, 0);
> -		sram2_write_w0w1(tp, 0x83da, 0x0e00, 0);
> -		sram2_write_w0w1(tp, 0x83ef, 0x0e00, 0);
> +		sram2_clr_bits(tp, 0x83b0, 0x0e00);
> +		sram2_clr_bits(tp, 0x83c5, 0x0e00);
> +		sram2_clr_bits(tp, 0x83da, 0x0e00);
> +		sram2_clr_bits(tp, 0x83ef, 0x0e00);
> +
> +		ocp_reg_w0w1(tp, 0xbf38, 0x01f0, 0x0160);
> +		ocp_reg_w0w1(tp, 0xbf3a, 0x001f, 0x0014);
> +		/* shorten CLKS latency */
> +		ocp_reg_clr_bits(tp, 0xbf28, BIT(14) | BIT(13));
> +		ocp_reg_clr_bits(tp, 0xbf2c, BIT(15) | BIT(14));
> +		/* CMP_Timer on MP_Timer=333
> +		 * GPHY OCP 0xbf28 bit[0] = 0x1
> +		 * GPHY OCP 0xbf28 bit[6:1] = 0x3
> +		 * GPHY OCP 0xbf28 bit[12:7] = 0x3
> +		 */
> +		ocp_reg_w0w1(tp, 0xbf28, 0x1fff, 0x0187);
> +		ocp_reg_w0w1(tp, 0xbf2a, 0x3f, 0x03);

[Severity: Low]
What do the 0xbf38 and 0xbf3a writes configure in r8159_hw_phy_cfg()?

The commit message lists four new RTL8159 tuning items: shorten CLKS
latency, CMP_Timer on MP_Timer=333, spdchg_pga1_lpf_cap, and ENET PLL
jitter improvement. These two writes come before the "shorten CLKS latency"
comment, have no comment of their own, and don't match any item on that
list. None of these registers were used in r8152.c before this patch.

The CMP_Timer comment only describes bit fields of 0xbf28, but the block
also writes 0xbf2a[5:0] = 0x03.

Could 0xbf38/0xbf3a get a comment and a mention in the commit message?
Could the CMP_Timer comment also cover 0xbf2a?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261110032416.16968-1-nic_swsd%40realtek.com
Technical Details
Message-ID: <179464851718.2199510.17123458125555803933@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-lon.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-363158-linux-kernel-netdev=dewy.ru
References: <20261110032416.16968-10-nic_swsd@realtek.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-lon.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-363158-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v8 09/11] r8152: split r8157_hw_phy_cfg into
 RTL8157 and RTL8159 variants
Date: Sat, 14 Nov 2026 09:28:37 +0000
Organization: Usenet Network
Message-ID: <179464851718.2199510.17123458125555803933@kernel.org>
References: <20261110032416.16968-10-nic_swsd@realtek.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1540799"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:zGkx+T2YGf5pERhVMyRQB40li8M= sha256:n6Ac8k975awceIuft3+ueqhQhzKP2kXcQTQD616246Y=
	sha1:gTRJRkd/b2dBiWLw2zzCRYxGoWs= sha256:Xpq3jOpNfVWRuvr/z2I+o4DyJ5JuYgm25Qw5QQ2kr9M=
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 329BB114751; Sat, 14 Nov 2026 12:30:02 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.3
X-Spam-Status: No, score=-2.3 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001,
	DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
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 omscY5vrEtIl;
	Sat, 14 Nov 2026 12:29:58 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-363158-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 3E13111478C; Sat, 14 Nov 2026 12:29:49 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 4F01F3DEC8; Sat, 14 Nov 2026 09:29:41 +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=1794648524;
	b=UWcqSdjTSgVMj9ZYHPI4R9y7/2yU4qusqx8h/QGOcI574OjcO9W1K6+Jm5biNGKM1VBN
	 KmdmALrLyj2OdOEw27ozk7bKGqvKaGuTvANdHjFgLI/qvNJv57oQIaNvxrUcdE7bp0yTF
	 wIqkoLZgrqJwiL72SLkyZd3S8Mo2nIeOuk/Spj+uElQpB+RIucRTQRqdbpQPcsbOvGi1p
	 5rqRG0UePz258XxmoQqV6h0cciHBCmFzSIe0PATHz0w5JVbfIkOGuqzchgTSCmMDNJXWk
	 LeR9/3OpqqZE3WuYVInkQkXdoSKl/tH9ZScfNAbcgLf9pSrbMqbPsfuQgzJcsoZNuPQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794648524;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=RENNZfG/pnKsnY0GRiJ1fVPMjdSy5AZ3i3jPYh5MFsM=;
	b=Y8drhvOeWWVuH7k84HiDqncOZkCAK+jZoINeaxOwsz5m1e0wG/iUrur1s9ObA8lK0xpl
	 +EqlRXowDcY+0f0HflIhAosfnXUhXNYvW+LedHkPEdhSnC2G4nKoQokGOPAgi4BAsgdwH
	 QjUE+W36chGp2jMXcZclahrR4DwVKcsBe9SHiiUtNpNQpun+FJwjWv1nAtBv/rpxlHdm7
	 cyqJi/Qm+eIhdrW6uGDWxsghoBa/QZ+12gQ+G7E/wE3UZX7tSCNJPr4R84X9q8DW9W/mr
	 ilR8WhVljFlXxFvFWcontaOzWXOAz25IJCeXDEmZ6Kl8qKjoo4KDeBEdYxZoPrmXjsg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Mjs5Mjqf;
	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 6BF4860A6F65;
	Sat, 14 Nov 2026 09:28:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Mjs5Mjqf
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794648518;
	b=ouKqR5KbzTDGMywUlOHMcVXwhBUHbTp3eQmyPpvARvMAVsgjVP+SwH4YtIat3R8o0k8T
	 RSNk7G6HP6g3QegTfezQMLIxgQu05msgqDyIPrUze9MQvkpMGyMZois4jx8TJAY2COxe1
	 Idhz49NKSWFQXyemudOOzjM/VBbY9YgQJKWlwVVyDjHqQv/I44FkH84ZMjIylwn+rcdKz
	 s8eaz0pJ/UC/ViNjhjEWudyrrlNIiOfP4VcWN7mpMiDf67c1VMXYnV6Un/x1X7oWuz4eM
	 6Ejli0Dwp8czrnrfkFtfd3Ala/J2cSNKTkCgmztOhYavduXT7PHj8lzxKXBDAeU58hw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794648518;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=RENNZfG/pnKsnY0GRiJ1fVPMjdSy5AZ3i3jPYh5MFsM=;
	b=vlgGPrM4kclkQbFgYx/gP5ME/hNdoHiXePs5bwxwtVPYc4vCJlaeBTDWj/e+jOtCRhPr
	 BQyXcev0PZ/Nt2JwjKwGkZaBMte7qI7C/0EgjeHH8ExZ8vX+dpW5O1TLWJve9pc5ZOci2
	 8Sxa+VhPz/I1e+6CvPDPKE38us/OYmYESfiFe4lJE0M/BkYdDAgwvioH1Er3YWEZGnqSG
	 E65sM/Ri/FNYaUB0873eQtXfjdS9HekETN55vHduW4jJZXQU533cYgoYTyvOoBE4ZVVie
	 79NM+5z+Gw8Bfu/PGG8H8wJqMgrBlZvLSuwMTLcpHQcKb5xlxwVrjdgWMG15sr7ed8A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Mjs5Mjqf;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A9A4606A881;
	Sat, 14 Nov 2026 09:28:38 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95C581F000C5;
	Sat, 14 Nov 2026 09:28:37 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794648518;
	bh=RENNZfG/pnKsnY0GRiJ1fVPMjdSy5AZ3i3jPYh5MFsM=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Mjs5MjqfMwPEACVbbaonWqHtO7Pu5x9zndh/9QS2TOB9IXl2s6YNI3OWhWCSq3UdB
	 Ml94QxTWMI2kByJdCpWUAcc04TkTJE9pJ/mzQ2BGTMAoKEopMpyOLqJlPt5PUyjgIM
	 TUazSslcoKKN15dFmQH8lwxMtT4Au7bAFLT9UiDKZGOfXtuJUGWs4Rlrx42+g4G1CS
	 wGwFTKjDJhuC84KxXpv+eLWebjamC9WXEUf/f75jQNzsOJgvhne4XlehCkWKdivHoM
	 HtI9vHhLuvnxRpjZQeh/syeu3eo+IXBRWNz1XActK6AiKcBCHiu1Pn9D+IZ2C9pybc
	 s5Oqv6REUQjTQ==
X-Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
 nic_swsd@realtek.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
 edumazet@google.com, bjorn@mork.no, pabeni@redhat.com, andrew+netdev@lunn.ch,
 mail@birger-koblitz.de
X-In-Reply-To: <20261110032416.16968-10-nic_swsd@realtek.com>
X-sashiko-severity: Low
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