[PATCH net-next v4 1/3] r8152: fix incorrect register write to USB_UPHY_XTAL

Chih Kai Hsu posted 3 patches 1 week ago
[PATCH net-next v4 1/3] r8152: fix incorrect register write to USB_UPHY_XTAL
Posted by Chih Kai Hsu 1 week ago
The old code used ocp_write_byte() to clear the OOBS_POLLING bit
(BIT(8)) in the USB_UPHY_XTAL register, but this doesn't correctly
clear a bit in the upper byte of the 16-bit register.

Fix this by using ocp_write_word() instead.

Fixes: 195aae321c82 ("r8152: support new chips")
Signed-off-by: Chih Kai Hsu <hsu.chih.kai@realtek.com>
---
 drivers/net/usb/r8152.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 3b6d4252d34c..bef0611e7ef0 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3892,7 +3892,7 @@ static void r8156_ups_en(struct r8152 *tp, bool enable)
 		case RTL_VER_15:
 			ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_UPHY_XTAL);
 			ocp_data &= ~OOBS_POLLING;
-			ocp_write_byte(tp, MCU_TYPE_USB, USB_UPHY_XTAL, ocp_data);
+			ocp_write_word(tp, MCU_TYPE_USB, USB_UPHY_XTAL, ocp_data);
 			break;
 		default:
 			break;
-- 
2.34.1
RE: [PATCH net-next v4 1/3] r8152: fix incorrect register write to USB_UPHY_XTAL
Posted by Hayes Wang 1 week ago
Chih Kai Hsu <hsu.chih.kai@realtek.com>
> Sent: Thursday, March 26, 2026 3:39 PM
> To: kuba@kernel.org; davem@davemloft.net
> Cc: netdev@vger.kernel.org; nic_swsd <nic_swsd@realtek.com>;
> linux-kernel@vger.kernel.org; linux-usb@vger.kernel.org;
> edumazet@google.com; bjorn@mork.no; pabeni@redhat.com; Chih Kai Hsu
> <hsu.chih.kai@realtek.com>
> Subject: [PATCH net-next v4 1/3] r8152: fix incorrect register write to
> USB_UPHY_XTAL
> 
> The old code used ocp_write_byte() to clear the OOBS_POLLING bit
> (BIT(8)) in the USB_UPHY_XTAL register, but this doesn't correctly clear a bit in
> the upper byte of the 16-bit register.
> 
> Fix this by using ocp_write_word() instead.
> 
> Fixes: 195aae321c82 ("r8152: support new chips")
> Signed-off-by: Chih Kai Hsu <hsu.chih.kai@realtek.com>

Reviewed-by: Hayes Wang <hayeswang@realtek.com>

Best Regards,
Hayes