Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: phy: marvell10g: report if the PHY fails to boot firmware

Some boards do not have the PHY firmware programmed in the 3310's flash,
which leads to the PHY not working as expected. Warn the user when the
PHY fails to boot the firmware and refuse to initialise.

Fixes: 20b2af32ff3f ("net: phy: add Marvell Alaska X 88X3310 10Gigabit PHY support")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Russell King and committed by
David S. Miller
3d3ced2e c6787263

+13
+13
drivers/net/phy/marvell10g.c
··· 31 31 #define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa) 32 32 33 33 enum { 34 + MV_PMA_BOOT = 0xc050, 35 + MV_PMA_BOOT_FATAL = BIT(0), 36 + 34 37 MV_PCS_BASE_T = 0x0000, 35 38 MV_PCS_BASE_R = 0x1000, 36 39 MV_PCS_1000BASEX = 0x2000, ··· 215 212 if (!phydev->is_c45 || 216 213 (phydev->c45_ids.devices_in_package & mmd_mask) != mmd_mask) 217 214 return -ENODEV; 215 + 216 + ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_BOOT); 217 + if (ret < 0) 218 + return ret; 219 + 220 + if (ret & MV_PMA_BOOT_FATAL) { 221 + dev_warn(&phydev->mdio.dev, 222 + "PHY failed to boot firmware, status=%04x\n", ret); 223 + return -ENODEV; 224 + } 218 225 219 226 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); 220 227 if (!priv)