[-mm patch 2/3] AVR32 MTD: Unlock flash if necessary (try 2)
Haavard Skinnemoen
hskinnemoen at atmel.com
Fri Sep 15 10:37:11 EDT 2006
If a cfi_cmdset_0002 fixup installs an unlock() operation, use it
to unlock the whole flash after the erase regions have been set up.
I wanted to do this in the fixup itself, but it wouldn't work because
the erase regions hadn't been initialized, and mtd->size was zero.
Signed-off-by: Haavard Skinnemoen <hskinnemoen at atmel.com>
---
drivers/mtd/chips/cfi_cmdset_0002.c | 9 +++++++++
1 file changed, 9 insertions(+)
Index: linux-2.6.18-rc6-mm2/drivers/mtd/chips/cfi_cmdset_0002.c
===================================================================
--- linux-2.6.18-rc6-mm2.orig/drivers/mtd/chips/cfi_cmdset_0002.c 2006-09-15 14:39:40.000000000 +0200
+++ linux-2.6.18-rc6-mm2/drivers/mtd/chips/cfi_cmdset_0002.c 2006-09-15 15:45:41.000000000 +0200
@@ -416,6 +416,15 @@ static struct mtd_info *cfi_amdstd_setup
}
#endif
+ /*
+ * If an unlock() operation was installed by a fixup, use it
+ * now to unlock the whole flash.
+ */
+ if (mtd->unlock && mtd->unlock(mtd, 0, mtd->size))
+ printk(KERN_WARNING "%s: unlock failed, writes may not work\n",
+ map->name);
+
+
/* FIXME: erase-suspend-program is broken. See
http://lists.infradead.org/pipermail/linux-mtd/2003-December/009001.html */
printk(KERN_NOTICE "cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.\n");
More information about the linux-mtd
mailing list