From patchwork Wed Apr 21 01:54:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Wu X-Patchwork-Id: 50606 X-Patchwork-Delegate: apw@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 5F4C4B6EEB for ; Wed, 21 Apr 2010 11:54:28 +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 1O4P8s-00012j-Tf; Wed, 21 Apr 2010 02:54:18 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1O4P8q-000124-Ul for kernel-team@lists.ubuntu.com; Wed, 21 Apr 2010 02:54:17 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1O4P8q-0000XY-TR for ; Wed, 21 Apr 2010 02:54:16 +0100 Received: from [58.33.182.36] (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 1O4P8p-00033p-SJ for kernel-team@lists.ubuntu.com; Wed, 21 Apr 2010 02:54:16 +0100 From: Bryan Wu To: kernel-team@lists.ubuntu.com Subject: [PATCH] netdev/fec: fix ifconfig eth0 down hang issue (v2) Date: Wed, 21 Apr 2010 09:54:07 +0800 Message-Id: <1271814847-3913-1-git-send-email-bryan.wu@canonical.com> X-Mailer: git-send-email 1.7.0.1 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/559065 v2: Check fec_enet_mii_probe() return value directly, instead of fep->phy_dev v1: In ethernet connection open/close function, we need to use phy_connect and phy_disconnect operation before we start/stop phy. Otherwise it will cause system hang. Also suspend/resume needs the same fix. Signed-off-by: Bryan Wu --- drivers/net/fec.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 2280373..6a13594 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c @@ -929,7 +929,9 @@ fec_enet_open(struct net_device *dev) return ret; /* schedule a link state check */ - phy_start(fep->phy_dev); + if (fec_enet_mii_probe(dev) != 0) + phy_start(fep->phy_dev); + netif_start_queue(dev); fep->opened = 1; return 0; @@ -942,10 +944,13 @@ fec_enet_close(struct net_device *dev) /* Don't know what to do yet. */ fep->opened = 0; - phy_stop(fep->phy_dev); netif_stop_queue(dev); + fec_stop(dev); + if (fep->phy_dev) + phy_disconnect(fep->phy_dev); + fec_enet_free_buffers(dev); clk_disable(fep->clk); @@ -1396,6 +1401,8 @@ fec_suspend(struct platform_device *dev, pm_message_t state) fep = netdev_priv(ndev); if (netif_running(ndev)) { netif_device_detach(ndev); + if (fep->phy_dev) + phy_disconnect(fep->phy_dev); fec_stop(ndev); clk_disable(fep->clk); } @@ -1415,6 +1422,8 @@ fec_resume(struct platform_device *dev) if (netif_running(ndev)) { clk_enable(fep->clk); fec_restart(ndev, 1); + if (fec_enet_mii_probe(dev) != 0) + phy_start(fep->phy_dev); netif_device_attach(ndev); } }