All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joakim Zhang <qiangqing.zhang@nxp.com>
To: Heiner Kallweit <hkallweit1@gmail.com>,
	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" <netdev@vger.kernel.org>
Subject: RE: [PATCH net-next 2/3] net: fec: use mac-managed PHY PM
Date: Thu, 8 Apr 2021 06:21:35 +0000	[thread overview]
Message-ID: <DB8PR04MB679538D39673F03F399F8F20E6749@DB8PR04MB6795.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <d47a3d9f-a9cf-4765-9ee8-19ebb9155150@gmail.com>


> -----Original Message-----
> From: Heiner Kallweit <hkallweit1@gmail.com>
> Sent: 2021年4月8日 14:00
> To: Joakim Zhang <qiangqing.zhang@nxp.com>; 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
> Subject: Re: [PATCH net-next 2/3] net: fec: use mac-managed PHY PM
> 
> On 08.04.2021 07:45, Joakim Zhang wrote:
> >
> >> -----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.
> >
> The PHY PM resume callback (that used to call phy_init_hw) is a no-op now.
> So we have to call it from the MAC resume callback. Power to the PHY may be
> off during system suspend, therefore it may be reset to power-on defaults.
> That's why phy_init_hw() should be called, that includes calling the PHY drivers
> config_init callback.

Yes, it is reasonable to invoke phy_init_hw() here to cover more cases. What I want to describe, we have not run into such case for FEC driver before.
At least no one complain it before as I know. Anyway, re-initialize PHY here indeed can benefit more scenarios.

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


  reply	other threads:[~2021-04-08  6:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 15:50 [PATCH net-next 0/3] net: make PHY PM ops a no-op if MAC driver manages PHY PM Heiner Kallweit
2021-04-07 15:51 ` [PATCH net-next 1/3] net: phy: " Heiner Kallweit
2021-04-07 15:52 ` [PATCH net-next 2/3] net: fec: use mac-managed " Heiner Kallweit
2021-04-08  5:45   ` Joakim Zhang
2021-04-08  5:59     ` Heiner Kallweit
2021-04-08  6:21       ` Joakim Zhang [this message]
2021-04-07 15:53 ` [PATCH net-next 3/3] r8169: " Heiner Kallweit
2021-04-08  5:42 ` [PATCH net-next 0/3] net: make PHY PM ops a no-op if MAC driver manages " Joakim Zhang
2021-04-08  9:02   ` Heiner Kallweit
2021-04-09  9:23 ` Heiner Kallweit
2021-04-10  1:13 ` Jakub Kicinski

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=DB8PR04MB679538D39673F03F399F8F20E6749@DB8PR04MB6795.eurprd04.prod.outlook.com \
    --to=qiangqing.zhang@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=fugang.duan@nxp.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.