lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CH2PR17MB3542969A2C3545C58E000928DFAD0@CH2PR17MB3542.namprd17.prod.outlook.com>
Date:   Wed, 29 Apr 2020 12:00:10 +0000
From:   "Badel, Laurent" <LaurentBadel@...on.com>
To:     "fugang.duan@....com" <fugang.duan@....com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "andrew@...n.ch" <andrew@...n.ch>,
        "f.fainelli@...il.com" <f.fainelli@...il.com>,
        "hkallweit1@...il.com" <hkallweit1@...il.com>,
        "linux@...linux.org.uk" <linux@...linux.org.uk>,
        "richard.leitner@...data.com" <richard.leitner@...data.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "alexander.levin@...rosoft.com" <alexander.levin@...rosoft.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
CC:     "Quette, Arnaud" <ArnaudQuette@...on.com>
Subject: RE: [PATCH 2/2] Reset PHY in phy_init_hw() before interrupt
 configuration

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: 1b0a83ac04e3 ("net: fec: add phy_reset_after_clk_enable() support")
Signed-off-by: Laurent Badel <laurentbadel@...on.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 

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

-----Original Message-----
> From: Badel, Laurent
> Sent: Wednesday, April 29, 2020 11:04 AM
> To: 'fugang.duan@....com' <fugang.duan@....com>;
> 'netdev@...r.kernel.org' <netdev@...r.kernel.org>; 'andrew@...n.ch'
> <andrew@...n.ch>; 'f.fainelli@...il.com' <f.fainelli@...il.com>;
> 'hkallweit1@...il.com' <hkallweit1@...il.com>; 'linux@...linux.org.uk'
> <linux@...linux.org.uk>; 'richard.leitner@...data.com'
> <richard.leitner@...data.com>; 'davem@...emloft.net'
> <davem@...emloft.net>; 'alexander.levin@...rosoft.com'
> <alexander.levin@...rosoft.com>; 'gregkh@...uxfoundation.org'
> <gregkh@...uxfoundation.org>
> Cc: Quette, Arnaud <ArnaudQuette@...on.com>
> Subject: [PATCH 2/2] Reset PHY in phy_init_hw() before interrupt
> configuration
> 
> 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@...on.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ