summaryrefslogtreecommitdiffstats
path: root/packages/linux/linux/acern30/n30-nand-hack.patch
blob: d606f2b47c3495ad2d49c82051d6f07412007e3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
The flash is locked on the n30 and needs to be unlocked before every
write.  It should be possible to do one big unlock operation outside
of the erase and write functions but for some strange reason that
doesn't seem to work any more, so do this ugly workaround for now.

Index: linux-2.6.14/drivers/mtd/nand/nand_base.c
===================================================================
--- linux-2.6.14.orig/drivers/mtd/nand/nand_base.c
+++ linux-2.6.14/drivers/mtd/nand/nand_base.c
@@ -866,6 +866,10 @@ static int nand_write_page (struct mtd_i
 	/* FIXME: Enable cached programming */
 	cached = 0;
 	
+	/* unlock the page */
+	this->cmdfunc (mtd, 0x23, -1, page);
+	this->cmdfunc (mtd, 0x24, -1, page);
+
 	/* Send command to begin auto page programming */
 	this->cmdfunc (mtd, NAND_CMD_SEQIN, 0x00, page);
 
@@ -2037,6 +2041,11 @@ out:
 static void single_erase_cmd (struct mtd_info *mtd, int page)
 {
 	struct nand_chip *this = mtd->priv;
+
+	/* unlock the page */
+	this->cmdfunc (mtd, 0x23, -1, page);
+	this->cmdfunc (mtd, 0x24, -1, page);
+
 	/* Send commands to erase a block */
 	this->cmdfunc (mtd, NAND_CMD_ERASE1, -1, page);
 	this->cmdfunc (mtd, NAND_CMD_ERASE2, -1, -1);