[-mm patch 2/3] AVR32 MTD: Unlock flash if necessary (try 2)

From: Haavard Skinnemoen
Date: Fri Sep 15 2006 - 10:39:38 EST


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@xxxxxxxxx>
---
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");
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/