From patchwork Tue Jul 13 15:20:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Wu X-Patchwork-Id: 58786 X-Patchwork-Delegate: stefan.bader@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id E8624B6F16 for ; Wed, 14 Jul 2010 01:21:14 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1OYhID-0002me-OO; Tue, 13 Jul 2010 16:21:09 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1OYhIB-0002lb-NS for kernel-team@lists.ubuntu.com; Tue, 13 Jul 2010 16:21:07 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1OYhIA-0000g4-FH for ; Tue, 13 Jul 2010 16:21:06 +0100 Received: from [58.33.190.89] (helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1OYhI8-0004Fg-0y for kernel-team@lists.ubuntu.com; Tue, 13 Jul 2010 16:21:06 +0100 From: Bryan Wu To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/2] UBUNTU: SAUCE: revert commit 41e74a1f7f90b0c092e9e153f7d8b685af2a980e Date: Tue, 13 Jul 2010 23:20:32 +0800 Message-Id: <1279034433-7791-2-git-send-email-bryan.wu@canonical.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1279034433-7791-1-git-send-email-bryan.wu@canonical.com> References: <1279034433-7791-1-git-send-email-bryan.wu@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com BugLink: http://bugs.launchpad.net/bugs/546649 BugLink: http://bugs.launchpad.net/bugs/457878 This commit is incorrect and was refused by upstream, so revert it. Signed-off-by: Bryan Wu --- drivers/net/fec.c | 45 ++++++++++++++++++++++++--------------------- 1 files changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 692d3c4..5a4f611 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c @@ -216,7 +216,7 @@ static void fec_stop(struct net_device *dev); #define FEC_MMFR_TA (2 << 16) #define FEC_MMFR_DATA(v) (v & 0xffff) -#define FEC_MII_TIMEOUT 10 +#define FEC_MII_TIMEOUT 10000 /* Transmitter timeout */ #define TX_TIMEOUT (2 * HZ) @@ -624,28 +624,12 @@ spin_unlock: /* * NOTE: a MII transaction is during around 25 us, so polling it... */ -static int fec_enet_mdio_poll(struct fec_enet_private *fep) -{ - int timeout = FEC_MII_TIMEOUT; - - fep->mii_timeout = 0; - - /* wait for end of transfer */ - while (!(readl(fep->hwp + FEC_IEVENT) & FEC_ENET_MII)) { - msleep(1); - if (timeout-- < 0) { - fep->mii_timeout = 1; - break; - } - } - - return 0; -} - static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum) { struct fec_enet_private *fep = bus->priv; + int timeout = FEC_MII_TIMEOUT; + fep->mii_timeout = 0; /* clear MII end of transfer bit*/ writel(FEC_ENET_MII, fep->hwp + FEC_IEVENT); @@ -655,7 +639,15 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum) FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(regnum) | FEC_MMFR_TA, fep->hwp + FEC_MII_DATA); - fec_enet_mdio_poll(fep); + /* wait for end of transfer */ + while (!(readl(fep->hwp + FEC_IEVENT) & FEC_ENET_MII)) { + cpu_relax(); + if (timeout-- < 0) { + fep->mii_timeout = 1; + printk(KERN_ERR "FEC: MDIO read timeout\n"); + return -ETIMEDOUT; + } + } /* return value */ return FEC_MMFR_DATA(readl(fep->hwp + FEC_MII_DATA)); @@ -665,6 +657,9 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) { struct fec_enet_private *fep = bus->priv; + int timeout = FEC_MII_TIMEOUT; + + fep->mii_timeout = 0; /* clear MII end of transfer bit*/ writel(FEC_ENET_MII, fep->hwp + FEC_IEVENT); @@ -675,7 +670,15 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum, FEC_MMFR_TA | FEC_MMFR_DATA(value), fep->hwp + FEC_MII_DATA); - fec_enet_mdio_poll(fep); + /* wait for end of transfer */ + while (!(readl(fep->hwp + FEC_IEVENT) & FEC_ENET_MII)) { + cpu_relax(); + if (timeout-- < 0) { + fep->mii_timeout = 1; + printk(KERN_ERR "FEC: MDIO write timeout\n"); + return -ETIMEDOUT; + } + } return 0; }