Skip to contentSkip to conversation

net: phy: don't stop state machine in case of MDIO error

PATCH In review Heiner Kallweit 4 participants 12 messages Dec 15, 2018 – Dec 17, 2018

Subsystems (4)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

cover net: phy: don't stop state machine in case of MDIO error

If we detect a MDIO error, it seems to be a little bit too aggressive to stop the state machine and bring down the PHY completely. E.g. when polling and we miss one update, then this has no relevant impact.

Heiner Kallweit (2):
net: phy: don't stop state machine in case of MDIO error
net: fec: remove workaround to restart state machine on MDIO error

 drivers/net/ethernet/freescale/fec.h      |  1 -
 drivers/net/ethernet/freescale/fec_main.c | 12 -------
 drivers/net/phy/phy.c                     | 42 +++++------------------
 include/linux/phy.h                       |  2 +-
 4 files changed, 10 insertions(+), 47 deletions(-)
Signature · 1 line
2.20.0
author maintainer
#1 lore raw

PATCH 1/2 net: phy: don't stop state machine in case of MDIO error

If we detect a MDIO error, it seems to be a little bit too aggressive to stop the state machine and bring down the PHY completely. E.g. when polling and we miss one update, then this has no relevant impact. And in phy_stop_interrupts() actually interrupts should be disabled already because phy_stop() is called before. The only caller of phy_stop_interrupts() isn't interested in the return value, so let's change return type to void.

---
 drivers/net/phy/phy.c | 42 +++++++++---------------------------------
 include/linux/phy.h   |  2 +-
 2 files changed, 10 insertions(+), 34 deletions(-)
drivers/net/phy/phy.c +9 -33
index e24708f1f..f926ec52a 100644
@@ -714,24 +714,6 @@ void phy_stop_machine(struct phy_device *phydev)
 	mutex_unlock(&phydev->lock);
 }
 
-/**
- * phy_error - enter HALTED state for this PHY device
- * @phydev: target phy_device struct
- *
- * Moves the PHY to the HALTED state in response to a read
- * or write error, and tells the controller the link is down.
- * Must not be called from interrupt context, or while the
- * phydev->lock is held.
- */
-static void phy_error(struct phy_device *phydev)
-{
-	mutex_lock(&phydev->lock);
-	phydev->state = PHY_HALTED;
-	mutex_unlock(&phydev->lock);
-
-	phy_trigger_machine(phydev);
-}
-
 /**
  * phy_disable_interrupts - Disable the PHY interrupts from the PHY side
  * @phydev: target phy_device struct
@@ -769,13 +751,12 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat)
 	/* reschedule state queue work to run as soon as possible */
 	phy_trigger_machine(phydev);
 
-	if (phy_clear_interrupt(phydev))
-		goto phy_err;
-	return IRQ_HANDLED;
+	if (phy_clear_interrupt(phydev)) {
+		phydev_err(phydev, "failed to ack interrupt\n");
+		return IRQ_NONE;
+	}
 
-phy_err:
-	phy_error(phydev);
-	return IRQ_NONE;
+	return IRQ_HANDLED;
 }
 
 /**
@@ -821,16 +802,10 @@ EXPORT_SYMBOL(phy_start_interrupts);
  * phy_stop_interrupts - disable interrupts from a PHY device
  * @phydev: target phy_device struct
  */
-int phy_stop_interrupts(struct phy_device *phydev)
+void phy_stop_interrupts(struct phy_device *phydev)
 {
-	int err = phy_disable_interrupts(phydev);
-
-	if (err)
-		phy_error(phydev);
-
+	phy_disable_interrupts(phydev);
 	free_irq(phydev->irq, phydev);
-
-	return err;
 }
 EXPORT_SYMBOL(phy_stop_interrupts);
 
@@ -969,7 +944,8 @@ void phy_state_machine(struct work_struct *work)
 		phy_suspend(phydev);
 
 	if (err < 0)
-		phy_error(phydev);
+		phydev_err(phydev,
+			   "error %d executing PHY state machine\n", err);
 
 	if (old_state != phydev->state)
 		phydev_dbg(phydev, "PHY state change %s -> %s\n",
include/linux/phy.h +1 -1
index 8f927246a..9b2235bd5 100644
@@ -932,7 +932,7 @@ int phy_aneg_done(struct phy_device *phydev);
 int phy_speed_down(struct phy_device *phydev, bool sync);
 int phy_speed_up(struct phy_device *phydev);
 
-int phy_stop_interrupts(struct phy_device *phydev);
+void phy_stop_interrupts(struct phy_device *phydev);
 int phy_restart_aneg(struct phy_device *phydev);
 int phy_reset_after_clk_enable(struct phy_device *phydev);
 
Signature · 1 line
2.20.0
maintainer
#2 lore raw
Quoted 2 lines · Heiner Kallweit

If we detect a MDIO error, it seems to be a little bit too aggressive to stop the state machine and bring down the PHY completely.

Hi Heiner

My assumption is, if we get one MDIO error, we will gets lots more MDIO errors. This should be the sort of bus which either works, or it does not. In that situation, i think it does make sense to stop everything.

I would like to know more about the FEC. Unfortunately, the commit adding the timeout handling code does not explain why it is needed. We might need to dig further backwards in time to figure it out.

Andrew

author maintainer
#3 lore raw
Quoted 6 lines · Andrew Lunn
Quoted 2 lines · Heiner Kallweit

If we detect a MDIO error, it seems to be a little bit too aggressive to stop the state machine and bring down the PHY completely.

Hi Heiner

Quoted 9 lines

My assumption is, if we get one MDIO error, we will gets lots more MDIO errors. This should be the sort of bus which either works, or it does not. In that situation, i think it does make sense to stop everything.

I would like to know more about the FEC. Unfortunately, the commit adding the timeout handling code does not explain why it is needed. We might need to dig further backwards in time to figure it out.

After checking the fec history it seems that at the time this workaround was added as part of phylib support (8 years ago), the MDIO access timeout value was too low and therefore sometimes MDIO access failed. Later timeout was set to a higher value and driver switched to an event-driven mechanism to signal end of MDIO access. So it should be safe to remove the workaround.

One issue with phy_error() is that it silently stops the PHY. We should at least add a phydev_err() to let the user know.

Quoted 2 lines

Andrew

Heiner

maintainer
#4 lore raw
Quoted 6 lines

After checking the fec history it seems that at the time this workaround was added as part of phylib support (8 years ago), the MDIO access timeout value was too low and therefore sometimes MDIO access failed. Later timeout was set to a higher value and driver switched to an event-driven mechanism to signal end of MDIO access. So it should be safe to remove the workaround.

Hi Heiner

Thanks for digging into the details.

Quoted 3 lines

One issue with phy_error() is that it silently stops the PHY. We should at least add a phydev_err() to let the user know.

Yes, that is a good idea.

Andrew

#5 lore raw
In reply to Heiner Kallweit

From: Heiner Kallweit <[email protected]> Sent: 2018年12月16日 0:19

Quoted 81 lines

If we detect a MDIO error, it seems to be a little bit too aggressive to stop the state machine and bring down the PHY completely.
E.g. when polling and we miss one update, then this has no relevant impact. And in phy_stop_interrupts() actually interrupts should be disabled already because phy_stop() is called before. The only caller of phy_stop_interrupts() isn't interested in the return value, so let's change return type to void.

---
 drivers/net/phy/phy.c | 42 +++++++++---------------------------------
 include/linux/phy.h   |  2 +-
 2 files changed, 10 insertions(+), 34 deletions(-)
drivers/net/phy/phy.c index renamed from drivers/net/phy/phy.c +0 -0

e24708f1f..f926ec52a 100644

drivers/net/phy/phy.c +5 -23
@@ -714,24 +714,6 @@ void phy_stop_machine(struct phy_device *phydev)
 	mutex_unlock(&phydev->lock);
 }
 
-/**
- * phy_error - enter HALTED state for this PHY device
- * @phydev: target phy_device struct
- *
- * Moves the PHY to the HALTED state in response to a read
- * or write error, and tells the controller the link is down.
- * Must not be called from interrupt context, or while the
- * phydev->lock is held.
- */
-static void phy_error(struct phy_device *phydev) -{
-	mutex_lock(&phydev->lock);
-	phydev->state = PHY_HALTED;
-	mutex_unlock(&phydev->lock);
-
-	phy_trigger_machine(phydev);
-}
-
 /**
  * phy_disable_interrupts - Disable the PHY interrupts from the PHY side
  * @phydev: target phy_device struct
@@ -769,13 +751,12 @@ static irqreturn_t phy_interrupt(int irq, void
 *phy_dat)
 	/* reschedule state queue work to run as soon as possible */
 	phy_trigger_machine(phydev);
 
-	if (phy_clear_interrupt(phydev))
-		goto phy_err;
-	return IRQ_HANDLED;
+	if (phy_clear_interrupt(phydev)) {
+		phydev_err(phydev, "failed to ack interrupt\n");
+		return IRQ_NONE;
+	}
 
-phy_err:
-	phy_error(phydev);
-	return IRQ_NONE;
+	return IRQ_HANDLED;
 }
 

/**

drivers/net/phy/phy.c +2 -8
@@ -821,16 +802,10 @@ EXPORT_SYMBOL(phy_start_interrupts);
  * phy_stop_interrupts - disable interrupts from a PHY device
  * @phydev: target phy_device struct
  */
-int phy_stop_interrupts(struct phy_device *phydev)
+void phy_stop_interrupts(struct phy_device *phydev)
 {
-	int err = phy_disable_interrupts(phydev);
-
-	if (err)
-		phy_error(phydev);
-
+	phy_disable_interrupts(phydev);
 	free_irq(phydev->irq, phydev);
-
-	return err;
 }
 EXPORT_SYMBOL(phy_stop_interrupts);
 

drivers/net/phy/phy.c void phy_state_machine(struct work_struct *work) · line 948

Quoted 6 lines
drivers/net/phy/phy.c +2 -1
@@ -969,7 +944,8 @@ void phy_state_machine(struct work_struct *work)
 		phy_suspend(phydev);
 
 	if (err < 0)
-		phy_error(phydev);
+		phydev_err(phydev,
+			   "error %d executing PHY state machine\n", err);

If to stop state machine when PHY is in polling mode, so we have to return here ?

Quoted 19 lines
drivers/net/phy/phy.c +0 -0
 	if (old_state != phydev->state)
 		phydev_dbg(phydev, "PHY state change %s -> %s\n", diff --git

a/include/linux/phy.h b/include/linux/phy.h index 8f927246a..9b2235bd5 100644

include/linux/phy.h +0 -0
@@ -932,7 +932,7 @@ int phy_aneg_done(struct phy_device *phydev);  int

phy_speed_down(struct phy_device *phydev, bool sync); int phy_speed_up(struct phy_device *phydev);

include/linux/phy.h +1 -1
-int phy_stop_interrupts(struct phy_device *phydev);
+void phy_stop_interrupts(struct phy_device *phydev);
 int phy_restart_aneg(struct phy_device *phydev);  int

phy_reset_after_clk_enable(struct phy_device *phydev);

--
2.20.0

author maintainer
#6 lore raw

PATCH 2/2 net: fec: remove workaround to restart state machine on MDIO error

In reply to Heiner Kallweit

Now that the PHY isn't stopped any longer by phylib in case of a MDIO error, we can remove this workaround.

---
 drivers/net/ethernet/freescale/fec.h      |  1 -
 drivers/net/ethernet/freescale/fec_main.c | 12 ------------
 2 files changed, 13 deletions(-)
drivers/net/ethernet/freescale/fec.h +0 -1
index bf80855dd..f79e57f73 100644
@@ -531,7 +531,6 @@ struct fec_enet_private {
 
 	/* Phylib and MDIO interface */
 	struct	mii_bus *mii_bus;
-	int	mii_timeout;
 	uint	phy_speed;
 	phy_interface_t	phy_interface;
 	struct device_node *phy_node;
drivers/net/ethernet/freescale/fec_main.c +0 -12
index 6db69ba30..ae0f88bce 100644
@@ -1714,12 +1714,6 @@ static void fec_enet_adjust_link(struct net_device *ndev)
 	struct phy_device *phy_dev = ndev->phydev;
 	int status_change = 0;
 
-	/* Prevent a state halted on mii error */
-	if (fep->mii_timeout && phy_dev->state == PHY_HALTED) {
-		phy_dev->state = PHY_RESUMING;
-		return;
-	}
-
 	/*
 	 * If the netdev is down, or is going down, we're not interested
 	 * in link state events, so just mark our idea of the link as down
@@ -1779,7 +1773,6 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 	if (ret < 0)
 		return ret;
 
-	fep->mii_timeout = 0;
 	reinit_completion(&fep->mdio_done);
 
 	/* start a read op */
@@ -1791,7 +1784,6 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 	time_left = wait_for_completion_timeout(&fep->mdio_done,
 			usecs_to_jiffies(FEC_MII_TIMEOUT));
 	if (time_left == 0) {
-		fep->mii_timeout = 1;
 		netdev_err(fep->netdev, "MDIO read timeout\n");
 		ret = -ETIMEDOUT;
 		goto out;
@@ -1820,7 +1812,6 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
 	else
 		ret = 0;
 
-	fep->mii_timeout = 0;
 	reinit_completion(&fep->mdio_done);
 
 	/* start a write op */
@@ -1833,7 +1824,6 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
 	time_left = wait_for_completion_timeout(&fep->mdio_done,
 			usecs_to_jiffies(FEC_MII_TIMEOUT));
 	if (time_left == 0) {
-		fep->mii_timeout = 1;
 		netdev_err(fep->netdev, "MDIO write timeout\n");
 		ret  = -ETIMEDOUT;
 	}
@@ -2001,8 +1991,6 @@ static int fec_enet_mii_init(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	fep->mii_timeout = 0;
-
 	/*
 	 * Set MII speed to 2.5 MHz (= clk_get_rate() / 2 * phy_speed)
 	 *
Signature · 1 line
2.20.0
Acked-by on v1 2/2
#7 lore raw

RE: [PATCH net-next 2/2] net: fec: remove workaround to restart state machine on MDIO error

From: Heiner Kallweit <[email protected]> Sent: 2018年12月16日 0:20

Quoted 4 lines

Now that the PHY isn't stopped any longer by phylib in case of a MDIO error, we can remove this workaround.

The old workaround can be removed NOW, thanks.

Quoted 86 lines
---
 drivers/net/ethernet/freescale/fec.h      |  1 -
 drivers/net/ethernet/freescale/fec_main.c | 12 ------------
 2 files changed, 13 deletions(-)
drivers/net/ethernet/freescale/fec.h +0 -1
index bf80855dd..f79e57f73 100644
@@ -531,7 +531,6 @@ struct fec_enet_private {
 
 	/* Phylib and MDIO interface */
 	struct	mii_bus *mii_bus;
-	int	mii_timeout;
 	uint	phy_speed;
 	phy_interface_t	phy_interface;
 	struct device_node *phy_node;
drivers/net/ethernet/freescale/fec_main.c +0 -6
index 6db69ba30..ae0f88bce 100644
@@ -1714,12 +1714,6 @@ static void fec_enet_adjust_link(struct net_device
 *ndev)
 	struct phy_device *phy_dev = ndev->phydev;
 	int status_change = 0;
 
-	/* Prevent a state halted on mii error */
-	if (fep->mii_timeout && phy_dev->state == PHY_HALTED) {
-		phy_dev->state = PHY_RESUMING;
-		return;
-	}
-
 	/*
 	 * If the netdev is down, or is going down, we're not interested

* in link state events, so just mark our idea of the link as down @@
-1779,7 +1773,6 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)

drivers/net/ethernet/freescale/fec_main.c +0 -2
 	if (ret < 0)
 		return ret;
 
-	fep->mii_timeout = 0;
 	reinit_completion(&fep->mdio_done);
 
 	/* start a read op */
@@ -1791,7 +1784,6 @@ static int fec_enet_mdio_read(struct mii_bus *bus,
 int mii_id, int regnum)
 	time_left = wait_for_completion_timeout(&fep->mdio_done,
 			usecs_to_jiffies(FEC_MII_TIMEOUT));
 	if (time_left == 0) {
-		fep->mii_timeout = 1;
 		netdev_err(fep->netdev, "MDIO read timeout\n");
 		ret = -ETIMEDOUT;
drivers/net/ethernet/freescale/fec_main.c +0 -1
 		goto out;
@@ -1820,7 +1812,6 @@ static int fec_enet_mdio_write(struct mii_bus *bus,
 int mii_id, int regnum,
 	else
 		ret = 0;
 
-	fep->mii_timeout = 0;
 	reinit_completion(&fep->mdio_done);
 
drivers/net/ethernet/freescale/fec_main.c +0 -1
 	/* start a write op */
@@ -1833,7 +1824,6 @@ static int fec_enet_mdio_write(struct mii_bus *bus,
 int mii_id, int regnum,
 	time_left = wait_for_completion_timeout(&fep->mdio_done,
 			usecs_to_jiffies(FEC_MII_TIMEOUT));
 	if (time_left == 0) {
-		fep->mii_timeout = 1;
 		netdev_err(fep->netdev, "MDIO write timeout\n");
 		ret  = -ETIMEDOUT;
drivers/net/ethernet/freescale/fec_main.c +0 -2
 	}
@@ -2001,8 +1991,6 @@ static int fec_enet_mii_init(struct platform_device
 *pdev)
 		return -ENOENT;
 	}
 
-	fep->mii_timeout = 0;
-
 	/*
 	 * Set MII speed to 2.5 MHz (= clk_get_rate() / 2 * phy_speed)

*
--
2.20.0

author maintainer
#8 lore raw

Re: [PATCH net-next 2/2] net: fec: remove workaround to restart state machine on MDIO error

Quoted 8 lines · Andy Duan

From: Heiner Kallweit <[email protected]> Sent: 2018年12月16日 0:20

Quoted 4 lines

Now that the PHY isn't stopped any longer by phylib in case of a MDIO error, we can remove this workaround.

The old workaround can be removed NOW, thanks.

This patch series has been superseded. After few more discussions we'll keep the current behavior and just use a WARN() to facilitate debugging in case of MDIO error.
However for fec it should be safe anyway to remove the old workaround, see description of my subsequent patch.

Quoted 88 lines
Quoted 86 lines
---
 drivers/net/ethernet/freescale/fec.h      |  1 -
 drivers/net/ethernet/freescale/fec_main.c | 12 ------------
 2 files changed, 13 deletions(-)
drivers/net/ethernet/freescale/fec.h +0 -1
index bf80855dd..f79e57f73 100644
@@ -531,7 +531,6 @@ struct fec_enet_private {
 
 	/* Phylib and MDIO interface */
 	struct	mii_bus *mii_bus;
-	int	mii_timeout;
 	uint	phy_speed;
 	phy_interface_t	phy_interface;
 	struct device_node *phy_node;
drivers/net/ethernet/freescale/fec_main.c +0 -6
index 6db69ba30..ae0f88bce 100644
@@ -1714,12 +1714,6 @@ static void fec_enet_adjust_link(struct net_device
 *ndev)
 	struct phy_device *phy_dev = ndev->phydev;
 	int status_change = 0;
 
-	/* Prevent a state halted on mii error */
-	if (fep->mii_timeout && phy_dev->state == PHY_HALTED) {
-		phy_dev->state = PHY_RESUMING;
-		return;
-	}
-
 	/*
 	 * If the netdev is down, or is going down, we're not interested

* in link state events, so just mark our idea of the link as down @@
-1779,7 +1773,6 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)

drivers/net/ethernet/freescale/fec_main.c +0 -2
 	if (ret < 0)
 		return ret;
 
-	fep->mii_timeout = 0;
 	reinit_completion(&fep->mdio_done);
 
 	/* start a read op */
@@ -1791,7 +1784,6 @@ static int fec_enet_mdio_read(struct mii_bus *bus,
 int mii_id, int regnum)
 	time_left = wait_for_completion_timeout(&fep->mdio_done,
 			usecs_to_jiffies(FEC_MII_TIMEOUT));
 	if (time_left == 0) {
-		fep->mii_timeout = 1;
 		netdev_err(fep->netdev, "MDIO read timeout\n");
 		ret = -ETIMEDOUT;
drivers/net/ethernet/freescale/fec_main.c +0 -1
 		goto out;
@@ -1820,7 +1812,6 @@ static int fec_enet_mdio_write(struct mii_bus *bus,
 int mii_id, int regnum,
 	else
 		ret = 0;
 
-	fep->mii_timeout = 0;
 	reinit_completion(&fep->mdio_done);
 
drivers/net/ethernet/freescale/fec_main.c +0 -1
 	/* start a write op */
@@ -1833,7 +1824,6 @@ static int fec_enet_mdio_write(struct mii_bus *bus,
 int mii_id, int regnum,
 	time_left = wait_for_completion_timeout(&fep->mdio_done,
 			usecs_to_jiffies(FEC_MII_TIMEOUT));
 	if (time_left == 0) {
-		fep->mii_timeout = 1;
 		netdev_err(fep->netdev, "MDIO write timeout\n");
 		ret  = -ETIMEDOUT;
drivers/net/ethernet/freescale/fec_main.c +0 -2
 	}
@@ -2001,8 +1991,6 @@ static int fec_enet_mii_init(struct platform_device
 *pdev)
 		return -ENOENT;
 	}
 
-	fep->mii_timeout = 0;
-
 	/*
 	 * Set MII speed to 2.5 MHz (= clk_get_rate() / 2 * phy_speed)

*
--
2.20.0

author maintainer
#9 lore raw
In reply to Heiner Kallweit
Quoted 9 lines · Heiner Kallweit

If we detect a MDIO error, it seems to be a little bit too aggressive to stop the state machine and bring down the PHY completely. E.g. when polling and we miss one update, then this has no relevant impact.

Heiner Kallweit (2):
net: phy: don't stop state machine in case of MDIO error
net: fec: remove workaround to restart state machine on MDIO error

Quoted 6 lines
 drivers/net/ethernet/freescale/fec.h      |  1 -
 drivers/net/ethernet/freescale/fec_main.c | 12 -------
 drivers/net/phy/phy.c                     | 42 +++++------------------
 include/linux/phy.h                       |  2 +-
 4 files changed, 10 insertions(+), 47 deletions(-)

David, could you please wait with applying this? I should have marked it RFC (did so in patchwork meanwhile), need to discuss it with Andrew and Florian.

Heiner

maintainer
#10 lore raw

From: Heiner Kallweit <[email protected]>
Date: Sun, 16 Dec 2018 09:29:16 +0100

Quoted 16 lines · Heiner Kallweit
Quoted 9 lines

If we detect a MDIO error, it seems to be a little bit too aggressive to stop the state machine and bring down the PHY completely. E.g. when polling and we miss one update, then this has no relevant impact.

Heiner Kallweit (2):
net: phy: don't stop state machine in case of MDIO error
net: fec: remove workaround to restart state machine on MDIO error

Quoted 6 lines
 drivers/net/ethernet/freescale/fec.h      |  1 -
 drivers/net/ethernet/freescale/fec_main.c | 12 -------
 drivers/net/phy/phy.c                     | 42 +++++------------------
 include/linux/phy.h                       |  2 +-
 4 files changed, 10 insertions(+), 47 deletions(-)
Quoted 3 lines

David, could you please wait with applying this? I should have marked it RFC (did so in patchwork meanwhile), need to discuss it with Andrew and Florian.

Ok.

I'd like to kindly ask that you not modify patchwork state even for your own changes, and let me take care of it.

When the patch state changes behind my back it's confusing and I start wondering if I made a mistake changing the state of patches in my queue.

Thanks.

author maintainer
#11 lore raw

PATCH 1/1 net: fec: remove workaround to restart phylib state machine on MDIO timeout

In reply to Heiner Kallweit

There's a workaround to restart the phylib state machine in case of a MDIO access timeout. Seems it was introduced to deal with the consequences of a too small MDIO timeout. See also commit message of c3b084c24c8a ("net: fec: Adjust ENET MDIO timeouts") which increased the timeout value later. Due to the later timeout value fix it seems to be safe to remove the workaround.

---
 drivers/net/ethernet/freescale/fec.h      |  1 -
 drivers/net/ethernet/freescale/fec_main.c | 12 ------------
 2 files changed, 13 deletions(-)
drivers/net/ethernet/freescale/fec.h +0 -1
index bf80855dd..f79e57f73 100644
@@ -531,7 +531,6 @@ struct fec_enet_private {
 
 	/* Phylib and MDIO interface */
 	struct	mii_bus *mii_bus;
-	int	mii_timeout;
 	uint	phy_speed;
 	phy_interface_t	phy_interface;
 	struct device_node *phy_node;
drivers/net/ethernet/freescale/fec_main.c +0 -12
index 6db69ba30..ae0f88bce 100644
@@ -1714,12 +1714,6 @@ static void fec_enet_adjust_link(struct net_device *ndev)
 	struct phy_device *phy_dev = ndev->phydev;
 	int status_change = 0;
 
-	/* Prevent a state halted on mii error */
-	if (fep->mii_timeout && phy_dev->state == PHY_HALTED) {
-		phy_dev->state = PHY_RESUMING;
-		return;
-	}
-
 	/*
 	 * If the netdev is down, or is going down, we're not interested
 	 * in link state events, so just mark our idea of the link as down
@@ -1779,7 +1773,6 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 	if (ret < 0)
 		return ret;
 
-	fep->mii_timeout = 0;
 	reinit_completion(&fep->mdio_done);
 
 	/* start a read op */
@@ -1791,7 +1784,6 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 	time_left = wait_for_completion_timeout(&fep->mdio_done,
 			usecs_to_jiffies(FEC_MII_TIMEOUT));
 	if (time_left == 0) {
-		fep->mii_timeout = 1;
 		netdev_err(fep->netdev, "MDIO read timeout\n");
 		ret = -ETIMEDOUT;
 		goto out;
@@ -1820,7 +1812,6 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
 	else
 		ret = 0;
 
-	fep->mii_timeout = 0;
 	reinit_completion(&fep->mdio_done);
 
 	/* start a write op */
@@ -1833,7 +1824,6 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
 	time_left = wait_for_completion_timeout(&fep->mdio_done,
 			usecs_to_jiffies(FEC_MII_TIMEOUT));
 	if (time_left == 0) {
-		fep->mii_timeout = 1;
 		netdev_err(fep->netdev, "MDIO write timeout\n");
 		ret  = -ETIMEDOUT;
 	}
@@ -2001,8 +1991,6 @@ static int fec_enet_mii_init(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	fep->mii_timeout = 0;
-
 	/*
 	 * Set MII speed to 2.5 MHz (= clk_get_rate() / 2 * phy_speed)
 	 *
Signature · 1 line
2.20.0