summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Smith <alex.smith@imgtec.com>2014-06-25 14:35:41 +0400
committerAlex Smith <alex.smith@imgtec.com>2015-07-06 18:02:56 +0300
commitde7366e799a626a4f997a6c769ecab672fcea32e (patch)
treeab33aa35d1758d9eb7b28fd27b95ea9f82d6a024
parent9724af5a443499193e1bd760fb868555175cfb20 (diff)
downloadCI20_u-boot-de7366e799a626a4f997a6c769ecab672fcea32e.tar.xz
HACK: nand: check explicitly for 0x00 as the factory BBM rather than != 0xff
This is a hack to avoid any potential problems with factory bad block marker identification. The NAND chip that we have uses a zero byte in the first OOB location of the first page of a bad block as the BBM (this is also in line with Factory Defect Mapping requirements in the the ONFI specification). However U-Boot will take any byte that is not 0xff to be a bad block. While the chips should be factory erased, Ingenic have been testing on chips that are not erased, and U-Boot mistakenly identifies most of the blocks on the chip as bad. Avoid this by testing explicitly for a zero byte.
-rw-r--r--drivers/mtd/nand/nand_base.c2
-rw-r--r--drivers/mtd/nand/nand_bbt.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index d4d586c94..7fc4e46da 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3387,6 +3387,8 @@ int nand_scan_tail(struct mtd_info *mtd)
if (chip->options & NAND_SKIP_BBTSCAN)
chip->options |= NAND_BBT_SCANNED;
+ chip->options |= NAND_BBT_SCANNED;
+ chip->scan_bbt(mtd);
return 0;
}
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 8ef58451d..2d4530c62 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -438,7 +438,7 @@ static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd,
if (ret && !mtd_is_bitflip_or_eccerr(ret))
return ret;
- if (check_short_pattern(buf, bd))
+ if (!check_short_pattern(buf, bd))
return 1;
offs += mtd->writesize;
@@ -1233,6 +1233,7 @@ int nand_update_bbt(struct mtd_info *mtd, loff_t offs)
* while scanning a device for factory marked good / bad blocks.
*/
static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
+static uint8_t scan_00_pattern[] = { 0x00, 0x00 };
static uint8_t scan_agand_pattern[] = { 0x1C, 0x71, 0xC7, 0x1C, 0x71, 0xC7 };
@@ -1310,7 +1311,7 @@ static int nand_create_badblock_pattern(struct nand_chip *this)
bd->options = this->bbt_options & BADBLOCK_SCAN_MASK;
bd->offs = this->badblockpos;
bd->len = (this->options & NAND_BUSWIDTH_16) ? 2 : 1;
- bd->pattern = scan_ff_pattern;
+ bd->pattern = scan_00_pattern;
bd->options |= NAND_BBT_DYNAMICSTRUCT;
this->badblock_pattern = bd;
return 0;