From patchwork Fri Nov 2 17:09:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitalii Demianets X-Patchwork-Id: 1689841 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id D2D303FCA5 for ; Fri, 2 Nov 2012 17:15:09 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TUKnY-0005Ou-Cx; Fri, 02 Nov 2012 17:12:48 +0000 Received: from mx3.cyfra.ua ([62.80.160.182]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TUKnU-0005Ob-Pf for linux-arm-kernel@lists.infradead.org; Fri, 02 Nov 2012 17:12:46 +0000 Received: from c.11.173.a246.dynamic.cyfra.net ([62.80.173.11] helo=nppfactor.kiev.ua) by mx3.cyfra.ua with esmtp (Exim 4.63) (envelope-from ) id 1TUKnO-0001uC-Nt; Fri, 02 Nov 2012 19:12:38 +0200 Received: from [192.168.0.20] (LUX [192.168.0.20]) by nppfactor.kiev.ua (Postfix) with ESMTP id C27F847CA83; Fri, 2 Nov 2012 19:09:25 +0200 (EET) From: Vitalii Demianets Organization: Factor-SPE To: netdev@vger.kernel.org Subject: [PATCH net-next] macb: Keep driver's speed/duplex in sync with actual NCFGR Date: Fri, 2 Nov 2012 19:09:24 +0200 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201211021909.25473.vitas@nppfactor.kiev.ua> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121102_131245_151241_838ECC47 X-CRM114-Status: GOOD ( 10.91 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Jean-Christophe PLAGNIOL-VILLARD , Nicolas Ferre , linux-arm-kernel@lists.infradead.org, Jamie Iles , Havard Skinnemoen X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When underlying phy driver restores its state very fast after being brought down and up so that macb driver function macb_handle_link_change() was never called with link state "down", driver's internal representation of phy speed and duplex (bp->speed and bp->duplex) didn't change. So, macb driver sees no reason to perform actual write to the NCFGR register, although the speed and duplex settings in that register were reset when interface was brought down and up. In that case actual phy speed and duplex differ from NCFGR settings. The patch fixes that by keeping internal driver representation of speed and duplex in sync with actual content of NCFGR. Signed-off-by: Vitalii Demianets --- drivers/net/ethernet/cadence/macb.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index c374875..13c3c33 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -1031,6 +1031,8 @@ static void macb_init_hw(struct macb *bp) config |= MACB_BIT(NBC); /* No BroadCast */ config |= macb_dbw(bp); macb_writel(bp, NCFGR, config); + bp->speed = SPEED_10; + bp->duplex = DUPLEX_HALF; macb_configure_dma(bp);