]> err.no Git - linux-2.6/commitdiff
[MTD] NAND: Select chip before checking write protect status
authorThomas Gleixner <tglx@cruncher.tec.linutronix.de>
Tue, 27 Jun 2006 22:11:45 +0000 (00:11 +0200)
committerDavid Woodhouse <dwmw2@infradead.org>
Tue, 27 Jun 2006 22:24:09 +0000 (23:24 +0100)
The other way round works not really well with boards which have a
static NAND chipselect.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
drivers/mtd/nand/nand_base.c

index 8df184f6d8d1682eb71849c395a7e74a7ed31a68..80a76654d963749a18d2c9a79a5df29f1093159c 100644 (file)
@@ -1610,13 +1610,13 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
        if (!writelen)
                return 0;
 
+       chipnr = (int)(to >> chip->chip_shift);
+       chip->select_chip(mtd, chipnr);
+
        /* Check, if it is write protected */
        if (nand_check_wp(mtd))
                return -EIO;
 
-       chipnr = (int)(to >> chip->chip_shift);
-       chip->select_chip(mtd, chipnr);
-
        realpage = (int)(to >> chip->page_shift);
        page = realpage & chip->pagemask;
        blockmask = (1 << (chip->phys_erase_shift - chip->page_shift)) - 1;