/* Return: 0 if wait succeeded, -ve if error occurred  */
static int wait_phy_ready(struct udevice *dev, u32 mask)
/* Return: 0 if wait succeeded, -ve if error occurred  */
static int wait_phy_ready(struct udevice *dev, u32 mask)
{
	u16 timeout = 20000;
	u32 phy_status;
	do {
		phy_status = get_reg(dev, REG_PHY_STATUS) & mask;
		if (!timeout--)
			return -ETIMEDOUT;
		udelay(20);
	} while (phy_status != mask);
	return 0;
}