
Hi Stefan, ok, got it. Because I saw the patch format is malformed in the website http://patchwork.ozlabs.org/project/uboot/list/, so I send this patch three times. You can reference the last patch I submit. It's my first time to submit Patch to Uboot community. Sorry for bring inconvenient for you. Sorry for that. Anyway, can you help check if the patch I submit make sense? Thanks a lot
-----Original Message----- From: Stefan Roese [mailto:sr@denx.de] Sent: Wednesday, March 12, 2014 1:14 PM To: Qi Wang 王起 (qiwang); u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH] cfi_flash: Micron Nor flash don't support read operation after send write command
Hi Qi Wang,
please don't send this patch so often.
On 11.03.2014 09:46, Qi Wang 王起 (qiwang) wrote:
Micron Nor flash don't support read operation after send write command.
Are all Micon NOR flash chips affected by this? Or only some chips? Please list the chips/families and best add a link to the description of this unsupported operation mode (chapter in data-sheet or errata).
Find a few more comments below.
As below,
flash_write_cmd(info, sector, offset, AMD_CMD_WRITE_TO_BUFFER); cnt = len >> shift; flash_write_cmd(info, sector, offset, cnt - 1);
switch (info->portwidth) { case FLASH_CFI_8BIT: while (cnt-- > 0) { flash_write8(flash_read8(src), dst); src += 1, dst += 1; } break;
If the src address locate in NOR flash, flash_read operation will be failed. So, read out the data to DRAM before send write command operation.
Signed-off-by: Qi Wangqiwang@micron.com
drivers/mtd/cfi_flash.c | 70 +++++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 24 deletions(-)
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index a389cd1..0f532c0 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -25,6 +25,8 @@ #include <environment.h> #include <mtd/cfi_flash.h> #include <watchdog.h> +#include <malloc.h> +#include <asm-generic/errno.h>
/*
- This file implements a Common Flash Interface (CFI) driver for @@ -855,6 +857,8 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp,
int cnt; int retcode; void *src = cp;
- void *src2;
- void *src2_bak; void *dst = (void *)dest; void *dst2 = dst; int flag = 1;
@@ -880,29 +884,45 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp, goto out_unmap; }
- src2 = malloc(len);
Naming is not optimal, at least for my taste. My not use "src_buf"?
- if(!src2)
- {
free(src2);
return -ENOMEM;
- }
Incorrect coding style. Please use something like this instead:
if (!src2) { free(src2); return -ENOMEM; }
Thanks, Stefan