Article View: linux.kernel.netdev
Article #5801Re: [PATCH net-next v7 05/10] r8152: fix up and down register settings for RTL8156/8156B/8157/8159
From: Jakub Kicinski
Date: Wed, 21 Oct 2026 00:52
Date: Wed, 21 Oct 2026 00:52
117 lines
11798 bytes
11798 bytes
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?
> + 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.
Technical Details
Message-ID:
<20261021005212.1254979-1-kuba@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349674-linux-kernel-netdev=dewy.ruReferences:
<20261014081904.6491-6-nic_swsd@realtek.com>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-349674-linux-kernel-netdev=dewy.ru From: kuba@kernel.org (Jakub Kicinski) 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: Tue, 20 Oct 2026 17:52:12 -0700 Organization: Usenet Network Message-ID: <20261021005212.1254979-1-kuba@kernel.org> References: <20261014081904.6491-6-nic_swsd@realtek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="4005866"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:dhM9rSFCXM0KgjECpVAmDqS5p5I= sha256:uPs+G1eyRz0nxQhGgRCjY/u3OswrcRir8Fy2IY+MIac= sha1:WrDEVnkSHNNkiqDg+8Zp9v/QnDA= sha256:LYMTMzR6QZxCsTinz8LJFYBaPO8owfHPmidqWvDPBzA= 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 714C5110EB3; Wed, 21 Oct 2026 03:54:08 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.729 X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=kernel.org 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 o5suF096JKYQ; Wed, 21 Oct 2026 03:54:06 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-349674-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id B51A9110EB7; Wed, 21 Oct 2026 03:53:57 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 081D33950E; Wed, 21 Oct 2026 00:52:25 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792543940; b=lKG/IwKX0uPynSnP/YfmvHKqjY4z2KmMuIx6DqCUwSXjtpGnI5tW8K7q0fdXHVNZcOAB JUqEL8wy18aTpCHnWi11xxFj9mkKQiVBIDYqRJ0HJdzNBoVPNMRKOQKprKbtnIg90oM6l qgBDeU7HpcAQNqX1qXHFAV87aA7cNtWm33AIt5Bi0wuHDrjUBN4MYMHHQAutwjH/7ozZt gmz/8Ex+QuvgAppivt52Yo/LUrTl9qgYAH5fC0lCVNx2pnGvrdpEJ0iDx9AcO9bhuKf4u fz1QNmDFfxbNIZW594RwT7qyCA9qokBp+vBL1O8ON4NbEqMJXjRA9JcPZtWl70QP0UQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792543940; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding; bh=GBFH6oRYSJP/dQWfGegi7pqI65g5/qbXzo/olR5/xbg=; b=f1IXLxfZQpGCm6T+vX9QCe71mPi7uPQ599YiDqNegE0cjaftAOcV8MI+zrfKX4lnXFz0 RiFNjseMlK72YtNorxZln/Oc3/ILSSDocBWv7SkFm8FoBr6oNvyi3QdoaTU6DswBiWkJ0 5Xz271R6n/vnIle2FOWK/9Set5Kx123gZQplrns/kTN48sXGef9Uu8o7hVdaOhRWMmXv7 YHSTo3pcaIoYin/j1Pnvz3rb+aOZV9cBKs5NukEnoP8Z9R2VNF8VDS/1+Y9JZf4laGOVN iPsGIlNF2N1FrOUywvVN8kJ9hBTxP830zrvOas8W9IRvRiWjIuN3pgh7LGpIgbiNurQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bII38EBC; arc=pass header.oldest-pass=0 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 96C42606A31F; Wed, 21 Oct 2026 00:52:20 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bII38EBC X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792543933; b=j7p/hmzsnBofJEKzhTfDQ0JyivvV88DSIt1Fgo4uteqHsOqbW64x+L4/LxbbiLHY9dOE I05XZxohFwQ9rHL4y6l60CFp2goJfGfVx2FKKndxXb2CTjUrYIMsu+BhviXb5wYL7u4Xn 3B8hqgX8HRSvH9oikPec6jIIjlCQbXx0ExPHa2cdHqWm6pGfeOnboAt7+hlQAm+w+vzyK 1U3AN9xLoo8dNKaQrjcgehQ/Bgzg57nnQ6r682L07VJaIyvfZ6mHbBkE5QPe9YYK4ryh7 ObJS3EesQW4XwQtSSD8L67osKN3h5hUCJuUt0CyWKckEU13nPjG+Xt68asmHfFykl9A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792543933; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=GBFH6oRYSJP/dQWfGegi7pqI65g5/qbXzo/olR5/xbg=; b=iMhy+Pb4rCuzJhbWItYKgYWkcy2f4ITE0gzdAzQysELAXJvBPMOOOM12lHV496shFT3H 2jwQROWv0Q4etrzACPTQiWzein+F/Ns8VWesaiBCMKzboUPy72OkZZrH69wHfDVEu2e3l 8Jbb3Ab17Ol4UZl6U9PicFkY6rx5o0H9FFMbgHUcfGjjIPdMIx8IKmRrf0ZN+zKo1rq9z gFXyOnwVRbysqfdsIh8hoorNI2IRj6RWIo9kBJ3gDu7xhpSRUqSwGUNqqzzjbD/L3zdPU 4HW9fG4jE5aKJyQ8XpPBXyoKmhwJiHwicCfOI5UTdF7SHYeFTONyb9D6lf8CqflM/Iw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bII38EBC; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61829606A323; Wed, 21 Oct 2026 00:52:13 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A690B1F000C9; Wed, 21 Oct 2026 00:52:12 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792543933; bh=GBFH6oRYSJP/dQWfGegi7pqI65g5/qbXzo/olR5/xbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bII38EBCvPXNjrjqOumQ4YCpuKNsNvskPH4yy49yKaPsullfPKOZAGf35AFSKgQLy j9cIwXj2GbDVMG8rr+WoIz6RPtSheHVjwqOdv3BQKUNbHNTyAEtg7JAEZRuOxqhDjk MStfA7WozJuuoO2uorH5vPqIrnoIMPn0IU+39Ny+6cown/DIpjkUnOvYEuyHTWl/k/ /ZQ+fd548btLFQR4kLQYR9/bD+a2OOOyHkcub2cN5VeOAc77Sl9lZDIdoo8VMiGcz4 1nT+0ZnodbPdx90NmX35t4aSu6SrS5U0J2g2XhVyLhDVMfVauV6V4GcDQFOmR7W2jd wEIaHTmHdlRaA== X-Cc: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net, 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 X-Mailer: git-send-email 2.56.0 X-In-Reply-To: <20261014081904.6491-6-nic_swsd@realtek.com> 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