netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Badel, Laurent" <LaurentBadel@eaton.com>
To: "fugang.duan@nxp.com" <fugang.duan@nxp.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"andrew@lunn.ch" <andrew@lunn.ch>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
	"hkallweit1@gmail.com" <hkallweit1@gmail.com>,
	"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"richard.leitner@skidata.com" <richard.leitner@skidata.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"alexander.levin@microsoft.com" <alexander.levin@microsoft.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "Quette, Arnaud" <ArnaudQuette@Eaton.com>
Subject: [PATCH 2/2] Reset PHY in phy_init_hw() before interrupt configuration
Date: Wed, 29 Apr 2020 09:03:39 +0000	[thread overview]
Message-ID: <CH2PR17MB3542BB17A1FA1764ACE3B20EDFAD0@CH2PR17MB3542.namprd17.prod.outlook.com> (raw)

Description: this patch adds a reset of the PHY in phy_init_hw() 
for PHY drivers bearing the PHY_RST_AFTER_CLK_EN flag.

Rationale: due to the PHY reset reverting the interrupt mask to default, 
it is necessary to either perform the reset before PHY configuration, 
or re-configure the PHY after reset. This patch implements the former
as it is simpler and more generic. 

Fixes: 1b0a83ac04e383e3bed21332962b90710fcf2828 ("net: fec: add phy_reset_after_clk_enable() support")
Signed-off-by: Laurent Badel <laurentbadel@eaton.com>

---
 drivers/net/phy/phy_device.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 28e3c5c0e..2cc511364 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1082,8 +1082,11 @@ int phy_init_hw(struct phy_device *phydev)
 {
 	int ret = 0;
 
-	/* Deassert the reset signal */
-	phy_device_reset(phydev, 0);
+	/* Deassert the reset signal
+	 * If the PHY needs a reset, do it now
+	 */
+	if (!phy_reset_after_clk_enable(phydev))
+		phy_device_reset(phydev, 0);
 
 	if (!phydev->drv)
 		return 0;
-- 
2.17.1



-----------------------------
Eaton Industries Manufacturing GmbH ~ Registered place of business: Route de la Longeraie 7, 1110, Morges, Switzerland 

-----------------------------


             reply	other threads:[~2020-04-29  9:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29  9:03 Badel, Laurent [this message]
2020-04-29 12:00 ` [PATCH 2/2] Reset PHY in phy_init_hw() before interrupt configuration Badel, Laurent
2020-04-29 17:06 ` Heiner Kallweit
2020-04-30  9:29   ` [EXTERNAL] " Badel, Laurent
2020-05-19  8:41     ` Jörg Willmann
2020-10-26 10:21       ` Badel, Laurent

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=CH2PR17MB3542BB17A1FA1764ACE3B20EDFAD0@CH2PR17MB3542.namprd17.prod.outlook.com \
    --to=laurentbadel@eaton.com \
    --cc=ArnaudQuette@Eaton.com \
    --cc=alexander.levin@microsoft.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=fugang.duan@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hkallweit1@gmail.com \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=richard.leitner@skidata.com \
    /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).