Lines Matching refs:mtd
342 static int mxc_nand_dev_ready(struct mtd_info *mtd) argument
351 static void _mxc_nand_enable_hwecc(struct mtd_info *mtd, int on) argument
353 struct nand_chip *nand_chip = mtd_to_nand(mtd);
375 static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode) argument
384 static int mxc_nand_read_oob_syndrome(struct mtd_info *mtd, argument
390 int length = mtd->oobsize;
398 chip->cmdfunc(mtd, NAND_CMD_READOOB, mtd->writesize, page);
402 chip->read_buf(mtd, bufpoi, toread);
412 chip->read_buf(mtd, bufpoi, toread);
418 chip->read_buf(mtd, bufpoi, length);
420 _mxc_nand_enable_hwecc(mtd, 0);
421 chip->cmdfunc(mtd, NAND_CMD_READOOB,
422 mtd->writesize + chip->ecc.prepad, page);
424 length = mtd->oobsize - chip->ecc.prepad;
427 chip->read_buf(mtd, bufpoi, toread);
432 _mxc_nand_enable_hwecc(mtd, 1);
436 static int mxc_nand_read_page_raw_syndrome(struct mtd_info *mtd, argument
450 _mxc_nand_enable_hwecc(mtd, 0);
451 chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
455 chip->read_buf(mtd, buf, eccsize);
458 host->col_addr = mtd->writesize + n * eccpitch;
460 chip->read_buf(mtd, oob, chip->ecc.prepad);
464 chip->read_buf(mtd, oob, eccbytes);
468 chip->read_buf(mtd, oob, chip->ecc.postpad);
473 size = mtd->oobsize - (oob - chip->oob_poi);
475 chip->read_buf(mtd, oob, size);
476 _mxc_nand_enable_hwecc(mtd, 1);
481 static int mxc_nand_read_page_syndrome(struct mtd_info *mtd, argument
504 chip->read_buf(mtd, p, eccsize);
506 host->col_addr = mtd->writesize + n * eccpitch;
509 chip->read_buf(mtd, oob, chip->ecc.prepad);
513 stat = chip->ecc.correct(mtd, p, oob, NULL);
516 mtd->ecc_stats.failed++;
518 mtd->ecc_stats.corrected += stat;
522 chip->read_buf(mtd, oob, chip->ecc.postpad);
528 n = mtd->oobsize - (oob - chip->oob_poi);
530 chip->read_buf(mtd, oob, n);
533 _mxc_nand_enable_hwecc(mtd, 0);
534 chip->cmdfunc(mtd, NAND_CMD_READOOB, mtd->writesize, page);
538 host->col_addr = mtd->writesize +
541 chip->read_buf(mtd, oob, eccbytes);
544 _mxc_nand_enable_hwecc(mtd, 1);
548 static int mxc_nand_write_oob_syndrome(struct mtd_info *mtd, argument
553 int length = mtd->oobsize;
557 chip->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize, page);
561 chip->write_buf(mtd, bufpoi, len);
567 chip->write_buf(mtd, bufpoi, length);
569 chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
570 status = chip->waitfunc(mtd, chip);
574 static int mxc_nand_write_page_raw_syndrome(struct mtd_info *mtd, argument
589 chip->write_buf(mtd, buf, eccsize);
592 host->col_addr = mtd->writesize + n * eccpitch;
595 chip->write_buf(mtd, oob, chip->ecc.prepad);
603 chip->write_buf(mtd, oob, chip->ecc.postpad);
608 size = mtd->oobsize - (oob - chip->oob_poi);
610 chip->write_buf(mtd, oob, size);
614 static int mxc_nand_write_page_syndrome(struct mtd_info *mtd, argument
627 chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
634 chip->write_buf(mtd, p, eccsize);
636 host->col_addr = mtd->writesize + n * eccpitch;
639 chip->write_buf(mtd, oob, chip->ecc.prepad);
643 chip->write_buf(mtd, oob, eccbytes);
647 chip->write_buf(mtd, oob, chip->ecc.postpad);
653 i = mtd->oobsize - (oob - chip->oob_poi);
655 chip->write_buf(mtd, oob, i);
659 static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat, argument
662 struct nand_chip *nand_chip = mtd_to_nand(mtd);
665 int subpages = mtd->writesize / nand_chip->subpagesize;
679 mtd->writesize / nand_chip->subpagesize
698 static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat, argument
701 struct nand_chip *nand_chip = mtd_to_nand(mtd);
720 static int mxc_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, argument
727 static u_char mxc_nand_read_byte(struct mtd_info *mtd) argument
729 struct nand_chip *nand_chip = mtd_to_nand(mtd);
767 static uint16_t mxc_nand_read_word(struct mtd_info *mtd) argument
769 struct nand_chip *nand_chip = mtd_to_nand(mtd);
778 if (col < mtd->writesize && host->spare_only)
779 col += mtd->writesize;
781 if (col < mtd->writesize) {
786 ((col - mtd->writesize) >> 1));
817 static void mxc_nand_write_buf(struct mtd_info *mtd, argument
820 struct nand_chip *nand_chip = mtd_to_nand(mtd);
830 if (col < mtd->writesize && host->spare_only)
831 col += mtd->writesize;
833 n = mtd->writesize + mtd->oobsize - col;
841 if (col < mtd->writesize) {
845 mtd->writesize + (col & ~3);
864 int m = mtd->writesize - col;
866 if (col >= mtd->writesize)
867 m += mtd->oobsize;
889 static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) argument
891 struct nand_chip *nand_chip = mtd_to_nand(mtd);
901 if (col < mtd->writesize && host->spare_only)
902 col += mtd->writesize;
904 n = mtd->writesize + mtd->oobsize - col;
910 if (col < mtd->writesize) {
914 mtd->writesize + (col & ~3);
928 int m = mtd->writesize - col;
930 if (col >= mtd->writesize)
931 m += mtd->oobsize;
949 static void mxc_nand_select_chip(struct mtd_info *mtd, int chip) argument
951 struct nand_chip *nand_chip = mtd_to_nand(mtd);
975 void mxc_nand_command(struct mtd_info *mtd, unsigned command, argument
978 struct nand_chip *nand_chip = mtd_to_nand(mtd);
1009 if (column >= mtd->writesize) {
1019 mxc_nand_command(mtd, NAND_CMD_READ0, 0,
1023 host->col_addr = column - mtd->writesize;
1147 struct mtd_info *mtd; local
1159 mtd = &this->mtd;
1207 _mxc_nand_enable_hwecc(mtd, 1);
1211 _mxc_nand_enable_hwecc(mtd, 0);
1214 this->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);