mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: hsu.chih.kai@realtek.com
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
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	[thread overview]
Message-ID: <179464851718.2199510.17123458125555803933@kernel.org> (raw)
In-Reply-To: <20261110032416.16968-10-nic_swsd@realtek.com>

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

  reply	other threads:[~2026-11-14  9:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  3:24 [PATCH net-next v8 00/11] r8152: refactor and extend RTL8157/8159 support Chih Kai Hsu
2026-11-10  3:24 ` [PATCH net-next v8 01/11] r8152: fix RTL8156/RTL8156B/RTL8157/RTL8159 up and down settings Chih Kai Hsu
2026-11-14  9:28   ` netdev-bot+sashiko
2026-11-10  3:24 ` [PATCH net-next v8 02/11] r8152: add rtl8157_unload() for RTL8157 and RTL8159 Chih Kai Hsu
2026-11-14  9:28   ` netdev-bot+sashiko
2026-11-10  3:24 ` [PATCH net-next v8 03/11] r8152: add rtl8157_change_mtu() " Chih Kai Hsu
2026-11-14  9:28   ` netdev-bot+sashiko
2026-11-10  3:24 ` [PATCH net-next v8 04/11] r8152: fix flow control for RTL8156/RTL8156B/RTL8157/RTL8159 Chih Kai Hsu
2026-11-14  9:28   ` netdev-bot+sashiko
2026-11-10  3:24 ` [PATCH net-next v8 05/11] r8152: split r8156_init by generation and factor out wait_autoload_done Chih Kai Hsu
2026-11-10  3:24 ` [PATCH net-next v8 06/11] r8152: add new init writes for RTL8156/8156B/8157/8159 Chih Kai Hsu
2026-11-14  9:28   ` netdev-bot+sashiko
2026-11-10  3:24 ` [PATCH net-next v8 07/11] r8152: split RTL_VER_17 into QFN68 and QFN100 package variants Chih Kai Hsu
2026-11-14  9:28   ` netdev-bot+sashiko
2026-11-10  3:24 ` [PATCH net-next v8 08/11] r8152: split rtl8156_enable/up/down into per-generation functions Chih Kai Hsu
2026-11-10  3:24 ` [PATCH net-next v8 09/11] r8152: split r8157_hw_phy_cfg into RTL8157 and RTL8159 variants Chih Kai Hsu
2026-11-14  9:28   ` netdev-bot+sashiko [this message]
2026-11-10  3:24 ` [PATCH net-next v8 10/11] r8152: add TGPHY register access for RTL8157 and RTL8159 Chih Kai Hsu
2026-11-14  9:28   ` netdev-bot+sashiko
2026-11-10  3:24 ` [PATCH net-next v8 11/11] r8152: enable UPS for RTL8157 and RTL8159 QFN68 Chih Kai Hsu
2026-11-14  9:28   ` netdev-bot+sashiko
2026-11-10  5:04 ` [PATCH net-next v8 00/11] r8152: refactor and extend RTL8157/8159 support netdev-bot+sinfo

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=179464851718.2199510.17123458125555803933@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bjorn@mork.no \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hsu.chih.kai@realtek.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mail@birger-koblitz.de \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®