public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] [MTD] [NAND]: nand_default_mark_blockbad() doesn't work when flash-based bbt not enabled
@ 2006-10-20 15:36 Ricard Wanderlof
  2006-10-20 15:51 ` Artem Bityutskiy
  0 siblings, 1 reply; 7+ messages in thread
From: Ricard Wanderlof @ 2006-10-20 15:36 UTC (permalink / raw)
  To: Linux mtd

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1017 bytes --]


Hi,

When a flash-based BBT is not used, nand_default_mark_blockbad() is 
supposed to mark the block bad in the oob. However, it sets the wrong 
length variable so that no bad block marker is in fact written. This patch 
attempts to rectify that.

From: Ricard Wanderlof <ricardw at axis.com>
Signed-off-by: Ricard Wanderlof <ricardw at axis.com>

diff -ur git/drivers/mtd/nand/nand_base.c rw/drivers/mtd/nand/nand_base.c
--- git/drivers/mtd/nand/nand_base.c	2006-10-20 17:23:37.000000000 +0200
+++ rw/drivers/mtd/nand/nand_base.c	2006-10-20 17:23:56.000000000 +0200
@@ -362,7 +362,7 @@
  		 * access
  		 */
  		ofs += mtd->oobsize;
-		chip->ops.len = 2;
+		chip->ops.ooblen = 2;
  		chip->ops.datbuf = NULL;
  		chip->ops.oobbuf = buf;
  		chip->ops.ooboffs = chip->badblockpos & ~0x01;

--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

[-- Attachment #2: patch file --]
[-- Type: TEXT/PLAIN, Size: 447 bytes --]

diff -ur git/drivers/mtd/nand/nand_base.c rw/drivers/mtd/nand/nand_base.c
--- git/drivers/mtd/nand/nand_base.c	2006-10-20 17:23:37.000000000 +0200
+++ rw/drivers/mtd/nand/nand_base.c	2006-10-20 17:23:56.000000000 +0200
@@ -362,7 +362,7 @@
 		 * access
 		 */
 		ofs += mtd->oobsize;
-		chip->ops.len = 2;
+		chip->ops.ooblen = 2;
 		chip->ops.datbuf = NULL;
 		chip->ops.oobbuf = buf;
 		chip->ops.ooboffs = chip->badblockpos & ~0x01;

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] [MTD] [NAND]: nand_default_mark_blockbad() doesn't work when flash-based bbt not enabled (fwd)
@ 2006-10-23  7:33 Ricard Wanderlof
  2006-10-23  9:52 ` David Woodhouse
  0 siblings, 1 reply; 7+ messages in thread
From: Ricard Wanderlof @ 2006-10-23  7:33 UTC (permalink / raw)
  To: Linux mtd

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1537 bytes --]


(This is an updated patch replacing the one I sent on Friday).

When a flash-based BBT is not used, nand_default_mark_blockbad() is supposed 
to mark the block bad in the oob. However, it sets the wrong length variable 
so that no bad block marker is in fact written. This patch attempts to 
rectify that.

(As note, it seems to be that logically, it shouldn't be necessary to set 
both length variables, as one appears to be for the main buffer, and 
one for the oob buffer, but this is how it is done in several places, 
including the code for the mtd character device MEMWRITEOOB and MEMREADOOB
ioctls. I'm not sure if this is a temporary solution during some rework of 
the mtd infrastructure, or whether there is a deeper thought here.)


From: Ricard Wanderlof <ricardw at axis.com>
Signed-off-by: Ricard Wanderlof <ricardw at axis.com>

diff -ur git/drivers/mtd/nand/nand_base.c rw/drivers/mtd/nand/nand_base.c
--- git/drivers/mtd/nand/nand_base.c	2006-10-20 17:23:37.000000000 +0200
+++ rw/drivers/mtd/nand/nand_base.c	2006-10-23 08:56:45.000000000 +0200
@@ -362,7 +362,7 @@
  		 * access
  		 */
  		ofs += mtd->oobsize;
-		chip->ops.len = 2;
+		chip->ops.len = chip->ops.ooblen = 2;
  		chip->ops.datbuf = NULL;
  		chip->ops.oobbuf = buf;
  		chip->ops.ooboffs = chip->badblockpos & ~0x01;

--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

[-- Attachment #2: patch file --]
[-- Type: TEXT/PLAIN, Size: 463 bytes --]

diff -ur git/drivers/mtd/nand/nand_base.c rw/drivers/mtd/nand/nand_base.c
--- git/drivers/mtd/nand/nand_base.c	2006-10-20 17:23:37.000000000 +0200
+++ rw/drivers/mtd/nand/nand_base.c	2006-10-23 08:56:45.000000000 +0200
@@ -362,7 +362,7 @@
 		 * access
 		 */
 		ofs += mtd->oobsize;
-		chip->ops.len = 2;
+		chip->ops.len = chip->ops.ooblen = 2;
 		chip->ops.datbuf = NULL;
 		chip->ops.oobbuf = buf;
 		chip->ops.ooboffs = chip->badblockpos & ~0x01;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-10-26  9:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-20 15:36 [PATCH] [MTD] [NAND]: nand_default_mark_blockbad() doesn't work when flash-based bbt not enabled Ricard Wanderlof
2006-10-20 15:51 ` Artem Bityutskiy
2006-10-20 19:00   ` Ricard Wanderlof
  -- strict thread matches above, loose matches on Subject: below --
2006-10-23  7:33 [PATCH] [MTD] [NAND]: nand_default_mark_blockbad() doesn't work when flash-based bbt not enabled (fwd) Ricard Wanderlof
2006-10-23  9:52 ` David Woodhouse
2006-10-23 10:46   ` [PATCH] [MTD] [NAND]: nand_default_mark_blockbad() doesn't work when flash-based bbt not enabled Ricard Wanderlof
2006-10-24  9:35   ` [PATCH] [MTD] [NAND]: nand_default_mark_blockbad() doesn't work when flash-based bbt not enabled (fwd) Vitaly Wool
2006-10-26  8:52     ` [PATCH] [MTD] [NAND]: nand_default_mark_blockbad() doesn't work when flash-based bbt not enabled Ricard Wanderlof
2006-10-26  8:55       ` Vitaly Wool
2006-10-26  9:06         ` Ricard Wanderlof

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox