From patchwork Wed Jun 9 05:22:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Timo Teras X-Patchwork-Id: 55049 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 0202EB7D29 for ; Wed, 9 Jun 2010 15:22:47 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751475Ab0FIFWl (ORCPT ); Wed, 9 Jun 2010 01:22:41 -0400 Received: from mail-ew0-f223.google.com ([209.85.219.223]:36397 "EHLO mail-ew0-f223.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751378Ab0FIFWk (ORCPT ); Wed, 9 Jun 2010 01:22:40 -0400 Received: by ewy23 with SMTP id 23so262321ewy.1 for ; Tue, 08 Jun 2010 22:22:39 -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=qnHpUywtjULtC1QGUPR7dGWqTvy21m/a0k0bwvLIwrw=; b=e4WCfP6N5gvi9Mlg0ijFObdbX6rB0XePz5XmjF2F8JSsm6ruAkJBTnsEEdVrxyRo6P /Rr1fr5Sglti9zd2he2Gk2b6TzFKSFYqIcCK5CPmhuiIO2eSeShH+dteo1N/oVGEuFc9 MDMx/McM0fb3cBbt1lgbojXb+E8EXqk6RRd84= 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=ZwBskGt18UeII2/73pqMA6ghzovoc+VXiGXACKYi+JLIoNPsEMazaADZdGgR1fFm2P +CsjUQ90xILRLjqAS7y5HFTQjzXZQgtFffOtRnH2AUiHo3szMvE6J+YTUdHwBda7845v eLOp9r+BbbKinj4zldOzKT0ak3sQKp/Ce5WQw= Received: by 10.213.109.9 with SMTP id h9mr12289888ebp.12.1276060958951; Tue, 08 Jun 2010 22:22:38 -0700 (PDT) Received: from localhost.localdomain (letku109.adsl.netsonic.fi [194.29.195.109]) by mx.google.com with ESMTPS id 13sm3813174ewy.13.2010.06.08.22.22.37 (version=SSLv3 cipher=RC4-MD5); Tue, 08 Jun 2010 22:22:38 -0700 (PDT) From: =?UTF-8?q?Timo=20Ter=C3=A4s?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Timo=20Ter=C3=A4s?= , Francois Romieu , Hayeswang Subject: [PATCH] r8169: fix mdio_read and update mdio_write according to hw specs Date: Wed, 9 Jun 2010 08:22:10 +0300 Message-Id: <1276060930-15697-1-git-send-email-timo.teras@iki.fi> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Realtek confirmed that a 20us delay is needed after mdio_read and mdio_write operations. Reduce the delay in mdio_write, and add it to mdio_read too. Also add a comment that the 20us is from hw specs. Signed-off-by: Timo Teräs Cc: Francois Romieu Cc: Hayeswang --- drivers/net/r8169.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 03a8318..96b6cfb 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -560,10 +560,10 @@ static void mdio_write(void __iomem *ioaddr, int reg_addr, int value) udelay(25); } /* - * Some configurations require a small delay even after the write - * completed indication or the next write might fail. + * According to hardware specs a 20us delay is required after write + * complete indication, but before sending next command. */ - udelay(25); + udelay(20); } static int mdio_read(void __iomem *ioaddr, int reg_addr) @@ -583,6 +583,12 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr) } udelay(25); } + /* + * According to hardware specs a 20us delay is required after read + * complete indication, but before sending next command. + */ + udelay(20); + return value; }