* [PATCH] mtd: apply tPROG delay for ONFI nand's page program
@ 2013-01-14 7:17 Huang Shijie
2013-01-14 12:28 ` Matthieu CASTET
0 siblings, 1 reply; 3+ messages in thread
From: Huang Shijie @ 2013-01-14 7:17 UTC (permalink / raw)
To: dwmw2; +Cc: dedekind1, linux-mtd, linux-kernel, Huang Shijie
With some latest Micron's onfi nand(such as MT29F64G08CBABAWP),
I find that if we do not apply the tPROG delay as the datasheet tells us,
the page program may fails. You will read out the all 0xff from this page
in this case.
This patch adds the tPROG delay for page program when it is an onfi nand.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/nand/nand_base.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 8323ac9..b628dd5 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -841,6 +841,10 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
*/
ndelay(100);
+ /* Apply the tPROG delay for ONFI nand program. */
+ if (chip->onfi_version && state == FL_WRITING)
+ udelay(le16_to_cpu(chip->onfi_params.t_prog));
+
if ((state == FL_ERASING) && (chip->options & NAND_IS_AND))
chip->cmdfunc(mtd, NAND_CMD_STATUS_MULTI, -1, -1);
else
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: apply tPROG delay for ONFI nand's page program
2013-01-14 7:17 [PATCH] mtd: apply tPROG delay for ONFI nand's page program Huang Shijie
@ 2013-01-14 12:28 ` Matthieu CASTET
2013-01-15 8:53 ` Huang Shijie
0 siblings, 1 reply; 3+ messages in thread
From: Matthieu CASTET @ 2013-01-14 12:28 UTC (permalink / raw)
To: Huang Shijie
Cc: dwmw2@infradead.org, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org, dedekind1@gmail.com
Huang Shijie a écrit :
> With some latest Micron's onfi nand(such as MT29F64G08CBABAWP),
> I find that if we do not apply the tPROG delay as the datasheet tells us,
> the page program may fails. You will read out the all 0xff from this page
> in this case.
>
> This patch adds the tPROG delay for page program when it is an onfi nand.
>
> Signed-off-by: Huang Shijie <b32955@freescale.com>
> ---
> drivers/mtd/nand/nand_base.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 8323ac9..b628dd5 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -841,6 +841,10 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
> */
> ndelay(100);
>
> + /* Apply the tPROG delay for ONFI nand program. */
> + if (chip->onfi_version && state == FL_WRITING)
> + udelay(le16_to_cpu(chip->onfi_params.t_prog));
> +
> if ((state == FL_ERASING) && (chip->options & NAND_IS_AND))
> chip->cmdfunc(mtd, NAND_CMD_STATUS_MULTI, -1, -1);
> else
It looks wrong : why should be wait tPROG before using status command to monitor
program end ?
tPROG is the Page program time (Measured from the falling edge of SR[6] to the
rising edge of SR[6]), but because we monitor SR[6] with status command, we
already wait for that time.
Are you sure that it is not a bug in your nand driver with status command ?
Matthieu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: apply tPROG delay for ONFI nand's page program
2013-01-14 12:28 ` Matthieu CASTET
@ 2013-01-15 8:53 ` Huang Shijie
0 siblings, 0 replies; 3+ messages in thread
From: Huang Shijie @ 2013-01-15 8:53 UTC (permalink / raw)
To: Matthieu CASTET
Cc: dwmw2@infradead.org, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org, dedekind1@gmail.com
于 2013年01月14日 20:28, Matthieu CASTET 写道:
> Huang Shijie a écrit :
>> With some latest Micron's onfi nand(such as MT29F64G08CBABAWP),
>> I find that if we do not apply the tPROG delay as the datasheet tells us,
>> the page program may fails. You will read out the all 0xff from this page
>> in this case.
>>
>> This patch adds the tPROG delay for page program when it is an onfi nand.
>>
>> Signed-off-by: Huang Shijie<b32955@freescale.com>
>> ---
>> drivers/mtd/nand/nand_base.c | 4 ++++
>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
>> index 8323ac9..b628dd5 100644
>> --- a/drivers/mtd/nand/nand_base.c
>> +++ b/drivers/mtd/nand/nand_base.c
>> @@ -841,6 +841,10 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
>> */
>> ndelay(100);
>>
>> + /* Apply the tPROG delay for ONFI nand program. */
>> + if (chip->onfi_version&& state == FL_WRITING)
>> + udelay(le16_to_cpu(chip->onfi_params.t_prog));
>> +
>> if ((state == FL_ERASING)&& (chip->options& NAND_IS_AND))
>> chip->cmdfunc(mtd, NAND_CMD_STATUS_MULTI, -1, -1);
>> else
> It looks wrong : why should be wait tPROG before using status command to monitor
> program end ?
>
> tPROG is the Page program time (Measured from the falling edge of SR[6] to the
> rising edge of SR[6]), but because we monitor SR[6] with status command, we
> already wait for that time.
>
thanks. you are right. Please ignore this patch.
> Are you sure that it is not a bug in your nand driver with status command ?
>
>
I will try to find the bug in the driver.
thanks
Huang Shijie
> Matthieu
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-15 8:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 7:17 [PATCH] mtd: apply tPROG delay for ONFI nand's page program Huang Shijie
2013-01-14 12:28 ` Matthieu CASTET
2013-01-15 8:53 ` Huang Shijie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox