From: Gianluca Renzi <gianlucarenzi@eptar.com>
To: linux-mtd@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Sascha Hauer <s.hauer@pengutronix.de>,
Claudio Lanconelli <claudiolanconelli@eptar.com>
Subject: Re: About the mxc nand driver
Date: Wed, 21 Oct 2009 13:30:37 +0200 [thread overview]
Message-ID: <200910211330.38141.gianlucarenzi@eptar.com> (raw)
In-Reply-To: <20091020131157.GR8818@pengutronix.de>
On Tuesday 20 October 2009 15:11:58 Sascha Hauer wrote:
> Hi all,
>
> I frequently get reports about bugs in the Freescale mxc nand driver.
> Juergen Beisert and me invested some time to see what's going on in this
> driver, so here are some results.
The problem is caused by the fact the FreeScale's NAND Core Controller manages
the 2K Largepage NAND as 4 SmallPage pages joined with their own ECC codes and
badblock markers positions i.e. the smallpage badblock marker is located at
6th byte of the oobpage data (offset 5) (repeated for each page).
To keep this NAND Controller fancy situation under kernel/mtd's control there
are 2 ways:
1- Keep the location of the badblock marker at the first byte of oobpage data
(offset 0) as mtd driver expects to be the badblock marker, but the mxc_nand
driver MUST swap those locations *before* sending them to mtd.
2- Tell to mtd through its badblock descriptors to use 6th location (offset 5)
as a badblock marker instead of the standard offset 0 (for each smallpage page
area).
In the latter case, the hardware NAND Flash vendor MUST follow the same
badblock marker layout (i.e.: Numonyx NAND02G-B2D 2-Gbit, 2112-byte/1056-word
page, multiplane architecture, 1.8 V or 3 V, SLC NAND flash memories is using
both locations as badblock marker (offset 0 and offset 5) of oobpage data)
In the first case we need to have a code like this to act the swap:
/*
* This function does the trick of swapping the 464th byte in the last RAM
* buffer in the main area with the 0th byte in the spare area. This seems
* to be the optimal way of addressing the NFC imcompatibility problem with
* the NAND flash out of factory in terms of BI field.
* Note: this function only operates on the NFC's internal RAM buffers and
* for 2K page only.
*/
static void mxc_swap_2k_bi_main_sp(void)
{
u16 tmp1, tmp2, new_tmp1;
tmp1 = BAD_BLK_MARKER_464;
tmp2 = BAD_BLK_MARKER_SP_0;
new_tmp1 = (tmp1 & 0xFF00) | (tmp2 >> 8);
tmp2 = (tmp1 << 8) | (tmp2 & 0xFF);
BAD_BLK_MARKER_464 = new_tmp1;
BAD_BLK_MARKER_SP_0 = tmp2;
}
and you can use the standard layout of mtd.
We are using the second case, and to make it works we had to use the following
ECCLayout as suggested by FreeScale using the HWECC:
/*
* OOB placement block for use with hardware ecc generation
*/
static struct nand_ecclayout nand_hw_eccoob_8 = {
.eccbytes = 5,
.eccpos = {6, 7, 8, 9, 10},
.oobfree = {{0, 5}, {11, 5}}
};
static struct nand_ecclayout nand_hw_eccoob_16 = {
.eccbytes = 5,
.eccpos = {6, 7, 8, 9, 10},
.oobfree = {{0, 6}, {12, 4}}
};
static struct nand_ecclayout nand_hw_eccoob_2k = {
.eccbytes = 20,
.eccpos = {6, 7, 8, 9, 10, 22, 23, 24, 25, 26,
38, 39, 40, 41, 42, 54, 55, 56, 57, 58},
.oobfree = {
{.offset = 0,
.length = 5},
{.offset = 11,
.length = 10},
{.offset = 27,
.length = 10},
{.offset = 43,
.length = 10},
{.offset = 59,
.length = 5}
}
};
We hope to see a common way to ensure this NAND Controller in the next kernel
release, hopefully selected by a Kconfig entry (so to keep both cases valid).
Best regards,
--
,,,
(o o)
======oOO==(_)==OOo======
Gianluca Renzi
R&D
phone: +39.0542.609120
fax: +39.0542.609212
.oooO Oooo.
======( )==( )=======
\ ( ) /
\_) (_/
next prev parent reply other threads:[~2009-10-21 11:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-20 13:11 About the mxc nand driver Sascha Hauer
2009-10-20 13:28 ` Juergen Beisert
2009-10-20 13:32 ` Sascha Hauer
2009-10-21 11:30 ` Gianluca Renzi [this message]
2009-10-22 10:26 ` Juergen Beisert
2009-10-22 21:17 ` alfred steele
2009-10-23 8:19 ` Juergen Beisert
[not found] <2132956280B09448AB947D9C8A291AC6011F88BE@SMFIDF806A.main.fr.ds.corp>
2009-10-20 17:08 ` Juergen Beisert
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=200910211330.38141.gianlucarenzi@eptar.com \
--to=gianlucarenzi@eptar.com \
--cc=claudiolanconelli@eptar.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=s.hauer@pengutronix.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