netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH] net: phy: marvell10g: report if the PHY fails to boot firmware
Date: Thu, 30 May 2019 16:12:20 +0200	[thread overview]
Message-ID: <20190530141220.GG18059@lunn.ch> (raw)
In-Reply-To: <20190529110315.uw4a24avp4czhcru@shell.armlinux.org.uk>

> Here's the fuller patch for what I'm suggesting:
> 
>  drivers/net/phy/marvell10g.c | 25 ++++++++++++++++++++-----
>  1 file changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
> index 754cde873dde..86333d98b384 100644
> --- a/drivers/net/phy/marvell10g.c
> +++ b/drivers/net/phy/marvell10g.c
> @@ -60,6 +60,8 @@ enum {
>  };
>  
>  struct mv3310_priv {
> +	bool firmware_failed;
> +
>  	struct device *hwmon_dev;
>  	char *hwmon_name;
>  };
> @@ -214,6 +216,10 @@ static int mv3310_probe(struct phy_device *phydev)
>  	    (phydev->c45_ids.devices_in_package & mmd_mask) != mmd_mask)
>  		return -ENODEV;
>  
> +	priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv)
> +		return -ENOMEM;
> +
>  	ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_BOOT);
>  	if (ret < 0)
>  		return ret;
> @@ -221,13 +227,9 @@ static int mv3310_probe(struct phy_device *phydev)
>  	if (ret & MV_PMA_BOOT_FATAL) {
>  		dev_warn(&phydev->mdio.dev,
>  			 "PHY failed to boot firmware, status=%04x\n", ret);
> -		return -ENODEV;
> +		priv->firmware_failed = true;
>  	}
>  
> -	priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
> -	if (!priv)
> -		return -ENOMEM;
> -
>  	dev_set_drvdata(&phydev->mdio.dev, priv);
>  
>  	ret = mv3310_hwmon_probe(phydev);
> @@ -247,6 +249,19 @@ static int mv3310_resume(struct phy_device *phydev)
>  	return mv3310_hwmon_config(phydev, true);
>  }
>  
> +static void mv3310_link_change_notify(struct phy_device *phydev)
> +{
> +	struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
> +	enum phy_state state = phydev->state;
> +
> +	if (priv->firmware_failed &&
> +	    (state == PHY_UP || state == PHY_RESUMING)) {
> +		dev_warn(&phydev->mdio.dev,
> +			 "PHY firmware failure: link forced down");
> +		phydev->state = state = PHY_HALTED;
> +	}
> +}

Hi Russell

This looks good.

     Andrew

  reply	other threads:[~2019-05-30 14:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28  9:34 [PATCH] net: phy: marvell10g: report if the PHY fails to boot firmware Russell King
2019-05-28 14:36 ` Maxime Chevallier
2019-05-28 14:41 ` Andrew Lunn
2019-05-28 15:42 ` Russell King - ARM Linux admin
2019-05-28 16:11   ` Andrew Lunn
2019-05-28 16:23     ` Russell King - ARM Linux admin
2019-05-29 11:03       ` Russell King - ARM Linux admin
2019-05-30 14:12         ` Andrew Lunn [this message]
2019-05-29 21:26 ` David Miller
2019-05-29 22:22   ` Russell King - ARM Linux admin

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=20190530141220.GG18059@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.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).