[U-Boot-Users] [PATCH 2/4] cfi_flash: Introduce read and write accessors

Jerry Van Baren gerald.vanbaren at ge.com
Wed Dec 12 14:23:00 CET 2007


Haavard Skinnemoen wrote:
> Introduce flash_read{8,16,32,64) and flash_write{8,16,32,64} and use
> them to access the flash memory. This makes it clearer when the flash
> is actually being accessed; merely dereferencing a volatile pointer
> looks just like any other kind of access.
> 
> Signed-off-by: Haavard Skinnemoen <hskinnemoen at atmel.com>
> ---
>  drivers/mtd/cfi_flash.c |  205 +++++++++++++++++++++++++++++------------------
>  1 files changed, 127 insertions(+), 78 deletions(-)
> 
> diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
> index a89fcae..d33725d 100644
> --- a/drivers/mtd/cfi_flash.c
> +++ b/drivers/mtd/cfi_flash.c
> @@ -149,13 +149,6 @@ typedef union {
>  	unsigned long long ll;
>  } cfiword_t;
>  
> -typedef union {
> -	volatile unsigned char *cp;
> -	volatile unsigned short *wp;
> -	volatile unsigned long *lp;
> -	volatile unsigned long long *llp;
> -} cfiptr_t;
> -
>  #define NUM_ERASE_REGIONS	4 /* max. number of erase regions */
>  
>  static uint flash_offset_cfi[2] = { FLASH_OFFSET_CFI, FLASH_OFFSET_CFI_ALT };
> @@ -178,6 +171,48 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS];		/* FLASH chips info */
>  
>  typedef unsigned long flash_sect_t;
>  
> +static void flash_write8(u8 value, void *addr)
> +{
> +	__raw_writeb(value, addr);
> +}

Hi Haavard,

Should you make the flash_write*() functions inline?

gvb




More information about the U-Boot mailing list