diff options
-rw-r--r-- | Documentation/DocBook/mtdnand.tmpl | 11 | ||||
-rw-r--r-- | drivers/mtd/devices/doc2000.c | 179 | ||||
-rw-r--r-- | drivers/mtd/devices/doc2001.c | 179 | ||||
-rw-r--r-- | drivers/mtd/devices/doc2001plus.c | 164 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 16 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_ecc.c | 3 | ||||
-rw-r--r-- | drivers/mtd/nand/sharpsl.c | 7 | ||||
-rw-r--r-- | fs/jffs2/acl.c | 4 | ||||
-rw-r--r-- | fs/jffs2/acl.h | 4 | ||||
-rw-r--r-- | fs/jffs2/malloc.c | 2 | ||||
-rw-r--r-- | fs/jffs2/nodelist.h | 2 | ||||
-rw-r--r-- | fs/jffs2/readinode.c | 1 | ||||
-rw-r--r-- | fs/jffs2/scan.c | 4 | ||||
-rw-r--r-- | fs/jffs2/xattr.c | 45 | ||||
-rw-r--r-- | include/linux/mtd/bbm.h | 35 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 4 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 16 | ||||
-rw-r--r-- | include/linux/mtd/onenand.h | 77 | ||||
-rw-r--r-- | include/mtd/mtd-abi.h | 2 |
19 files changed, 327 insertions, 428 deletions
diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl index 999afe1ca8c..a8c8cce5063 100644 --- a/Documentation/DocBook/mtdnand.tmpl +++ b/Documentation/DocBook/mtdnand.tmpl | |||
@@ -109,7 +109,7 @@ | |||
109 | for most of the implementations. These functions can be replaced by the | 109 | for most of the implementations. These functions can be replaced by the |
110 | board driver if neccecary. Those functions are called via pointers in the | 110 | board driver if neccecary. Those functions are called via pointers in the |
111 | NAND chip description structure. The board driver can set the functions which | 111 | NAND chip description structure. The board driver can set the functions which |
112 | should be replaced by board dependend functions before calling nand_scan(). | 112 | should be replaced by board dependent functions before calling nand_scan(). |
113 | If the function pointer is NULL on entry to nand_scan() then the pointer | 113 | If the function pointer is NULL on entry to nand_scan() then the pointer |
114 | is set to the default function which is suitable for the detected chip type. | 114 | is set to the default function which is suitable for the detected chip type. |
115 | </para></listitem> | 115 | </para></listitem> |
@@ -133,7 +133,7 @@ | |||
133 | [REPLACEABLE]</para><para> | 133 | [REPLACEABLE]</para><para> |
134 | Replaceable members hold hardware related functions which can be | 134 | Replaceable members hold hardware related functions which can be |
135 | provided by the board driver. The board driver can set the functions which | 135 | provided by the board driver. The board driver can set the functions which |
136 | should be replaced by board dependend functions before calling nand_scan(). | 136 | should be replaced by board dependent functions before calling nand_scan(). |
137 | If the function pointer is NULL on entry to nand_scan() then the pointer | 137 | If the function pointer is NULL on entry to nand_scan() then the pointer |
138 | is set to the default function which is suitable for the detected chip type. | 138 | is set to the default function which is suitable for the detected chip type. |
139 | </para></listitem> | 139 | </para></listitem> |
@@ -156,9 +156,8 @@ | |||
156 | <title>Basic board driver</title> | 156 | <title>Basic board driver</title> |
157 | <para> | 157 | <para> |
158 | For most boards it will be sufficient to provide just the | 158 | For most boards it will be sufficient to provide just the |
159 | basic functions and fill out some really board dependend | 159 | basic functions and fill out some really board dependent |
160 | members in the nand chip description structure. | 160 | members in the nand chip description structure. |
161 | See drivers/mtd/nand/skeleton for reference. | ||
162 | </para> | 161 | </para> |
163 | <sect1> | 162 | <sect1> |
164 | <title>Basic defines</title> | 163 | <title>Basic defines</title> |
@@ -1295,7 +1294,9 @@ in this page</entry> | |||
1295 | </para> | 1294 | </para> |
1296 | !Idrivers/mtd/nand/nand_base.c | 1295 | !Idrivers/mtd/nand/nand_base.c |
1297 | !Idrivers/mtd/nand/nand_bbt.c | 1296 | !Idrivers/mtd/nand/nand_bbt.c |
1298 | !Idrivers/mtd/nand/nand_ecc.c | 1297 | <!-- No internal functions for kernel-doc: |
1298 | X!Idrivers/mtd/nand/nand_ecc.c | ||
1299 | --> | ||
1299 | </chapter> | 1300 | </chapter> |
1300 | 1301 | ||
1301 | <chapter id="credits"> | 1302 | <chapter id="credits"> |
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c index c54e40464d8..603a7951ac9 100644 --- a/drivers/mtd/devices/doc2000.c +++ b/drivers/mtd/devices/doc2000.c | |||
@@ -55,10 +55,6 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
55 | size_t *retlen, u_char *buf); | 55 | size_t *retlen, u_char *buf); |
56 | static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, | 56 | static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, |
57 | size_t *retlen, const u_char *buf); | 57 | size_t *retlen, const u_char *buf); |
58 | static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | ||
59 | size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); | ||
60 | static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | ||
61 | size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); | ||
62 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, | 58 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, |
63 | struct mtd_oob_ops *ops); | 59 | struct mtd_oob_ops *ops); |
64 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, | 60 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, |
@@ -615,17 +611,10 @@ EXPORT_SYMBOL_GPL(DoC2k_init); | |||
615 | static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, | 611 | static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, |
616 | size_t * retlen, u_char * buf) | 612 | size_t * retlen, u_char * buf) |
617 | { | 613 | { |
618 | /* Just a special case of doc_read_ecc */ | ||
619 | return doc_read_ecc(mtd, from, len, retlen, buf, NULL, NULL); | ||
620 | } | ||
621 | |||
622 | static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | ||
623 | size_t * retlen, u_char * buf, u_char * eccbuf, struct nand_oobinfo *oobsel) | ||
624 | { | ||
625 | struct DiskOnChip *this = mtd->priv; | 614 | struct DiskOnChip *this = mtd->priv; |
626 | void __iomem *docptr = this->virtadr; | 615 | void __iomem *docptr = this->virtadr; |
627 | struct Nand *mychip; | 616 | struct Nand *mychip; |
628 | unsigned char syndrome[6]; | 617 | unsigned char syndrome[6], eccbuf[6]; |
629 | volatile char dummy; | 618 | volatile char dummy; |
630 | int i, len256 = 0, ret=0; | 619 | int i, len256 = 0, ret=0; |
631 | size_t left = len; | 620 | size_t left = len; |
@@ -673,15 +662,9 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
673 | DoC_Address(this, ADDR_COLUMN_PAGE, from, CDSN_CTRL_WP, | 662 | DoC_Address(this, ADDR_COLUMN_PAGE, from, CDSN_CTRL_WP, |
674 | CDSN_CTRL_ECC_IO); | 663 | CDSN_CTRL_ECC_IO); |
675 | 664 | ||
676 | if (eccbuf) { | 665 | /* Prime the ECC engine */ |
677 | /* Prime the ECC engine */ | 666 | WriteDOC(DOC_ECC_RESET, docptr, ECCConf); |
678 | WriteDOC(DOC_ECC_RESET, docptr, ECCConf); | 667 | WriteDOC(DOC_ECC_EN, docptr, ECCConf); |
679 | WriteDOC(DOC_ECC_EN, docptr, ECCConf); | ||
680 | } else { | ||
681 | /* disable the ECC engine */ | ||
682 | WriteDOC(DOC_ECC_RESET, docptr, ECCConf); | ||
683 | WriteDOC(DOC_ECC_DIS, docptr, ECCConf); | ||
684 | } | ||
685 | 668 | ||
686 | /* treat crossing 256-byte sector for 2M x 8bits devices */ | 669 | /* treat crossing 256-byte sector for 2M x 8bits devices */ |
687 | if (this->page256 && from + len > (from | 0xff) + 1) { | 670 | if (this->page256 && from + len > (from | 0xff) + 1) { |
@@ -698,58 +681,59 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
698 | /* Let the caller know we completed it */ | 681 | /* Let the caller know we completed it */ |
699 | *retlen += len; | 682 | *retlen += len; |
700 | 683 | ||
701 | if (eccbuf) { | 684 | /* Read the ECC data through the DiskOnChip ECC logic */ |
702 | /* Read the ECC data through the DiskOnChip ECC logic */ | 685 | /* Note: this will work even with 2M x 8bit devices as */ |
703 | /* Note: this will work even with 2M x 8bit devices as */ | 686 | /* they have 8 bytes of OOB per 256 page. mf. */ |
704 | /* they have 8 bytes of OOB per 256 page. mf. */ | 687 | DoC_ReadBuf(this, eccbuf, 6); |
705 | DoC_ReadBuf(this, eccbuf, 6); | ||
706 | |||
707 | /* Flush the pipeline */ | ||
708 | if (DoC_is_Millennium(this)) { | ||
709 | dummy = ReadDOC(docptr, ECCConf); | ||
710 | dummy = ReadDOC(docptr, ECCConf); | ||
711 | i = ReadDOC(docptr, ECCConf); | ||
712 | } else { | ||
713 | dummy = ReadDOC(docptr, 2k_ECCStatus); | ||
714 | dummy = ReadDOC(docptr, 2k_ECCStatus); | ||
715 | i = ReadDOC(docptr, 2k_ECCStatus); | ||
716 | } | ||
717 | 688 | ||
718 | /* Check the ECC Status */ | 689 | /* Flush the pipeline */ |
719 | if (i & 0x80) { | 690 | if (DoC_is_Millennium(this)) { |
720 | int nb_errors; | 691 | dummy = ReadDOC(docptr, ECCConf); |
721 | /* There was an ECC error */ | 692 | dummy = ReadDOC(docptr, ECCConf); |
693 | i = ReadDOC(docptr, ECCConf); | ||
694 | } else { | ||
695 | dummy = ReadDOC(docptr, 2k_ECCStatus); | ||
696 | dummy = ReadDOC(docptr, 2k_ECCStatus); | ||
697 | i = ReadDOC(docptr, 2k_ECCStatus); | ||
698 | } | ||
699 | |||
700 | /* Check the ECC Status */ | ||
701 | if (i & 0x80) { | ||
702 | int nb_errors; | ||
703 | /* There was an ECC error */ | ||
722 | #ifdef ECC_DEBUG | 704 | #ifdef ECC_DEBUG |
723 | printk(KERN_ERR "DiskOnChip ECC Error: Read at %lx\n", (long)from); | 705 | printk(KERN_ERR "DiskOnChip ECC Error: Read at %lx\n", (long)from); |
724 | #endif | 706 | #endif |
725 | /* Read the ECC syndrom through the DiskOnChip ECC logic. | 707 | /* Read the ECC syndrom through the DiskOnChip ECC |
726 | These syndrome will be all ZERO when there is no error */ | 708 | logic. These syndrome will be all ZERO when there |
727 | for (i = 0; i < 6; i++) { | 709 | is no error */ |
728 | syndrome[i] = | 710 | for (i = 0; i < 6; i++) { |
729 | ReadDOC(docptr, ECCSyndrome0 + i); | 711 | syndrome[i] = |
730 | } | 712 | ReadDOC(docptr, ECCSyndrome0 + i); |
731 | nb_errors = doc_decode_ecc(buf, syndrome); | 713 | } |
714 | nb_errors = doc_decode_ecc(buf, syndrome); | ||
732 | 715 | ||
733 | #ifdef ECC_DEBUG | 716 | #ifdef ECC_DEBUG |
734 | printk(KERN_ERR "Errors corrected: %x\n", nb_errors); | 717 | printk(KERN_ERR "Errors corrected: %x\n", nb_errors); |
735 | #endif | 718 | #endif |
736 | if (nb_errors < 0) { | 719 | if (nb_errors < 0) { |
737 | /* We return error, but have actually done the read. Not that | 720 | /* We return error, but have actually done the |
738 | this can be told to user-space, via sys_read(), but at least | 721 | read. Not that this can be told to |
739 | MTD-aware stuff can know about it by checking *retlen */ | 722 | user-space, via sys_read(), but at least |
740 | ret = -EIO; | 723 | MTD-aware stuff can know about it by |
741 | } | 724 | checking *retlen */ |
725 | ret = -EIO; | ||
742 | } | 726 | } |
727 | } | ||
743 | 728 | ||
744 | #ifdef PSYCHO_DEBUG | 729 | #ifdef PSYCHO_DEBUG |
745 | printk(KERN_DEBUG "ECC DATA at %lxB: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", | 730 | printk(KERN_DEBUG "ECC DATA at %lxB: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", |
746 | (long)from, eccbuf[0], eccbuf[1], eccbuf[2], | 731 | (long)from, eccbuf[0], eccbuf[1], eccbuf[2], |
747 | eccbuf[3], eccbuf[4], eccbuf[5]); | 732 | eccbuf[3], eccbuf[4], eccbuf[5]); |
748 | #endif | 733 | #endif |
749 | 734 | ||
750 | /* disable the ECC engine */ | 735 | /* disable the ECC engine */ |
751 | WriteDOC(DOC_ECC_DIS, docptr , ECCConf); | 736 | WriteDOC(DOC_ECC_DIS, docptr , ECCConf); |
752 | } | ||
753 | 737 | ||
754 | /* according to 11.4.1, we need to wait for the busy line | 738 | /* according to 11.4.1, we need to wait for the busy line |
755 | * drop if we read to the end of the page. */ | 739 | * drop if we read to the end of the page. */ |
@@ -771,17 +755,10 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
771 | static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, | 755 | static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, |
772 | size_t * retlen, const u_char * buf) | 756 | size_t * retlen, const u_char * buf) |
773 | { | 757 | { |
774 | char eccbuf[6]; | ||
775 | return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, NULL); | ||
776 | } | ||
777 | |||
778 | static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | ||
779 | size_t * retlen, const u_char * buf, | ||
780 | u_char * eccbuf, struct nand_oobinfo *oobsel) | ||
781 | { | ||
782 | struct DiskOnChip *this = mtd->priv; | 758 | struct DiskOnChip *this = mtd->priv; |
783 | int di; /* Yes, DI is a hangover from when I was disassembling the binary driver */ | 759 | int di; /* Yes, DI is a hangover from when I was disassembling the binary driver */ |
784 | void __iomem *docptr = this->virtadr; | 760 | void __iomem *docptr = this->virtadr; |
761 | unsigned char eccbuf[6]; | ||
785 | volatile char dummy; | 762 | volatile char dummy; |
786 | int len256 = 0; | 763 | int len256 = 0; |
787 | struct Nand *mychip; | 764 | struct Nand *mychip; |
@@ -835,15 +812,9 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
835 | DoC_Command(this, NAND_CMD_SEQIN, 0); | 812 | DoC_Command(this, NAND_CMD_SEQIN, 0); |
836 | DoC_Address(this, ADDR_COLUMN_PAGE, to, 0, CDSN_CTRL_ECC_IO); | 813 | DoC_Address(this, ADDR_COLUMN_PAGE, to, 0, CDSN_CTRL_ECC_IO); |
837 | 814 | ||
838 | if (eccbuf) { | 815 | /* Prime the ECC engine */ |
839 | /* Prime the ECC engine */ | 816 | WriteDOC(DOC_ECC_RESET, docptr, ECCConf); |
840 | WriteDOC(DOC_ECC_RESET, docptr, ECCConf); | 817 | WriteDOC(DOC_ECC_EN | DOC_ECC_RW, docptr, ECCConf); |
841 | WriteDOC(DOC_ECC_EN | DOC_ECC_RW, docptr, ECCConf); | ||
842 | } else { | ||
843 | /* disable the ECC engine */ | ||
844 | WriteDOC(DOC_ECC_RESET, docptr, ECCConf); | ||
845 | WriteDOC(DOC_ECC_DIS, docptr, ECCConf); | ||
846 | } | ||
847 | 818 | ||
848 | /* treat crossing 256-byte sector for 2M x 8bits devices */ | 819 | /* treat crossing 256-byte sector for 2M x 8bits devices */ |
849 | if (this->page256 && to + len > (to | 0xff) + 1) { | 820 | if (this->page256 && to + len > (to | 0xff) + 1) { |
@@ -873,39 +844,35 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
873 | 844 | ||
874 | DoC_WriteBuf(this, &buf[len256], len - len256); | 845 | DoC_WriteBuf(this, &buf[len256], len - len256); |
875 | 846 | ||
876 | if (eccbuf) { | 847 | WriteDOC(CDSN_CTRL_ECC_IO | CDSN_CTRL_CE, docptr, CDSNControl); |
877 | WriteDOC(CDSN_CTRL_ECC_IO | CDSN_CTRL_CE, docptr, | ||
878 | CDSNControl); | ||
879 | |||
880 | if (DoC_is_Millennium(this)) { | ||
881 | WriteDOC(0, docptr, NOP); | ||
882 | WriteDOC(0, docptr, NOP); | ||
883 | WriteDOC(0, docptr, NOP); | ||
884 | } else { | ||
885 | WriteDOC_(0, docptr, this->ioreg); | ||
886 | WriteDOC_(0, docptr, this->ioreg); | ||
887 | WriteDOC_(0, docptr, this->ioreg); | ||
888 | } | ||
889 | 848 | ||
890 | WriteDOC(CDSN_CTRL_ECC_IO | CDSN_CTRL_FLASH_IO | CDSN_CTRL_CE, docptr, | 849 | if (DoC_is_Millennium(this)) { |
891 | CDSNControl); | 850 | WriteDOC(0, docptr, NOP); |
851 | WriteDOC(0, docptr, NOP); | ||
852 | WriteDOC(0, docptr, NOP); | ||
853 | } else { | ||
854 | WriteDOC_(0, docptr, this->ioreg); | ||
855 | WriteDOC_(0, docptr, this->ioreg); | ||
856 | WriteDOC_(0, docptr, this->ioreg); | ||
857 | } | ||
892 | 858 | ||
893 | /* Read the ECC data through the DiskOnChip ECC logic */ | 859 | WriteDOC(CDSN_CTRL_ECC_IO | CDSN_CTRL_FLASH_IO | CDSN_CTRL_CE, docptr, |
894 | for (di = 0; di < 6; di++) { | 860 | CDSNControl); |
895 | eccbuf[di] = ReadDOC(docptr, ECCSyndrome0 + di); | ||
896 | } | ||
897 | 861 | ||
898 | /* Reset the ECC engine */ | 862 | /* Read the ECC data through the DiskOnChip ECC logic */ |
899 | WriteDOC(DOC_ECC_DIS, docptr, ECCConf); | 863 | for (di = 0; di < 6; di++) { |
864 | eccbuf[di] = ReadDOC(docptr, ECCSyndrome0 + di); | ||
865 | } | ||
866 | |||
867 | /* Reset the ECC engine */ | ||
868 | WriteDOC(DOC_ECC_DIS, docptr, ECCConf); | ||
900 | 869 | ||
901 | #ifdef PSYCHO_DEBUG | 870 | #ifdef PSYCHO_DEBUG |
902 | printk | 871 | printk |
903 | ("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", | 872 | ("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", |
904 | (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], | 873 | (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], |
905 | eccbuf[4], eccbuf[5]); | 874 | eccbuf[4], eccbuf[5]); |
906 | #endif | 875 | #endif |
907 | } | ||
908 | |||
909 | DoC_Command(this, NAND_CMD_PAGEPROG, 0); | 876 | DoC_Command(this, NAND_CMD_PAGEPROG, 0); |
910 | 877 | ||
911 | DoC_Command(this, NAND_CMD_STATUS, CDSN_CTRL_WP); | 878 | DoC_Command(this, NAND_CMD_STATUS, CDSN_CTRL_WP); |
diff --git a/drivers/mtd/devices/doc2001.c b/drivers/mtd/devices/doc2001.c index 0cf022a69e6..0e2a9326f71 100644 --- a/drivers/mtd/devices/doc2001.c +++ b/drivers/mtd/devices/doc2001.c | |||
@@ -37,12 +37,6 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
37 | size_t *retlen, u_char *buf); | 37 | size_t *retlen, u_char *buf); |
38 | static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, | 38 | static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, |
39 | size_t *retlen, const u_char *buf); | 39 | size_t *retlen, const u_char *buf); |
40 | static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | ||
41 | size_t *retlen, u_char *buf, u_char *eccbuf, | ||
42 | struct nand_oobinfo *oobsel); | ||
43 | static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | ||
44 | size_t *retlen, const u_char *buf, u_char *eccbuf, | ||
45 | struct nand_oobinfo *oobsel); | ||
46 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, | 40 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, |
47 | struct mtd_oob_ops *ops); | 41 | struct mtd_oob_ops *ops); |
48 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, | 42 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, |
@@ -397,17 +391,9 @@ EXPORT_SYMBOL_GPL(DoCMil_init); | |||
397 | static int doc_read (struct mtd_info *mtd, loff_t from, size_t len, | 391 | static int doc_read (struct mtd_info *mtd, loff_t from, size_t len, |
398 | size_t *retlen, u_char *buf) | 392 | size_t *retlen, u_char *buf) |
399 | { | 393 | { |
400 | /* Just a special case of doc_read_ecc */ | ||
401 | return doc_read_ecc(mtd, from, len, retlen, buf, NULL, NULL); | ||
402 | } | ||
403 | |||
404 | static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, | ||
405 | size_t *retlen, u_char *buf, u_char *eccbuf, | ||
406 | struct nand_oobinfo *oobsel) | ||
407 | { | ||
408 | int i, ret; | 394 | int i, ret; |
409 | volatile char dummy; | 395 | volatile char dummy; |
410 | unsigned char syndrome[6]; | 396 | unsigned char syndrome[6], eccbuf[6]; |
411 | struct DiskOnChip *this = mtd->priv; | 397 | struct DiskOnChip *this = mtd->priv; |
412 | void __iomem *docptr = this->virtadr; | 398 | void __iomem *docptr = this->virtadr; |
413 | struct Nand *mychip = &this->chips[from >> (this->chipshift)]; | 399 | struct Nand *mychip = &this->chips[from >> (this->chipshift)]; |
@@ -437,15 +423,9 @@ static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, | |||
437 | DoC_Address(docptr, 3, from, CDSN_CTRL_WP, 0x00); | 423 | DoC_Address(docptr, 3, from, CDSN_CTRL_WP, 0x00); |
438 | DoC_WaitReady(docptr); | 424 | DoC_WaitReady(docptr); |
439 | 425 | ||
440 | if (eccbuf) { | 426 | /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ |
441 | /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ | 427 | WriteDOC (DOC_ECC_RESET, docptr, ECCConf); |
442 | WriteDOC (DOC_ECC_RESET, docptr, ECCConf); | 428 | WriteDOC (DOC_ECC_EN, docptr, ECCConf); |
443 | WriteDOC (DOC_ECC_EN, docptr, ECCConf); | ||
444 | } else { | ||
445 | /* disable the ECC engine */ | ||
446 | WriteDOC (DOC_ECC_RESET, docptr, ECCConf); | ||
447 | WriteDOC (DOC_ECC_DIS, docptr, ECCConf); | ||
448 | } | ||
449 | 429 | ||
450 | /* Read the data via the internal pipeline through CDSN IO register, | 430 | /* Read the data via the internal pipeline through CDSN IO register, |
451 | see Pipelined Read Operations 11.3 */ | 431 | see Pipelined Read Operations 11.3 */ |
@@ -465,58 +445,56 @@ static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, | |||
465 | *retlen = len; | 445 | *retlen = len; |
466 | ret = 0; | 446 | ret = 0; |
467 | 447 | ||
468 | if (eccbuf) { | 448 | /* Read the ECC data from Spare Data Area, |
469 | /* Read the ECC data from Spare Data Area, | 449 | see Reed-Solomon EDC/ECC 11.1 */ |
470 | see Reed-Solomon EDC/ECC 11.1 */ | 450 | dummy = ReadDOC(docptr, ReadPipeInit); |
471 | dummy = ReadDOC(docptr, ReadPipeInit); | ||
472 | #ifndef USE_MEMCPY | 451 | #ifndef USE_MEMCPY |
473 | for (i = 0; i < 5; i++) { | 452 | for (i = 0; i < 5; i++) { |
474 | /* N.B. you have to increase the source address in this way or the | 453 | /* N.B. you have to increase the source address in this way or the |
475 | ECC logic will not work properly */ | 454 | ECC logic will not work properly */ |
476 | eccbuf[i] = ReadDOC(docptr, Mil_CDSN_IO + i); | 455 | eccbuf[i] = ReadDOC(docptr, Mil_CDSN_IO + i); |
477 | } | 456 | } |
478 | #else | 457 | #else |
479 | memcpy_fromio(eccbuf, docptr + DoC_Mil_CDSN_IO, 5); | 458 | memcpy_fromio(eccbuf, docptr + DoC_Mil_CDSN_IO, 5); |
480 | #endif | 459 | #endif |
481 | eccbuf[5] = ReadDOC(docptr, LastDataRead); | 460 | eccbuf[5] = ReadDOC(docptr, LastDataRead); |
482 | 461 | ||
483 | /* Flush the pipeline */ | 462 | /* Flush the pipeline */ |
484 | dummy = ReadDOC(docptr, ECCConf); | 463 | dummy = ReadDOC(docptr, ECCConf); |
485 | dummy = ReadDOC(docptr, ECCConf); | 464 | dummy = ReadDOC(docptr, ECCConf); |
486 | 465 | ||
487 | /* Check the ECC Status */ | 466 | /* Check the ECC Status */ |
488 | if (ReadDOC(docptr, ECCConf) & 0x80) { | 467 | if (ReadDOC(docptr, ECCConf) & 0x80) { |
489 | int nb_errors; | 468 | int nb_errors; |
490 | /* There was an ECC error */ | 469 | /* There was an ECC error */ |
491 | #ifdef ECC_DEBUG | 470 | #ifdef ECC_DEBUG |
492 | printk("DiskOnChip ECC Error: Read at %lx\n", (long)from); | 471 | printk("DiskOnChip ECC Error: Read at %lx\n", (long)from); |
493 | #endif | 472 | #endif |
494 | /* Read the ECC syndrom through the DiskOnChip ECC logic. | 473 | /* Read the ECC syndrom through the DiskOnChip ECC logic. |
495 | These syndrome will be all ZERO when there is no error */ | 474 | These syndrome will be all ZERO when there is no error */ |
496 | for (i = 0; i < 6; i++) { | 475 | for (i = 0; i < 6; i++) { |
497 | syndrome[i] = ReadDOC(docptr, ECCSyndrome0 + i); | 476 | syndrome[i] = ReadDOC(docptr, ECCSyndrome0 + i); |
498 | } | 477 | } |
499 | nb_errors = doc_decode_ecc(buf, syndrome); | 478 | nb_errors = doc_decode_ecc(buf, syndrome); |
500 | #ifdef ECC_DEBUG | 479 | #ifdef ECC_DEBUG |
501 | printk("ECC Errors corrected: %x\n", nb_errors); | 480 | printk("ECC Errors corrected: %x\n", nb_errors); |
502 | #endif | 481 | #endif |
503 | if (nb_errors < 0) { | 482 | if (nb_errors < 0) { |
504 | /* We return error, but have actually done the read. Not that | 483 | /* We return error, but have actually done the read. Not that |
505 | this can be told to user-space, via sys_read(), but at least | 484 | this can be told to user-space, via sys_read(), but at least |
506 | MTD-aware stuff can know about it by checking *retlen */ | 485 | MTD-aware stuff can know about it by checking *retlen */ |
507 | ret = -EIO; | 486 | ret = -EIO; |
508 | } | ||
509 | } | 487 | } |
488 | } | ||
510 | 489 | ||
511 | #ifdef PSYCHO_DEBUG | 490 | #ifdef PSYCHO_DEBUG |
512 | printk("ECC DATA at %lx: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", | 491 | printk("ECC DATA at %lx: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", |
513 | (long)from, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], | 492 | (long)from, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], |
514 | eccbuf[4], eccbuf[5]); | 493 | eccbuf[4], eccbuf[5]); |
515 | #endif | 494 | #endif |
516 | 495 | ||
517 | /* disable the ECC engine */ | 496 | /* disable the ECC engine */ |
518 | WriteDOC(DOC_ECC_DIS, docptr , ECCConf); | 497 | WriteDOC(DOC_ECC_DIS, docptr , ECCConf); |
519 | } | ||
520 | 498 | ||
521 | return ret; | 499 | return ret; |
522 | } | 500 | } |
@@ -524,15 +502,8 @@ static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, | |||
524 | static int doc_write (struct mtd_info *mtd, loff_t to, size_t len, | 502 | static int doc_write (struct mtd_info *mtd, loff_t to, size_t len, |
525 | size_t *retlen, const u_char *buf) | 503 | size_t *retlen, const u_char *buf) |
526 | { | 504 | { |
527 | char eccbuf[6]; | ||
528 | return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, NULL); | ||
529 | } | ||
530 | |||
531 | static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, | ||
532 | size_t *retlen, const u_char *buf, u_char *eccbuf, | ||
533 | struct nand_oobinfo *oobsel) | ||
534 | { | ||
535 | int i,ret = 0; | 505 | int i,ret = 0; |
506 | char eccbuf[6]; | ||
536 | volatile char dummy; | 507 | volatile char dummy; |
537 | struct DiskOnChip *this = mtd->priv; | 508 | struct DiskOnChip *this = mtd->priv; |
538 | void __iomem *docptr = this->virtadr; | 509 | void __iomem *docptr = this->virtadr; |
@@ -573,15 +544,9 @@ static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, | |||
573 | DoC_Address(docptr, 3, to, 0x00, 0x00); | 544 | DoC_Address(docptr, 3, to, 0x00, 0x00); |
574 | DoC_WaitReady(docptr); | 545 | DoC_WaitReady(docptr); |
575 | 546 | ||
576 | if (eccbuf) { | 547 | /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ |
577 | /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ | 548 | WriteDOC (DOC_ECC_RESET, docptr, ECCConf); |
578 | WriteDOC (DOC_ECC_RESET, docptr, ECCConf); | 549 | WriteDOC (DOC_ECC_EN | DOC_ECC_RW, docptr, ECCConf); |
579 | WriteDOC (DOC_ECC_EN | DOC_ECC_RW, docptr, ECCConf); | ||
580 | } else { | ||
581 | /* disable the ECC engine */ | ||
582 | WriteDOC (DOC_ECC_RESET, docptr, ECCConf); | ||
583 | WriteDOC (DOC_ECC_DIS, docptr, ECCConf); | ||
584 | } | ||
585 | 550 | ||
586 | /* Write the data via the internal pipeline through CDSN IO register, | 551 | /* Write the data via the internal pipeline through CDSN IO register, |
587 | see Pipelined Write Operations 11.2 */ | 552 | see Pipelined Write Operations 11.2 */ |
@@ -596,46 +561,44 @@ static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, | |||
596 | #endif | 561 | #endif |
597 | WriteDOC(0x00, docptr, WritePipeTerm); | 562 | WriteDOC(0x00, docptr, WritePipeTerm); |
598 | 563 | ||
599 | if (eccbuf) { | 564 | /* Write ECC data to flash, the ECC info is generated by the DiskOnChip ECC logic |
600 | /* Write ECC data to flash, the ECC info is generated by the DiskOnChip ECC logic | 565 | see Reed-Solomon EDC/ECC 11.1 */ |
601 | see Reed-Solomon EDC/ECC 11.1 */ | 566 | WriteDOC(0, docptr, NOP); |
602 | WriteDOC(0, docptr, NOP); | 567 | WriteDOC(0, docptr, NOP); |
603 | WriteDOC(0, docptr, NOP); | 568 | WriteDOC(0, docptr, NOP); |
604 | WriteDOC(0, docptr, NOP); | ||
605 | 569 | ||
606 | /* Read the ECC data through the DiskOnChip ECC logic */ | 570 | /* Read the ECC data through the DiskOnChip ECC logic */ |
607 | for (i = 0; i < 6; i++) { | 571 | for (i = 0; i < 6; i++) { |
608 | eccbuf[i] = ReadDOC(docptr, ECCSyndrome0 + i); | 572 | eccbuf[i] = ReadDOC(docptr, ECCSyndrome0 + i); |
609 | } | 573 | } |
610 | 574 | ||
611 | /* ignore the ECC engine */ | 575 | /* ignore the ECC engine */ |
612 | WriteDOC(DOC_ECC_DIS, docptr , ECCConf); | 576 | WriteDOC(DOC_ECC_DIS, docptr , ECCConf); |
613 | 577 | ||
614 | #ifndef USE_MEMCPY | 578 | #ifndef USE_MEMCPY |
615 | /* Write the ECC data to flash */ | 579 | /* Write the ECC data to flash */ |
616 | for (i = 0; i < 6; i++) { | 580 | for (i = 0; i < 6; i++) { |
617 | /* N.B. you have to increase the source address in this way or the | 581 | /* N.B. you have to increase the source address in this way or the |
618 | ECC logic will not work properly */ | 582 | ECC logic will not work properly */ |
619 | WriteDOC(eccbuf[i], docptr, Mil_CDSN_IO + i); | 583 | WriteDOC(eccbuf[i], docptr, Mil_CDSN_IO + i); |
620 | } | 584 | } |
621 | #else | 585 | #else |
622 | memcpy_toio(docptr + DoC_Mil_CDSN_IO, eccbuf, 6); | 586 | memcpy_toio(docptr + DoC_Mil_CDSN_IO, eccbuf, 6); |
623 | #endif | 587 | #endif |
624 | 588 | ||
625 | /* write the block status BLOCK_USED (0x5555) at the end of ECC data | 589 | /* write the block status BLOCK_USED (0x5555) at the end of ECC data |
626 | FIXME: this is only a hack for programming the IPL area for LinuxBIOS | 590 | FIXME: this is only a hack for programming the IPL area for LinuxBIOS |
627 | and should be replace with proper codes in user space utilities */ | 591 | and should be replace with proper codes in user space utilities */ |
628 | WriteDOC(0x55, docptr, Mil_CDSN_IO); | 592 | WriteDOC(0x55, docptr, Mil_CDSN_IO); |
629 | WriteDOC(0x55, docptr, Mil_CDSN_IO + 1); | 593 | WriteDOC(0x55, docptr, Mil_CDSN_IO + 1); |
630 | 594 | ||
631 | WriteDOC(0x00, docptr, WritePipeTerm); | 595 | WriteDOC(0x00, docptr, WritePipeTerm); |
632 | 596 | ||
633 | #ifdef PSYCHO_DEBUG | 597 | #ifdef PSYCHO_DEBUG |
634 | printk("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", | 598 | printk("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", |
635 | (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], | 599 | (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], |
636 | eccbuf[4], eccbuf[5]); | 600 | eccbuf[4], eccbuf[5]); |
637 | #endif | 601 | #endif |
638 | } | ||
639 | 602 | ||
640 | /* Commit the Page Program command and wait for ready | 603 | /* Commit the Page Program command and wait for ready |
641 | see Software Requirement 11.4 item 1.*/ | 604 | see Software Requirement 11.4 item 1.*/ |
diff --git a/drivers/mtd/devices/doc2001plus.c b/drivers/mtd/devices/doc2001plus.c index 66cb1e50469..92dbb47f2ac 100644 --- a/drivers/mtd/devices/doc2001plus.c +++ b/drivers/mtd/devices/doc2001plus.c | |||
@@ -41,12 +41,6 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
41 | size_t *retlen, u_char *buf); | 41 | size_t *retlen, u_char *buf); |
42 | static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, | 42 | static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, |
43 | size_t *retlen, const u_char *buf); | 43 | size_t *retlen, const u_char *buf); |
44 | static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | ||
45 | size_t *retlen, u_char *buf, u_char *eccbuf, | ||
46 | struct nand_oobinfo *oobsel); | ||
47 | static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | ||
48 | size_t *retlen, const u_char *buf, u_char *eccbuf, | ||
49 | struct nand_oobinfo *oobsel); | ||
50 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, | 44 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, |
51 | struct mtd_oob_ops *ops); | 45 | struct mtd_oob_ops *ops); |
52 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, | 46 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, |
@@ -595,18 +589,10 @@ static int doc_dumpblk(struct mtd_info *mtd, loff_t from) | |||
595 | static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, | 589 | static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, |
596 | size_t *retlen, u_char *buf) | 590 | size_t *retlen, u_char *buf) |
597 | { | 591 | { |
598 | /* Just a special case of doc_read_ecc */ | ||
599 | return doc_read_ecc(mtd, from, len, retlen, buf, NULL, NULL); | ||
600 | } | ||
601 | |||
602 | static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | ||
603 | size_t *retlen, u_char *buf, u_char *eccbuf, | ||
604 | struct nand_oobinfo *oobsel) | ||
605 | { | ||
606 | int ret, i; | 592 | int ret, i; |
607 | volatile char dummy; | 593 | volatile char dummy; |
608 | loff_t fofs; | 594 | loff_t fofs; |
609 | unsigned char syndrome[6]; | 595 | unsigned char syndrome[6], eccbuf[6]; |
610 | struct DiskOnChip *this = mtd->priv; | 596 | struct DiskOnChip *this = mtd->priv; |
611 | void __iomem * docptr = this->virtadr; | 597 | void __iomem * docptr = this->virtadr; |
612 | struct Nand *mychip = &this->chips[from >> (this->chipshift)]; | 598 | struct Nand *mychip = &this->chips[from >> (this->chipshift)]; |
@@ -644,56 +630,51 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
644 | WriteDOC(0, docptr, Mplus_FlashControl); | 630 | WriteDOC(0, docptr, Mplus_FlashControl); |
645 | DoC_WaitReady(docptr); | 631 | DoC_WaitReady(docptr); |
646 | 632 | ||
647 | if (eccbuf) { | 633 | /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ |
648 | /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ | 634 | WriteDOC(DOC_ECC_RESET, docptr, Mplus_ECCConf); |
649 | WriteDOC(DOC_ECC_RESET, docptr, Mplus_ECCConf); | 635 | WriteDOC(DOC_ECC_EN, docptr, Mplus_ECCConf); |
650 | WriteDOC(DOC_ECC_EN, docptr, Mplus_ECCConf); | ||
651 | } else { | ||
652 | /* disable the ECC engine */ | ||
653 | WriteDOC(DOC_ECC_RESET, docptr, Mplus_ECCConf); | ||
654 | } | ||
655 | 636 | ||
656 | /* Let the caller know we completed it */ | 637 | /* Let the caller know we completed it */ |
657 | *retlen = len; | 638 | *retlen = len; |
658 | ret = 0; | 639 | ret = 0; |
659 | 640 | ||
660 | ReadDOC(docptr, Mplus_ReadPipeInit); | 641 | ReadDOC(docptr, Mplus_ReadPipeInit); |
661 | ReadDOC(docptr, Mplus_ReadPipeInit); | 642 | ReadDOC(docptr, Mplus_ReadPipeInit); |
662 | 643 | ||
663 | if (eccbuf) { | 644 | /* Read the data via the internal pipeline through CDSN IO |
664 | /* Read the data via the internal pipeline through CDSN IO | 645 | register, see Pipelined Read Operations 11.3 */ |
665 | register, see Pipelined Read Operations 11.3 */ | 646 | MemReadDOC(docptr, buf, len); |
666 | MemReadDOC(docptr, buf, len); | ||
667 | 647 | ||
668 | /* Read the ECC data following raw data */ | 648 | /* Read the ECC data following raw data */ |
669 | MemReadDOC(docptr, eccbuf, 4); | 649 | MemReadDOC(docptr, eccbuf, 4); |
670 | eccbuf[4] = ReadDOC(docptr, Mplus_LastDataRead); | 650 | eccbuf[4] = ReadDOC(docptr, Mplus_LastDataRead); |
671 | eccbuf[5] = ReadDOC(docptr, Mplus_LastDataRead); | 651 | eccbuf[5] = ReadDOC(docptr, Mplus_LastDataRead); |
672 | 652 | ||
673 | /* Flush the pipeline */ | 653 | /* Flush the pipeline */ |
674 | dummy = ReadDOC(docptr, Mplus_ECCConf); | 654 | dummy = ReadDOC(docptr, Mplus_ECCConf); |
675 | dummy = ReadDOC(docptr, Mplus_ECCConf); | 655 | dummy = ReadDOC(docptr, Mplus_ECCConf); |
676 | 656 | ||
677 | /* Check the ECC Status */ | 657 | /* Check the ECC Status */ |
678 | if (ReadDOC(docptr, Mplus_ECCConf) & 0x80) { | 658 | if (ReadDOC(docptr, Mplus_ECCConf) & 0x80) { |
679 | int nb_errors; | 659 | int nb_errors; |
680 | /* There was an ECC error */ | 660 | /* There was an ECC error */ |
681 | #ifdef ECC_DEBUG | 661 | #ifdef ECC_DEBUG |
682 | printk("DiskOnChip ECC Error: Read at %lx\n", (long)from); | 662 | printk("DiskOnChip ECC Error: Read at %lx\n", (long)from); |
683 | #endif | 663 | #endif |
684 | /* Read the ECC syndrom through the DiskOnChip ECC logic. | 664 | /* Read the ECC syndrom through the DiskOnChip ECC logic. |
685 | These syndrome will be all ZERO when there is no error */ | 665 | These syndrome will be all ZERO when there is no error */ |
686 | for (i = 0; i < 6; i++) | 666 | for (i = 0; i < 6; i++) |
687 | syndrome[i] = ReadDOC(docptr, Mplus_ECCSyndrome0 + i); | 667 | syndrome[i] = ReadDOC(docptr, Mplus_ECCSyndrome0 + i); |
688 | 668 | ||
689 | nb_errors = doc_decode_ecc(buf, syndrome); | 669 | nb_errors = doc_decode_ecc(buf, syndrome); |
690 | #ifdef ECC_DEBUG | 670 | #ifdef ECC_DEBUG |
691 | printk("ECC Errors corrected: %x\n", nb_errors); | 671 | printk("ECC Errors corrected: %x\n", nb_errors); |
692 | #endif | 672 | #endif |
693 | if (nb_errors < 0) { | 673 | if (nb_errors < 0) { |
694 | /* We return error, but have actually done the read. Not that | 674 | /* We return error, but have actually done the |
695 | this can be told to user-space, via sys_read(), but at least | 675 | read. Not that this can be told to user-space, via |
696 | MTD-aware stuff can know about it by checking *retlen */ | 676 | sys_read(), but at least MTD-aware stuff can know |
677 | about it by checking *retlen */ | ||
697 | #ifdef ECC_DEBUG | 678 | #ifdef ECC_DEBUG |
698 | printk("%s(%d): Millennium Plus ECC error (from=0x%x:\n", | 679 | printk("%s(%d): Millennium Plus ECC error (from=0x%x:\n", |
699 | __FILE__, __LINE__, (int)from); | 680 | __FILE__, __LINE__, (int)from); |
@@ -707,24 +688,16 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
707 | eccbuf[3], eccbuf[4], eccbuf[5]); | 688 | eccbuf[3], eccbuf[4], eccbuf[5]); |
708 | #endif | 689 | #endif |
709 | ret = -EIO; | 690 | ret = -EIO; |
710 | } | ||
711 | } | 691 | } |
692 | } | ||
712 | 693 | ||
713 | #ifdef PSYCHO_DEBUG | 694 | #ifdef PSYCHO_DEBUG |
714 | printk("ECC DATA at %lx: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", | 695 | printk("ECC DATA at %lx: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", |
715 | (long)from, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], | 696 | (long)from, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], |
716 | eccbuf[4], eccbuf[5]); | 697 | eccbuf[4], eccbuf[5]); |
717 | #endif | 698 | #endif |
718 | 699 | /* disable the ECC engine */ | |
719 | /* disable the ECC engine */ | 700 | WriteDOC(DOC_ECC_DIS, docptr , Mplus_ECCConf); |
720 | WriteDOC(DOC_ECC_DIS, docptr , Mplus_ECCConf); | ||
721 | } else { | ||
722 | /* Read the data via the internal pipeline through CDSN IO | ||
723 | register, see Pipelined Read Operations 11.3 */ | ||
724 | MemReadDOC(docptr, buf, len-2); | ||
725 | buf[len-2] = ReadDOC(docptr, Mplus_LastDataRead); | ||
726 | buf[len-1] = ReadDOC(docptr, Mplus_LastDataRead); | ||
727 | } | ||
728 | 701 | ||
729 | /* Disable flash internally */ | 702 | /* Disable flash internally */ |
730 | WriteDOC(0, docptr, Mplus_FlashSelect); | 703 | WriteDOC(0, docptr, Mplus_FlashSelect); |
@@ -735,17 +708,10 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
735 | static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, | 708 | static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, |
736 | size_t *retlen, const u_char *buf) | 709 | size_t *retlen, const u_char *buf) |
737 | { | 710 | { |
738 | char eccbuf[6]; | ||
739 | return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, NULL); | ||
740 | } | ||
741 | |||
742 | static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | ||
743 | size_t *retlen, const u_char *buf, u_char *eccbuf, | ||
744 | struct nand_oobinfo *oobsel) | ||
745 | { | ||
746 | int i, before, ret = 0; | 711 | int i, before, ret = 0; |
747 | loff_t fto; | 712 | loff_t fto; |
748 | volatile char dummy; | 713 | volatile char dummy; |
714 | char eccbuf[6]; | ||
749 | struct DiskOnChip *this = mtd->priv; | 715 | struct DiskOnChip *this = mtd->priv; |
750 | void __iomem * docptr = this->virtadr; | 716 | void __iomem * docptr = this->virtadr; |
751 | struct Nand *mychip = &this->chips[to >> (this->chipshift)]; | 717 | struct Nand *mychip = &this->chips[to >> (this->chipshift)]; |
@@ -795,46 +761,42 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
795 | /* Disable the ECC engine */ | 761 | /* Disable the ECC engine */ |
796 | WriteDOC(DOC_ECC_RESET, docptr, Mplus_ECCConf); | 762 | WriteDOC(DOC_ECC_RESET, docptr, Mplus_ECCConf); |
797 | 763 | ||
798 | if (eccbuf) { | 764 | if (before) { |
799 | if (before) { | 765 | /* Write the block status BLOCK_USED (0x5555) */ |
800 | /* Write the block status BLOCK_USED (0x5555) */ | 766 | WriteDOC(0x55, docptr, Mil_CDSN_IO); |
801 | WriteDOC(0x55, docptr, Mil_CDSN_IO); | 767 | WriteDOC(0x55, docptr, Mil_CDSN_IO); |
802 | WriteDOC(0x55, docptr, Mil_CDSN_IO); | ||
803 | } | ||
804 | |||
805 | /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ | ||
806 | WriteDOC(DOC_ECC_EN | DOC_ECC_RW, docptr, Mplus_ECCConf); | ||
807 | } | 768 | } |
808 | 769 | ||
770 | /* init the ECC engine, see Reed-Solomon EDC/ECC 11.1 .*/ | ||
771 | WriteDOC(DOC_ECC_EN | DOC_ECC_RW, docptr, Mplus_ECCConf); | ||
772 | |||
809 | MemWriteDOC(docptr, (unsigned char *) buf, len); | 773 | MemWriteDOC(docptr, (unsigned char *) buf, len); |
810 | 774 | ||
811 | if (eccbuf) { | 775 | /* Write ECC data to flash, the ECC info is generated by |
812 | /* Write ECC data to flash, the ECC info is generated by | 776 | the DiskOnChip ECC logic see Reed-Solomon EDC/ECC 11.1 */ |
813 | the DiskOnChip ECC logic see Reed-Solomon EDC/ECC 11.1 */ | 777 | DoC_Delay(docptr, 3); |
814 | DoC_Delay(docptr, 3); | ||
815 | 778 | ||
816 | /* Read the ECC data through the DiskOnChip ECC logic */ | 779 | /* Read the ECC data through the DiskOnChip ECC logic */ |
817 | for (i = 0; i < 6; i++) | 780 | for (i = 0; i < 6; i++) |
818 | eccbuf[i] = ReadDOC(docptr, Mplus_ECCSyndrome0 + i); | 781 | eccbuf[i] = ReadDOC(docptr, Mplus_ECCSyndrome0 + i); |
819 | 782 | ||
820 | /* disable the ECC engine */ | 783 | /* disable the ECC engine */ |
821 | WriteDOC(DOC_ECC_DIS, docptr, Mplus_ECCConf); | 784 | WriteDOC(DOC_ECC_DIS, docptr, Mplus_ECCConf); |
822 | 785 | ||
823 | /* Write the ECC data to flash */ | 786 | /* Write the ECC data to flash */ |
824 | MemWriteDOC(docptr, eccbuf, 6); | 787 | MemWriteDOC(docptr, eccbuf, 6); |
825 | 788 | ||
826 | if (!before) { | 789 | if (!before) { |
827 | /* Write the block status BLOCK_USED (0x5555) */ | 790 | /* Write the block status BLOCK_USED (0x5555) */ |
828 | WriteDOC(0x55, docptr, Mil_CDSN_IO+6); | 791 | WriteDOC(0x55, docptr, Mil_CDSN_IO+6); |
829 | WriteDOC(0x55, docptr, Mil_CDSN_IO+7); | 792 | WriteDOC(0x55, docptr, Mil_CDSN_IO+7); |
830 | } | 793 | } |
831 | 794 | ||
832 | #ifdef PSYCHO_DEBUG | 795 | #ifdef PSYCHO_DEBUG |
833 | printk("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", | 796 | printk("OOB data at %lx is %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", |
834 | (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], | 797 | (long) to, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], |
835 | eccbuf[4], eccbuf[5]); | 798 | eccbuf[4], eccbuf[5]); |
836 | #endif | 799 | #endif |
837 | } | ||
838 | 800 | ||
839 | WriteDOC(0x00, docptr, Mplus_WritePipeTerm); | 801 | WriteDOC(0x00, docptr, Mplus_WritePipeTerm); |
840 | WriteDOC(0x00, docptr, Mplus_WritePipeTerm); | 802 | WriteDOC(0x00, docptr, Mplus_WritePipeTerm); |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 80a76654d96..62b861304e0 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -155,7 +155,7 @@ static u16 nand_read_word(struct mtd_info *mtd) | |||
155 | /** | 155 | /** |
156 | * nand_select_chip - [DEFAULT] control CE line | 156 | * nand_select_chip - [DEFAULT] control CE line |
157 | * @mtd: MTD device structure | 157 | * @mtd: MTD device structure |
158 | * @chip: chipnumber to select, -1 for deselect | 158 | * @chipnr: chipnumber to select, -1 for deselect |
159 | * | 159 | * |
160 | * Default select function for 1 chip devices. | 160 | * Default select function for 1 chip devices. |
161 | */ | 161 | */ |
@@ -542,7 +542,6 @@ static void nand_command(struct mtd_info *mtd, unsigned int command, | |||
542 | * Send command to NAND device. This is the version for the new large page | 542 | * Send command to NAND device. This is the version for the new large page |
543 | * devices We dont have the separate regions as we have in the small page | 543 | * devices We dont have the separate regions as we have in the small page |
544 | * devices. We must emulate NAND_CMD_READOOB to keep the code compatible. | 544 | * devices. We must emulate NAND_CMD_READOOB to keep the code compatible. |
545 | * | ||
546 | */ | 545 | */ |
547 | static void nand_command_lp(struct mtd_info *mtd, unsigned int command, | 546 | static void nand_command_lp(struct mtd_info *mtd, unsigned int command, |
548 | int column, int page_addr) | 547 | int column, int page_addr) |
@@ -656,7 +655,7 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command, | |||
656 | 655 | ||
657 | /** | 656 | /** |
658 | * nand_get_device - [GENERIC] Get chip for selected access | 657 | * nand_get_device - [GENERIC] Get chip for selected access |
659 | * @this: the nand chip descriptor | 658 | * @chip: the nand chip descriptor |
660 | * @mtd: MTD device structure | 659 | * @mtd: MTD device structure |
661 | * @new_state: the state which is requested | 660 | * @new_state: the state which is requested |
662 | * | 661 | * |
@@ -696,13 +695,12 @@ nand_get_device(struct nand_chip *chip, struct mtd_info *mtd, int new_state) | |||
696 | /** | 695 | /** |
697 | * nand_wait - [DEFAULT] wait until the command is done | 696 | * nand_wait - [DEFAULT] wait until the command is done |
698 | * @mtd: MTD device structure | 697 | * @mtd: MTD device structure |
699 | * @this: NAND chip structure | 698 | * @chip: NAND chip structure |
700 | * | 699 | * |
701 | * Wait for command done. This applies to erase and program only | 700 | * Wait for command done. This applies to erase and program only |
702 | * Erase can take up to 400ms and program up to 20ms according to | 701 | * Erase can take up to 400ms and program up to 20ms according to |
703 | * general NAND and SmartMedia specs | 702 | * general NAND and SmartMedia specs |
704 | * | 703 | */ |
705 | */ | ||
706 | static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip) | 704 | static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip) |
707 | { | 705 | { |
708 | 706 | ||
@@ -896,6 +894,7 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip, | |||
896 | /** | 894 | /** |
897 | * nand_transfer_oob - [Internal] Transfer oob to client buffer | 895 | * nand_transfer_oob - [Internal] Transfer oob to client buffer |
898 | * @chip: nand chip structure | 896 | * @chip: nand chip structure |
897 | * @oob: oob destination address | ||
899 | * @ops: oob ops structure | 898 | * @ops: oob ops structure |
900 | */ | 899 | */ |
901 | static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob, | 900 | static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob, |
@@ -946,6 +945,7 @@ static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob, | |||
946 | * | 945 | * |
947 | * @mtd: MTD device structure | 946 | * @mtd: MTD device structure |
948 | * @from: offset to read from | 947 | * @from: offset to read from |
948 | * @ops: oob ops structure | ||
949 | * | 949 | * |
950 | * Internal function. Called with chip held. | 950 | * Internal function. Called with chip held. |
951 | */ | 951 | */ |
@@ -1760,7 +1760,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, | |||
1760 | /** | 1760 | /** |
1761 | * nand_write_oob - [MTD Interface] NAND write data and/or out-of-band | 1761 | * nand_write_oob - [MTD Interface] NAND write data and/or out-of-band |
1762 | * @mtd: MTD device structure | 1762 | * @mtd: MTD device structure |
1763 | * @from: offset to read from | 1763 | * @to: offset to write to |
1764 | * @ops: oob operation description structure | 1764 | * @ops: oob operation description structure |
1765 | */ | 1765 | */ |
1766 | static int nand_write_oob(struct mtd_info *mtd, loff_t to, | 1766 | static int nand_write_oob(struct mtd_info *mtd, loff_t to, |
@@ -2055,7 +2055,7 @@ static void nand_sync(struct mtd_info *mtd) | |||
2055 | /** | 2055 | /** |
2056 | * nand_block_isbad - [MTD Interface] Check if block at offset is bad | 2056 | * nand_block_isbad - [MTD Interface] Check if block at offset is bad |
2057 | * @mtd: MTD device structure | 2057 | * @mtd: MTD device structure |
2058 | * @ofs: offset relative to mtd start | 2058 | * @offs: offset relative to mtd start |
2059 | */ | 2059 | */ |
2060 | static int nand_block_isbad(struct mtd_info *mtd, loff_t offs) | 2060 | static int nand_block_isbad(struct mtd_info *mtd, loff_t offs) |
2061 | { | 2061 | { |
diff --git a/drivers/mtd/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c index 2a163e4084d..dd438ca47d9 100644 --- a/drivers/mtd/nand/nand_ecc.c +++ b/drivers/mtd/nand/nand_ecc.c | |||
@@ -65,8 +65,7 @@ static const u_char nand_ecc_precalc_table[] = { | |||
65 | }; | 65 | }; |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * nand_calculate_ecc - [NAND Interface] Calculate 3 byte ECC code | 68 | * nand_calculate_ecc - [NAND Interface] Calculate 3-byte ECC for 256-byte block |
69 | * for 256 byte block | ||
70 | * @mtd: MTD block structure | 69 | * @mtd: MTD block structure |
71 | * @dat: raw data | 70 | * @dat: raw data |
72 | * @ecc_code: buffer for ECC | 71 | * @ecc_code: buffer for ECC |
diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c index 21743658d15..fbeedc3184e 100644 --- a/drivers/mtd/nand/sharpsl.c +++ b/drivers/mtd/nand/sharpsl.c | |||
@@ -237,11 +237,6 @@ static int __init sharpsl_nand_init(void) | |||
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | if (machine_is_husky() || machine_is_borzoi() || machine_is_akita()) { | ||
241 | /* Need to use small eraseblock size for backward compatibility */ | ||
242 | sharpsl_mtd->flags |= MTD_NO_VIRTBLOCKS; | ||
243 | } | ||
244 | |||
245 | add_mtd_partitions(sharpsl_mtd, sharpsl_partition_info, nr_partitions); | 240 | add_mtd_partitions(sharpsl_mtd, sharpsl_partition_info, nr_partitions); |
246 | 241 | ||
247 | /* Return happy */ | 242 | /* Return happy */ |
@@ -255,8 +250,6 @@ module_init(sharpsl_nand_init); | |||
255 | */ | 250 | */ |
256 | static void __exit sharpsl_nand_cleanup(void) | 251 | static void __exit sharpsl_nand_cleanup(void) |
257 | { | 252 | { |
258 | struct nand_chip *this = (struct nand_chip *)&sharpsl_mtd[1]; | ||
259 | |||
260 | /* Release resources, unregister device */ | 253 | /* Release resources, unregister device */ |
261 | nand_release(sharpsl_mtd); | 254 | nand_release(sharpsl_mtd); |
262 | 255 | ||
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index 9c2077e7e08..0ae3cd10702 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c | |||
@@ -345,10 +345,8 @@ int jffs2_init_acl(struct inode *inode, struct inode *dir) | |||
345 | return rc; | 345 | return rc; |
346 | } | 346 | } |
347 | 347 | ||
348 | void jffs2_clear_acl(struct inode *inode) | 348 | void jffs2_clear_acl(struct jffs2_inode_info *f) |
349 | { | 349 | { |
350 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); | ||
351 | |||
352 | if (f->i_acl_access && f->i_acl_access != JFFS2_ACL_NOT_CACHED) { | 350 | if (f->i_acl_access && f->i_acl_access != JFFS2_ACL_NOT_CACHED) { |
353 | posix_acl_release(f->i_acl_access); | 351 | posix_acl_release(f->i_acl_access); |
354 | f->i_acl_access = JFFS2_ACL_NOT_CACHED; | 352 | f->i_acl_access = JFFS2_ACL_NOT_CACHED; |
diff --git a/fs/jffs2/acl.h b/fs/jffs2/acl.h index 8893bd1a6ba..fa327dbd317 100644 --- a/fs/jffs2/acl.h +++ b/fs/jffs2/acl.h | |||
@@ -30,7 +30,7 @@ struct jffs2_acl_header { | |||
30 | extern int jffs2_permission(struct inode *, int, struct nameidata *); | 30 | extern int jffs2_permission(struct inode *, int, struct nameidata *); |
31 | extern int jffs2_acl_chmod(struct inode *); | 31 | extern int jffs2_acl_chmod(struct inode *); |
32 | extern int jffs2_init_acl(struct inode *, struct inode *); | 32 | extern int jffs2_init_acl(struct inode *, struct inode *); |
33 | extern void jffs2_clear_acl(struct inode *); | 33 | extern void jffs2_clear_acl(struct jffs2_inode_info *); |
34 | 34 | ||
35 | extern struct xattr_handler jffs2_acl_access_xattr_handler; | 35 | extern struct xattr_handler jffs2_acl_access_xattr_handler; |
36 | extern struct xattr_handler jffs2_acl_default_xattr_handler; | 36 | extern struct xattr_handler jffs2_acl_default_xattr_handler; |
@@ -40,6 +40,6 @@ extern struct xattr_handler jffs2_acl_default_xattr_handler; | |||
40 | #define jffs2_permission NULL | 40 | #define jffs2_permission NULL |
41 | #define jffs2_acl_chmod(inode) (0) | 41 | #define jffs2_acl_chmod(inode) (0) |
42 | #define jffs2_init_acl(inode,dir) (0) | 42 | #define jffs2_init_acl(inode,dir) (0) |
43 | #define jffs2_clear_acl(inode) | 43 | #define jffs2_clear_acl(f) |
44 | 44 | ||
45 | #endif /* CONFIG_JFFS2_FS_POSIX_ACL */ | 45 | #endif /* CONFIG_JFFS2_FS_POSIX_ACL */ |
diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c index 8310c95478e..33f29100501 100644 --- a/fs/jffs2/malloc.c +++ b/fs/jffs2/malloc.c | |||
@@ -190,7 +190,7 @@ void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x) | |||
190 | kmem_cache_free(tmp_dnode_info_slab, x); | 190 | kmem_cache_free(tmp_dnode_info_slab, x); |
191 | } | 191 | } |
192 | 192 | ||
193 | struct jffs2_raw_node_ref *jffs2_alloc_refblock(void) | 193 | static struct jffs2_raw_node_ref *jffs2_alloc_refblock(void) |
194 | { | 194 | { |
195 | struct jffs2_raw_node_ref *ret; | 195 | struct jffs2_raw_node_ref *ret; |
196 | 196 | ||
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h index f752baa8d39..cae92c14116 100644 --- a/fs/jffs2/nodelist.h +++ b/fs/jffs2/nodelist.h | |||
@@ -426,8 +426,6 @@ char *jffs2_getlink(struct jffs2_sb_info *c, struct jffs2_inode_info *f); | |||
426 | /* scan.c */ | 426 | /* scan.c */ |
427 | int jffs2_scan_medium(struct jffs2_sb_info *c); | 427 | int jffs2_scan_medium(struct jffs2_sb_info *c); |
428 | void jffs2_rotate_lists(struct jffs2_sb_info *c); | 428 | void jffs2_rotate_lists(struct jffs2_sb_info *c); |
429 | int jffs2_fill_scan_buf(struct jffs2_sb_info *c, void *buf, | ||
430 | uint32_t ofs, uint32_t len); | ||
431 | struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uint32_t ino); | 429 | struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uint32_t ino); |
432 | int jffs2_scan_classify_jeb(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); | 430 | int jffs2_scan_classify_jeb(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); |
433 | int jffs2_scan_dirty_space(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t size); | 431 | int jffs2_scan_dirty_space(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t size); |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index cc1899268c4..266423b2709 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
@@ -968,6 +968,7 @@ void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f) | |||
968 | struct jffs2_full_dirent *fd, *fds; | 968 | struct jffs2_full_dirent *fd, *fds; |
969 | int deleted; | 969 | int deleted; |
970 | 970 | ||
971 | jffs2_clear_acl(f); | ||
971 | jffs2_xattr_delete_inode(c, f->inocache); | 972 | jffs2_xattr_delete_inode(c, f->inocache); |
972 | down(&f->sem); | 973 | down(&f->sem); |
973 | deleted = f->inocache && !f->inocache->nlink; | 974 | deleted = f->inocache && !f->inocache->nlink; |
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 2bfdc33752d..e2413466ddd 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
@@ -274,8 +274,8 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
274 | return ret; | 274 | return ret; |
275 | } | 275 | } |
276 | 276 | ||
277 | int jffs2_fill_scan_buf (struct jffs2_sb_info *c, void *buf, | 277 | static int jffs2_fill_scan_buf(struct jffs2_sb_info *c, void *buf, |
278 | uint32_t ofs, uint32_t len) | 278 | uint32_t ofs, uint32_t len) |
279 | { | 279 | { |
280 | int ret; | 280 | int ret; |
281 | size_t retlen; | 281 | size_t retlen; |
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c index 18e66dbf23b..25bc1ae0864 100644 --- a/fs/jffs2/xattr.c +++ b/fs/jffs2/xattr.c | |||
@@ -50,9 +50,10 @@ | |||
50 | * is used to write xdatum to medium. xd->version will be incremented. | 50 | * is used to write xdatum to medium. xd->version will be incremented. |
51 | * create_xattr_datum(c, xprefix, xname, xvalue, xsize) | 51 | * create_xattr_datum(c, xprefix, xname, xvalue, xsize) |
52 | * is used to create new xdatum and write to medium. | 52 | * is used to create new xdatum and write to medium. |
53 | * delete_xattr_datum(c, xd) | 53 | * unrefer_xattr_datum(c, xd) |
54 | * is used to delete a xdatum. It marks xd JFFS2_XFLAGS_DEAD, and allows | 54 | * is used to delete a xdatum. When nobody refers this xdatum, JFFS2_XFLAGS_DEAD |
55 | * GC to reclaim those physical nodes. | 55 | * is set on xd->flags and chained xattr_dead_list or release it immediately. |
56 | * In the first case, the garbage collector release it later. | ||
56 | * -------------------------------------------------- */ | 57 | * -------------------------------------------------- */ |
57 | static uint32_t xattr_datum_hashkey(int xprefix, const char *xname, const char *xvalue, int xsize) | 58 | static uint32_t xattr_datum_hashkey(int xprefix, const char *xname, const char *xvalue, int xsize) |
58 | { | 59 | { |
@@ -394,22 +395,24 @@ static struct jffs2_xattr_datum *create_xattr_datum(struct jffs2_sb_info *c, | |||
394 | return xd; | 395 | return xd; |
395 | } | 396 | } |
396 | 397 | ||
397 | static void delete_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd) | 398 | static void unrefer_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd) |
398 | { | 399 | { |
399 | /* must be called under down_write(xattr_sem) */ | 400 | /* must be called under down_write(xattr_sem) */ |
400 | BUG_ON(atomic_read(&xd->refcnt)); | 401 | if (atomic_dec_and_lock(&xd->refcnt, &c->erase_completion_lock)) { |
402 | uint32_t xid = xd->xid, version = xd->version; | ||
401 | 403 | ||
402 | unload_xattr_datum(c, xd); | 404 | unload_xattr_datum(c, xd); |
403 | xd->flags |= JFFS2_XFLAGS_DEAD; | 405 | xd->flags |= JFFS2_XFLAGS_DEAD; |
404 | spin_lock(&c->erase_completion_lock); | 406 | if (xd->node == (void *)xd) { |
405 | if (xd->node == (void *)xd) { | 407 | BUG_ON(!(xd->flags & JFFS2_XFLAGS_INVALID)); |
406 | BUG_ON(!(xd->flags & JFFS2_XFLAGS_INVALID)); | 408 | jffs2_free_xattr_datum(xd); |
407 | jffs2_free_xattr_datum(xd); | 409 | } else { |
408 | } else { | 410 | list_add(&xd->xindex, &c->xattr_dead_list); |
409 | list_add(&xd->xindex, &c->xattr_dead_list); | 411 | } |
412 | spin_unlock(&c->erase_completion_lock); | ||
413 | |||
414 | dbg_xattr("xdatum(xid=%u, version=%u) was removed.\n", xid, version); | ||
410 | } | 415 | } |
411 | spin_unlock(&c->erase_completion_lock); | ||
412 | dbg_xattr("xdatum(xid=%u, version=%u) was removed.\n", xd->xid, xd->version); | ||
413 | } | 416 | } |
414 | 417 | ||
415 | /* -------- xref related functions ------------------ | 418 | /* -------- xref related functions ------------------ |
@@ -580,8 +583,7 @@ static void delete_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *re | |||
580 | dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) was removed.\n", | 583 | dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) was removed.\n", |
581 | ref->ino, ref->xid, ref->xseqno); | 584 | ref->ino, ref->xid, ref->xseqno); |
582 | 585 | ||
583 | if (atomic_dec_and_test(&xd->refcnt)) | 586 | unrefer_xattr_datum(c, xd); |
584 | delete_xattr_datum(c, xd); | ||
585 | } | 587 | } |
586 | 588 | ||
587 | void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic) | 589 | void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic) |
@@ -1119,8 +1121,7 @@ int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname, | |||
1119 | ref->next = c->xref_dead_list; | 1121 | ref->next = c->xref_dead_list; |
1120 | c->xref_dead_list = ref; | 1122 | c->xref_dead_list = ref; |
1121 | spin_unlock(&c->erase_completion_lock); | 1123 | spin_unlock(&c->erase_completion_lock); |
1122 | if (atomic_dec_and_test(&xd->refcnt)) | 1124 | unrefer_xattr_datum(c, xd); |
1123 | delete_xattr_datum(c, xd); | ||
1124 | } else { | 1125 | } else { |
1125 | ref->ic = ic; | 1126 | ref->ic = ic; |
1126 | ref->xd = xd; | 1127 | ref->xd = xd; |
@@ -1156,8 +1157,7 @@ int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname, | |||
1156 | down_write(&c->xattr_sem); | 1157 | down_write(&c->xattr_sem); |
1157 | if (rc) { | 1158 | if (rc) { |
1158 | JFFS2_WARNING("jffs2_reserve_space()=%d, request=%u\n", rc, request); | 1159 | JFFS2_WARNING("jffs2_reserve_space()=%d, request=%u\n", rc, request); |
1159 | if (atomic_dec_and_test(&xd->refcnt)) | 1160 | unrefer_xattr_datum(c, xd); |
1160 | delete_xattr_datum(c, xd); | ||
1161 | up_write(&c->xattr_sem); | 1161 | up_write(&c->xattr_sem); |
1162 | return rc; | 1162 | return rc; |
1163 | } | 1163 | } |
@@ -1170,8 +1170,7 @@ int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname, | |||
1170 | ic->xref = ref; | 1170 | ic->xref = ref; |
1171 | } | 1171 | } |
1172 | rc = PTR_ERR(newref); | 1172 | rc = PTR_ERR(newref); |
1173 | if (atomic_dec_and_test(&xd->refcnt)) | 1173 | unrefer_xattr_datum(c, xd); |
1174 | delete_xattr_datum(c, xd); | ||
1175 | } else if (ref) { | 1174 | } else if (ref) { |
1176 | delete_xattr_ref(c, ref); | 1175 | delete_xattr_ref(c, ref); |
1177 | } | 1176 | } |
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index 7a7fbe87fef..1221b7c4415 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h | |||
@@ -19,21 +19,21 @@ | |||
19 | 19 | ||
20 | /** | 20 | /** |
21 | * struct nand_bbt_descr - bad block table descriptor | 21 | * struct nand_bbt_descr - bad block table descriptor |
22 | * @param options options for this descriptor | 22 | * @options: options for this descriptor |
23 | * @param pages the page(s) where we find the bbt, used with | 23 | * @pages: the page(s) where we find the bbt, used with |
24 | * option BBT_ABSPAGE when bbt is searched, | 24 | * option BBT_ABSPAGE when bbt is searched, |
25 | * then we store the found bbts pages here. | 25 | * then we store the found bbts pages here. |
26 | * Its an array and supports up to 8 chips now | 26 | * Its an array and supports up to 8 chips now |
27 | * @param offs offset of the pattern in the oob area of the page | 27 | * @offs: offset of the pattern in the oob area of the page |
28 | * @param veroffs offset of the bbt version counter in the oob are of the page | 28 | * @veroffs: offset of the bbt version counter in the oob area of the page |
29 | * @param version version read from the bbt page during scan | 29 | * @version: version read from the bbt page during scan |
30 | * @param len length of the pattern, if 0 no pattern check is performed | 30 | * @len: length of the pattern, if 0 no pattern check is performed |
31 | * @param maxblocks maximum number of blocks to search for a bbt. This number of | 31 | * @maxblocks: maximum number of blocks to search for a bbt. This |
32 | * blocks is reserved at the end of the device | 32 | * number of blocks is reserved at the end of the device |
33 | * where the tables are written. | 33 | * where the tables are written. |
34 | * @param reserved_block_code if non-0, this pattern denotes a reserved | 34 | * @reserved_block_code: if non-0, this pattern denotes a reserved |
35 | * (rather than bad) block in the stored bbt | 35 | * (rather than bad) block in the stored bbt |
36 | * @param pattern pattern to identify bad block table or factory marked | 36 | * @pattern: pattern to identify bad block table or factory marked |
37 | * good / bad blocks, can be NULL, if len = 0 | 37 | * good / bad blocks, can be NULL, if len = 0 |
38 | * | 38 | * |
39 | * Descriptor for the bad block table marker and the descriptor for the | 39 | * Descriptor for the bad block table marker and the descriptor for the |
@@ -93,12 +93,15 @@ struct nand_bbt_descr { | |||
93 | #define ONENAND_BADBLOCK_POS 0 | 93 | #define ONENAND_BADBLOCK_POS 0 |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * struct bbt_info - [GENERIC] Bad Block Table data structure | 96 | * struct bbm_info - [GENERIC] Bad Block Table data structure |
97 | * @param bbt_erase_shift [INTERN] number of address bits in a bbt entry | 97 | * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry |
98 | * @param badblockpos [INTERN] position of the bad block marker in the oob area | 98 | * @badblockpos: [INTERN] position of the bad block marker in the oob area |
99 | * @param bbt [INTERN] bad block table pointer | 99 | * @options: options for this descriptor |
100 | * @param badblock_pattern [REPLACEABLE] bad block scan pattern used for initial bad block scan | 100 | * @bbt: [INTERN] bad block table pointer |
101 | * @param priv [OPTIONAL] pointer to private bbm date | 101 | * @isbad_bbt: function to determine if a block is bad |
102 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for | ||
103 | * initial bad block scan | ||
104 | * @priv: [OPTIONAL] pointer to private bbm date | ||
102 | */ | 105 | */ |
103 | struct bbm_info { | 106 | struct bbm_info { |
104 | int bbt_erase_shift; | 107 | int bbt_erase_shift; |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 9b7a2b525d6..94a443d4525 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -77,11 +77,11 @@ typedef enum { | |||
77 | * | 77 | * |
78 | * @len: number of bytes to write/read. When a data buffer is given | 78 | * @len: number of bytes to write/read. When a data buffer is given |
79 | * (datbuf != NULL) this is the number of data bytes. When | 79 | * (datbuf != NULL) this is the number of data bytes. When |
80 | + no data buffer is available this is the number of oob bytes. | 80 | * no data buffer is available this is the number of oob bytes. |
81 | * | 81 | * |
82 | * @retlen: number of bytes written/read. When a data buffer is given | 82 | * @retlen: number of bytes written/read. When a data buffer is given |
83 | * (datbuf != NULL) this is the number of data bytes. When | 83 | * (datbuf != NULL) this is the number of data bytes. When |
84 | + no data buffer is available this is the number of oob bytes. | 84 | * no data buffer is available this is the number of oob bytes. |
85 | * | 85 | * |
86 | * @ooblen: number of oob bytes per page | 86 | * @ooblen: number of oob bytes per page |
87 | * @ooboffs: offset of oob data in the oob area (only relevant when | 87 | * @ooboffs: offset of oob data in the oob area (only relevant when |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 66559272ebc..0b4cd2fa64a 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -202,7 +202,7 @@ typedef enum { | |||
202 | struct nand_chip; | 202 | struct nand_chip; |
203 | 203 | ||
204 | /** | 204 | /** |
205 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices | 205 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices |
206 | * @lock: protection lock | 206 | * @lock: protection lock |
207 | * @active: the mtd device which holds the controller currently | 207 | * @active: the mtd device which holds the controller currently |
208 | * @wq: wait queue to sleep on if a NAND operation is in progress | 208 | * @wq: wait queue to sleep on if a NAND operation is in progress |
@@ -223,12 +223,15 @@ struct nand_hw_control { | |||
223 | * @total: total number of ecc bytes per page | 223 | * @total: total number of ecc bytes per page |
224 | * @prepad: padding information for syndrome based ecc generators | 224 | * @prepad: padding information for syndrome based ecc generators |
225 | * @postpad: padding information for syndrome based ecc generators | 225 | * @postpad: padding information for syndrome based ecc generators |
226 | * @layout: ECC layout control struct pointer | ||
226 | * @hwctl: function to control hardware ecc generator. Must only | 227 | * @hwctl: function to control hardware ecc generator. Must only |
227 | * be provided if an hardware ECC is available | 228 | * be provided if an hardware ECC is available |
228 | * @calculate: function for ecc calculation or readback from ecc hardware | 229 | * @calculate: function for ecc calculation or readback from ecc hardware |
229 | * @correct: function for ecc correction, matching to ecc generator (sw/hw) | 230 | * @correct: function for ecc correction, matching to ecc generator (sw/hw) |
230 | * @read_page: function to read a page according to the ecc generator requirements | 231 | * @read_page: function to read a page according to the ecc generator requirements |
231 | * @write_page: function to write a page according to the ecc generator requirements | 232 | * @write_page: function to write a page according to the ecc generator requirements |
233 | * @read_oob: function to read chip OOB data | ||
234 | * @write_oob: function to write chip OOB data | ||
232 | */ | 235 | */ |
233 | struct nand_ecc_ctrl { | 236 | struct nand_ecc_ctrl { |
234 | nand_ecc_modes_t mode; | 237 | nand_ecc_modes_t mode; |
@@ -300,11 +303,15 @@ struct nand_buffers { | |||
300 | * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip | 303 | * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip |
301 | * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready | 304 | * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready |
302 | * @ecc: [BOARDSPECIFIC] ecc control ctructure | 305 | * @ecc: [BOARDSPECIFIC] ecc control ctructure |
306 | * @buffers: buffer structure for read/write | ||
307 | * @hwcontrol: platform-specific hardware control structure | ||
308 | * @ops: oob operation operands | ||
303 | * @erase_cmd: [INTERN] erase command write function, selectable due to AND support | 309 | * @erase_cmd: [INTERN] erase command write function, selectable due to AND support |
304 | * @scan_bbt: [REPLACEABLE] function to scan bad block table | 310 | * @scan_bbt: [REPLACEABLE] function to scan bad block table |
305 | * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) | 311 | * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) |
306 | * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress | 312 | * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress |
307 | * @state: [INTERN] the current state of the NAND device | 313 | * @state: [INTERN] the current state of the NAND device |
314 | * @oob_poi: poison value buffer | ||
308 | * @page_shift: [INTERN] number of address bits in a page (column address bits) | 315 | * @page_shift: [INTERN] number of address bits in a page (column address bits) |
309 | * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock | 316 | * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock |
310 | * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry | 317 | * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry |
@@ -400,7 +407,6 @@ struct nand_chip { | |||
400 | 407 | ||
401 | /** | 408 | /** |
402 | * struct nand_flash_dev - NAND Flash Device ID Structure | 409 | * struct nand_flash_dev - NAND Flash Device ID Structure |
403 | * | ||
404 | * @name: Identify the device type | 410 | * @name: Identify the device type |
405 | * @id: device ID code | 411 | * @id: device ID code |
406 | * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 | 412 | * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 |
@@ -519,9 +525,8 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
519 | 525 | ||
520 | /** | 526 | /** |
521 | * struct platform_nand_chip - chip level device structure | 527 | * struct platform_nand_chip - chip level device structure |
522 | * | ||
523 | * @nr_chips: max. number of chips to scan for | 528 | * @nr_chips: max. number of chips to scan for |
524 | * @chip_offs: chip number offset | 529 | * @chip_offset: chip number offset |
525 | * @nr_partitions: number of partitions pointed to by partitions (or zero) | 530 | * @nr_partitions: number of partitions pointed to by partitions (or zero) |
526 | * @partitions: mtd partition list | 531 | * @partitions: mtd partition list |
527 | * @chip_delay: R/B delay value in us | 532 | * @chip_delay: R/B delay value in us |
@@ -542,11 +547,10 @@ struct platform_nand_chip { | |||
542 | 547 | ||
543 | /** | 548 | /** |
544 | * struct platform_nand_ctrl - controller level device structure | 549 | * struct platform_nand_ctrl - controller level device structure |
545 | * | ||
546 | * @hwcontrol: platform specific hardware control structure | 550 | * @hwcontrol: platform specific hardware control structure |
547 | * @dev_ready: platform specific function to read ready/busy pin | 551 | * @dev_ready: platform specific function to read ready/busy pin |
548 | * @select_chip: platform specific chip select function | 552 | * @select_chip: platform specific chip select function |
549 | * @priv_data: private data to transport driver specific settings | 553 | * @priv: private data to transport driver specific settings |
550 | * | 554 | * |
551 | * All fields are optional and depend on the hardware driver requirements | 555 | * All fields are optional and depend on the hardware driver requirements |
552 | */ | 556 | */ |
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index 9ce9a48db44..1f497215524 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h | |||
@@ -23,7 +23,7 @@ extern int onenand_scan(struct mtd_info *mtd, int max_chips); | |||
23 | /* Free resources held by the OneNAND device */ | 23 | /* Free resources held by the OneNAND device */ |
24 | extern void onenand_release(struct mtd_info *mtd); | 24 | extern void onenand_release(struct mtd_info *mtd); |
25 | 25 | ||
26 | /** | 26 | /* |
27 | * onenand_state_t - chip states | 27 | * onenand_state_t - chip states |
28 | * Enumeration for OneNAND flash chip state | 28 | * Enumeration for OneNAND flash chip state |
29 | */ | 29 | */ |
@@ -42,9 +42,9 @@ typedef enum { | |||
42 | 42 | ||
43 | /** | 43 | /** |
44 | * struct onenand_bufferram - OneNAND BufferRAM Data | 44 | * struct onenand_bufferram - OneNAND BufferRAM Data |
45 | * @param block block address in BufferRAM | 45 | * @block: block address in BufferRAM |
46 | * @param page page address in BufferRAM | 46 | * @page: page address in BufferRAM |
47 | * @param valid valid flag | 47 | * @valid: valid flag |
48 | */ | 48 | */ |
49 | struct onenand_bufferram { | 49 | struct onenand_bufferram { |
50 | int block; | 50 | int block; |
@@ -54,32 +54,43 @@ struct onenand_bufferram { | |||
54 | 54 | ||
55 | /** | 55 | /** |
56 | * struct onenand_chip - OneNAND Private Flash Chip Data | 56 | * struct onenand_chip - OneNAND Private Flash Chip Data |
57 | * @param base [BOARDSPECIFIC] address to access OneNAND | 57 | * @base: [BOARDSPECIFIC] address to access OneNAND |
58 | * @param chipsize [INTERN] the size of one chip for multichip arrays | 58 | * @chipsize: [INTERN] the size of one chip for multichip arrays |
59 | * @param device_id [INTERN] device ID | 59 | * @device_id: [INTERN] device ID |
60 | * @param verstion_id [INTERN] version ID | 60 | * @density_mask: chip density, used for DDP devices |
61 | * @param options [BOARDSPECIFIC] various chip options. They can partly be set to inform onenand_scan about | 61 | * @verstion_id: [INTERN] version ID |
62 | * @param erase_shift [INTERN] number of address bits in a block | 62 | * @options: [BOARDSPECIFIC] various chip options. They can |
63 | * @param page_shift [INTERN] number of address bits in a page | 63 | * partly be set to inform onenand_scan about |
64 | * @param ppb_shift [INTERN] number of address bits in a pages per block | 64 | * @erase_shift: [INTERN] number of address bits in a block |
65 | * @param page_mask [INTERN] a page per block mask | 65 | * @page_shift: [INTERN] number of address bits in a page |
66 | * @param bufferam_index [INTERN] BufferRAM index | 66 | * @ppb_shift: [INTERN] number of address bits in a pages per block |
67 | * @param bufferam [INTERN] BufferRAM info | 67 | * @page_mask: [INTERN] a page per block mask |
68 | * @param readw [REPLACEABLE] hardware specific function for read short | 68 | * @bufferram_index: [INTERN] BufferRAM index |
69 | * @param writew [REPLACEABLE] hardware specific function for write short | 69 | * @bufferram: [INTERN] BufferRAM info |
70 | * @param command [REPLACEABLE] hardware specific function for writing commands to the chip | 70 | * @readw: [REPLACEABLE] hardware specific function for read short |
71 | * @param wait [REPLACEABLE] hardware specific function for wait on ready | 71 | * @writew: [REPLACEABLE] hardware specific function for write short |
72 | * @param read_bufferram [REPLACEABLE] hardware specific function for BufferRAM Area | 72 | * @command: [REPLACEABLE] hardware specific function for writing |
73 | * @param write_bufferram [REPLACEABLE] hardware specific function for BufferRAM Area | 73 | * commands to the chip |
74 | * @param read_word [REPLACEABLE] hardware specific function for read register of OneNAND | 74 | * @wait: [REPLACEABLE] hardware specific function for wait on ready |
75 | * @param write_word [REPLACEABLE] hardware specific function for write register of OneNAND | 75 | * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area |
76 | * @param scan_bbt [REPLACEALBE] hardware specific function for scaning Bad block Table | 76 | * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area |
77 | * @param chip_lock [INTERN] spinlock used to protect access to this structure and the chip | 77 | * @read_word: [REPLACEABLE] hardware specific function for read |
78 | * @param wq [INTERN] wait queue to sleep on if a OneNAND operation is in progress | 78 | * register of OneNAND |
79 | * @param state [INTERN] the current state of the OneNAND device | 79 | * @write_word: [REPLACEABLE] hardware specific function for write |
80 | * @param ecclayout [REPLACEABLE] the default ecc placement scheme | 80 | * register of OneNAND |
81 | * @param bbm [REPLACEABLE] pointer to Bad Block Management | 81 | * @mmcontrol: sync burst read function |
82 | * @param priv [OPTIONAL] pointer to private chip date | 82 | * @block_markbad: function to mark a block as bad |
83 | * @scan_bbt: [REPLACEALBE] hardware specific function for scanning | ||
84 | * Bad block Table | ||
85 | * @chip_lock: [INTERN] spinlock used to protect access to this | ||
86 | * structure and the chip | ||
87 | * @wq: [INTERN] wait queue to sleep on if a OneNAND | ||
88 | * operation is in progress | ||
89 | * @state: [INTERN] the current state of the OneNAND device | ||
90 | * @page_buf: data buffer | ||
91 | * @ecclayout: [REPLACEABLE] the default ecc placement scheme | ||
92 | * @bbm: [REPLACEABLE] pointer to Bad Block Management | ||
93 | * @priv: [OPTIONAL] pointer to private chip date | ||
83 | */ | 94 | */ |
84 | struct onenand_chip { | 95 | struct onenand_chip { |
85 | void __iomem *base; | 96 | void __iomem *base; |
@@ -147,9 +158,9 @@ struct onenand_chip { | |||
147 | #define ONENAND_MFR_SAMSUNG 0xec | 158 | #define ONENAND_MFR_SAMSUNG 0xec |
148 | 159 | ||
149 | /** | 160 | /** |
150 | * struct nand_manufacturers - NAND Flash Manufacturer ID Structure | 161 | * struct onenand_manufacturers - NAND Flash Manufacturer ID Structure |
151 | * @param name: Manufacturer name | 162 | * @name: Manufacturer name |
152 | * @param id: manufacturer ID code of device. | 163 | * @id: manufacturer ID code of device. |
153 | */ | 164 | */ |
154 | struct onenand_manufacturers { | 165 | struct onenand_manufacturers { |
155 | int id; | 166 | int id; |
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index 31329fce1ff..1da3f7fa799 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h | |||
@@ -133,7 +133,7 @@ struct nand_ecclayout { | |||
133 | }; | 133 | }; |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * struct mtd_ecc_stats - error correction status | 136 | * struct mtd_ecc_stats - error correction stats |
137 | * | 137 | * |
138 | * @corrected: number of corrected bits | 138 | * @corrected: number of corrected bits |
139 | * @failed: number of uncorrectable errors | 139 | * @failed: number of uncorrectable errors |