[PATCH] OneNAND: write oob with oobsize to prevent byte access

Kyungmin Park kyungmin.park at samsung.com
Wed Jan 25 20:37:35 EST 2006


Hi

There's some problem with write oob in serveral platform.
So we write oob with oobsize aligned (16bytes) instead of 3 bytes (from {2,
3})

If you don't mind I will commit this with write oob verify patch from Jarkko
Lavinen

Regards,
Kyungmin Park

Index: drivers/mtd/onenand/onenand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/onenand/onenand_base.c,v
retrieving revision 1.15
diff -u -p -r1.15 onenand_base.c
--- drivers/mtd/onenand/onenand_base.c	20 Jan 2006 15:29:28 -0000	1.15
+++ drivers/mtd/onenand/onenand_base.c	26 Jan 2006 01:29:00 -0000
@@ -936,8 +936,11 @@ static int onenand_write_oob(struct mtd_
 
 		this->command(mtd, ONENAND_CMD_BUFFERRAM, to, mtd->oobsize);
 
-		this->write_bufferram(mtd, ONENAND_SPARERAM, ffchars, 0,
mtd->oobsize);
-		this->write_bufferram(mtd, ONENAND_SPARERAM, buf, column,
thislen);
+		/* We send data to spare ram with oobsize
+		 * to prevent byte access */
+		memset(this->page_buf, 0xff, mtd->oobsize);
+		memcpy(this->page_buf + column, buf, thislen);
+		this->write_bufferram(mtd, ONENAND_SPARERAM, this->page_buf,
0, mtd->oobsize);
 
 		this->command(mtd, ONENAND_CMD_PROGOOB, to, mtd->oobsize);
 





More information about the linux-mtd mailing list