diff mbox

[RFC] mtd: nand: Fix bad block identification issue

Message ID 1303906161-24175-1-git-send-email-parth.saxena@ti.com
State RFC
Headers show

Commit Message

Saxena, Parth April 27, 2011, 12:09 p.m. UTC
Commit e0b58d0 ("mtd: nand: add ->badblockbits for minimum number 
of set bits in bad block byte") by Maxim Levitsky added 
badblockbits to nand_chip to specify minimum number of set bits 
in bad block byte. The patch initialized badblockbits to 8 in 
nand_base.c, but later the initialization line got removed by commit
c7b28e2("mtd: nand: refactor BB marker detection"). After this all 
NAND drivers with NAND_SKIP_BBTSCAN are forced to initialize it to 8.
Otherwise bad block identification will fail.

As a result, mounting of empty jffs2 file system on omap3evm
(having bad blocks) failed giving the following error message -

"mount: mounting /dev/mtdblock4 on /tmp failed: Input/output error"

This patch solves the above issue for omap by initialising
badblockbits. We are working further on this to find a generic fix
to the problem in nand_base.c.

Signed-off-by: Saxena, Parth <parth.saxena@ti.com>
Signed-off-by: Basheer, Mansoor Ahamed <mansoor.ahamed@ti.com>
---
 drivers/mtd/nand/omap2.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Gražvydas Ignotas April 27, 2011, 3:45 p.m. UTC | #1
Brian,

did you really intend to remove badblockbits? Maybe it should go back
to nand_base.c?

On Wed, Apr 27, 2011 at 3:09 PM, Saxena, Parth <parth.saxena@ti.com> wrote:
> Commit e0b58d0 ("mtd: nand: add ->badblockbits for minimum number
> of set bits in bad block byte") by Maxim Levitsky added
> badblockbits to nand_chip to specify minimum number of set bits
> in bad block byte. The patch initialized badblockbits to 8 in
> nand_base.c, but later the initialization line got removed by commit
> c7b28e2("mtd: nand: refactor BB marker detection"). After this all
> NAND drivers with NAND_SKIP_BBTSCAN are forced to initialize it to 8.
> Otherwise bad block identification will fail.
>
> As a result, mounting of empty jffs2 file system on omap3evm
> (having bad blocks) failed giving the following error message -
>
> "mount: mounting /dev/mtdblock4 on /tmp failed: Input/output error"
>
> This patch solves the above issue for omap by initialising
> badblockbits. We are working further on this to find a generic fix
> to the problem in nand_base.c.
>
> Signed-off-by: Saxena, Parth <parth.saxena@ti.com>
> Signed-off-by: Basheer, Mansoor Ahamed <mansoor.ahamed@ti.com>
> ---
>  drivers/mtd/nand/omap2.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> index 454f90c..350c77f 100644
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c
> @@ -1005,6 +1005,8 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
>        info->nand.options      = pdata->devsize;
>        info->nand.options      |= NAND_SKIP_BBTSCAN;
>
> +       info->nand.badblockbits = 8;
> +
>        /* NAND write protect off */
>        gpmc_cs_configure(info->gpmc_cs, GPMC_CONFIG_WP, 0);
>
> --
> 1.6.2.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Brian Norris April 28, 2011, 12:45 a.m. UTC | #2
Hi,

On 4/27/2011 8:45 AM, Grazvydas Ignotas wrote:
> Brian,
> 
> did you really intend to remove badblockbits? Maybe it should go back
> to nand_base.c?

No, I had no intention of the sorts! It surely should not have been
removed in the first place. I will "ack" a patch to revert it, or next
time I'm at my work machine I'll write one myself.

As a defense for myself...I think I was relatively new to git + kernel
hacking at the time I sent this patch. Sorry for the messup.

> On Wed, Apr 27, 2011 at 3:09 PM, Saxena, Parth <parth.saxena@ti.com> wrote:
>> Commit e0b58d0 ("mtd: nand: add ->badblockbits for minimum number
>> of set bits in bad block byte") by Maxim Levitsky added
>> badblockbits to nand_chip to specify minimum number of set bits
>> in bad block byte. The patch initialized badblockbits to 8 in
>> nand_base.c, but later the initialization line got removed by commit
>> c7b28e2("mtd: nand: refactor BB marker detection"). After this all
>> NAND drivers with NAND_SKIP_BBTSCAN are forced to initialize it to 8.
>> Otherwise bad block identification will fail.

Brian
diff mbox

Patch

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 454f90c..350c77f 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1005,6 +1005,8 @@  static int __devinit omap_nand_probe(struct platform_device *pdev)
 	info->nand.options	= pdata->devsize;
 	info->nand.options	|= NAND_SKIP_BBTSCAN;
 
+	info->nand.badblockbits = 8;
+
 	/* NAND write protect off */
 	gpmc_cs_configure(info->gpmc_cs, GPMC_CONFIG_WP, 0);