From patchwork Wed Sep 2 15:05:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: miguel.aguilar@ridgerun.com X-Patchwork-Id: 45226 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n82F7fsx000460 for ; Wed, 2 Sep 2009 15:07:42 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n82F5abJ027688; Wed, 2 Sep 2009 10:05:41 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id n82F5Zpf018180; Wed, 2 Sep 2009 10:05:35 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 354D080627; Wed, 2 Sep 2009 10:05:35 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id AF40680626 for ; Wed, 2 Sep 2009 10:05:32 -0500 (CDT) Received: from white.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id n82F5Wvd025839 for ; Wed, 2 Sep 2009 10:05:32 -0500 (CDT) Received: from mail148-tx2-R.bigfish.com (mail-tx2.bigfish.com [65.55.88.113]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id n82F5Q3h008652 for ; Wed, 2 Sep 2009 10:05:32 -0500 Received: from mail148-tx2 (localhost.localdomain [127.0.0.1]) by mail148-tx2-R.bigfish.com (Postfix) with ESMTP id D553312F02CA for ; Wed, 2 Sep 2009 15:05:26 +0000 (UTC) X-SpamScore: 7 X-BigFish: vps7(zza4b1ozz1202hzzz2fh62h) X-Spam-TCS-SCL: 1:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 74.208.67.6; Service: EHS Received: by mail148-tx2 (MessageSwitch) id 1251903923775628_29611; Wed, 2 Sep 2009 15:05:23 +0000 (UCT) Received: from mail.navvo.net (mail.navvo.net [74.208.67.6]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail148-tx2.bigfish.com (Postfix) with ESMTP id 9ED0AA2805D for ; Wed, 2 Sep 2009 15:05:23 +0000 (UTC) Received: from [201.198.127.70] (helo=localhost.localdomain) by mail.navvo.net with esmtpa (Exim 4.63) (envelope-from ) id 1MirOi-0001fM-EY; Wed, 02 Sep 2009 10:05:21 -0500 From: miguel.aguilar@ridgerun.com To: davinci-linux-open-source@linux.davincidsp.com Date: Wed, 2 Sep 2009 09:05:19 -0600 Message-Id: <1251903919-7320-1-git-send-email-miguel.aguilar@ridgerun.com> X-Mailer: git-send-email 1.6.0.4 X-SA-Exim-Connect-IP: 201.198.127.70 X-SA-Exim-Mail-From: miguel.aguilar@ridgerun.com X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on mail.navvo.net X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,BAYES_00, NO_REAL_NAME autolearn=ham version=3.1.7-deb X-SA-Exim-Version: 4.2.1 (built Tue, 09 Jan 2007 17:23:22 +0000) X-SA-Exim-Scanned: Yes (on mail.navvo.net) Cc: todd.fischer@ridgerun.com, clark.becker@ridgerun.com, Miguel Aguilar , Maria Rodriguez Subject: [PATCH] DM9000: Set the steps to reset the DM9000 properly X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Miguel Aguilar According to the application notes of the DM9000 v1.22 page 29, the driver initializing steps are: first to power on the internal PHY and then to do a software reset. This patch is needed by the DM355 Leopard Board to make the ethernet work properly. Signed-off-by: Miguel Aguilar Signed-off-by: Maria Rodriguez --- drivers/net/dm9000.c | 19 +++++++++++++++++-- drivers/net/dm9000.h | 4 ++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index dd771de..34ebbe9 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c @@ -147,10 +147,25 @@ dm9000_reset(board_info_t * db) { dev_dbg(db->dev, "resetting device\n"); - /* RESET device */ + /* Reset DM9000 */ + /* see DM9000 Application Notes V1.22 Jun 11, 2004 page 29 */ + + /* DEBUG: Make all GPIO0 outputs, all others inputs */ + writeb(DM9000_GPCR, db->io_addr); + udelay(200); + writeb(GPCR_GPIO0_OUT, db->io_data); + udelay(200); + + /* Step 1: Power internal PHY by writing 0 to GPIO0 pin */ + writeb(DM9000_GPR, db->io_addr); + udelay(200); + writeb(0, db->io_data); + udelay(200); + + /* Step 2: Software reset */ writeb(DM9000_NCR, db->io_addr); udelay(200); - writeb(NCR_RST, db->io_data); + writeb(NCR_LBK_INT_MAC | NCR_RST, db->io_data); udelay(200); } diff --git a/drivers/net/dm9000.h b/drivers/net/dm9000.h index ba25cf5..90d580a 100644 --- a/drivers/net/dm9000.h +++ b/drivers/net/dm9000.h @@ -66,6 +66,8 @@ #define NCR_FCOL (1<<4) #define NCR_FDX (1<<3) #define NCR_LBK (3<<1) +#define NCR_LBK_INT_MAC (1<<1) +#define NCR_LBK_INT_PHY (2<<1) #define NCR_RST (1<<0) #define NSR_SPEED (1<<7) @@ -131,6 +133,8 @@ #define GPCR_GEP_CNTL (1<<0) +#define GPCR_GPIO0_OUT (1<<0) + #define DM9000_PKT_RDY 0x01 /* Packet ready to receive */ #define DM9000_PKT_MAX 1536 /* Received packet max size */