From patchwork Thu Apr 1 10:56:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Wu X-Patchwork-Id: 49203 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 C3BA8B7C06 for ; Thu, 1 Apr 2010 21:56:43 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1NxI4k-0001Zd-VS; Thu, 01 Apr 2010 11:56:39 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1NxI4j-0001Yc-1P for kernel-team@lists.ubuntu.com; Thu, 01 Apr 2010 11:56:37 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1NxI4i-0008FR-TW for ; Thu, 01 Apr 2010 11:56:36 +0100 Received: from [218.82.233.81] (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 1NxI4h-0005bS-IH for kernel-team@lists.ubuntu.com; Thu, 01 Apr 2010 11:56:36 +0100 From: Bryan Wu To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/2] netdev/fec: fix phy_speed caculating Date: Thu, 1 Apr 2010 18:56:05 +0800 Message-Id: <1270119366-6301-2-git-send-email-bryan.wu@canonical.com> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1270119366-6301-1-git-send-email-bryan.wu@canonical.com> References: <1270119366-6301-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 - remove duplicated phy_speed caculation - fix the phy_speed caculation according to the DataSheet Signed-off-by: Bryan Wu --- drivers/net/fec.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 9d99359..53240d3 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c @@ -737,10 +737,9 @@ static int fec_enet_mii_init(struct platform_device *pdev) fep->mii_timeout = 0; /* - * Set MII speed to 2.5 MHz + * Set MII speed to 2.5 MHz (= clk_get_rate() / 2 * phy_speed) */ - fep->phy_speed = ((((clk_get_rate(fep->clk) / 2 + 4999999) - / 2500000) / 2) & 0x3F) << 1; + fep->phy_speed = DIV_ROUND_UP(clk_get_rate(fep->clk), 5000000) << 1; writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); fep->mii_bus = mdiobus_alloc(); @@ -1121,10 +1120,6 @@ int __init fec_enet_init(struct net_device *dev, int index) dev->netdev_ops = &fec_netdev_ops; dev->ethtool_ops = &fec_enet_ethtool_ops; - /* Set MII speed to 2.5 MHz */ - fep->phy_speed = ((((clk_get_rate(fep->clk) / 2 + 4999999) - / 2500000) / 2) & 0x3F) << 1; - /* Initialize the receive buffer descriptors. */ bdp = fep->rx_bd_base; for (i = 0; i < RX_RING_SIZE; i++) {