From patchwork Tue Jan 22 14:10:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Dols X-Patchwork-Id: 214565 X-Patchwork-Delegate: joe.hershberger@gmail.com 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 B2D4B2C007C for ; Wed, 23 Jan 2013 01:35:48 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0FDB14A10A; Tue, 22 Jan 2013 15:35:38 +0100 (CET) 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 jIgJsvFNR-u8; Tue, 22 Jan 2013 15:35:37 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 917454A112; Tue, 22 Jan 2013 15:35:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5B24A4A106 for ; Tue, 22 Jan 2013 15:20:18 +0100 (CET) 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 eHknJPIWoKDI for ; Tue, 22 Jan 2013 15:20:06 +0100 (CET) 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 vaxjo.synopsys.com (us02smtp1.synopsys.com [198.182.60.75]) by theia.denx.de (Postfix) with ESMTP id B5A0E4A100 for ; Tue, 22 Jan 2013 15:20:02 +0100 (CET) Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by vaxjo.synopsys.com (Postfix) with ESMTP id E327AE11C; Tue, 22 Jan 2013 06:10:33 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id CC8E4828; Tue, 22 Jan 2013 06:10:33 -0800 (PST) Received: from localhost.localdomain (nl-droid1.internal.synopsys.com [10.100.24.228]) by mailhost.synopsys.com (Postfix) with ESMTP id 076EC824; Tue, 22 Jan 2013 06:10:32 -0800 (PST) From: Frank Dols To: vipin.kumar@st.com, u-boot@lists.denx.de Date: Tue, 22 Jan 2013 15:10:21 +0100 Message-Id: <1358863821-31956-3-git-send-email-frank.dols@synopsys.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1358863821-31956-1-git-send-email-frank.dols@synopsys.com> References: <1358863821-31956-1-git-send-email-frank.dols@synopsys.com> X-Mailman-Approved-At: Tue, 22 Jan 2013 15:35:26 +0100 Cc: Frank Dols Subject: [U-Boot] [PATCH 2/2] u-boot/drivers/net/designware with cache support. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Frank Dols --- drivers/net/designware.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 2f235d5..8e0508e 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -32,6 +32,9 @@ #include #include #include "designware.h" +#ifdef CONFIG_SYS_DCACHE_ON +#include +#endif static int configure_phy(struct eth_device *dev); @@ -227,6 +230,10 @@ static int dw_eth_send(struct eth_device *dev, void *packet, int length) memcpy((void *)readl(&desc_p->dmamac_addr), packet, length); +#ifdef CONFIG_SYS_DCACHE_ON + flush_dcache_range((void *)readl(&desc_p->dmamac_addr), length); +#endif + #if defined(CONFIG_DW_ALTDESCRIPTOR) writel(readl(&desc_p->txrx_status) | DESC_TXSTS_TXFIRST | DESC_TXSTS_TXLAST, &desc_p->txrx_status); @@ -277,8 +284,17 @@ static int dw_eth_recv(struct eth_device *dev) length = (status & DESC_RXSTS_FRMLENMSK) >> DESC_RXSTS_FRMLENSHFT; +#ifdef CONFIG_SYS_DCACHE_ON + invalidate_dcache_range((void *)readl(&desc_p->dmamac_addr), + length); +#endif + NetReceive(readl(&desc_p->dmamac_addr), length); +#ifdef CONFIG_SYS_DCACHE_ON + flush_dcache_range((void *)readl(&desc_p->dmamac_addr), length); +#endif + /* * Make the current descriptor valid again and go to * the next one @@ -584,6 +600,10 @@ int designware_initialize(u32 id, ulong base_addr, u32 phy_addr, u32 interface) dev->halt = dw_eth_halt; dev->write_hwaddr = dw_write_hwaddr; +#ifdef CONFIG_SYS_DCACHE_ON + flush_dcache_range(priv, sizeof(struct dw_eth_dev)); +#endif + eth_register(dev); #if defined(CONFIG_MII)