🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6323

RE: [PATCH net-next v7 05/10] r8152: fix up and down register settings for RTL8156/8156B/8157/8159

#6323
From: Chih Kai Hsu
Date: Thu, 22 Oct 2026 08:08
140 lines
14826 bytes
On Wednesday, October 21, 2026 8:52 AM, Kicinski wrote:
> This is an AI-generated review of your patch. The human sending this email has
> considered the AI review valid, or at least plausible.
> ---
> r8152: fix up and down register settings for RTL8156/8156B/8157/8159
> 
> This commit corrects several up/down and OOB register settings for the
> RTL8156, RTL8156B, RTL8157 and RTL8159 chips, following the earlier
> per-generation split of the up/down callbacks. It changes the PLA_RCR1,
> USB_SPEED_OPTION, Clear_SDR, PLA_BDC_CR/PLA_OOB_CTRL and OOB
> PLA_RMS/PLA_MTPS settings, and drops PLA_MCU_SPDWN_EN handling from
> rtl8157_up()/rtl8157_down().
> 
> > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index
> > b245b63fb6aaf..045460a35f383 100644
> > --- a/drivers/net/usb/r8152.c
> > +++ b/drivers/net/usb/r8152.c
> 
> [ ... ]
> 
> > @@ -6938,8 +6937,18 @@ static void r8156_enter_oob(struct r8152 *tp)
> >       rtl_disable(tp);
> >       rtl_reset_bmu(tp);
> >
> > -     ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, 1522);
> > -     ocp_write_byte(tp, MCU_TYPE_PLA, PLA_MTPS, MTPS_DEFAULT);
> > +     switch (tp->version) {
> > +     case RTL_VER_16:
> > +     case RTL_VER_17_QFN68:
> > +     case RTL_VER_17_QFN100:
> 
> [Severity: Medium]
> This patch has three Fixes: tags:
> 
>   Fixes: 195aae321c82 ("r8152: support new chips")
>   Fixes: fd3c7d080df5 ("r8152: Add support for the RTL8157 hardware")
>   Fixes: ad2a55b63b41 ("r8152: Add support for the RTL8159 chip")
> 
> Will it apply and build on the trees those tags point to?
> 
> RTL_VER_17_QFN68 and RTL_VER_17_QFN100 come from an earlier patch in
> this series, "r8152: split RTL_VER_17 into QFN68 and QFN100 package
> variants".
> Before that patch the enum only has RTL_VER_17.
> 
> rtl8157_up() and rtl8157_down() also only exist after "r8152: split
> rtl8156_enable/up/down into per-generation functions", which is described as
> no functional change. Before that patch there is one shared
> rtl8156_up() with tp->version >= RTL_VER_16 and tp->version < RTL_VER_16
> checks.
> 
> So a stable backport would either conflict or need both non-fix patches as
> prerequisites. One of them is the package detection change, which makes an
> unrecognised PLA_PKG_DET value fall back to RTL_VER_UNKNOWN.
> 
> Could these fixes go to net separately, written against the pre-refactor code? Or
> could the commit message at least name the prerequisites?

I will reorder the series so the fixes come first, written against the pre-refactor code, 
with the refactor rebased on top.

> 
> > +             ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, 1526);
> > +             ocp_write_byte(tp, MCU_TYPE_PLA, PLA_MTPS, 10 * 1024 /
> 64);
> > +             break;
> 
> [ ... ]
> 
> > @@ -6997,6 +7008,11 @@ static void rtl8157_up(struct r8152 *tp)
> >       }
> >
> >       r8153_aldps_en(tp, true);
> > +
> > +     /* Enable Clear_SDR */
> > +     ocp_byte_set_bits(tp, MCU_TYPE_USB, 0xd378, BIT(7));
> > +     /* Clear SDR bit */
> > +     ocp_word_clr_bits(tp, MCU_TYPE_USB, 0xcd06, BIT(15));
> >  }
> 
> [Severity: High]
> The commit message says:
> 
>   - RTL8156B (VER_13/15) need Clear_SDR enabled on up, which nothing
>     ever did for them.
> 
> Is the RTL8156B part missing from this patch? These are the only Clear_SDR
> writes the patch adds. rtl8157_up() is only used for RTL_VER_16,
> RTL_VER_17_QFN68 and RTL_VER_17_QFN100.
> 
> In rtl_ops_init(), RTL_VER_13 and RTL_VER_15 are bound to rtl8156_up():
> 
>         case RTL_VER_12:
>         case RTL_VER_13:
>                 tp->support_2500full    = 1;
>                 fallthrough;
>         case RTL_VER_15:
>                 ...
>                 ops->up                 = rtl8156_up;
> 
> This patch does not change rtl8156_up(), and it still writes no Clear_SDR
> register:
> 
>         r8156_exit_oob(tp);
> 
>         ocp_word_clr_bits(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3,
> PLA_MCU_SPDWN_EN);
> 
>         ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_SPEED_OPTION,
>                           RG_PWRDN_EN | ALL_SPEED_OFF);
> 
>         ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH,
> 0x00600400);
>         ...
>         r8153_aldps_en(tp, true);
>         r8153_u2p3en(tp, true);
> 
> So every open or resume on an RTL8156B goes through ops->up ->
> rtl8156_up() without the Clear_SDR enable. The later patches in the series don't
> add it to rtl8156_up() either.
> 
> Should rtl8156_up() get the RTL8156B Clear_SDR writes under an
> RTL_VER_13/RTL_VER_15 check, or should this bullet come out of the commit
> message? The 0xd378/0xcd06 writes used for RTL8157/8159 can't be assumed
> to apply to RTL8156B.

I accidentally dropped the corresponding code; I will add it back.

Best Regards,
Chih-Kai
Technical Details
Message-ID: <0595476b3b8f4aefa6f9eb990b17c7d0@realtek.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350421-linux-kernel-netdev=dewy.ru
References: <20261014081904.6491-6-nic_swsd@realtek.com> <20261021005212.1254979-1-kuba@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350421-linux-kernel-netdev=dewy.ru
From: hsu.chih.kai@realtek.com (Chih Kai Hsu)
Newsgroups: linux.kernel.netdev
Subject: RE: [PATCH net-next v7 05/10] r8152: fix up and down register
 settings for RTL8156/8156B/8157/8159
Date: Thu, 22 Oct 2026 08:08:26 +0000
Organization: Usenet Network
Message-ID: <0595476b3b8f4aefa6f9eb990b17c7d0@realtek.com>
References: <20261014081904.6491-6-nic_swsd@realtek.com>
 <20261021005212.1254979-1-kuba@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="161683"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:3Qf0cIRr/D1soNcLUEauM+90wVs= sha256:J0qD6kFxm6J7rFuSq5qIVoybSfMLF7wL8qmcKVxB2eA=
	sha1:CnbKGbV1kPK9SKag3h9sZAzbjt4= sha256:vgZLK0Mo+M1pEIP+Hv3IsYO8a2LJmMsDRNYXp53ezzI=
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 773C11111DA; Thu, 22 Oct 2026 11:14:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-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 FbHsM58kUGhC;
	Thu, 22 Oct 2026 11:14:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350421-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 9D2081111BD; Thu, 22 Oct 2026 11:14:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id B4FA237630; Thu, 22 Oct 2026 08:09:12 +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=1792656552;
	b=oZb0b0a3ivd51oyO9rFD0St2tTU3R7ZAWB6V1Cm82HkkaHAnG2a/kiTlQn0ti6deN4y3
	 mTIF5DGdG4jlVz8BV41Irx4ESpdXhHJLRM9LFhkkTg0odQYoXFWYioKKr3lTJqXrkkewY
	 BqtMhC2hxgYajZbkdoDBFUIXU5NuTQ0MipwWqiCc6Ouexyr9og8gXwlfLHUk1Dq6jwECB
	 pyScK/LECQrMKH0bbifiSWWYZlp5V4vrYB7XD6v0bq40EnfkXNgxagtgakpU8aW3EIJDo
	 wY2YhVpHgQo3Ee9I7noj92TiAOAW0da1/4/HYmt+X3icHX0t30BX0/kxkKmwcZub1yA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792656552;
	h=X-Original-To:Received:DMARC-Filter:X-SpamFilter-By:DKIM-Signature:
	 Received: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=SrQOB/R3SLUbovIU/JTFQuMZaTtCp4c2h+ziHO4QK18=;
	b=0DtlKPBlHEa+1foe5HRFyy5b0C6R5MVszfS2lBwSS2fkKL3Uy/wfHgFGl1/0b5UmkdqX
	 XG2uyhe/IWjdRVHpBysNnAsIbANXCfg9kMAQZiblGxhozbAOZHSV6cjUDsHWfUQjlHJPA
	 7vH1hcr+WwOUezkzi+z2vgcfAvlESqPvbKe8H+uNWKLI/O5Axju7iwRMU9K3hRVON7wyJ
	 taVe/Frr4Xv/kpli9rGZHE2ypF4wz0XeyoI65H7Y/8Rbt0n83KV3nUsZV0N8BMzjfhb67
	 EmMe+SyuNZy3dNTO8eYk8/TmhPsy1jSMgNfNWTozNDQEZnU1KLhH7ymAuaYtV7FEJJg==
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=JtocyhfD;
	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 8C494606A31E;
	Thu, 22 Oct 2026 08:09:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=realtek.com header.i=@realtek.com header.a=rsa-sha256 header.s=dkim header.b=JtocyhfD
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=1792656541;
	b=3t0NPHNTkOOJ+dsiAkR3h9s7NuSUOQtXay2wB0pMrh8h3a7zA5lwa7KbprddXBsbJLAJ
	 TN+M108uEm5GJGWs109hi9LgJzM7dEknrgfFcyGImVfeHdK/HBPNE6XXXqxdvsju/xQ2q
	 lOTWJXum/KqhWn+aoy3h0u1Q6WOrkjI99G2OwCfbh/3GCqInr7bf9w8sna1f+pAJKlLaN
	 2XNpYFVFfaXKL5QutQioICUYBdYnNat2n0Q3zOl9oXDMa7MnnEFGewjggqy9Ov1TDwdRT
	 dWoEuqPt221+qHwSAg+iu4Xv3rm7L2/jOHpbcD7NyWs2hxY+CAZVCXEol1ueCxbV1VQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792656541;
	h=DMARC-Filter:X-SpamFilter-By:DKIM-Signature:Received: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=SrQOB/R3SLUbovIU/JTFQuMZaTtCp4c2h+ziHO4QK18=;
	b=Aqy0kfYwlNU+lywRIj+L33WHI649PFZolXUYZYW4rzMH+81M1SMzPMSXeK3smVZzB2Eo
	 dPLmo04cSX5THBYrrbP2YOkj+oA+ulFS1SuYMGqx7oRGqBfW/NHjTMFzqXu7vciJnHWQ1
	 cv8nGG0OGs83vovUrbEf+P1UYEpRsYTLVYSSR/OUzs5qMIbY3FcBq+s31Yy9WKW4URIz3
	 16f+qnwOvesa72JnfQgRMTQ1Ns/jLdaSRhY+d0KApDQ5GKzvhtrDUgJfvaXo6J9xObR/W
	 EBRli6Qh8J/WXiVed8sza6zla+F28AwIyuDTAjwb04XdTARsbUnx4kKG0CjLUw2mnIA==
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=JtocyhfD;
	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 01888606A319;
	Thu, 22 Oct 2026 08:09:00 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 01888606A319
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 69M88W080738026, This message is accepted by code: ctloc85258
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realtek.com; s=dkim;
	t=1792656512; bh=SrQOB/R3SLUbovIU/JTFQuMZaTtCp4c2h+ziHO4QK18=;
	h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding:MIME-Version;
	b=JtocyhfDotR85/5iXRd5H5dOm2ab6Mhc1Lx64bJAsv9prot2YhTM8Ev1JP73I2Sxc
	 yPbcywXvE/9FS9btjXDNWN0Hucfxf8EvvDyoAWyhdjO8lKB9rfS+bxckt65laKl0DS
	 6XTctr1kyMD4jt6jGZRihXN+W2w0MxDxS0Njpt6dreLSFASVpbYtlJY730iI7Y5w5a
	 Ll93n9jIY/yuMHqi6ubSwSW3cgx0V1+0v0OZpDUbbMnN4vPmoJauHbpSdz9y82JpE7
	 +wHyZIG1UsGOQANwLUIOO4+b2ZFZ3wRd8zzryRxCVikrlPbOiCeiCUDiZK5i0X6ZYb
	 VYrKi5Oq0vsKg==
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 69M88W080738026
	(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
	Thu, 22 Oct 2026 16:08:32 +0800
X-Received: from RTKEXHMBS05.realtek.com.tw (10.21.1.55) 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.49; Thu, 22 Oct 2026 16:08:27 +0800
X-Received: from RTKEXHMBS06.realtek.com.tw (10.21.1.56) by
 RTKEXHMBS05.realtek.com.tw (10.21.1.55) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.2.2562.49; Thu, 22 Oct 2026 16:08:26 +0800
X-Received: from RTKEXHMBS06.realtek.com.tw ([::1]) by
 RTKEXHMBS06.realtek.com.tw ([fe80::b3cc:c263:b82d:e87c%10]) with mapi id
 15.02.2562.049; Thu, 22 Oct 2026 16:08:26 +0800
X-CC: "davem@davemloft.net" <davem@davemloft.net>, "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 v7 05/10] r8152: fix up and down register
 settings for RTL8156/8156B/8157/8159
X-Thread-Index: AQHdW7Sw+V1oQp1ZvEmSf7eTjx4JUbcGr0sAgAKOofA=
X-In-Reply-To: <20261021005212.1254979-1-kuba@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