From patchwork Thu Jul 19 11:35:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Th=C3=A9baudeau?= X-Patchwork-Id: 171933 X-Patchwork-Delegate: albert.aribaud@free.fr 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 EC5852C0102 for ; Thu, 19 Jul 2012 21:30:44 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8F61328087; Thu, 19 Jul 2012 13:30: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 nICKjLL-JtpM; Thu, 19 Jul 2012 13:30:42 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 353C12807F; Thu, 19 Jul 2012 13:30:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D44632807F for ; Thu, 19 Jul 2012 13:30:38 +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 uSkB0pyYSWYJ for ; Thu, 19 Jul 2012 13:30:38 +0200 (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 zose-mta15.web4all.fr (zose-mta15.web4all.fr [176.31.217.11]) by theia.denx.de (Postfix) with ESMTP id 0ACD52807B for ; Thu, 19 Jul 2012 13:30:36 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zose-mta15.web4all.fr (Postfix) with ESMTP id 60A9F32145; Thu, 19 Jul 2012 13:33:04 +0200 (CEST) X-Virus-Scanned: amavisd-new at zose1.web4all.fr Received: from zose-mta15.web4all.fr ([127.0.0.1]) by localhost (zose-mta15.web4all.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Iq6EAyIP+nAX; Thu, 19 Jul 2012 13:33:04 +0200 (CEST) Received: from zose-store12.web4all.fr (zose-store-12.w4a.fr [178.33.204.48]) by zose-mta15.web4all.fr (Postfix) with ESMTP id DD3B7320F8; Thu, 19 Jul 2012 13:33:03 +0200 (CEST) Date: Thu, 19 Jul 2012 13:35:32 +0200 (CEST) From: =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?= To: u-boot@lists.denx.de Message-ID: <17110452.263656.1342697732030.JavaMail.root@advansee.com> MIME-Version: 1.0 X-Originating-IP: [88.188.188.98] X-Mailer: Zimbra 7.2.0_GA_2669 (ZimbraWebClient - FF3.0 (Win)/7.2.0_GA_2669) Subject: [U-Boot] [PATCH] ARM1136: Fix cache range checks 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de bad_cache_range actually returned true if the range was OK, but it was used according to its name, which resulted in all valid dcache range invalidate/flush operations being dropped. Hence, most DMA transfers resulted in garbage data. This patch renames this function according to what it does, and it fixes the interpretation of its return value by other functions. The chosen naming is the same as for ARM926EJ-S in order to be consistent. Signed-off-by: Benoît Thébaudeau Cc: Albert Aribaud Acked-by: Stefano Babic --- .../arch/arm/cpu/arm1136/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git u-boot-66714b1.orig/arch/arm/cpu/arm1136/cpu.c u-boot-66714b1/arch/arm/cpu/arm1136/cpu.c index f72bab6..b98e3d9 100644 --- u-boot-66714b1.orig/arch/arm/cpu/arm1136/cpu.c +++ u-boot-66714b1/arch/arm/cpu/arm1136/cpu.c @@ -95,7 +95,7 @@ void flush_dcache_all(void) asm volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0)); } -static inline int bad_cache_range(unsigned long start, unsigned long stop) +static int check_cache_range(unsigned long start, unsigned long stop) { int ok = 1; @@ -114,7 +114,7 @@ static inline int bad_cache_range(unsigned long start, unsigned long stop) void invalidate_dcache_range(unsigned long start, unsigned long stop) { - if (bad_cache_range(start, stop)) + if (!check_cache_range(start, stop)) return; while (start < stop) { @@ -125,7 +125,7 @@ void invalidate_dcache_range(unsigned long start, unsigned long stop) void flush_dcache_range(unsigned long start, unsigned long stop) { - if (bad_cache_range(start, stop)) + if (!check_cache_range(start, stop)) return; while (start < stop) {