All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: 张忠山 <zzs213@126.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] read cfi device id according the bus width
Date: Thu, 22 Nov 2012 08:25:03 +0100	[thread overview]
Message-ID: <20121122072503.GT8327@game.jcrosoft.org> (raw)
In-Reply-To: <1353566987-20609-1-git-send-email-zzs213@126.com>

On 14:49 Thu 22 Nov     , 张忠山 wrote:
> Signed-off-by: 张忠山 <zzs213@126.com>
> ---
>  drivers/nor/cfi_flash_amd.c   |    7 +++++--
>  drivers/nor/cfi_flash_intel.c |    7 +++++--
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/nor/cfi_flash_amd.c b/drivers/nor/cfi_flash_amd.c
> index 45c59b9..3ab4be0 100644
> --- a/drivers/nor/cfi_flash_amd.c
> +++ b/drivers/nor/cfi_flash_amd.c
> @@ -62,8 +62,11 @@ static void amd_read_jedec_ids (struct flash_info *info)
>  	udelay(1000); /* some flash are slow to respond */
>  
>  	info->manufacturer_id = jedec_read_mfr(info);
> -	info->device_id = flash_read_uchar (info,
> -					FLASH_OFFSET_DEVICE_ID);
> +	if(info->chipwidth == FLASH_CFI_BY16)
> +		info->device_id = flash_read16(flash_make_addr(info, 0, FLASH_OFFSET_DEVICE_ID));
> +	else
> +		info->device_id = flash_read_uchar (info,
> +						FLASH_OFFSET_DEVICE_ID);
>  	if (info->device_id == 0x7E) {
>  		/* AMD 3-byte (expanded) device ids */
>  		info->device_id2 = flash_read_uchar (info,
> diff --git a/drivers/nor/cfi_flash_intel.c b/drivers/nor/cfi_flash_intel.c
> index 32e581a..75dc5a8 100644
> --- a/drivers/nor/cfi_flash_intel.c
> +++ b/drivers/nor/cfi_flash_intel.c
> @@ -19,8 +19,11 @@ static void intel_read_jedec_ids (struct flash_info *info)
>  	udelay(1000); /* some flash are slow to respond */
>  
>  	info->manufacturer_id = jedec_read_mfr(info);
> -	info->device_id = flash_read_uchar (info,
> -					FLASH_OFFSET_DEVICE_ID);
> +	if(info->chipwidth == FLASH_CFI_BY16)
> +		info->device_id = flash_read16(flash_make_addr(info, 0, FLASH_OFFSET_DEVICE_ID));
> +	else
> +		info->device_id = flash_read_uchar (info,
> +						FLASH_OFFSET_DEVICE_ID);
>  	flash_write_cmd(info, 0, 0, info->cmd_reset);

I said factorize not duplicate

and you need to handle all the with not only 8 and 16

Best Regards,
J.
>  }
>  
> -- 
> 1.7.4.4
> 
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

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

  reply	other threads:[~2012-11-22  7:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22  6:49 [PATCH] read cfi device id according the bus width 张忠山
2012-11-22  7:25 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-11-22  8:06   ` 张忠山
  -- strict thread matches above, loose matches on Subject: below --
2012-11-22  6:01 张忠山
2012-11-22  6:14 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-22  6:26   ` 张忠山
2012-11-22  6:38     ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-22  1:48 张忠山
2012-11-22  5:46 ` Jean-Christophe PLAGNIOL-VILLARD

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=20121122072503.GT8327@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=zzs213@126.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.