From: Jan Hoffmann Date: Wed, 22 Apr 2026 15:48:20 +0000 (+0200) Subject: realtek: fix SMBus Rollball access X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F23049%2Fhead;p=thirdparty%2Fopenwrt.git 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 --- 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)