All of lore.kernel.org
 help / color / mirror / Atom feed
From: w.sang@pengutronix.de (Wolfram Sang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] fec: use interrupt for MDIO completion indication
Date: Wed, 21 Jul 2010 14:51:13 +0200	[thread overview]
Message-ID: <20100721125113.GA2651@pengutronix.de> (raw)
In-Reply-To: <20100715040956.GA7690@jasper.tkos.co.il>


> > Thanks for this patch, we tested on our i.MX51 board with Ubuntu. It works 
> > fine.
> > 
> > Wolfram, you can pick up this, too. -;)
> 
> Dave has already applied this patch to his net-next tree.

Bryan, thanks for letting me know, I missed this one.

However, have you guys ever tried pulling the cable off/on or restarting
the interface with 'ifconfig down/up'? This always caused a stalled PHY
for me. This patch helps:

==========================

From: Wolfram Sang <w.sang@pengutronix.de>
Subject: [PATCH] net/fec: restore interrupt mask after software-reset in fec_stop()

After the change from mdio polling to irq, it became necessary to
restore the interrupt mask after resetting the chip in fec_stop().
Otherwise, with all irqs disabled, no communication with the PHY will be
possible after e.g. un-/replugging the cable and the device gets
stalled.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
 drivers/net/fec.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 391a553..768b840 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -118,6 +118,8 @@ static unsigned char	fec_mac_default[] = {
 #define FEC_ENET_MII	((uint)0x00800000)	/* MII interrupt */
 #define FEC_ENET_EBERR	((uint)0x00400000)	/* SDMA bus error */
 
+#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII)
+
 /* The FEC stores dest/src/type, data, and checksum for receive packets.
  */
 #define PKT_MAXBUF_SIZE		1518
@@ -1213,8 +1215,7 @@ fec_restart(struct net_device *dev, int duplex)
 	writel(0, fep->hwp + FEC_R_DES_ACTIVE);
 
 	/* Enable interrupts we wish to service */
-	writel(FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII,
-			fep->hwp + FEC_IMASK);
+	writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
 }
 
 static void
@@ -1233,8 +1234,8 @@ fec_stop(struct net_device *dev)
 	/* Whack a reset.  We should wait for this. */
 	writel(1, fep->hwp + FEC_ECNTRL);
 	udelay(10);
-
 	writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
+	writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
 }
 
 static int __devinit
-- 
1.7.1

==========================

BUT, while it helps and may possibly be a quick fix for 2.6.35,
resetting the chip in fec_stop() looks like a wrong thing to do for me.
In the long run, it probably is better to make sure the chip is set up
correctly during initialization, so the reset in fec_stop() is not
needed at all. I had a quick shot at this, but seem to have missed
something as it didn't work. As I will be away from the computers for
two weeks in about 24 hours, I at least wanted to bring up the issue.

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100721/852e18a4/attachment-0001.sig>

WARNING: multiple messages have this Message-ID (diff)
From: Wolfram Sang <w.sang@pengutronix.de>
To: Baruch Siach <baruch@tkos.co.il>
Cc: Bryan Wu <bryan.wu@canonical.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Sascha Hauer <kernel@pengutronix.de>,
	Greg Ungerer <gerg@uclinux.org>
Subject: Re: [PATCH] fec: use interrupt for MDIO completion indication
Date: Wed, 21 Jul 2010 14:51:13 +0200	[thread overview]
Message-ID: <20100721125113.GA2651@pengutronix.de> (raw)
In-Reply-To: <20100715040956.GA7690@jasper.tkos.co.il>

[-- Attachment #1: Type: text/plain, Size: 2886 bytes --]


> > Thanks for this patch, we tested on our i.MX51 board with Ubuntu. It works 
> > fine.
> > 
> > Wolfram, you can pick up this, too. -;)
> 
> Dave has already applied this patch to his net-next tree.

Bryan, thanks for letting me know, I missed this one.

However, have you guys ever tried pulling the cable off/on or restarting
the interface with 'ifconfig down/up'? This always caused a stalled PHY
for me. This patch helps:

==========================

From: Wolfram Sang <w.sang@pengutronix.de>
Subject: [PATCH] net/fec: restore interrupt mask after software-reset in fec_stop()

After the change from mdio polling to irq, it became necessary to
restore the interrupt mask after resetting the chip in fec_stop().
Otherwise, with all irqs disabled, no communication with the PHY will be
possible after e.g. un-/replugging the cable and the device gets
stalled.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
 drivers/net/fec.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 391a553..768b840 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -118,6 +118,8 @@ static unsigned char	fec_mac_default[] = {
 #define FEC_ENET_MII	((uint)0x00800000)	/* MII interrupt */
 #define FEC_ENET_EBERR	((uint)0x00400000)	/* SDMA bus error */
 
+#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII)
+
 /* The FEC stores dest/src/type, data, and checksum for receive packets.
  */
 #define PKT_MAXBUF_SIZE		1518
@@ -1213,8 +1215,7 @@ fec_restart(struct net_device *dev, int duplex)
 	writel(0, fep->hwp + FEC_R_DES_ACTIVE);
 
 	/* Enable interrupts we wish to service */
-	writel(FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII,
-			fep->hwp + FEC_IMASK);
+	writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
 }
 
 static void
@@ -1233,8 +1234,8 @@ fec_stop(struct net_device *dev)
 	/* Whack a reset.  We should wait for this. */
 	writel(1, fep->hwp + FEC_ECNTRL);
 	udelay(10);
-
 	writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
+	writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
 }
 
 static int __devinit
-- 
1.7.1

==========================

BUT, while it helps and may possibly be a quick fix for 2.6.35,
resetting the chip in fec_stop() looks like a wrong thing to do for me.
In the long run, it probably is better to make sure the chip is set up
correctly during initialization, so the reset in fec_stop() is not
needed at all. I had a quick shot at this, but seem to have missed
something as it didn't work. As I will be away from the computers for
two weeks in about 24 hours, I at least wanted to bring up the issue.

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2010-07-21 12:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12  7:12 [PATCH] fec: use interrupt for MDIO completion indication Baruch Siach
2010-07-12  7:12 ` Baruch Siach
2010-07-13  3:36 ` David Miller
2010-07-13  3:36   ` David Miller
2010-07-15  3:31 ` Bryan Wu
2010-07-15  3:31   ` Bryan Wu
2010-07-15  4:09   ` Baruch Siach
2010-07-15  4:09     ` Baruch Siach
2010-07-21 12:51     ` Wolfram Sang [this message]
2010-07-21 12:51       ` Wolfram Sang
2010-07-22  6:17       ` Baruch Siach
2010-07-22  6:17         ` Baruch Siach
2010-07-22 21:12       ` David Miller
2010-07-22 21:12         ` David Miller

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=20100721125113.GA2651@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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.