Commit 004a1fdb45fb06ee2faf6e50945ceb79d43a2f41
Committed by
Scott Wood
1 parent
073adf987e
Exists in
v2017.01-smarct4x
and in
40 other branches
nand: yaffs: Remove the "nand write.yaffs" command
This command is only enabled by one board, complicates the NAND code, and doesn't appear to have been functioning properly for several years. If there are no bad blocks in the NAND region being written nand_write_skip_bad() will take the shortcut of calling nand_write() which bypasses the special yaffs handling. This causes invalid YAFFS data to be written. See http://lists.denx.de/pipermail/u-boot/2011-September/102830.html for an example and a potential workaround. U-Boot still retains the ability to mount and access YAFFS partitions via CONFIG_YAFFS2. Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Showing 5 changed files with 14 additions and 87 deletions Side-by-side Diff
common/cmd_nand.c
| ... | ... | @@ -705,16 +705,6 @@ |
| 705 | 705 | maxsize, (u_char *)addr, |
| 706 | 706 | WITH_DROP_FFS | WITH_WR_VERIFY); |
| 707 | 707 | #endif |
| 708 | -#ifdef CONFIG_CMD_NAND_YAFFS | |
| 709 | - } else if (!strcmp(s, ".yaffs")) { | |
| 710 | - if (read) { | |
| 711 | - printf("Unknown nand command suffix '%s'.\n", s); | |
| 712 | - return 1; | |
| 713 | - } | |
| 714 | - ret = nand_write_skip_bad(nand, off, &rwsize, NULL, | |
| 715 | - maxsize, (u_char *)addr, | |
| 716 | - WITH_YAFFS_OOB | WITH_WR_VERIFY); | |
| 717 | -#endif | |
| 718 | 708 | } else if (!strcmp(s, ".oob")) { |
| 719 | 709 | /* out-of-band data */ |
| 720 | 710 | mtd_oob_ops_t ops = { |
| ... | ... | @@ -856,11 +846,6 @@ |
| 856 | 846 | " write 'size' bytes starting at offset 'off' from memory address\n" |
| 857 | 847 | " 'addr', skipping bad blocks and dropping any pages at the end\n" |
| 858 | 848 | " of eraseblocks that contain only 0xFF\n" |
| 859 | -#endif | |
| 860 | -#ifdef CONFIG_CMD_NAND_YAFFS | |
| 861 | - "nand write.yaffs - addr off|partition size\n" | |
| 862 | - " write 'size' bytes starting at offset 'off' with yaffs format\n" | |
| 863 | - " from memory address 'addr', skipping bad blocks.\n" | |
| 864 | 849 | #endif |
| 865 | 850 | "nand erase[.spread] [clean] off size - erase 'size' bytes " |
| 866 | 851 | "from offset 'off'\n" |
drivers/mtd/nand/nand_util.c
| ... | ... | @@ -580,25 +580,8 @@ |
| 580 | 580 | if (actual) |
| 581 | 581 | *actual = 0; |
| 582 | 582 | |
| 583 | -#ifdef CONFIG_CMD_NAND_YAFFS | |
| 584 | - if (flags & WITH_YAFFS_OOB) { | |
| 585 | - if (flags & (~WITH_YAFFS_OOB & ~WITH_WR_VERIFY)) | |
| 586 | - return -EINVAL; | |
| 583 | + blocksize = nand->erasesize; | |
| 587 | 584 | |
| 588 | - int pages; | |
| 589 | - pages = nand->erasesize / nand->writesize; | |
| 590 | - blocksize = (pages * nand->oobsize) + nand->erasesize; | |
| 591 | - if (*length % (nand->writesize + nand->oobsize)) { | |
| 592 | - printf("Attempt to write incomplete page" | |
| 593 | - " in yaffs mode\n"); | |
| 594 | - return -EINVAL; | |
| 595 | - } | |
| 596 | - } else | |
| 597 | -#endif | |
| 598 | - { | |
| 599 | - blocksize = nand->erasesize; | |
| 600 | - } | |
| 601 | - | |
| 602 | 585 | /* |
| 603 | 586 | * nand_write() handles unaligned, partial page writes. |
| 604 | 587 | * |
| 605 | 588 | |
| 606 | 589 | |
| 607 | 590 | |
| 608 | 591 | |
| ... | ... | @@ -666,58 +649,22 @@ |
| 666 | 649 | else |
| 667 | 650 | write_size = blocksize - block_offset; |
| 668 | 651 | |
| 669 | -#ifdef CONFIG_CMD_NAND_YAFFS | |
| 670 | - if (flags & WITH_YAFFS_OOB) { | |
| 671 | - int page, pages; | |
| 672 | - size_t pagesize = nand->writesize; | |
| 673 | - size_t pagesize_oob = pagesize + nand->oobsize; | |
| 674 | - struct mtd_oob_ops ops; | |
| 675 | - | |
| 676 | - ops.len = pagesize; | |
| 677 | - ops.ooblen = nand->oobsize; | |
| 678 | - ops.mode = MTD_OPS_AUTO_OOB; | |
| 679 | - ops.ooboffs = 0; | |
| 680 | - | |
| 681 | - pages = write_size / pagesize_oob; | |
| 682 | - for (page = 0; page < pages; page++) { | |
| 683 | - WATCHDOG_RESET(); | |
| 684 | - | |
| 685 | - ops.datbuf = p_buffer; | |
| 686 | - ops.oobbuf = ops.datbuf + pagesize; | |
| 687 | - | |
| 688 | - rval = mtd_write_oob(nand, offset, &ops); | |
| 689 | - | |
| 690 | - if ((flags & WITH_WR_VERIFY) && !rval) | |
| 691 | - rval = nand_verify_page_oob(nand, | |
| 692 | - &ops, offset); | |
| 693 | - | |
| 694 | - if (rval != 0) | |
| 695 | - break; | |
| 696 | - | |
| 697 | - offset += pagesize; | |
| 698 | - p_buffer += pagesize_oob; | |
| 699 | - } | |
| 700 | - } | |
| 701 | - else | |
| 702 | -#endif | |
| 703 | - { | |
| 704 | - truncated_write_size = write_size; | |
| 652 | + truncated_write_size = write_size; | |
| 705 | 653 | #ifdef CONFIG_CMD_NAND_TRIMFFS |
| 706 | - if (flags & WITH_DROP_FFS) | |
| 707 | - truncated_write_size = drop_ffs(nand, p_buffer, | |
| 708 | - &write_size); | |
| 654 | + if (flags & WITH_DROP_FFS) | |
| 655 | + truncated_write_size = drop_ffs(nand, p_buffer, | |
| 656 | + &write_size); | |
| 709 | 657 | #endif |
| 710 | 658 | |
| 711 | - rval = nand_write(nand, offset, &truncated_write_size, | |
| 712 | - p_buffer); | |
| 659 | + rval = nand_write(nand, offset, &truncated_write_size, | |
| 660 | + p_buffer); | |
| 713 | 661 | |
| 714 | - if ((flags & WITH_WR_VERIFY) && !rval) | |
| 715 | - rval = nand_verify(nand, offset, | |
| 716 | - truncated_write_size, p_buffer); | |
| 662 | + if ((flags & WITH_WR_VERIFY) && !rval) | |
| 663 | + rval = nand_verify(nand, offset, | |
| 664 | + truncated_write_size, p_buffer); | |
| 717 | 665 | |
| 718 | - offset += write_size; | |
| 719 | - p_buffer += write_size; | |
| 720 | - } | |
| 666 | + offset += write_size; | |
| 667 | + p_buffer += write_size; | |
| 721 | 668 | |
| 722 | 669 | if (rval != 0) { |
| 723 | 670 | printf("NAND write to offset %llx failed %d\n", |
include/configs/M54418TWR.h
include/configs/VCMA9.h
include/nand.h
| ... | ... | @@ -104,11 +104,8 @@ |
| 104 | 104 | int nand_read_skip_bad(nand_info_t *nand, loff_t offset, size_t *length, |
| 105 | 105 | size_t *actual, loff_t lim, u_char *buffer); |
| 106 | 106 | |
| 107 | -#define WITH_YAFFS_OOB (1 << 0) /* whether write with yaffs format. This flag | |
| 108 | - * is a 'mode' meaning it cannot be mixed with | |
| 109 | - * other flags */ | |
| 110 | -#define WITH_DROP_FFS (1 << 1) /* drop trailing all-0xff pages */ | |
| 111 | -#define WITH_WR_VERIFY (1 << 2) /* verify data was written correctly */ | |
| 107 | +#define WITH_DROP_FFS (1 << 0) /* drop trailing all-0xff pages */ | |
| 108 | +#define WITH_WR_VERIFY (1 << 1) /* verify data was written correctly */ | |
| 112 | 109 | |
| 113 | 110 | int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length, |
| 114 | 111 | size_t *actual, loff_t lim, u_char *buffer, int flags); |