[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200414194520.GA25745@shell.armlinux.org.uk>
Date: Tue, 14 Apr 2020 20:45:20 +0100
From: Russell King - ARM Linux admin <linux@...linux.org.uk>
To: Andrew Lunn <andrew@...n.ch>
Cc: Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Matteo Croce <mcroce@...hat.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH net 1/2] net: marvell10g: report firmware version
On Tue, Apr 14, 2020 at 08:47:39PM +0200, Andrew Lunn wrote:
> On Tue, Apr 14, 2020 at 07:30:15PM +0100, Russell King wrote:
> > Report the firmware version when probing the PHY to allow issues
> > attributable to firmware to be diagnosed.
> >
> > Tested-by: Matteo Croce <mcroce@...hat.com>
> > Signed-off-by: Russell King <rmk+kernel@...linux.org.uk>
> > ---
> > drivers/net/phy/marvell10g.c | 21 +++++++++++++++++++++
> > 1 file changed, 21 insertions(+)
> >
> > diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
> > index 7621badae64d..ee60417cdc55 100644
> > --- a/drivers/net/phy/marvell10g.c
> > +++ b/drivers/net/phy/marvell10g.c
> > @@ -33,6 +33,8 @@
> > #define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa)
> >
> > enum {
> > + MV_PMA_FW_VER0 = 0xc011,
> > + MV_PMA_FW_VER1 = 0xc012,
> > MV_PMA_BOOT = 0xc050,
> > MV_PMA_BOOT_FATAL = BIT(0),
> >
> > @@ -83,6 +85,8 @@ enum {
> > };
> >
> > struct mv3310_priv {
> > + u32 firmware_ver;
> > +
> > struct device *hwmon_dev;
> > char *hwmon_name;
> > };
> > @@ -355,6 +359,23 @@ static int mv3310_probe(struct phy_device *phydev)
> >
> > dev_set_drvdata(&phydev->mdio.dev, priv);
> >
> > + ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_FW_VER0);
> > + if (ret < 0)
> > + return ret;
> > +
> > + priv->firmware_ver = ret << 16;
> > +
> > + ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_FW_VER1);
> > + if (ret < 0)
> > + return ret;
> > +
> > + priv->firmware_ver |= ret;
> > +
> > + dev_info(&phydev->mdio.dev,
> > + "Firmware version %u.%u.%u.%u\n",
> > + priv->firmware_ver >> 24, (priv->firmware_ver >> 16) & 255,
> > + (priv->firmware_ver >> 8) & 255, priv->firmware_ver & 255);
> > +
>
> Hi Russell
>
> Did you consider using phydev_info()? Or is it too early, and you
> don't get a sensible name?
No, I keep forgetting those exist! I'll resend shortly.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up
Powered by blists - more mailing lists