/* Find out if PHY is in copper or serdes mode by looking at Expansion Reg 0x42 - "Operating Mode Status Register"  */
static int bcm5482_is_serdes(struct phy_device *phydev)
/* Find out if PHY is in copper or serdes mode by looking at Expansion Reg 0x42 - "Operating Mode Status Register"  */
static int bcm5482_is_serdes(struct phy_device *phydev)
{
	u16 val;
	int serdes = 0;
	phy_write(phydev, MDIO_DEVAD_NONE, MIIM_BCM54XX_EXP_SEL,
			MIIM_BCM54XX_EXP_SEL_ER | 0x42);
	val = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_BCM54XX_EXP_DATA);
	switch (val & 0x1f) {
	case 0x0d:
	case 0x0e:
	case 0x0f:
	case 0x12:
	case 0x13:
	case 0x16:
		serdes = 1;
		break;
	case 0x6:
	case 0x14:
	case 0x17:
		break;
	default:
		printf("ERROR, invalid PHY mode (0x%x\n)", val);
		break;
	}
	return serdes;
}