diff options
author | Markus Klotzbücher <Markus Klotzbümk@pollux.denx.de> | 2006-03-06 13:45:42 +0100 |
---|---|---|
committer | Markus Klotzbücher <mk@pollux.denx.de> | 2006-03-06 13:45:42 +0100 |
commit | f9e029184be5ef550d05262e0f150d31fb09d19b (patch) | |
tree | 5109bf2a67225fb57ad0561ba3e31331ae65d7bc /drivers | |
parent | bf7cac033b27589c7de71a5f37f0c8e872ad489a (diff) |
NAND finally working. Two bugs fixed:
* For READ_STATUS and READID commands always 8 bytes need to be read from
NDDB. Otherwise they stay there and get send to flash as the first data
word when writing.
* In nand_base.c the oob variable is not reset so this->oob_buf is
overwritten what eventually screws up the bad block descriptor table.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/nand/nand_base.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/nand/nand_base.c b/drivers/nand/nand_base.c index b039c3cd8c..a5792cfb52 100644 --- a/drivers/nand/nand_base.c +++ b/drivers/nand/nand_base.c @@ -489,6 +489,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) return nand_write_oob (mtd, ofs , 2, &retlen, buf); } +#if READ_STATUS_BUG /** * nand_check_wp - [GENERIC] check if the chip is write protected * @mtd: MTD device structure @@ -503,7 +504,12 @@ static int nand_check_wp (struct mtd_info *mtd) this->cmdfunc (mtd, NAND_CMD_STATUS, -1, -1); return (this->read_byte(mtd) & 0x80) ? 0 : 1; } - +#else +static int nand_check_wp (struct mtd_info *mtd) +{ + return 0; +} +#endif /** * nand_block_checkbad - [GENERIC] Check if a block is marked bad * @mtd: MTD device structure @@ -1721,6 +1727,8 @@ static int nand_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, numpages = min (totalpages, ppblock); page &= this->pagemask; startpage = page; + oob = 0; + this->oobdirty = 1; oobbuf = nand_prepare_oobbuf (mtd, eccbuf, oobsel, autoplace, numpages); /* Check, if we cross a chip boundary */ @@ -2145,13 +2153,14 @@ int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbb instr->state = MTD_ERASING; while (len) { +#ifndef NAND_ALLOW_ERASE_ALL /* Check if we have a bad block, we do not erase bad blocks ! */ if (nand_block_checkbad(mtd, ((loff_t) page) << this->page_shift, 0, allowbbt)) { printk (KERN_WARNING "nand_erase: attempt to erase a bad block at page 0x%08x\n", page); instr->state = MTD_ERASE_FAILED; goto erase_exit; } - +#endif /* Invalidate the page cache, if we erase the block which contains the current cached page */ if (page <= this->pagebuf && this->pagebuf < (page + pages_per_block)) |