mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Teresa Gámez" <t.gamez@phytec.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] cfi_flash: support of u32 cmd
Date: Wed, 24 Aug 2011 18:38:04 +0200	[thread overview]
Message-ID: <20110824163804.GK31404@pengutronix.de> (raw)
In-Reply-To: <1314176175-22795-1-git-send-email-t.gamez@phytec.de>

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@mail.ru>
> 
> Only tested with little endian on an intel cfi_flash.
> 
> Signed-off-by: Teresa Gámez <t.gamez@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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2011-08-24 16:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24  8:56 Teresa Gámez
2011-08-24 16:38 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110824163804.GK31404@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=t.gamez@phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox