aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRoman Tereshonkov <roman.tereshonkov@nokia.com>2010-12-02 08:28:38 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-12-03 11:36:07 -0500
commit01039e4e63a8ea0d66fcfc71d7b99769bbbed9d6 (patch)
treed156cc0d0f5475c4176293530aa6b2a738fabb0b /drivers
parent8a8f632d8534d0c403831341450bd8db9e842f05 (diff)
mtd: onenand: bugfix for 2x mode bad block handling
This bug becomes visible in 2x mode when chip->writesize is different from mtd->writesize (= 2 * chip->writesize). At this case the bad block information is read from the first and the third physical pages instead of the first and the second as specification states. Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/onenand/onenand_bbt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c
index 01ab5b3c453b..905209bf9465 100644
--- a/drivers/mtd/onenand/onenand_bbt.c
+++ b/drivers/mtd/onenand/onenand_bbt.c
@@ -91,13 +91,15 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
91 for (j = 0; j < len; j++) { 91 for (j = 0; j < len; j++) {
92 /* No need to read pages fully, 92 /* No need to read pages fully,
93 * just read required OOB bytes */ 93 * just read required OOB bytes */
94 ret = onenand_bbt_read_oob(mtd, from + j * mtd->writesize + bd->offs, &ops); 94 ret = onenand_bbt_read_oob(mtd,
95 from + j * this->writesize + bd->offs, &ops);
95 96
96 /* If it is a initial bad block, just ignore it */ 97 /* If it is a initial bad block, just ignore it */
97 if (ret == ONENAND_BBT_READ_FATAL_ERROR) 98 if (ret == ONENAND_BBT_READ_FATAL_ERROR)
98 return -EIO; 99 return -EIO;
99 100
100 if (ret || check_short_pattern(&buf[j * scanlen], scanlen, mtd->writesize, bd)) { 101 if (ret || check_short_pattern(&buf[j * scanlen],
102 scanlen, this->writesize, bd)) {
101 bbm->bbt[i >> 3] |= 0x03 << (i & 0x6); 103 bbm->bbt[i >> 3] |= 0x03 << (i & 0x6);
102 printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n", 104 printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n",
103 i >> 1, (unsigned int) from); 105 i >> 1, (unsigned int) from);