c22/c45 descision in phy_restart_aneg()

markus.stockhausen at gmx.de markus.stockhausen at gmx.de
Fri Aug 29 00:39:46 PDT 2025


Hi Russel,

once again some interesting finding from the limitations in the Realtek 
mdio driver. Remember it can only run in c22 or in c45. This time in
autonegotiation restart.

int phy_restart_aneg(struct phy_device *phydev)
{
  int ret;

  if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0)))
    ret = genphy_c45_restart_aneg(phydev);
  else
    ret = genphy_restart_aneg(phydev);

  return ret;
}

I assume BIT(0) means MDIO_DEVS_C22PRESENT. This basically 
uses c22 for c45 PHYs if c22 presence is detected. So in our case 
it fails as soon as the bus has been switched to c45. Of course 
stupid but it is as it is. I see two options to fix the issue.

- Mask the c22 presence in the bus for all PHYs if running in c45
- Or drop the c22 condition check in above function

Any advise?

Thanks in advance.

Markus




More information about the linux-phy mailing list