public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] net: phy: marvell: Call phy_reset() where possible
@ 2016-02-10  6:06 Stefan Roese
  2016-02-10  6:06 ` [U-Boot] [PATCH 2/2] net: phy: marvell: Fix problem with phy_reset() clearing BMCR Stefan Roese
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stefan Roese @ 2016-02-10  6:06 UTC (permalink / raw)
  To: u-boot

Instead of coding the soft PHY reset function multiple times in marvell.c,
lets call the common phy_reset() function from phy.c.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Stefan Agner <stefan@agner.ch>
Cc: Hao Zhang <hzhang@ti.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
---
 drivers/net/phy/marvell.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index eab1558..6e3dc85 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -172,7 +172,6 @@ static int m88e1011s_startup(struct phy_device *phydev)
 static int m88e1111s_config(struct phy_device *phydev)
 {
 	int reg;
-	int timeout;
 
 	if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
 			(phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
@@ -236,16 +235,7 @@ static int m88e1111s_config(struct phy_device *phydev)
 			MIIM_88E1111_PHY_EXT_SR, reg);
 
 		/* soft reset */
-		timeout = 1000;
-		phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
-		udelay(1000);
-		reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
-		while ((reg & BMCR_RESET) && --timeout) {
-			udelay(1000);
-			reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
-		}
-		if (!timeout)
-			printf("%s: phy soft reset timeout\n", __func__);
+		phy_reset(phydev);
 
 		reg = phy_read(phydev, MDIO_DEVAD_NONE,
 			MIIM_88E1111_PHY_EXT_SR);
@@ -258,16 +248,7 @@ static int m88e1111s_config(struct phy_device *phydev)
 	}
 
 	/* soft reset */
-	timeout = 1000;
-	phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
-	udelay(1000);
-	reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
-	while ((reg & BMCR_RESET) && --timeout) {
-		udelay(1000);
-		reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
-	}
-	if (!timeout)
-		printf("%s: phy soft reset timeout\n", __func__);
+	phy_reset(phydev);
 
 	genphy_config_aneg(phydev);
 
-- 
2.7.1

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

* [U-Boot] [PATCH 2/2] net: phy: marvell: Fix problem with phy_reset() clearing BMCR
  2016-02-10  6:06 [U-Boot] [PATCH 1/2] net: phy: marvell: Call phy_reset() where possible Stefan Roese
@ 2016-02-10  6:06 ` Stefan Roese
  2016-02-10 16:11   ` Joe Hershberger
  2016-02-18 17:39   ` [U-Boot] net: phy: marvell: Call phy_reset() where possible Joe Hershberger
  2016-02-10 16:11 ` [U-Boot] [PATCH 1/2] " Joe Hershberger
  2016-02-18 17:39 ` [U-Boot] net: phy: marvell: Fix problem with phy_reset() clearing BMCR Joe Hershberger
  2 siblings, 2 replies; 6+ messages in thread
From: Stefan Roese @ 2016-02-10  6:06 UTC (permalink / raw)
  To: u-boot

With commit a058052c [net: phy: do not read configuration register on
reset], phy_reset() will clear the BMCR register. Resulting in bit 12
being cleared (A/N enable). This leads to autonegotiation link problems,
at least on the Marvell Armada ClearFog board. I suspect that other
boards using this driver will be affected as well.

At the of m88e1111s_config(), phy_reset() is called. This is not needed
for the PHY to load the changed configuration, as phy_reset() is called
a few lines before already. So lets call genphy_restart_aneg() here
instead to start the AN correctly.

Tested on clearfog.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Stefan Agner <stefan@agner.ch>
Cc: Hao Zhang <hzhang@ti.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
---
 drivers/net/phy/marvell.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 6e3dc85..b8b1157 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -251,8 +251,7 @@ static int m88e1111s_config(struct phy_device *phydev)
 	phy_reset(phydev);
 
 	genphy_config_aneg(phydev);
-
-	phy_reset(phydev);
+	genphy_restart_aneg(phydev);
 
 	return 0;
 }
-- 
2.7.1

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

* [U-Boot] [PATCH 2/2] net: phy: marvell: Fix problem with phy_reset() clearing BMCR
  2016-02-10  6:06 ` [U-Boot] [PATCH 2/2] net: phy: marvell: Fix problem with phy_reset() clearing BMCR Stefan Roese
@ 2016-02-10 16:11   ` Joe Hershberger
  2016-02-18 17:39   ` [U-Boot] net: phy: marvell: Call phy_reset() where possible Joe Hershberger
  1 sibling, 0 replies; 6+ messages in thread
From: Joe Hershberger @ 2016-02-10 16:11 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 10, 2016 at 12:06 AM, Stefan Roese <sr@denx.de> wrote:
> With commit a058052c [net: phy: do not read configuration register on
> reset], phy_reset() will clear the BMCR register. Resulting in bit 12
> being cleared (A/N enable). This leads to autonegotiation link problems,
> at least on the Marvell Armada ClearFog board. I suspect that other
> boards using this driver will be affected as well.
>
> At the of m88e1111s_config(), phy_reset() is called. This is not needed
> for the PHY to load the changed configuration, as phy_reset() is called
> a few lines before already. So lets call genphy_restart_aneg() here
> instead to start the AN correctly.
>
> Tested on clearfog.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Stefan Agner <stefan@agner.ch>
> Cc: Hao Zhang <hzhang@ti.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Andy Fleming <afleming@gmail.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

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

* [U-Boot] [PATCH 1/2] net: phy: marvell: Call phy_reset() where possible
  2016-02-10  6:06 [U-Boot] [PATCH 1/2] net: phy: marvell: Call phy_reset() where possible Stefan Roese
  2016-02-10  6:06 ` [U-Boot] [PATCH 2/2] net: phy: marvell: Fix problem with phy_reset() clearing BMCR Stefan Roese
@ 2016-02-10 16:11 ` Joe Hershberger
  2016-02-18 17:39 ` [U-Boot] net: phy: marvell: Fix problem with phy_reset() clearing BMCR Joe Hershberger
  2 siblings, 0 replies; 6+ messages in thread
From: Joe Hershberger @ 2016-02-10 16:11 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 10, 2016 at 12:06 AM, Stefan Roese <sr@denx.de> wrote:
> Instead of coding the soft PHY reset function multiple times in marvell.c,
> lets call the common phy_reset() function from phy.c.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Stefan Agner <stefan@agner.ch>
> Cc: Hao Zhang <hzhang@ti.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Andy Fleming <afleming@gmail.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> ---

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

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

* [U-Boot] net: phy: marvell: Fix problem with phy_reset() clearing BMCR
  2016-02-10  6:06 [U-Boot] [PATCH 1/2] net: phy: marvell: Call phy_reset() where possible Stefan Roese
  2016-02-10  6:06 ` [U-Boot] [PATCH 2/2] net: phy: marvell: Fix problem with phy_reset() clearing BMCR Stefan Roese
  2016-02-10 16:11 ` [U-Boot] [PATCH 1/2] " Joe Hershberger
@ 2016-02-18 17:39 ` Joe Hershberger
  2 siblings, 0 replies; 6+ messages in thread
From: Joe Hershberger @ 2016-02-18 17:39 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

https://patchwork.ozlabs.org/patch/581316/ was applied to u-boot-net.git.

Thanks!
-Joe

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

* [U-Boot] net: phy: marvell: Call phy_reset() where possible
  2016-02-10  6:06 ` [U-Boot] [PATCH 2/2] net: phy: marvell: Fix problem with phy_reset() clearing BMCR Stefan Roese
  2016-02-10 16:11   ` Joe Hershberger
@ 2016-02-18 17:39   ` Joe Hershberger
  1 sibling, 0 replies; 6+ messages in thread
From: Joe Hershberger @ 2016-02-18 17:39 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

https://patchwork.ozlabs.org/patch/581317/ was applied to u-boot-net.git.

Thanks!
-Joe

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

end of thread, other threads:[~2016-02-18 17:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-10  6:06 [U-Boot] [PATCH 1/2] net: phy: marvell: Call phy_reset() where possible Stefan Roese
2016-02-10  6:06 ` [U-Boot] [PATCH 2/2] net: phy: marvell: Fix problem with phy_reset() clearing BMCR Stefan Roese
2016-02-10 16:11   ` Joe Hershberger
2016-02-18 17:39   ` [U-Boot] net: phy: marvell: Call phy_reset() where possible Joe Hershberger
2016-02-10 16:11 ` [U-Boot] [PATCH 1/2] " Joe Hershberger
2016-02-18 17:39 ` [U-Boot] net: phy: marvell: Fix problem with phy_reset() clearing BMCR Joe Hershberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox