Article View: linux.kernel.netdev
Article #18372RE: [PATCH net-next v8 06/11] r8152: add new init writes for RTL8156/8156B/8157/8159
From: Chih Kai Hsu
Date: Wed, 18 Nov 2026 08:38
Date: Wed, 18 Nov 2026 08:38
96 lines
17042 bytes
17042 bytes
> 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
Technical Details
Message-ID:
<cf7f59fa1e624344a0f86fbd8280c239@realtek.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-365954-linux-kernel-netdev=dewy.ruReferences:
<20261110032416.16968-7-nic_swsd@realtek.com> <179464851473.2199510.6808488710116582608@kernel.org>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-365954-linux-kernel-netdev=dewy.ru From: hsu.chih.kai@realtek.com (Chih Kai Hsu) Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <cf7f59fa1e624344a0f86fbd8280c239@realtek.com> References: <20261110032416.16968-7-nic_swsd@realtek.com> <179464851473.2199510.6808488710116582608@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Injection-Info: usenet.network; logging-data="2543787"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:FDPyvZipTz3HQgafELFeWNurI/Q= sha256:z1/emimxEKpTN9aoYaltTgpC9OknXClRucrm98bxF5I= sha1:mK3whX7iX6DgHgfLLRhyMPkj6xA= sha256:HjPRaklFhYussC3EF9t7f+M69SYeu7Bui9FxvxghK8A= Content-Language: zh-TW 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 19BEF1151F8; Wed, 18 Nov 2026 11:39:15 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=realtek.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 jYSlPxX0zV4m; Wed, 18 Nov 2026 11:39:11 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-365954-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=realtek.com X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 4BF37114F03; Wed, 18 Nov 2026 11:39:03 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 89FD36133BF; Wed, 18 Nov 2026 08:39:02 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1794991140; b=p5t1QslpWWxfOc2OJMlukuWuucwInqENQp0WF+oCjGQAPM/lRl/TKXXlcTEj8mkGZuAE Gc2ETgh4MuaN0J7QTfedduDs2DnykZkfz2492OHV7tyYWw+NuodzRReH0yPUrSCiBqw7F 3R5u8Cv3fRBU5Qwo+5WsntBdYTZTvJFP/UUX1zwosYjuASbVez2u3dwY39zMItH6lxq5Z c2wUEXzy4eUIg6nt2rCHb41HUFBvGfS9t5zFDeNDSz4pp8q0NDLvyScYEMx/nZ81ULZUn hoRwoEZHAZBb4e+a+BetBob1wzs1hePwo86kK0BzaVpXaypQZJ+88T7zfZgrCBSmevA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794991140; h=X-Original-To:Received:DMARC-Filter:X-SpamFilter-By:DKIM-Signature: Received:Received:Received:From:To:CC:Subject:Thread-Topic: Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language: Content-Language:Content-Type:Content-Transfer-Encoding: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version; bh=yTaC3kglV/CRr/khGG/rEda/XWAoN+VFABgn6XUjuZc=; b=GjTh3YYoMxYLzsaPVt3TCJg1ZVFO5Yj3CrlgocIrSre6oYdry7eUPeV892IPEOVQFEia Iu/ipjbCJl3uN/TrqUanLnbVcsm3G/ZcaOfFJ4e5WdlmT93kC5WnpWuFryd98kSi9ui5h /nTOxsnDB8hyV2u+D43bJkbMn+6wrXelVichP69qEmn4eIclM3dtcV+roWw3h+dS6jQaP x0w0q4r0sjjhysrJdbjiocFms3liWy9793X+lQgFulP1PupVn4/LR/XiEPsloV//q4556 snmNdNiM4oCnElvf9NhvVQ+9FhA4IPESsSrFveXkblswN3LTocFVhXNY1rNvmMQOqhQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=realtek.com header.i=@realtek.com header.a=rsa-sha256 header.s=dkim header.b=OcCslqf3; dmarc=pass header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=fail 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 DBB3E606A330; Wed, 18 Nov 2026 08:38:59 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=realtek.com header.i=@realtek.com header.a=rsa-sha256 header.s=dkim header.b=OcCslqf3 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=211.75.126.72 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794991134; b=E736qGqbpUPyZAHMOtI8c2zwoCUyzqDy751sDkjhFI9fPw/IFRzc0ys0lcRndEHsltJ3 5C7iwjFmrrp26sPJC5XtR0GSIxZuxNqpeII985atGjMdk5UgIJZnJiEXVwi+LGp83+mMH oo8TeZD4yW+muOMhdQvHRmshWGLoVHVhOdfB78zGKF1xPH+EFuQsUAN2CkF9kiXJ8Z/C9 xojER2KbC34gBsWj2bBknxE8cyStUe8VSZ/j/0bp9ujR43Sj1lcjd4DShzBZ/zwYwaZKC WPah1omlSqMzucCHUzqlaC6g/GHMvcaKQ9Xcn4KN0uzhigGs1oqvBTLATCdknReJXZA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794991134; h=DMARC-Filter:X-SpamFilter-By:DKIM-Signature:Received:Received: Received:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID: References:In-Reply-To:Accept-Language:Content-Language: x-originating-ip:Content-Type:Content-Transfer-Encoding:MIME-Version; bh=yTaC3kglV/CRr/khGG/rEda/XWAoN+VFABgn6XUjuZc=; b=TCic1r5pcZyGasmNpiFJfMY4iYONOdToYz68Qy+7Jx7D252Zqnm+Vyw+GPJz/u7boxZJ ZxeKliYRqSEXJESDRHuuLcqOy8WWGkFtCowFLEAH/GL8YIM+tKZ9UaBSBgDT2x5EIjW3R Mwd38TvTOstxbqZqZuFWmi/CnxwBsZN+jA5GSvq4v+W26cIRedW8AC+53v32Sz0J+44Wr o3iY9f3cJs/QLeezjOErpmh4IIXgrTYVyqtiKZKDCsutCgPp5m34PuZ0CxqkOfuZO2DUZ 0j/P5BSW/DnYhUzAJl9UfRbmdPp/23ZUq31fuBj2oOFsYvkclRnEa6vcQKjzXYCyxgw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=pass header.d=realtek.com header.i=@realtek.com header.a=rsa-sha256 header.s=dkim header.b=OcCslqf3; arc=none smtp.remote-ip=211.75.126.72 X-Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21DCD606A31C; Wed, 18 Nov 2026 08:38:52 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 21DCD606A31C X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 6AI8c6oR51187651, This message is accepted by code: ctloc85258 X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realtek.com; s=dkim; t=1794991086; bh=yTaC3kglV/CRr/khGG/rEda/XWAoN+VFABgn6XUjuZc=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:Content-Transfer-Encoding:MIME-Version; b=OcCslqf3J8buj3P91sni+Xoh/sYgJlrd9PQMZKFhugrVeb1rAkGvGNoAw4lZ6ujvW 0SQsVFCso2/zaAaCMDesXCZL7sWLekR7D5SXrepH1yB6yPZMhmfHtM4VbPCGYNDLnC 3mhZsLmCN3U8XzIU1J2L++uJAlMxhdIfehNJHwEgHa37AFpWD1bikPFaUoRr1E1wSV 9B7aR5hoy6RJgsdEdNG4EZ+JWcg0jvjychMo8vIywOlSrwrFkVuXMWetlR7h4sXnZq a69rRFNfn7FH7IxyG6dfZdj4P8pH9ZYmFOZ6ABfKHVVAmRcCvjZ2FKU2WHK+c+M9jm boFJ68MtXgkFw== X-Received: from mail.realtek.com (rtkexhmbs04.realtek.com.tw[10.21.1.54]) by rtits2.realtek.com.tw (8.15.2/3.29/5.94) with ESMTPS id 6AI8c6oR51187651 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Nov 2026 16:38:06 +0800 X-Received: from RTKEXHMBS06.realtek.com.tw (10.21.1.56) by RTKEXHMBS04.realtek.com.tw (10.21.1.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Wed, 18 Nov 2026 16:38:06 +0800 X-Received: from RTKEXHMBS06.realtek.com.tw ([fe80::eeeb:c765:ca73:5eef]) by RTKEXHMBS06.realtek.com.tw ([fe80::eeeb:c765:ca73:5eef%10]) with mapi id 15.02.2562.056; Wed, 18 Nov 2026 16:38:06 +0800 X-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> X-Thread-Topic: [PATCH net-next v8 06/11] r8152: add new init writes for RTL8156/8156B/8157/8159 X-Thread-Index: AQHdcML+sJzPbTRchkm8kmytHOT0SbcszWcAgAa/nnA= X-In-Reply-To: <179464851473.2199510.6808488710116582608@kernel.org> X-Accept-Language: zh-TW, en-US 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