diff mbox series

[net-next,2/3] net: fec: use mac-managed PHY PM

Message ID a34e3ad6-21a8-5151-7beb-5080f4ac102a@gmail.com
State New
Headers show
Series net: make PHY PM ops a no-op if MAC driver manages PHY PM | expand

Commit Message

Heiner Kallweit April 7, 2021, 3:52 p.m. UTC
Use the new mac_managed_pm flag to work around an issue with KSZ8081 PHY
that becomes unstable when a soft reset is triggered during aneg.

Reported-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Tested-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/freescale/fec_main.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Joakim Zhang April 8, 2021, 5:45 a.m. UTC | #1
> -----Original Message-----

> From: Heiner Kallweit <hkallweit1@gmail.com>

> Sent: 2021年4月7日 23:53

> To: Andrew Lunn <andrew@lunn.ch>; Russell King - ARM Linux

> <linux@armlinux.org.uk>; Jakub Kicinski <kuba@kernel.org>; David Miller

> <davem@davemloft.net>; Fugang Duan <fugang.duan@nxp.com>

> Cc: netdev@vger.kernel.org; Joakim Zhang <qiangqing.zhang@nxp.com>

> Subject: [PATCH net-next 2/3] net: fec: use mac-managed PHY PM

> 

> Use the new mac_managed_pm flag to work around an issue with KSZ8081

> PHY that becomes unstable when a soft reset is triggered during aneg.

> 

> Reported-by: Joakim Zhang <qiangqing.zhang@nxp.com>

> Tested-by: Joakim Zhang <qiangqing.zhang@nxp.com>

> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

> ---

>  drivers/net/ethernet/freescale/fec_main.c | 3 +++

>  1 file changed, 3 insertions(+)

> 

> diff --git a/drivers/net/ethernet/freescale/fec_main.c

> b/drivers/net/ethernet/freescale/fec_main.c

> index 3db882322..70aea9c27 100644

> --- a/drivers/net/ethernet/freescale/fec_main.c

> +++ b/drivers/net/ethernet/freescale/fec_main.c

> @@ -2048,6 +2048,8 @@ static int fec_enet_mii_probe(struct net_device

> *ndev)

>  	fep->link = 0;

>  	fep->full_duplex = 0;

> 

> +	phy_dev->mac_managed_pm = 1;

> +

>  	phy_attached_info(phy_dev);

> 

>  	return 0;

> @@ -3864,6 +3866,7 @@ static int __maybe_unused fec_resume(struct

> device *dev)

>  		netif_device_attach(ndev);

>  		netif_tx_unlock_bh(ndev);

>  		napi_enable(&fep->napi);

> +		phy_init_hw(ndev->phydev);



For now, I think we doesn't need to re-initialize PHY after MAC resume back, it also can be done by PHY driver if it needed.

Best Regards,
Joakim Zhang
>  		phy_start(ndev->phydev);

>  	}

>  	rtnl_unlock();

> --

> 2.31.1

>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 3db882322..70aea9c27 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2048,6 +2048,8 @@  static int fec_enet_mii_probe(struct net_device *ndev)
 	fep->link = 0;
 	fep->full_duplex = 0;
 
+	phy_dev->mac_managed_pm = 1;
+
 	phy_attached_info(phy_dev);
 
 	return 0;
@@ -3864,6 +3866,7 @@  static int __maybe_unused fec_resume(struct device *dev)
 		netif_device_attach(ndev);
 		netif_tx_unlock_bh(ndev);
 		napi_enable(&fep->napi);
+		phy_init_hw(ndev->phydev);
 		phy_start(ndev->phydev);
 	}
 	rtnl_unlock();