/* This sets @prtad and @mmds in the MDIO interface if successful. Returns 0 on success, negative on error.  */
int mdio45_probe(struct mdio_if_info *mdio, int prtad)
/* This sets @prtad and @mmds in the MDIO interface if successful. Returns 0 on success, negative on error.  */
int mdio45_probe(struct mdio_if_info *mdio, int prtad)
{
	int mmd, stat2, devs1, devs2;
	for (mmd = 1; mmd <= 5; mmd++) {
		stat2 = mdio->mdio_read(mdio->dev, prtad, mmd, MDIO_STAT2);
		if (stat2 < 0 ||
		    (stat2 & MDIO_STAT2_DEVPRST) != MDIO_STAT2_DEVPRST_VAL)
			continue;
		devs1 = mdio->mdio_read(mdio->dev, prtad, mmd, MDIO_DEVS1);
		devs2 = mdio->mdio_read(mdio->dev, prtad, mmd, MDIO_DEVS2);
		if (devs1 < 0 || devs2 < 0)
			continue;
		mdio->prtad = prtad;
		mdio->mmds = devs1 | (devs2 << 16);
		return 0;
	}
	return -ENODEV;
}