netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Matteo Croce <mcroce@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net 1/2] net: marvell10g: report firmware version
Date: Tue, 14 Apr 2020 20:45:20 +0100	[thread overview]
Message-ID: <20200414194520.GA25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200414184739.GD637127@lunn.ch>

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@redhat.com>
> > Signed-off-by: Russell King <rmk+kernel@armlinux.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

  reply	other threads:[~2020-04-14 19:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 18:29 [PATCH net 0/2] Fix 88x3310 leaving power save mode Russell King - ARM Linux admin
2020-04-14 18:30 ` [PATCH net 1/2] net: marvell10g: report firmware version Russell King
2020-04-14 18:47   ` Andrew Lunn
2020-04-14 19:45     ` Russell King - ARM Linux admin [this message]
2020-04-14 18:30 ` [PATCH net 2/2] net: marvell10g: soft-reset the PHY when coming out of low power Russell King
2020-04-14 18:48   ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200414194520.GA25745@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=mcroce@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).