From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] omap_gpmc: Do not default to HAM1 when SW ECC is selected
Date: Wed, 18 Feb 2015 15:14:42 +0100 [thread overview]
Message-ID: <54E49E52.3080903@gmail.com> (raw)
In-Reply-To: <1424228335-22876-1-git-send-email-adam.yh.lee@gmail.com>
Hi Adam,
On 02/18/2015 03:58 AM, Adam YH Lee wrote:
> The ECC scheme selection algorithm in OMAP GPMC appears to be left untested when
> BCH8 handling code was added. Running 'nandecc sw' defaults to HAM1 even if
> the board is using another scheme (ex. OMAP_ECC_BCH8_CODE_HW_DETECTION_SW on
> OMAP3). This results in unrecoverable ECC errors when reading data. This commit
> fixes the behavior by checking for CONFIG_BCH and using the scheme defined by
> CONFIG_NAND_OMAP_ECCSCHEME in the board configuration file.
>
> This has been tested on Gumstix Overo (OMAP3).
>
> Signed-off-by: Adam YH Lee <adam.yh.lee@gmail.com>
> ---
> drivers/mtd/nand/omap_gpmc.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
> index fc64f48..5daf932 100644
> --- a/drivers/mtd/nand/omap_gpmc.c
> +++ b/drivers/mtd/nand/omap_gpmc.c
> @@ -901,8 +901,13 @@ int __maybe_unused omap_nand_switch_ecc(uint32_t hardware, uint32_t eccstrength)
> return -EINVAL;
> }
> } else {
> + #ifdef CONFIG_BCH
> + err = omap_select_ecc_scheme(nand, CONFIG_NAND_OMAP_ECCSCHEME,
> + mtd->writesize, mtd->oobsize);
> + #else
> err = omap_select_ecc_scheme(nand, OMAP_ECC_HAM1_CODE_SW,
> mtd->writesize, mtd->oobsize);
Couldn't we just use the CONFIG_NAND_OMAP_ECCSCHEME instead of
OMAP_ECC_HAM1_CODE_SW here and omit the CONFIG_BCH define?
On the other hand I think the whole function omap_nand_switch_ecc() is
wrong. AFAIR it should only be used on omap3 aka am35xx/dm37xx devices
witch the nandecc command.
These SoC do not have a ELM. Therefore I decided to say BCH8 on those
devices is always 'HW ECC' when introduced BCH8 on omap3 first. Nowadays
it is the so called BCH8_CODE_HW_DETECTION_SW. Coming from this mindset
the right solution is to use some detection if the ELM is supported or
not and switch in the HW part of omap_nand_switch_ecc() between
OMAP_ECC_BCH8_CODE_HW and OMAP_ECC_BCH8_CODE_HW_DETECTION_SW.
Best regards
Andreas Bie?mann
next prev parent reply other threads:[~2015-02-18 14:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-18 2:58 [U-Boot] omap_gpmc: Do not default to HAM1 when SW ECC is selected Adam YH Lee
2015-02-18 14:14 ` Andreas Bießmann [this message]
2015-02-18 17:33 ` Adam Lee
2015-02-18 19:04 ` Adam Lee
2015-02-18 19:25 ` [U-Boot] [PATCH] omap: gpmc: 'nandecc sw' can use HAM1 or BCH8 Ash Charles
2015-03-06 15:47 ` [U-Boot] " Tom Rini
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=54E49E52.3080903@gmail.com \
--to=andreas.devel@googlemail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox