Check the initial bad block using ONENAND_CTRL_ERROR
PATCH 1/1 Check the initial bad block using ONENAND_CTRL_ERROR
Some chips don't set the ONENAND_CTRL_LOAD bit.
--- drivers/mtd/onenand/onenand_base.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/onenand/onenand_base.c +2 -2
@@ -1121,8 +1121,8 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state)if (ctrl &ONENAND_CTRL_ERROR ) {printk (KERN_DEBUG "onenand_bbt_wait: controller error = 0x%04x\n" , ctrl); -/* Initial bad block case */ -if (ctrl &ONENAND_CTRL_LOAD ) +/* Initial bad block case: 0x2400 or 0x0400 */ +if (ctrl &ONENAND_CTRL_ERROR )return ONENAND_BBT_READ_ERROR ;return ONENAND_BBT_READ_FATAL_ERROR ; }
Signature · 1 line
1.5.0.6
Quoted 12 lines · ext Kyungmin Park
Some chips don't set the
ONENAND_CTRL_LOADbit.Signed-off-by Kyungmin Park <[email protected]>--- drivers/mtd/onenand/onenand_base.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)drivers/mtd/onenand/onenand_base.c +0
-0
drivers/mtd/onenand/onenand_base.c static int onenand_bbt_wait(struct mtd_info *mtd, int state) · line 1128
Quoted 10 lines
drivers/mtd/onenand/onenand_base.c +2
-2@@ -1121,8 +1121,8 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state)if (ctrl &ONENAND_CTRL_ERROR ) {printk (KERN_DEBUG "onenand_bbt_wait: controller error = 0x%04x\n" , ctrl); -/* Initial bad block case */ -if (ctrl &ONENAND_CTRL_LOAD ) +/* Initial bad block case: 0x2400 or 0x0400 */ +if (ctrl &ONENAND_CTRL_ERROR )return ONENAND_BBT_READ_ERROR ;return ONENAND_BBT_READ_FATAL_ERROR ; }
You have:
if (ctrl & ONENAND_CTRL_ERROR) {
printk(KERN_DEBUG "onenand_bbt_wait: controller error = 0x%04x\n", ctrl); /* Initial bad block case: 0x2400 or 0x0400 */ if (ctrl & ONENAND_CTRL_ERROR)
return ONENAND_BBT_READ_ERROR;
return ONENAND_BBT_READ_FATAL_ERROR;
}
which is the same as:
if (ctrl & ONENAND_CTRL_ERROR) {
printk(KERN_DEBUG "onenand_bbt_wait: controller error = 0x%04x\n", ctrl); return ONENAND_BBT_READ_ERROR;
}
Is that what you intended?
Hi,
Quoted 10 lines
You have:
if (ctrl & ONENAND_CTRL_ERROR) { printk(KERN_DEBUG "onenand_bbt_wait: controller error = 0x%04x\n", ctrl); /* Initial bad block case: 0x2400 or 0x0400 */ if (ctrl & ONENAND_CTRL_ERROR) return ONENAND_BBT_READ_ERROR; return ONENAND_BBT_READ_FATAL_ERROR; }
Quoted 9 lines
which is the same as:
if (ctrl & ONENAND_CTRL_ERROR) { printk(KERN_DEBUG "onenand_bbt_wait: controller error = 0x%04x\n", ctrl); return ONENAND_BBT_READ_ERROR; }Is that what you intended?
Aha, You're right.
The original goal is to find a initial bad block and other unknown errors. First it checks the controller error and try to find a initial bad block with load error.
But some chips are not set the load error. it only sets the error bit (10).
Strictly to find a initial bad block, it checks the non 0xff pattern from oob area.
But now it checks the controller error as initial bad block. I'm not sure it have to check the non 0xff pattern after controller error. I think it's enough to check controller error at least onenand_bbt_wait. :)
I will change it as you suggested.
Thank you,
Kyungmin Park