diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 04de315e4937..7e68203fe1ba 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -303,28 +303,27 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip) | |||
303 | struct nand_chip *chip = mtd->priv; | 303 | struct nand_chip *chip = mtd->priv; |
304 | u16 bad; | 304 | u16 bad; |
305 | 305 | ||
306 | page = (int)(ofs >> chip->page_shift) & chip->pagemask; | ||
307 | |||
306 | if (getchip) { | 308 | if (getchip) { |
307 | page = (int)(ofs >> chip->page_shift); | ||
308 | chipnr = (int)(ofs >> chip->chip_shift); | 309 | chipnr = (int)(ofs >> chip->chip_shift); |
309 | 310 | ||
310 | nand_get_device(chip, mtd, FL_READING); | 311 | nand_get_device(chip, mtd, FL_READING); |
311 | 312 | ||
312 | /* Select the NAND device */ | 313 | /* Select the NAND device */ |
313 | chip->select_chip(mtd, chipnr); | 314 | chip->select_chip(mtd, chipnr); |
314 | } else | 315 | } |
315 | page = (int)(ofs >> chip->page_shift); | ||
316 | 316 | ||
317 | if (chip->options & NAND_BUSWIDTH_16) { | 317 | if (chip->options & NAND_BUSWIDTH_16) { |
318 | chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos & 0xFE, | 318 | chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos & 0xFE, |
319 | page & chip->pagemask); | 319 | page); |
320 | bad = cpu_to_le16(chip->read_word(mtd)); | 320 | bad = cpu_to_le16(chip->read_word(mtd)); |
321 | if (chip->badblockpos & 0x1) | 321 | if (chip->badblockpos & 0x1) |
322 | bad >>= 8; | 322 | bad >>= 8; |
323 | if ((bad & 0xFF) != 0xff) | 323 | if ((bad & 0xFF) != 0xff) |
324 | res = 1; | 324 | res = 1; |
325 | } else { | 325 | } else { |
326 | chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos, | 326 | chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos, page); |
327 | page & chip->pagemask); | ||
328 | if (chip->read_byte(mtd) != 0xff) | 327 | if (chip->read_byte(mtd) != 0xff) |
329 | res = 1; | 328 | res = 1; |
330 | } | 329 | } |