diff options
Diffstat (limited to 'drivers/mtd/nand/nand_bbt.c')
-rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index af46428286fe..ccbeaa1e4a8e 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c | |||
@@ -1276,20 +1276,6 @@ int nand_update_bbt(struct mtd_info *mtd, loff_t offs) | |||
1276 | * while scanning a device for factory marked good / bad blocks. */ | 1276 | * while scanning a device for factory marked good / bad blocks. */ |
1277 | static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; | 1277 | static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; |
1278 | 1278 | ||
1279 | static struct nand_bbt_descr smallpage_flashbased = { | ||
1280 | .options = NAND_BBT_SCAN2NDPAGE, | ||
1281 | .offs = NAND_SMALL_BADBLOCK_POS, | ||
1282 | .len = 1, | ||
1283 | .pattern = scan_ff_pattern | ||
1284 | }; | ||
1285 | |||
1286 | static struct nand_bbt_descr largepage_flashbased = { | ||
1287 | .options = NAND_BBT_SCAN2NDPAGE, | ||
1288 | .offs = NAND_LARGE_BADBLOCK_POS, | ||
1289 | .len = 2, | ||
1290 | .pattern = scan_ff_pattern | ||
1291 | }; | ||
1292 | |||
1293 | static uint8_t scan_agand_pattern[] = { 0x1C, 0x71, 0xC7, 0x1C, 0x71, 0xC7 }; | 1279 | static uint8_t scan_agand_pattern[] = { 0x1C, 0x71, 0xC7, 0x1C, 0x71, 0xC7 }; |
1294 | 1280 | ||
1295 | static struct nand_bbt_descr agand_flashbased = { | 1281 | static struct nand_bbt_descr agand_flashbased = { |
@@ -1355,10 +1341,6 @@ static struct nand_bbt_descr bbt_mirror_no_bbt_descr = { | |||
1355 | * this->badblock_pattern. Thus, this->badblock_pattern should be NULL when | 1341 | * this->badblock_pattern. Thus, this->badblock_pattern should be NULL when |
1356 | * passed to this function. | 1342 | * passed to this function. |
1357 | * | 1343 | * |
1358 | * TODO: Handle other flags, replace other static structs | ||
1359 | * (e.g. handle NAND_BBT_FLASH for flash-based BBT, | ||
1360 | * replace smallpage_flashbased) | ||
1361 | * | ||
1362 | */ | 1344 | */ |
1363 | static int nand_create_default_bbt_descr(struct nand_chip *this) | 1345 | static int nand_create_default_bbt_descr(struct nand_chip *this) |
1364 | { | 1346 | { |
@@ -1422,15 +1404,14 @@ int nand_default_bbt(struct mtd_info *mtd) | |||
1422 | this->bbt_md = &bbt_mirror_descr; | 1404 | this->bbt_md = &bbt_mirror_descr; |
1423 | } | 1405 | } |
1424 | } | 1406 | } |
1425 | if (!this->badblock_pattern) { | ||
1426 | this->badblock_pattern = (mtd->writesize > 512) ? &largepage_flashbased : &smallpage_flashbased; | ||
1427 | } | ||
1428 | } else { | 1407 | } else { |
1429 | this->bbt_td = NULL; | 1408 | this->bbt_td = NULL; |
1430 | this->bbt_md = NULL; | 1409 | this->bbt_md = NULL; |
1431 | if (!this->badblock_pattern) | ||
1432 | nand_create_default_bbt_descr(this); | ||
1433 | } | 1410 | } |
1411 | |||
1412 | if (!this->badblock_pattern) | ||
1413 | nand_create_default_bbt_descr(this); | ||
1414 | |||
1434 | return nand_scan_bbt(mtd, this->badblock_pattern); | 1415 | return nand_scan_bbt(mtd, this->badblock_pattern); |
1435 | } | 1416 | } |
1436 | 1417 | ||