From: Chih Kai Hsu <hsu.chih.kai@realtek.com>
To: "netdev-bot+sashiko@kernel.org" <netdev-bot+sashiko@kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
"kuba@kernel.org" <kuba@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
nic_swsd <nic_swsd@realtek.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"edumazet@google.com" <edumazet@google.com>,
"bjorn@mork.no" <bjorn@mork.no>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
"mail@birger-koblitz.de" <mail@birger-koblitz.de>
Subject: RE: [PATCH net-next v8 06/11] r8152: add new init writes for RTL8156/8156B/8157/8159
Date: Wed, 18 Nov 2026 08:38:06 +0000 [thread overview]
Message-ID: <cf7f59fa1e624344a0f86fbd8280c239@realtek.com> (raw)
In-Reply-To: <179464851473.2199510.6808488710116582608@kernel.org>
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 1
>
> If you believe none of the issues are legitimate, please reply to each issue of
> Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork know
> by including "pw-bot: cr" as a separate line at the end of your reply (one such
> reply per series is enough).
>
> - [Medium] r8156_init() (RTL_TEST_01/VER_10/11/12/13/15) and r8157_init()
> (VER_16/17) now always clear RMT_WAKE_EN (BIT(0) of PLA 0xe0c8).
> - [Low] The commit message lists each new register write but explains
> only one of them (RX_END_TRANSFER_EN).
>
> --
>
> r8152: add new init writes for RTL8156/8156B/8157/8159
>
> This commit adds register writes to r8156_init() and r8157_init() so they match
> the vendor init sequence. Both functions now clear PREBOOT_OPTION and
> RMT_WAKE_EN, and RTL8156B gets a u2phy backup. r8157_init() also disables
> interrupt mitigation and AUTO_SPEEDUP, clears the reset event flag, adds
> VER_17 specific writes, and clears RX_END_TRANSFER_EN for all chips.
>
> > Bring the per-generation init functions in line with the vendor init
> > sequence by adding writes the shared r8156_init() never performed.
>
> [Severity: Low]
> This isn't a bug, but could the commit message say why most of these writes are
> needed? Only RX_END_TRANSFER_EN is explained. The rest are listed with no
> stated purpose or effect:
>
> - clearing PREBOOT_OPTION in PLA_INDICATE_FALG
> - clearing RMT_WAKE_EN in PLA 0xe0c8
> - the r8156b_u2phy_backup() values written to USB 0xd3ce..0xd3dc
> - clearing USB 0xcf04 bits 0/1/2/7 (interrupt mitigation)
> - clearing USB 0xcd06 BIT(11) (Warm RST / Bus RST event flag)
> - clearing USB 0xb9a6 BIT(0) and writing 0x0448 to 0xb9a2 on VER_17
> - clearing AUTO_SPEEDUP
>
> Several of these look like fixes for specific failures. Examples would be problems
> after a warm or bus reset, after a USB2/USB3 PHY power cut, or with interrupt
> mitigation enabled. Other patches in the series are marked as fixes.
>
> Is there a user-visible symptom behind any of these writes? If so, could it be
> described, with Fixes: tags added? That would show whether this belongs in net
> and stable rather than net-next.
Ok. I will add some descriptions.
>
> Could the message also say how clearing RMT_WAKE_EN relates to WoL and to
> remote wakeup from runtime autosuspend?
>
> > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index
> > 364a0573f6cd1..a1c2e1e08b161 100644
> > --- a/drivers/net/usb/r8152.c
> > +++ b/drivers/net/usb/r8152.c
>
> [ ... ]
>
> > @@ -8528,11 +8543,24 @@ static void r8156_init(struct r8152 *tp)
>
> [ ... ]
>
> > r8153b_power_cut_en(tp, false);
> > r8156_ups_en(tp, false);
> > r8153_queue_wake(tp, false);
> > rtl_runtime_suspend_enable(tp, false);
> >
> > + ocp_byte_clr_bits(tp, MCU_TYPE_PLA, PLA_INDICATE_FALG,
> > + PREBOOT_OPTION);
> > +
> > + ocp_byte_clr_bits(tp, MCU_TYPE_PLA, PLA_RMT_WAKE,
> RMT_WAKE_EN);
>
> [Severity: Medium]
> Does this leave RMT_WAKE_EN permanently off on these chips? r8156_init()
> (TEST_01, VER_10/11/12/13/15) clears it every time, and so does
> r8157_init() (VER_16/17). Nothing else in the driver uses PLA_RMT_WAKE or
> RMT_WAKE_EN, so the bit is never set again.
>
> init() runs at probe, right after the wake state is read:
>
> drivers/net/usb/r8152.c:rtl8152_probe() {
> ...
> intf->needs_remote_wakeup = 1;
>
> if (!rtl_can_wakeup(tp))
> __rtl_set_wol(tp, 0);
> else
> tp->saved_wolopts = __rtl_get_wol(tp);
>
> tp->rtl_ops.init(tp);
> ...
> }
>
> It also runs again on every rtl8152_reset_resume()->tp->rtl_ops.init().
>
> The WoL arming path, __rtl_set_wol(), only writes PLA_CONFIG34,
> PLA_CONFIG5 and PLA_CFG_WOL, then calls device_set_wakeup_enable(). The
> runtime-suspend paths through rtl_runtime_suspend_enable() and
> r8153_queue_wake() never touch PLA_RMT_WAKE either.
>
> What happens if RMT_WAKE_EN controls whether the MAC can send a USB
> remote wakeup? Then WoL from system suspend and resume from runtime
> autosuspend on a link change would stop working on
> RTL8156/8156B/8157/8159. Software would still report wake as armed
> through saved_wolopts and needs_remote_wakeup.
>
> If the bit is only leftover state from a UEFI/PXE preboot driver, which its
> placement next to PREBOOT_OPTION suggests, the clear is harmless.
> Neither the code nor the changelog says which case applies. Can this be
> confirmed?
>
RMT_WAKE_EN controls USB remote wakeup in the device, and it is managed by
the firmware. The firmware sets it when it receives SET_FEATURE(FUNCTION_SUSPEND)
or SET_FEATURE(DEVICE_REMOTE_WAKEUP) from the host, and clears it itself.
The driver is not supposed to set it.
The clear at init only removes a stale value that was there before init(), so it cannot
cause abnormal behavior.
> --
> Sashiko AI review ·
> https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261110032416.16968-1
> -nic_swsd%40realtek.com
Best regards,
Chih-Kai
---
pw-bot: cr
next prev parent reply other threads:[~2026-11-18 8:38 UTC|newest]
Thread overview: 35+ 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-11 3:25 ` sashiko-bot
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-11 3:25 ` sashiko-bot
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-11 3:25 ` sashiko-bot
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-11 3:25 ` sashiko-bot
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-11 3:25 ` sashiko-bot
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-11 3:25 ` sashiko-bot
2026-11-14 9:28 ` netdev-bot+sashiko
2026-11-18 8:38 ` Chih Kai Hsu [this message]
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-11 3:25 ` sashiko-bot
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-11 3:25 ` sashiko-bot
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-11 3:25 ` sashiko-bot
2026-11-14 9:28 ` netdev-bot+sashiko
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-11 3:25 ` sashiko-bot
2026-11-14 9:28 ` netdev-bot+sashiko
2026-11-18 9:01 ` Chih Kai Hsu
2026-11-10 3:24 ` [PATCH net-next v8 11/11] r8152: enable UPS for RTL8157 and RTL8159 QFN68 Chih Kai Hsu
2026-11-11 3:25 ` sashiko-bot
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=cf7f59fa1e624344a0f86fbd8280c239@realtek.com \
--to=hsu.chih.kai@realtek.com \
--cc=andrew+netdev@lunn.ch \
--cc=bjorn@mork.no \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mail@birger-koblitz.de \
--cc=netdev-bot+sashiko@kernel.org \
--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