Skip to content

Commit dd649b4

Browse files
Russell Kingdavem330
authored andcommitted
net: marvell10g: report firmware version
Report the firmware version when probing the PHY to allow issues attributable to firmware to be diagnosed. Tested-by: Matteo Croce <[email protected]> Signed-off-by: Russell King <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c799fca commit dd649b4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/net/phy/marvell10g.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa)
3434

3535
enum {
36+
MV_PMA_FW_VER0 = 0xc011,
37+
MV_PMA_FW_VER1 = 0xc012,
3638
MV_PMA_BOOT = 0xc050,
3739
MV_PMA_BOOT_FATAL = BIT(0),
3840

@@ -83,6 +85,8 @@ enum {
8385
};
8486

8587
struct mv3310_priv {
88+
u32 firmware_ver;
89+
8690
struct device *hwmon_dev;
8791
char *hwmon_name;
8892
};
@@ -355,6 +359,22 @@ static int mv3310_probe(struct phy_device *phydev)
355359

356360
dev_set_drvdata(&phydev->mdio.dev, priv);
357361

362+
ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_FW_VER0);
363+
if (ret < 0)
364+
return ret;
365+
366+
priv->firmware_ver = ret << 16;
367+
368+
ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_FW_VER1);
369+
if (ret < 0)
370+
return ret;
371+
372+
priv->firmware_ver |= ret;
373+
374+
phydev_info(phydev, "Firmware version %u.%u.%u.%u\n",
375+
priv->firmware_ver >> 24, (priv->firmware_ver >> 16) & 255,
376+
(priv->firmware_ver >> 8) & 255, priv->firmware_ver & 255);
377+
358378
/* Powering down the port when not in use saves about 600mW */
359379
ret = mv3310_power_down(phydev);
360380
if (ret)

0 commit comments

Comments
 (0)