From patchwork Fri Apr 15 10:48:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: alain.peteut@space.unibe.ch X-Patchwork-Id: 91350 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 02B1CB6FF0 for ; Fri, 15 Apr 2011 20:53:53 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 21FB92844E; Fri, 15 Apr 2011 12:53:47 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7S9qSMQvDImN; Fri, 15 Apr 2011 12:53:46 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3301728439; Fri, 15 Apr 2011 12:53:44 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8299428439 for ; Fri, 15 Apr 2011 12:53:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mrka2hSVYm6n for ; Fri, 15 Apr 2011 12:53:41 +0200 (CEST) X-Greylist: delayed 322 seconds by postgrey-1.27 at theia; Fri, 15 Apr 2011 12:53:39 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailhub-lb2.unibe.ch (mailhub-lb2.unibe.ch [130.92.0.83]) by theia.denx.de (Postfix) with ESMTPS id 0B8CC28433 for ; Fri, 15 Apr 2011 12:53:39 +0200 (CEST) Received: from localhost (scanhub-lb1.unibe.ch [130.92.5.65]) by mailhub-lb2.unibe.ch (Postfix) with ESMTP id 8090E80B47 for ; Fri, 15 Apr 2011 12:48:17 +0200 (CEST) X-Virus-Scanned: by University of Bern - Mailgateway Received: from mailhub-lb2.unibe.ch ([130.92.0.83]) by localhost (scanhub-lb1.unibe.ch [130.92.5.65]) (amavisd-new, port 10024) with LMTP id t2P23XpyzfCe for ; Fri, 15 Apr 2011 12:48:15 +0200 (CEST) Received: from lenny.unibe.ch (lenny.unibe.ch [130.92.4.150]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mailhub-lb2.unibe.ch (Postfix) with ESMTPS id EFD7880ADA for ; Fri, 15 Apr 2011 12:48:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lenny.unibe.ch (Postfix) with ESMTP id D7A2378C05F for ; Fri, 15 Apr 2011 12:48:15 +0200 (CEST) X-Virus-checked: by University of Bern - smtp out Received: from lenny.unibe.ch ([127.0.0.1]) by localhost (lenny.unibe.ch [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 8VeMOZg05u1N for ; Fri, 15 Apr 2011 12:48:15 +0200 (CEST) Received: from localhost (bane [130.92.4.132]) by lenny.unibe.ch (Postfix) with ESMTP id AD6FB78C05B for ; Fri, 15 Apr 2011 12:48:15 +0200 (CEST) Received: from donar.unibe.ch (donar.unibe.ch [130.92.145.76]) by mail.unibe.ch (Horde Framework) with HTTP; Fri, 15 Apr 2011 12:48:15 +0200 Message-ID: <20110415124815.1253591nkjx5al4f@mail.unibe.ch> Date: Fri, 15 Apr 2011 12:48:15 +0200 From: alain.peteut@space.unibe.ch To: u-boot@lists.denx.de MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.3.4) Subject: [U-Boot] [PATCH] xilinx_emaclite.c ping-pong macro names X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Dear all, The macro name configuring Ping/Pong didn't match. It has been checked on a Spartan3e Starterkit. Kind regards, Alain From 35b00080dd397dfa4d8dae2d84423c36a34fe061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20P=C3=A9teut?= Date: Fri, 15 Apr 2011 12:44:37 +0200 Subject: [PATCH] xilinx_emaclite.c ping-pong fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alain Péteut --- drivers/net/xilinx_emaclite.c | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index 76af939..523f41a 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -138,7 +138,9 @@ static int emaclite_init(struct eth_device *dev, bd_t *bis) debug ("EmacLite Initialization Started\n"); memset (&emaclite, 0, sizeof (xemaclite)); emaclite.baseaddress = dev->iobase; - + + emaclite.nexttxbuffertouse = 0; + emaclite.nextrxbuffertouse = 0; /* * TX - TX_PING & TX_PONG initialization */ @@ -155,12 +157,13 @@ static int emaclite_init(struct eth_device *dev, bd_t *bis) while ((in_be32 (emaclite.baseaddress + XEL_TSR_OFFSET) & XEL_TSR_PROG_MAC_ADDR) != 0) ; -#ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG +#ifdef XILINX_EMACLITE_TX_PING_PONG /* The same operation with PONG TX */ out_be32 (emaclite.baseaddress + XEL_TSR_OFFSET + XEL_BUFFER_OFFSET, 0); xemaclite_alignedwrite (dev->enetaddr, emaclite.baseaddress + XEL_BUFFER_OFFSET, ENET_ADDR_LENGTH); - out_be32 (emaclite.baseaddress + XEL_TPLR_OFFSET, ENET_ADDR_LENGTH); + out_be32 (emaclite.baseaddress + XEL_TPLR_OFFSET + XEL_BUFFER_OFFSET, + ENET_ADDR_LENGTH); out_be32 (emaclite.baseaddress + XEL_TSR_OFFSET + XEL_BUFFER_OFFSET, XEL_TSR_PROG_MAC_ADDR); while ((in_be32 (emaclite.baseaddress + XEL_TSR_OFFSET + @@ -172,7 +175,7 @@ static int emaclite_init(struct eth_device *dev, bd_t *bis) */ /* Write out the value to flush the RX buffer */ out_be32 (emaclite.baseaddress + XEL_RSR_OFFSET, XEL_RSR_RECV_IE_MASK); -#ifdef CONFIG_XILINX_EMACLITE_RX_PING_PONG +#ifdef XILINX_EMACLITE_RX_PING_PONG out_be32 (emaclite.baseaddress + XEL_RSR_OFFSET + XEL_BUFFER_OFFSET, XEL_RSR_RECV_IE_MASK); #endif @@ -222,7 +225,7 @@ static int emaclite_send (struct eth_device *dev, volatile void *ptr, int len) printf ("Error: Timeout waiting for ethernet TX buffer\n"); /* Restart PING TX */ out_be32 (emaclite.baseaddress + XEL_TSR_OFFSET, 0); -#ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG +#ifdef XILINX_EMACLITE_TX_PING_PONG out_be32 (emaclite.baseaddress + XEL_TSR_OFFSET + XEL_BUFFER_OFFSET, 0); #endif @@ -238,7 +241,7 @@ static int emaclite_send (struct eth_device *dev, volatile void *ptr, int len) && ((in_be32 ((baseaddress) + XEL_TSR_OFFSET) & XEL_TSR_XMIT_ACTIVE_MASK) == 0)) { -#ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG +#ifdef XILINX_EMACLITE_TX_PING_PONG emaclite.nexttxbuffertouse ^= XEL_BUFFER_OFFSET; #endif debug ("Send packet from 0x%x\n", baseaddress); @@ -254,7 +257,7 @@ static int emaclite_send (struct eth_device *dev, volatile void *ptr, int len) out_be32 (baseaddress + XEL_TSR_OFFSET, reg); return 1; } -#ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG +#ifdef XILINX_EMACLITE_TX_PING_PONG /* Switch to second buffer */ baseaddress ^= XEL_BUFFER_OFFSET; /* Determine if the expected buffer address is empty */ @@ -290,11 +293,11 @@ static int emaclite_recv(struct eth_device *dev) reg = in_be32 (baseaddress + XEL_RSR_OFFSET); debug ("Testing data at address 0x%x\n", baseaddress); if ((reg & XEL_RSR_RECV_DONE_MASK) == XEL_RSR_RECV_DONE_MASK) { -#ifdef CONFIG_XILINX_EMACLITE_RX_PING_PONG +#ifdef XILINX_EMACLITE_RX_PING_PONG emaclite.nextrxbuffertouse ^= XEL_BUFFER_OFFSET; #endif } else { -#ifndef CONFIG_XILINX_EMACLITE_RX_PING_PONG +#ifndef XILINX_EMACLITE_RX_PING_PONG debug ("No data was available - address 0x%x\n", baseaddress); return 0; #else -- 1.7.2.5