All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] NAND: DaVinci: Update 4 bit ECC correction
Date: Tue, 1 Dec 2009 16:53:03 -0600	[thread overview]
Message-ID: <20091201225303.GA19467@loki.buserror.net> (raw)
In-Reply-To: <1259706299-10213-1-git-send-email-s-paulraj@ti.com>

On Tue, Dec 01, 2009 at 05:24:59PM -0500, s-paulraj at ti.com wrote:
> From: Sandeep Paulraj <s-paulraj@ti.com>
> 
> There was a bug in the 4 bit ECC calculation routine
> in the DaVinci NAND driver. This becomes prominent
> when we use 4K page size NAND devices.
> This is a fix for the issue.
> 
> Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
> ---
>  drivers/mtd/nand/davinci_nand.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
> index 41a9568..68a0e15 100644
> --- a/drivers/mtd/nand/davinci_nand.c
> +++ b/drivers/mtd/nand/davinci_nand.c
> @@ -388,6 +388,17 @@ static int nand_davinci_4bit_correct_data(struct mtd_info *mtd, uint8_t *dat,
>  	emif_regs->NANDFCR |= 1 << 13;
>  
>  	/*
> +	 * ECC_STATE in NANDFSR register reads 0x3 (Error correction complete)
> +	 * immediately after setting the 4BITECC_ADD_CALC_START bit. So if we
> +	 * begin trying to poll for the state, we may fall right out of your
> +	 * loop

"your" loop?

>  without any of the correction calculations having taken place.
> +	 * So wait till ECC_STATE reads less than 4.
> +	 */
> +	do {
> +		val = ((emif_regs->NANDFSR >> 8) & 0xf);
> +	} while (val < 4);

Comment says wait until less than 4, code says wait until@least 4.  Could
symbolic constants be used to describe the states instead of magic numbers
like 4 and 0xc00?

Is it possible that there could be a race, whereby the hardware finishes
before you read NANDFSR for the first time, and thus you never see it be
greater than 3?

-Scott

  reply	other threads:[~2009-12-01 22:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-01 22:24 [U-Boot] [PATCH] NAND: DaVinci: Update 4 bit ECC correction s-paulraj at ti.com
2009-12-01 22:53 ` Scott Wood [this message]
2009-12-01 23:08   ` Paulraj, Sandeep
2009-12-01 23:21     ` Scott Wood

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=20091201225303.GA19467@loki.buserror.net \
    --to=scottwood@freescale.com \
    --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.