From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cfi_flash: Micron Nor flash don't support read operation after send write command
Date: Wed, 12 Mar 2014 06:14:12 +0100 [thread overview]
Message-ID: <531FED24.10004@denx.de> (raw)
In-Reply-To: <71CF8D7F32C5C24C9CD1D0E02D52498A770D0A29@NTXXIAMBX02.xacn.micron.com>
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 Wang<qiwang@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
next prev parent reply other threads:[~2014-03-12 5:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-11 8:46 [U-Boot] [PATCH] cfi_flash: Micron Nor flash don't support read operation after send write command Qi Wang 王起 (qiwang)
2014-03-12 5:14 ` Stefan Roese [this message]
2014-03-12 5:27 ` Qi Wang 王起 (qiwang)
[not found] <mailman.286.1394523795.2333.u-boot@lists.denx.de>
2014-03-11 8:08 ` Qi Wang 王起 (qiwang)
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=531FED24.10004@denx.de \
--to=sr@denx.de \
--cc=u-boot@lists.denx.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 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.