From c78e2fe26dde403179da1622c4197e74a9f1cb93 Mon Sep 17 00:00:00 2001 From: Jan Hoffmann Date: Wed, 22 Apr 2026 17:48:20 +0200 Subject: [PATCH] realtek: fix SMBus Rollball access The Rollball command byte needs to be written last. Otherwise the controller might access the wrong register or write the wrong value. Fixes: 1fc19bc06edc ("realtek: rtl93xx: mdio-smbus support for clause 45 and Rollball SFPs") Signed-off-by: Jan Hoffmann Link: https://github.com/openwrt/openwrt/pull/23049 Signed-off-by: Hauke Mehrtens --- .../712-net-phy-add-an-MDIO-SMBus-library.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/realtek/patches-6.18/712-net-phy-add-an-MDIO-SMBus-library.patch b/target/linux/realtek/patches-6.18/712-net-phy-add-an-MDIO-SMBus-library.patch index 0b471be1ec7..6f79964db90 100644 --- a/target/linux/realtek/patches-6.18/712-net-phy-add-an-MDIO-SMBus-library.patch +++ b/target/linux/realtek/patches-6.18/712-net-phy-add-an-MDIO-SMBus-library.patch @@ -260,8 +260,8 @@ Signed-off-by: Antoine Tenart + buf[2] = reg >> 8; + buf[3] = reg & 0xff; + -+ /* send address */ -+ for (i = 0; i < 4; i++) { ++ /* send address, making sure to send the command byte last */ ++ for (i = 3; i >= 0; i--) { + data.byte = buf[i]; + ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_WRITE, ROLLBALL_CMD_ADDR + i, I2C_SMBUS_BYTE_DATA, &data); + if (ret < 0) @@ -311,8 +311,8 @@ Signed-off-by: Antoine Tenart + buf[4] = val >> 8; + buf[5] = val & 0xff; + -+ /* send address and value */ -+ for (i = 0; i < 6; i++) { ++ /* send address and value, making sure to send the command byte last */ ++ for (i = 5; i >= 0; i--) { + data.byte = buf[i]; + ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_WRITE, ROLLBALL_CMD_ADDR + i, I2C_SMBUS_BYTE_DATA, &data); + if (ret < 0)