From: Markus Stockhausen Date: Wed, 10 Jun 2026 19:41:44 +0000 (+0200) Subject: net: mdio: realtek-rtl9300: Add registers for high port count models X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e8035b861c2481084cdddb54b0e21d8a19d8f81;p=thirdparty%2Flinux.git net: mdio: realtek-rtl9300: Add registers for high port count models The high port count models of the Realtek Otto switches have additional registers to instrument the MDIO controller. These are: - High port mask: A bitfield that extends the already existing low port mask to select ports starting from 32. - Broadcast: This takes the port number during reads on the RTL931x. - Extended page: Some additional page info. The SDK does not give much information about this. Basically some fixed value must be written into it during access. Reviewed-by: Andrew Lunn Signed-off-by: Markus Stockhausen Link: https://patch.msgid.link/20260610194145.4153668-5-markus.stockhausen@gmx.de Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/mdio/mdio-realtek-rtl9300.c b/drivers/net/mdio/mdio-realtek-rtl9300.c index 5aa447ed6424..1cdf2049cfa5 100644 --- a/drivers/net/mdio/mdio-realtek-rtl9300.c +++ b/drivers/net/mdio/mdio-realtek-rtl9300.c @@ -91,6 +91,10 @@ struct otto_emdio_cmd_regs { u32 c45_data; u32 io_data; u32 port_mask_low; + /* additional registers for high port count models RTL839x/RTL931x */ + u32 port_mask_high; + u32 broadcast; + u32 ext_page; }; struct otto_emdio_priv { @@ -164,6 +168,22 @@ static int otto_emdio_run_cmd(struct mii_bus *bus, u32 cmd, return ret; /* Fill all registers. Hardware will read only the needed bits depending on command */ + if (info->cmd_regs.port_mask_high) { + /* Fill extra registers for high port count models */ + ret = regmap_write(priv->regmap, info->cmd_regs.broadcast, cmd_data->broadcast); + if (ret) + return ret; + + ret = regmap_write(priv->regmap, info->cmd_regs.ext_page, cmd_data->ext_page); + if (ret) + return ret; + + ret = regmap_write(priv->regmap, + info->cmd_regs.port_mask_high, cmd_data->port_mask_high); + if (ret) + return ret; + } + ret = regmap_write(priv->regmap, info->cmd_regs.port_mask_low, cmd_data->port_mask_low); if (ret) return ret;