summaryrefslogtreecommitdiff
path: root/drivers/nand/nand_base.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2007-05-05 16:57:46 +0200
committerWolfgang Denk <wd@denx.de>2007-05-05 16:57:46 +0200
commit55aee109ce0439f6315dce9c8f27423316e56fc4 (patch)
treec5e5531b19d2c6d85ad0b81b52aee428b480258a /drivers/nand/nand_base.c
parent5c3d76762194a63f662841d1f00da275f6d033f7 (diff)
parent9fab1181d0410dd274c58b76352c60328778e69d (diff)
downloadu-boot-imx-55aee109ce0439f6315dce9c8f27423316e56fc4.zip
u-boot-imx-55aee109ce0439f6315dce9c8f27423316e56fc4.tar.gz
u-boot-imx-55aee109ce0439f6315dce9c8f27423316e56fc4.tar.bz2
Merge with /home/wd/git/u-boot/custodian/u-boot-nand-flash
Diffstat (limited to 'drivers/nand/nand_base.c')
-rw-r--r--drivers/nand/nand_base.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/nand/nand_base.c b/drivers/nand/nand_base.c
index 8495829..c6fee18 100644
--- a/drivers/nand/nand_base.c
+++ b/drivers/nand/nand_base.c
@@ -427,8 +427,9 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
struct nand_chip *this = mtd->priv;
u16 bad;
+ page = (int)(ofs >> this->page_shift) & this->pagemask;
+
if (getchip) {
- page = (int)(ofs >> this->page_shift);
chipnr = (int)(ofs >> this->chip_shift);
/* Grab the lock and see if the device is available */
@@ -436,18 +437,17 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
/* Select the NAND device */
this->select_chip(mtd, chipnr);
- } else
- page = (int) ofs;
+ }
if (this->options & NAND_BUSWIDTH_16) {
- this->cmdfunc (mtd, NAND_CMD_READOOB, this->badblockpos & 0xFE, page & this->pagemask);
+ this->cmdfunc (mtd, NAND_CMD_READOOB, this->badblockpos & 0xFE, page);
bad = cpu_to_le16(this->read_word(mtd));
if (this->badblockpos & 0x1)
bad >>= 1;
if ((bad & 0xFF) != 0xff)
res = 1;
} else {
- this->cmdfunc (mtd, NAND_CMD_READOOB, this->badblockpos, page & this->pagemask);
+ this->cmdfunc (mtd, NAND_CMD_READOOB, this->badblockpos, page);
if (this->read_byte(mtd) != 0xff)
res = 1;
}