Merge git://git.infradead.org/mtd-2.6

* git://git.infradead.org/mtd-2.6:
[JFFS2][XATTR] Fix memory leak in POSIX-ACL support
fs/jffs2/: make 2 functions static
[MTD] NAND: Fix broken sharpsl driver
[JFFS2][XATTR] Fix xd->refcnt race condition
MTD: kernel-doc fixes + additions
MTD: fix all kernel-doc warnings
[MTD] DOC: Fixup read functions and do a little cleanup

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