[PATCH] read cfi device id according the bus width
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Thu Nov 22 02:25:03 EST 2012
On 14:49 Thu 22 Nov , 张忠山 wrote:
> Signed-off-by: 张忠山 <zzs213 at 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 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
More information about the barebox
mailing list