From patchwork Sat Jun 5 10:21:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Timo Teras X-Patchwork-Id: 54768 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8E963B7D2E for ; Sat, 5 Jun 2010 20:22:33 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932811Ab0FEKVs (ORCPT ); Sat, 5 Jun 2010 06:21:48 -0400 Received: from ey-out-2122.google.com ([74.125.78.27]:59746 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932647Ab0FEKVr (ORCPT ); Sat, 5 Jun 2010 06:21:47 -0400 Received: by ey-out-2122.google.com with SMTP id 25so134216eya.19 for ; Sat, 05 Jun 2010 03:21:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:to:cc:subject :date:message-id:x-mailer:in-reply-to:references:mime-version :content-type:content-transfer-encoding; bh=bgDjKl2WNqRylJ5AFVBfSlgR9eoIal7nIihj0IBRShM=; b=r0j6AdkZSikckZNxfjl0TjWz7rm0CLYS/pMZudxu94oTjvbXkx5pjhwg3c5ny9M7KI HcLqkGIhavukZPQHyvAvFCIBYHvqTHLVjlwCdeCQlulazSofAGIS2whprQYd/qNeCK+R yip/EQiX5MPf4gWGrYsHAPBL2s4GEyQMxbCGo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:mime-version:content-type:content-transfer-encoding; b=dddxqt2Vr3ZQUYy2h4aV1HQQPlaIjwN3qQDxOmDBD15g5sjcTognuFxxEIICATLeVe 1XO469zcbJBH32126qzy3fTvDSNEkRxbm6m5K9UQt12ZLKuIEPooB+Ng8eS9AeAuZea9 3FiudZrh5dp2eCY7a7BmWk65p8YfQJM+3K7vc= Received: by 10.213.11.12 with SMTP id r12mr3974359ebr.54.1275733305999; Sat, 05 Jun 2010 03:21:45 -0700 (PDT) Received: from localhost.localdomain (letku109.adsl.netsonic.fi [194.29.195.109]) by mx.google.com with ESMTPS id 16sm1272841ewy.3.2010.06.05.03.21.45 (version=SSLv3 cipher=RC4-MD5); Sat, 05 Jun 2010 03:21:45 -0700 (PDT) From: =?UTF-8?q?Timo=20Ter=C3=A4s?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Timo=20Ter=C3=A4s?= , =?UTF-8?q?fran=C3=A7ois=20romieu?= , Edward Hsu Subject: [PATCH] r8169: fix random mdio_write failures Date: Sat, 5 Jun 2010 13:21:13 +0300 Message-Id: <1275733273-28321-1-git-send-email-timo.teras@iki.fi> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <4C0A1736.9030209@iki.fi> References: <4C0A1736.9030209@iki.fi> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Some configurations need delay between the "write completed" indication and new write to work reliably. Realtek driver seems to use longer delay when polling the "write complete" bit, so it waits long enough between writes with high probability (but could probably break too). This patch adds a new udelay to make sure we wait unconditionally some time after the write complete indication. This caused a regression with XID 18000000 boards when the board specific phy configuration writing many mdio registers was added in commit 2e955856ff (r8169: phy init for the 8169scd). Some of the configration mdio writes would almost always fail, and depending on failure might leave the PHY in non-working state. Signed-off-by: Timo Teräs Cc: françois romieu Cc: Edward Hsu --- drivers/net/r8169.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 217e709..03a8318 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -559,6 +559,11 @@ static void mdio_write(void __iomem *ioaddr, int reg_addr, int value) break; udelay(25); } + /* + * Some configurations require a small delay even after the write + * completed indication or the next write might fail. + */ + udelay(25); } static int mdio_read(void __iomem *ioaddr, int reg_addr)