diff --git a/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto-serdes.c b/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto-serdes.c index 641a6196b9..9ae62bfc4f 100644 --- a/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto-serdes.c +++ b/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto-serdes.c @@ -326,9 +326,6 @@ static int rtsds_rt93xx_io(struct rtsds_ctrl *ctrl, int sds, int page, int regnu */ static int rtsds_930x_get_backing_sds(int sds, int page) { - if (sds == 3 && page < 4) - return 10; - return sds; } diff --git a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c index c8e10bc025..31b40038f4 100644 --- a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c +++ b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c @@ -932,6 +932,34 @@ static int rtpcs_839x_setup_serdes(struct rtpcs_serdes *sds, /* RTL930X */ +/* + * RTL930X needs a special mapping from logic SerDes ID to physical SerDes ID, + * which takes the page into account. This applies to most of read/write calls. + */ +static int rtpcs_930x_sds_get_phys_sds_id(int sds_id, int page) +{ + if (sds_id == 3 && page < 4) + return 10; + + return sds_id; +} + +static int rtpcs_930x_sds_op_read(struct rtpcs_serdes *sds, int page, int regnum, int bithigh, + int bitlow) +{ + int sds_id = rtpcs_930x_sds_get_phys_sds_id(sds->id, page); + + return __rtpcs_sds_read_raw(sds->ctrl, sds_id, page, regnum, bithigh, bitlow); +} + +static int rtpcs_930x_sds_op_write(struct rtpcs_serdes *sds, int page, int regnum, int bithigh, + int bitlow, u16 value) +{ + int sds_id = rtpcs_930x_sds_get_phys_sds_id(sds->id, page); + + return __rtpcs_sds_write_raw(sds->ctrl, sds_id, page, regnum, bithigh, bitlow, value); +} + static const u16 rtpcs_930x_sds_regs[] = { 0x0194, 0x0194, 0x0194, 0x0194, /* SDS_MODE_SEL_0 */ 0x02a0, 0x02a0, 0x02a0, 0x02a0, /* SDS_MODE_SEL_1 */ @@ -3857,8 +3885,8 @@ static const struct phylink_pcs_ops rtpcs_930x_pcs_ops = { }; static const struct rtpcs_serdes_ops rtpcs_930x_sds_ops = { - .read = rtpcs_generic_sds_op_read, - .write = rtpcs_generic_sds_op_write, + .read = rtpcs_930x_sds_op_read, + .write = rtpcs_930x_sds_op_write, }; static const struct rtpcs_config rtpcs_930x_cfg = {