linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2] net: phy: marvell: add sleep time after enabling the loopback bit
@ 2022-11-08  7:40 Aminuddin Jamaluddin
  2022-11-10  2:41 ` Jakub Kicinski
  2022-11-10  3:54 ` Florian Fainelli
  0 siblings, 2 replies; 5+ messages in thread
From: Aminuddin Jamaluddin @ 2022-11-08  7:40 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Mohammad Athari Bin Ismail
  Cc: netdev, linux-kernel, stable, tee.min.tan,
	muhammad.husaini.zulkifli, aminuddin.jamaluddin, hong.aun.looi

Sleep time is added to ensure the phy to be ready after loopback
bit was set. This to prevent the phy loopback test from failing.

---
V1: https://patchwork.kernel.org/project/netdevbpf/patch/20220825082238.11056-1-aminuddin.jamaluddin@intel.com/
---

Fixes: 020a45aff119 ("net: phy: marvell: add Marvell specific PHY loopback")
Cc: <stable@vger.kernel.org> # 5.15.x
Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
Signed-off-by: Aminuddin Jamaluddin <aminuddin.jamaluddin@intel.com>
---
 drivers/net/phy/marvell.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index a3e810705ce2..860610ba4d00 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -2015,14 +2015,16 @@ static int m88e1510_loopback(struct phy_device *phydev, bool enable)
 		if (err < 0)
 			return err;
 
-		/* FIXME: Based on trial and error test, it seem 1G need to have
-		 * delay between soft reset and loopback enablement.
-		 */
-		if (phydev->speed == SPEED_1000)
-			msleep(1000);
+		err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
+				 BMCR_LOOPBACK);
 
-		return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
-				  BMCR_LOOPBACK);
+		if (!err) {
+			/* It takes some time for PHY device to switch
+			 * into/out-of loopback mode.
+			 */
+			msleep(1000);
+		}
+		return err;
 	} else {
 		err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, 0);
 		if (err < 0)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v2] net: phy: marvell: add sleep time after enabling the loopback bit
  2022-11-08  7:40 [PATCH net-next v2] net: phy: marvell: add sleep time after enabling the loopback bit Aminuddin Jamaluddin
@ 2022-11-10  2:41 ` Jakub Kicinski
  2022-11-11  3:43   ` Jamaluddin, Aminuddin
  2022-11-10  3:54 ` Florian Fainelli
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2022-11-10  2:41 UTC (permalink / raw)
  To: Aminuddin Jamaluddin
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Paolo Abeni, Mohammad Athari Bin Ismail, netdev,
	linux-kernel, stable, tee.min.tan, muhammad.husaini.zulkifli,
	hong.aun.looi

On Tue,  8 Nov 2022 15:40:05 +0800 Aminuddin Jamaluddin wrote:
> Subject: [PATCH net-next v2] net: phy: marvell: add sleep time after enabling the loopback bit

Looks like v1 was tagged for net, why switch to net-next?
It's either a fix or not, we don't do gray scales in netdev.

> Sleep time is added to ensure the phy to be ready after loopback
> bit was set. This to prevent the phy loopback test from failing.
> 
> ---
> V1: https://patchwork.kernel.org/project/netdevbpf/patch/20220825082238.11056-1-aminuddin.jamaluddin@intel.com/
> ---

git am will cut off at the first --- it finds, so the v1 link and all
the tags below we'll be lost when the patch is applied. Please move 
this section after the tags.

> Fixes: 020a45aff119 ("net: phy: marvell: add Marvell specific PHY loopback")
> Cc: <stable@vger.kernel.org> # 5.15.x
> Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
> Signed-off-by: Aminuddin Jamaluddin <aminuddin.jamaluddin@intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v2] net: phy: marvell: add sleep time after enabling the loopback bit
  2022-11-08  7:40 [PATCH net-next v2] net: phy: marvell: add sleep time after enabling the loopback bit Aminuddin Jamaluddin
  2022-11-10  2:41 ` Jakub Kicinski
@ 2022-11-10  3:54 ` Florian Fainelli
  2022-11-11  3:40   ` Jamaluddin, Aminuddin
  1 sibling, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2022-11-10  3:54 UTC (permalink / raw)
  To: Aminuddin Jamaluddin, Andrew Lunn, Heiner Kallweit, Russell King,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Mohammad Athari Bin Ismail
  Cc: netdev, linux-kernel, stable, tee.min.tan,
	muhammad.husaini.zulkifli, hong.aun.looi



On 11/7/2022 11:40 PM, Aminuddin Jamaluddin wrote:
> Sleep time is added to ensure the phy to be ready after loopback
> bit was set. This to prevent the phy loopback test from failing.
> 
> ---
> V1: https://patchwork.kernel.org/project/netdevbpf/patch/20220825082238.11056-1-aminuddin.jamaluddin@intel.com/
> ---
> 
> Fixes: 020a45aff119 ("net: phy: marvell: add Marvell specific PHY loopback")
> Cc: <stable@vger.kernel.org> # 5.15.x
> Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
> Signed-off-by: Aminuddin Jamaluddin <aminuddin.jamaluddin@intel.com>
> ---
>   drivers/net/phy/marvell.c | 16 +++++++++-------
>   1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> index a3e810705ce2..860610ba4d00 100644
> --- a/drivers/net/phy/marvell.c
> +++ b/drivers/net/phy/marvell.c
> @@ -2015,14 +2015,16 @@ static int m88e1510_loopback(struct phy_device *phydev, bool enable)
>   		if (err < 0)
>   			return err;
>   
> -		/* FIXME: Based on trial and error test, it seem 1G need to have
> -		 * delay between soft reset and loopback enablement.
> -		 */
> -		if (phydev->speed == SPEED_1000)
> -			msleep(1000);
> +		err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
> +				 BMCR_LOOPBACK);
>   
> -		return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
> -				  BMCR_LOOPBACK);
> +		if (!err) {
> +			/* It takes some time for PHY device to switch
> +			 * into/out-of loopback mode.
> +			 */
> +			msleep(1000);

Is not there a better indication than waiting a full second to ensure 
the PHY exited loopback?
-- 
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH net-next v2] net: phy: marvell: add sleep time after enabling the loopback bit
  2022-11-10  3:54 ` Florian Fainelli
@ 2022-11-11  3:40   ` Jamaluddin, Aminuddin
  0 siblings, 0 replies; 5+ messages in thread
From: Jamaluddin, Aminuddin @ 2022-11-11  3:40 UTC (permalink / raw)
  To: Florian Fainelli, Andrew Lunn, Heiner Kallweit, Russell King,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Ismail, Mohammad Athari
  Cc: netdev, linux-kernel, stable, Tan, Tee Min, Zulkifli,
	Muhammad Husaini, Looi, Hong Aun

> -----Original Message-----
> From: Florian Fainelli <f.fainelli@gmail.com>
> Sent: Thursday, 10 November, 2022 11:54 AM
> To: Jamaluddin, Aminuddin <aminuddin.jamaluddin@intel.com>; Andrew
> Lunn <andrew@lunn.ch>; Heiner Kallweit <hkallweit1@gmail.com>; Russell
> King <linux@armlinux.org.uk>; David S . Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> Paolo Abeni <pabeni@redhat.com>; Ismail, Mohammad Athari
> <mohammad.athari.ismail@intel.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> stable@vger.kernel.org; Tan, Tee Min <tee.min.tan@intel.com>; Zulkifli,
> Muhammad Husaini <muhammad.husaini.zulkifli@intel.com>; Looi, Hong
> Aun <hong.aun.looi@intel.com>
> Subject: Re: [PATCH net-next v2] net: phy: marvell: add sleep time after
> enabling the loopback bit
> 
> 
> 
> On 11/7/2022 11:40 PM, Aminuddin Jamaluddin wrote:
> > Sleep time is added to ensure the phy to be ready after loopback bit
> > was set. This to prevent the phy loopback test from failing.
> >
> > ---
> > V1:
> >
> https://patchwork.kernel.org/project/netdevbpf/patch/20220825082238.11
> > 056-1-aminuddin.jamaluddin@intel.com/
> > ---
> >
> > Fixes: 020a45aff119 ("net: phy: marvell: add Marvell specific PHY
> > loopback")
> > Cc: <stable@vger.kernel.org> # 5.15.x
> > Signed-off-by: Muhammad Husaini Zulkifli
> > <muhammad.husaini.zulkifli@intel.com>
> > Signed-off-by: Aminuddin Jamaluddin <aminuddin.jamaluddin@intel.com>
> > ---
> >   drivers/net/phy/marvell.c | 16 +++++++++-------
> >   1 file changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> > index a3e810705ce2..860610ba4d00 100644
> > --- a/drivers/net/phy/marvell.c
> > +++ b/drivers/net/phy/marvell.c
> > @@ -2015,14 +2015,16 @@ static int m88e1510_loopback(struct
> phy_device *phydev, bool enable)
> >   		if (err < 0)
> >   			return err;
> >
> > -		/* FIXME: Based on trial and error test, it seem 1G need to
> have
> > -		 * delay between soft reset and loopback enablement.
> > -		 */
> > -		if (phydev->speed == SPEED_1000)
> > -			msleep(1000);
> > +		err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
> > +				 BMCR_LOOPBACK);
> >
> > -		return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
> > -				  BMCR_LOOPBACK);
> > +		if (!err) {
> > +			/* It takes some time for PHY device to switch
> > +			 * into/out-of loopback mode.
> > +			 */
> > +			msleep(1000);
> 
> Is not there a better indication than waiting a full second to ensure the PHY
> exited loopback?

Previously we implemented the link status check that waiting phy to be ready
before the loopback bit being set in V1. But we removed it due to simpler
behaviour as that can be achieve with this. And previous discussion with Marvell
stated the delay timing was needed after loopback bit is set. 

> --

Amin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH net-next v2] net: phy: marvell: add sleep time after enabling the loopback bit
  2022-11-10  2:41 ` Jakub Kicinski
@ 2022-11-11  3:43   ` Jamaluddin, Aminuddin
  0 siblings, 0 replies; 5+ messages in thread
From: Jamaluddin, Aminuddin @ 2022-11-11  3:43 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Paolo Abeni, Ismail, Mohammad Athari, netdev,
	linux-kernel, stable, Tan, Tee Min, Zulkifli, Muhammad Husaini,
	Looi, Hong Aun

> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Thursday, 10 November, 2022 10:42 AM
> To: Jamaluddin, Aminuddin <aminuddin.jamaluddin@intel.com>
> Cc: Andrew Lunn <andrew@lunn.ch>; Heiner Kallweit
> <hkallweit1@gmail.com>; Russell King <linux@armlinux.org.uk>; David S .
> Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>;
> Paolo Abeni <pabeni@redhat.com>; Ismail, Mohammad Athari
> <mohammad.athari.ismail@intel.com>; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; stable@vger.kernel.org; Tan, Tee Min
> <tee.min.tan@intel.com>; Zulkifli, Muhammad Husaini
> <muhammad.husaini.zulkifli@intel.com>; Looi, Hong Aun
> <hong.aun.looi@intel.com>
> Subject: Re: [PATCH net-next v2] net: phy: marvell: add sleep time after
> enabling the loopback bit
> 
> On Tue,  8 Nov 2022 15:40:05 +0800 Aminuddin Jamaluddin wrote:
> > Subject: [PATCH net-next v2] net: phy: marvell: add sleep time after
> > enabling the loopback bit
> 
> Looks like v1 was tagged for net, why switch to net-next?
> It's either a fix or not, we don't do gray scales in netdev.
> 
> > Sleep time is added to ensure the phy to be ready after loopback bit
> > was set. This to prevent the phy loopback test from failing.
> >
> > ---
> > V1:
> >
> https://patchwork.kernel.org/project/netdevbpf/patch/20220825082238.11
> > 056-1-aminuddin.jamaluddin@intel.com/
> > ---
> 
> git am will cut off at the first --- it finds, so the v1 link and all the tags below
> we'll be lost when the patch is applied. Please move this section after the
> tags.
> 

Ok noted will correct this with V3

> > Fixes: 020a45aff119 ("net: phy: marvell: add Marvell specific PHY
> > loopback")
> > Cc: <stable@vger.kernel.org> # 5.15.x
> > Signed-off-by: Muhammad Husaini Zulkifli
> > <muhammad.husaini.zulkifli@intel.com>
> > Signed-off-by: Aminuddin Jamaluddin <aminuddin.jamaluddin@intel.com>

Amin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-11  3:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08  7:40 [PATCH net-next v2] net: phy: marvell: add sleep time after enabling the loopback bit Aminuddin Jamaluddin
2022-11-10  2:41 ` Jakub Kicinski
2022-11-11  3:43   ` Jamaluddin, Aminuddin
2022-11-10  3:54 ` Florian Fainelli
2022-11-11  3:40   ` Jamaluddin, Aminuddin

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).