diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-10-27 15:12:02 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-10-27 15:12:02 -0400 |
commit | 63a1423763c6c38eeeaf6dc8cee986514ab67aed (patch) | |
tree | 06eaad2dac5bcca712280a95630c4ccc74bf91b1 /drivers | |
parent | 7608194c4ae454fab23b8d940986eeb9c58c3478 (diff) |
[MTD] NAND: Remove empty block ECC workaround
They fixed the hardware so that ECC doesn't fail on reading an empty
block.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/nand/cafe.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/drivers/mtd/nand/cafe.c b/drivers/mtd/nand/cafe.c index d894c7286aab..887040c6c2d6 100644 --- a/drivers/mtd/nand/cafe.c +++ b/drivers/mtd/nand/cafe.c | |||
@@ -356,26 +356,6 @@ static int cafe_nand_read_oob(struct mtd_info *mtd, struct nand_chip *chip, | |||
356 | * The hw generator calculates the error syndrome automatically. Therefor | 356 | * The hw generator calculates the error syndrome automatically. Therefor |
357 | * we need a special oob layout and handling. | 357 | * we need a special oob layout and handling. |
358 | */ | 358 | */ |
359 | |||
360 | static unsigned short cafe_empty_syndromes[8] = { 4095, 748, 2629, 2920, 875, 1454, 51, 1456 }; | ||
361 | |||
362 | static int is_all_ff(unsigned char *buf, int len) | ||
363 | { | ||
364 | unsigned long *lbuf = (void *)buf; | ||
365 | int i; | ||
366 | |||
367 | for (i=0; i < (len/sizeof(long)); i++) { | ||
368 | if (lbuf[i] != ~0UL) | ||
369 | return 0; | ||
370 | } | ||
371 | i *= sizeof(long); | ||
372 | for (; i< len; i++) { | ||
373 | if (buf[i] != 0xff) | ||
374 | return 0; | ||
375 | } | ||
376 | return 1; | ||
377 | } | ||
378 | |||
379 | static int cafe_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip, | 359 | static int cafe_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip, |
380 | uint8_t *buf) | 360 | uint8_t *buf) |
381 | { | 361 | { |
@@ -398,13 +378,7 @@ static int cafe_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip, | |||
398 | syn[i+1] = (tmp >> 16) & 0xfff; | 378 | syn[i+1] = (tmp >> 16) & 0xfff; |
399 | } | 379 | } |
400 | 380 | ||
401 | /* FIXME: http://dev.laptop.org/ticket/215 */ | 381 | if ((i = cafe_correct_ecc(buf, syn)) < 0) { |
402 | if (!memcmp(syn, cafe_empty_syndromes, sizeof(syn)) | ||
403 | && is_all_ff(chip->oob_poi, 14) | ||
404 | && is_all_ff(buf, mtd->writesize)) { | ||
405 | dev_dbg(&cafe->pdev->dev, "ECC error reported on empty block\n"); | ||
406 | /* It was an empty block. Nothing to fix here except the hardware */ | ||
407 | } else if ((i = cafe_correct_ecc(buf, syn)) < 0) { | ||
408 | dev_dbg(&cafe->pdev->dev, "Failed to correct ECC\n"); | 382 | dev_dbg(&cafe->pdev->dev, "Failed to correct ECC\n"); |
409 | mtd->ecc_stats.failed++; | 383 | mtd->ecc_stats.failed++; |
410 | } else { | 384 | } else { |