[U-Boot-Users] [DNX#2007021242000052] [PATCH] Add sync to ensure flash_write_cmd is full [...]

OTRS Notification Master otrs at denx.de
Mon Feb 12 23:30:03 CET 2007


Hello list,

inside the automatic U-Boot patch tracking system a new ticket
[DNX#2007021242000052] was created:

<snip>
> Re-submit this patch by using sync instead of SYNC/DO_SYNC.
> 
> Some CPUs like PPC, BLACKFIN need sync() to ensure cfi flash write
> command is fully finished. The sync() is defined in each CPUs' io.h
> file. For those CPUs which do not need sync for now, a dummy sync() is
> defined in their io.h as well.
> 
> Signed-off-by: Haiying Wang <haiying.wang at freescale.com>
> ---
>  drivers/cfi_flash.c         |   16 ++++------------
>  include/asm-arm/io.h        |    4 ++++
>  include/asm-avr32/io.h      |    4 ++++
>  include/asm-blackfin/io.h   |    5 +++++
>  include/asm-i386/io.h       |    3 +++
>  include/asm-m68k/io.h       |    9 ++++++++-
>  include/asm-microblaze/io.h |    4 ++++
>  include/asm-mips/io.h       |    3 +++
>  include/asm-nios/io.h       |    4 ++++
>  include/asm-nios2/io.h      |    5 ++++-
>  include/asm-ppc/io.h        |    6 +++++-
>  11 files changed, 48 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/cfi_flash.c b/drivers/cfi_flash.c
> index 696f9a4..5579a1e 100644
> --- a/drivers/cfi_flash.c
> +++ b/drivers/cfi_flash.c
> @@ -36,6 +36,7 @@
>  
>  #include <common.h>
>  #include <asm/processor.h>
> +#include <asm/io.h>
>  #include <asm/byteorder.h>
>  #include <environment.h>
>  #ifdef	CFG_FLASH_CFI_DRIVER
> @@ -931,27 +932,18 @@ static void flash_write_cmd (flash_info_t * info,
> flash_sect_t sect, uint offset
>  		debug ("fwc addr %p cmd %x %x 8bit x %d bit\n", addr.cp, cmd,
>  		       cword.c, info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
>  		*addr.cp = cword.c;
> -#ifdef CONFIG_BLACKFIN
> -		asm("ssync;");
> -#endif
>  		break;
>  	case FLASH_CFI_16BIT:
>  		debug ("fwc addr %p cmd %x %4.4x 16bit x %d bit\n", addr.wp,
>  		       cmd, cword.w,
>  		       info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
>  		*addr.wp = cword.w;
> -#ifdef CONFIG_BLACKFIN
> -		asm("ssync;");
> -#endif
>  		break;
>  	case FLASH_CFI_32BIT:
>  		debug ("fwc addr %p cmd %x %8.8lx 32bit x %d bit\n", addr.lp,
>  		       cmd, cword.l,
>  		       info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
>  		*addr.lp = cword.l;
> -#ifdef CONFIG_BLACKFIN
> -		asm("ssync;");
> -#endif
>  		break;
>  	case FLASH_CFI_64BIT:
>  #ifdef DEBUG
> @@ -966,11 +958,11 @@ static void flash_write_cmd (flash_info_t * info,
> flash_sect_t sect, uint offset
>  		}
>  #endif
>  		*addr.llp = cword.ll;
> -#ifdef CONFIG_BLACKFIN
> -		asm("ssync;");
> -#endif
>  		break;
>  	}
> +
> +	/* Ensure all the instructions are fully finished */
> +	sync();
>  }
>  
>  static void flash_unlock_seq (flash_info_t * info, flash_sect_t sect)
> diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
> index 648a10d..47c18e7 100644
> --- a/include/asm-arm/io.h
> +++ b/include/asm-arm/io.h
> @@ -29,6 +29,10 @@
>  #include <asm/arch/hardware.h>
>  #endif	/* XXX###XXX */
>  
> +static inline void sync(void)
> +{
> +}
> +
>  /*
>   * Generic virtual read/write.  Note that we don't support half-word
>   * read/writes.  We define __arch_*[bl] here, and leave __arch_*w
> diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
> index e86c456..3c0d569 100644
> --- a/include/asm-avr32/io.h
> +++ b/include/asm-avr32/io.h
> @@ -89,4 +89,8 @@ static __inline__ void * phys_to_virt(unsigned long
> address)
</snip>

Your U-Boot support team



More information about the U-Boot mailing list