Re: [PATCH net-next v9] net: mdio: Add RTL9300 MDIO driver
From: Andrew Lunn
Date: Thu Mar 13 2025 - 09:07:49 EST
> Ah I get it. It's about tracking the current page for a particular
> device address and using that instead of 0xfff in
> FIELD_PREP(PHY_CTRL_MAIN_PAGE, 0xfff). I'm not sure it's going to work
> generically. Realtek switches know about Realtek PHYs but I've seen
> plenty of other PHYs that do paging via addresses other than 0x1f
> (Marvell 88E1111 for example uses 0x1d for its extaddr, some Broadcom
> PHYs seem to use 0x1c). I'm not sure how many systems are mixing vendors
> for C22 PHYs (the Zyxel boards seem to have Marvell AQR 10G PHYs but
> that's C45).
It is worse than that. The switch needs to change the page itself:
static int rtlgen_read_status(struct phy_device *phydev)
{
int ret, val;
ret = genphy_read_status(phydev);
if (ret < 0)
return ret;
if (!phydev->link)
return 0;
val = phy_read_paged(phydev, 0xa43, 0x12);
if (val < 0)
return val;
rtlgen_decode_physr(phydev, val);
It needs to read register 0x12 from page 0xa43.
I do agree this cannot work in the general case. Which is why i asked
about what the limitations are for configuring the MAC in software.
Andrew