[OLPC-devel] Flash driver status.

David Woodhouse dwmw2 at infradead.org
Fri May 12 23:29:15 EDT 2006


On Fri, 2006-05-12 at 01:19 +0100, David Woodhouse wrote:
> Currently, it takes about 24 seconds to mount an almost-empty JFFS2 file
> system covering the whole 512MiB of flash. I should be able to get it
> going faster than that though, and that's before I start on improvements
> in JFFS2 itself. 

With help from Tom Sylla, I've got this down to about 8½ seconds. I've
also got the bad block stuff working, albeit slowly. It takes a while to
start up with a virgin chip, because it scans the _whole_ chip instead
of just looking for the two byte markers. That's fixable with the
attached patch, but I haven't committed that because I want to fix it
properly in the generic code if I can -- which involves working out why
Thomas was so paranoid in the first place :)

With the code now in my git tree (git://git.infradead.org/mtd-2.6)
we should be able to use JFFS2 on the board quite happily. With the
current Insyde BIOS you still need the userspace hack to enable the NAND
controller, which is at http://david.woodhou.se/olpc-enable-nand.c

This is the hack to speed up scanning a virgin chip. It only matters the
very first time -- after that, the bad block table already exists on the
flash.

diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c
index 4f0b338..58f277f 100644
--- a/drivers/mtd/nand/cs553x_nand.c
+++ b/drivers/mtd/nand/cs553x_nand.c
@@ -89,6 +89,15 @@ #define CS_NAND_ECC_PARITY	(1<<2)
 #define CS_NAND_ECC_CLRECC	(1<<1)
 #define CS_NAND_ECC_ENECC	(1<<0)
 
+static unsigned char cs553x_ff_pattern[] = { 0xff };
+
+static struct nand_bbt_descr cs553x_bbt_pattern = {
+	.options = NAND_BBT_SCAN2NDPAGE,
+	.offs = 0,
+	.len = 1,
+	.pattern = cs553x_ff_pattern
+};
+
 static void cs553x_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 {
 	struct nand_chip *this = mtd->priv;
@@ -248,6 +257,11 @@ static int __init cs553x_init_one(int cs
 	this->calculate_ecc = cs_calculate_ecc;
 	this->correct_data  = nand_correct_data;
 	
+	/* XXX: The default in nand_bbt.c seems somewhat excessive. 
+	   Should we need to do this, just to make it do its scan in
+	   under 5 minutes? */
+	this->badblock_pattern = &cs553x_bbt_pattern;
+
 	/* Enable the following for a flash based bad block table */
 	this->options = NAND_USE_FLASH_BBT | NAND_NO_AUTOINCR;
 


-- 
dwmw2




More information about the Devel mailing list