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 <andrew@lunn.ch>
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://patch.msgid.link/20260610194145.4153668-5-markus.stockhausen@gmx.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Markus Stockhausen 2026-06-10 21:41:44 +02:00 committed by Jakub Kicinski
parent 6e1d8b024d
commit 3e8035b861

View File

@ -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;