Re: [PATCH net-next v9 10/12] r8152: split r8157_hw_phy_cfg into RTL8157 and RTL8159 variants

From: netdev-bot+sashiko

Date: Thu Nov 26 2026 - 23:27:39 EST


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) adds two RTL8159
(VER_17_QFN68/QFN100) PHY register writes that neither the code nor…
- [Low] The commit message says that clearing PLA 0xd3c8 BIT(0) ("Disable
bypass_turn_off_clk_in_aldps") "is needed by both chips" and now also…

--

r8152: split r8157_hw_phy_cfg into RTL8157 and RTL8159 variants

This patch splits r8157_hw_phy_cfg() into an RTL8157-only function and a
new r8159_hw_phy_cfg() for RTL8159 (VER_17_QFN68/QFN100). It also changes
the RTL8159 EEE, 10M clock divider, 0xa5ea and 0x8ffe programming, and
moves the 0xd3c8 bypass_turn_off_clk_in_aldps clear into the shared
prologue so RTL8157 runs it too. Several new RTL8159 PHY tuning parameters
are added as well.

> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index dbbaf06dca20b..2f3d97e2400c3 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c

[ ... ]

> @@ -8231,11 +8242,14 @@ static void r8157_hw_phy_cfg(struct r8152 *tp)

[ ... ]

> /* 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]
This isn't a bug, but should this patch carry Fixes: tags?

The commit message says the 0xd3c8 BIT(0) clear "is needed by both
chips". Until now r8157_hw_phy_cfg() has not run it for RTL8157, and the
RTL8157 support came in with fd3c7d080df5 ("r8152: Add support for the
RTL8157 hardware").

In the same way, the RTL8159 EN_10M_CLKDIV, 0xa5ea and 0x8ffe changes in
r8159_hw_phy_cfg() correct programming added by ad2a55b63b41 ("r8152: Add
support for the RTL8159 chip"):

ocp_reg_clr_bits(tp, OCP_DOWN_SPEED,
EN_EEE_100 | EN_EEE_1000 | EN_10M_CLKDIV);
tp->ups_info._10m_ckdiv = false;

Other "per the datasheet" corrections in this series that target the same
two commits do carry Fixes: tags. Examples are "r8152: add
rtl8157_unload() for RTL8157 and RTL8159", "r8152: add
rtl8157_change_mtu() for RTL8157 and RTL8159" and "r8152: fix
RTL8156/RTL8156B/RTL8157/RTL8159 up and down settings".

This patch has no tag and doesn't describe a user-visible symptom. That
makes it hard for stable and distro backporters to tell whether the old
programming caused real problems or whether this is only a datasheet
alignment. Could the commit message say which one it is?

[ ... ]

> @@ -8372,22 +8459,35 @@ static void r8157_hw_phy_cfg(struct r8152 *tp)

[ ... ]

> + 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]
This isn't a bug, but what do the 0xbf38 and 0xbf3a writes in
r8159_hw_phy_cfg() configure?

They have no comment. None of the new RTL8159 tuning parameters listed in
the commit message (shorten CLKS latency, CMP_Timer on MP_Timer=333,
spdchg_pga1_lpf_cap, ENET PLL jitter improvement) seem to cover them.

The CMP_Timer comment also describes only the 0xbf28 bit fields. Nothing
explains the 0xbf2a write that follows it.

Could these writes get a short comment, and a mention in the commit
message, so each one can be traced to the datasheet item it implements?

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126033211.51850-1-nic_swsd%40realtek.com