Skip to contentSkip to conversation

Fix for missed MII interrupts and MDIO timeouts when FEC is in STOP

PATCH New Matteo Fortini 2 participants 4 messages Apr 21, 2011 – Apr 22, 2011 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix for missed MII interrupts and MDIO timeouts when FEC is in STOP

We are experiencing unrecoverable timeouts if we disconnect a cable from the FEC. This patch solves the issue by keeping the Ethernet enabled even in STOP. The RM doesn't state it, but i seems that if disabled, the Ethernet is not issuing interrupts to the core.
(See
http://forums.freescale.com/t5/i-MX-Microprocessors/iMX28-Network-MDIO-timeout-recovery-and-lost-IRQs/td-p/73309
)

---
?drivers/net/fec.c | ? ?7 ++++++-
?1 files changed, 6 insertions(+), 1 deletions(-)

drivers/net/fec.c +0 -0
index d0e2e69..26ea72d 100644
@@ -121,8 +121,10 @@

?#if defined(CONFIG_FEC_1588) && defined(CONFIG_ARCH_MX28) ?#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII | \
? ? ? ? ? ? ? ? FEC_ENET_TS_AVAIL | FEC_ENET_TS_TIMER) +#define FEC_STOP_IMASK (FEC_ENET_MII)
?#else
?#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII) +#define FEC_STOP_IMASK (FEC_ENET_MII)
?#endif

?/* The FEC stores dest/src/type, data, and checksum for receive packets. @@ -1409,6 +1411,9 @@ fec_stop(struct net_device *dev)
? ? writel(1, fep->hwp + FEC_ECNTRL);
? ? udelay(10);

+ ? ?/* Reactivate the controller to get the IRQs */
+ ? ?writel(0x00000002, fep->hwp + FEC_ECNTRL); +
?#ifdef CONFIG_ARCH_MXS
? ? /* Check MII or RMII */
? ? if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) @@ -1423,7 +1428,7 @@ fec_stop(struct net_device *dev) ? ? writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); ? ? if (fep->ptimer_present)
? ? ? ? fec_ptp_stop(fep->ptp_priv);
- ? ?writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+ ? ?writel(FEC_STOP_IMASK, fep->hwp + FEC_IMASK);

? ? netif_stop_queue(dev);
? ? fep->link = 0;
--
1.7.4.2

#1 lore raw

PATCH 1/1 Fix for missed MII interrupts and MDIO timeouts when FEC is in STOP

Hi Matteo,

Quoted 7 lines · Matteo Fortini

We are experiencing unrecoverable timeouts if we disconnect a cable from the FEC. This patch solves the issue by keeping the Ethernet enabled even in STOP. The RM doesn't state it, but i seems that if disabled, the Ethernet is not issuing interrupts to the core.
(See
http://forums.freescale.com/t5/i-MX-Microprocessors/iMX28-Network-MDIO-timeout-recovery-and-lost-IRQs/td-p/73309
)

Please send network driver patches to the network drivers mailing list at netdev at vger.kernel.org.

This patch does not apply to the current mainline kernel. Which kernel tree are you using?

baruch

Quoted 38 lines

---
?drivers/net/fec.c | ? ?7 ++++++-
?1 files changed, 6 insertions(+), 1 deletions(-)

drivers/net/fec.c +1 -0
index d0e2e69..26ea72d 100644
@@ -121,8 +121,10 @@
 ?#if defined(CONFIG_FEC_1588) && defined(CONFIG_ARCH_MX28)
 ?#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII | \
 ? ? ? ? ? ? ? ? FEC_ENET_TS_AVAIL | FEC_ENET_TS_TIMER)
+#define FEC_STOP_IMASK (FEC_ENET_MII)

?#else
?#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII) +#define FEC_STOP_IMASK (FEC_ENET_MII)
?#endif

?/* The FEC stores dest/src/type, data, and checksum for receive packets.

drivers/net/fec.c +3 -0
@@ -1409,6 +1411,9 @@ fec_stop(struct net_device *dev)
 ? ? writel(1, fep->hwp + FEC_ECNTRL);
 ? ? udelay(10);
 
+ ? ?/* Reactivate the controller to get the IRQs */
+ ? ?writel(0x00000002, fep->hwp + FEC_ECNTRL);
+

?#ifdef CONFIG_ARCH_MXS
? ? /* Check MII or RMII */
? ? if (fep->phy_interface == PHY_INTERFACE_MODE_RMII)

drivers/net/fec.c +1 -1
@@ -1423,7 +1428,7 @@ fec_stop(struct net_device *dev)
 ? ? writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
 ? ? if (fep->ptimer_present)
 ? ? ? ? fec_ptp_stop(fep->ptp_priv);
- ? ?writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+ ? ?writel(FEC_STOP_IMASK, fep->hwp + FEC_IMASK);
 
 ? ? netif_stop_queue(dev);
 ? ? fep->link = 0;
Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 Fix for missed MII interrupts and MDIO timeouts when FEC is in STOP

Ok I sent it to netdev, let's see if they accept it. The interface is not working without it.
I patched the opensource.freescale.com git tree, since it is the most common start for iMX.

Regards

Quoted 63 lines · Baruch Siach

Hi Matteo,

Quoted 7 lines · Matteo Fortini

We are experiencing unrecoverable timeouts if we disconnect a cable from the FEC. This patch solves the issue by keeping the Ethernet enabled even in STOP. The RM doesn't state it, but i seems that if disabled, the Ethernet is not issuing interrupts to the core.
(See
http://forums.freescale.com/t5/i-MX-Microprocessors/iMX28-Network-MDIO-timeout-recovery-and-lost-IRQs/td-p/73309
)

Please send network driver patches to the network drivers mailing list at netdev at vger.kernel.org.

This patch does not apply to the current mainline kernel. Which kernel tree are you using?

baruch

Quoted 30 lines

---
?drivers/net/fec.c | ? ?7 ++++++-
?1 files changed, 6 insertions(+), 1 deletions(-)

drivers/net/fec.c +1 -0
index d0e2e69..26ea72d 100644
@@ -121,8 +121,10 @@
 ?#if defined(CONFIG_FEC_1588) && defined(CONFIG_ARCH_MX28)
 ?#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII | \
 ? ? ? ? ? ? ? ? FEC_ENET_TS_AVAIL | FEC_ENET_TS_TIMER)
+#define FEC_STOP_IMASK (FEC_ENET_MII)

?#else
?#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII) +#define FEC_STOP_IMASK (FEC_ENET_MII)
?#endif

?/* The FEC stores dest/src/type, data, and checksum for receive packets.

drivers/net/fec.c +3 -0
@@ -1409,6 +1411,9 @@ fec_stop(struct net_device *dev)
 ? ? writel(1, fep->hwp + FEC_ECNTRL);
 ? ? udelay(10);
 
+ ? ?/* Reactivate the controller to get the IRQs */
+ ? ?writel(0x00000002, fep->hwp + FEC_ECNTRL);
+

?#ifdef CONFIG_ARCH_MXS
? ? /* Check MII or RMII */
? ? if (fep->phy_interface == PHY_INTERFACE_MODE_RMII)

drivers/net/fec.c fec_stop(struct net_device *dev) · line 1434

Quoted 8 lines
drivers/net/fec.c +1 -1
@@ -1423,7 +1428,7 @@ fec_stop(struct net_device *dev)
 ? ? writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
 ? ? if (fep->ptimer_present)
 ? ? ? ? fec_ptp_stop(fep->ptp_priv);
- ? ?writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+ ? ?writel(FEC_STOP_IMASK, fep->hwp + FEC_IMASK);
 
 ? ? netif_stop_queue(dev);
 ? ? fep->link = 0;

--
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ~. .~ ? Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= ? - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

#3 lore raw

PATCH 1/1 Fix for missed MII interrupts and MDIO timeouts when FEC is in STOP

Hi Metteo,

Quoted 1 line · Matteo Fortini

Ok I sent it to netdev, let's see if they accept it.

Keeping the linux-arm-kernel list Cc on the patch is a good idea.

Quoted 3 lines

The interface is not working without it.
I patched the opensource.freescale.com git tree, since it is the most common start for iMX.

The networking drivers maintainer (David Miller) can not possibly accept this patch because it does not apply to the current mainline kernel. For patches against the Freescale git tree you should contact Freescale.

Which i.MX variant is this?

I suggest you to try the latest mainline kernel, or the i.MX kernel development tree at http://git.pengutronix.de/?p=imx/linux-2.6.git;a=summary.

baruch

Quoted 58 lines · Baruch Siach
Quoted 57 lines

Hi Matteo,

Quoted 7 lines · Matteo Fortini

We are experiencing unrecoverable timeouts if we disconnect a cable from the FEC. This patch solves the issue by keeping the Ethernet enabled even in STOP. The RM doesn't state it, but i seems that if disabled, the Ethernet is not issuing interrupts to the core.
(See
http://forums.freescale.com/t5/i-MX-Microprocessors/iMX28-Network-MDIO-timeout-recovery-and-lost-IRQs/td-p/73309
)

Please send network driver patches to the network drivers mailing list at netdev at vger.kernel.org.

This patch does not apply to the current mainline kernel. Which kernel tree are you using?

baruch

Quoted 38 lines

---
?drivers/net/fec.c | ? ?7 ++++++-
?1 files changed, 6 insertions(+), 1 deletions(-)

drivers/net/fec.c +1 -0
index d0e2e69..26ea72d 100644
@@ -121,8 +121,10 @@
 ?#if defined(CONFIG_FEC_1588) && defined(CONFIG_ARCH_MX28)
 ?#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII | \
 ? ? ? ? ? ? ? ? FEC_ENET_TS_AVAIL | FEC_ENET_TS_TIMER)
+#define FEC_STOP_IMASK (FEC_ENET_MII)

?#else
?#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII) +#define FEC_STOP_IMASK (FEC_ENET_MII)
?#endif

?/* The FEC stores dest/src/type, data, and checksum for receive packets.

drivers/net/fec.c +3 -0
@@ -1409,6 +1411,9 @@ fec_stop(struct net_device *dev)
 ? ? writel(1, fep->hwp + FEC_ECNTRL);
 ? ? udelay(10);
 
+ ? ?/* Reactivate the controller to get the IRQs */
+ ? ?writel(0x00000002, fep->hwp + FEC_ECNTRL);
+

?#ifdef CONFIG_ARCH_MXS
? ? /* Check MII or RMII */
? ? if (fep->phy_interface == PHY_INTERFACE_MODE_RMII)

drivers/net/fec.c +1 -1
@@ -1423,7 +1428,7 @@ fec_stop(struct net_device *dev)
 ? ? writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
 ? ? if (fep->ptimer_present)
 ? ? ? ? fec_ptp_stop(fep->ptp_priv);
- ? ?writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+ ? ?writel(FEC_STOP_IMASK, fep->hwp + FEC_IMASK);
 
 ? ? netif_stop_queue(dev);
 ? ? fep->link = 0;
Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -