[PATCH] cfi_flash: support of u32 cmd

Sascha Hauer s.hauer at pengutronix.de
Wed Aug 24 12:38:04 EDT 2011


On Wed, Aug 24, 2011 at 10:56:15AM +0200, Teresa Gámez wrote:
> Some NOR flash chips have commands with length greater than the maximum
> value size of uchar.
> 
> Based on an U-Boot Patch by Vasiliy Leoenenko <vasiliy.leonenko at mail.ru>
> 
> Only tested with little endian on an intel cfi_flash.
> 
> Signed-off-by: Teresa Gámez <t.gamez at phytec.de>
> ---
>  drivers/nor/cfi_flash.c       |   38 +++++++++++++++++++++++++++++---------
>  drivers/nor/cfi_flash.h       |   11 +++++++----
>  drivers/nor/cfi_flash_amd.c   |    8 ++++----
>  drivers/nor/cfi_flash_intel.c |    2 +-
>  4 files changed, 41 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
> index 461b0e6..489c15d 100644
> --- a/drivers/nor/cfi_flash.c
> +++ b/drivers/nor/cfi_flash.c
> @@ -820,20 +820,38 @@ int flash_generic_status_check (struct flash_info *info, flash_sect_t sector,
>  /*
>   * make a proper sized command based on the port and chip widths
>   */
> -void flash_make_cmd(struct flash_info *info, u8 cmd, cfiword_t *cmdbuf)
> +void flash_make_cmd(struct flash_info *info, u32 cmd, cfiword_t *cmdbuf)
>  {
> -	cfiword_t result = 0;
> -	int i = info->portwidth / info->chipwidth;
> +	int i;
> +	int cp_offset;
> +	int cword_offset;
> +	uchar val;
> +	uchar *cp;
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
> +	u32 cmd_le = cpu_to_le32(cmd);
> +#endif

This looks suspicious. With little endian byte order cpu_to_le32 is a
noop.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list