Skip to content

Commit

Permalink
[MTD] NAND: Select chip before checking write protect status
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Gleixner authored and David Woodhouse committed Jun 27, 2006
1 parent 1887f51 commit 6a93096
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6a93096

Please sign in to comment.