public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] ARM1136: Fix cache range checks
@ 2012-07-19 11:35 Benoît Thébaudeau
  2012-07-19 11:53 ` Stefano Babic
  0 siblings, 1 reply; 2+ messages in thread
From: Benoît Thébaudeau @ 2012-07-19 11:35 UTC (permalink / raw)
  To: u-boot

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 <benoit.thebaudeau@advansee.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
---
 .../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) {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] ARM1136: Fix cache range checks
  2012-07-19 11:35 [U-Boot] [PATCH] ARM1136: Fix cache range checks Benoît Thébaudeau
@ 2012-07-19 11:53 ` Stefano Babic
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Babic @ 2012-07-19 11:53 UTC (permalink / raw)
  To: u-boot

On 19/07/2012 13:35, Beno?t Th?baudeau wrote:
> 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 <benoit.thebaudeau@advansee.com>
> Cc: Albert Aribaud <albert.u.boot@aribaud.net>
> ---

Hi Beno?t,

thanks for fix this !

>  .../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) {

Acked-by: Stefano Babic <sbabic@denx.de>

Albert, this is surely a fix - can you apply it for the release ?

Thanks,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-19 11:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-19 11:35 [U-Boot] [PATCH] ARM1136: Fix cache range checks Benoît Thébaudeau
2012-07-19 11:53 ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox