Lines Matching refs:mtd
192 static void set_addr(struct mtd_info *mtd, int column, int page_addr) in set_addr() argument
194 struct sh_flctl *flctl = mtd_to_flctl(mtd); in set_addr()
500 static void set_cmd_regs(struct mtd_info *mtd, uint32_t cmd, uint32_t flcmcdr_val) in set_cmd_regs() argument
502 struct sh_flctl *flctl = mtd_to_flctl(mtd); in set_cmd_regs()
562 static int flctl_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, in flctl_read_page_hwecc() argument
565 chip->read_buf(mtd, buf, mtd->writesize); in flctl_read_page_hwecc()
567 chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); in flctl_read_page_hwecc()
571 static int flctl_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, in flctl_write_page_hwecc() argument
575 chip->write_buf(mtd, buf, mtd->writesize); in flctl_write_page_hwecc()
576 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); in flctl_write_page_hwecc()
580 static void execmd_read_page_sector(struct mtd_info *mtd, int page_addr) in execmd_read_page_sector() argument
582 struct sh_flctl *flctl = mtd_to_flctl(mtd); in execmd_read_page_sector()
588 set_cmd_regs(mtd, NAND_CMD_READ0, in execmd_read_page_sector()
603 &flctl->done_buff[mtd->writesize + 16 * sector], in execmd_read_page_sector()
610 flctl->mtd.ecc_stats.corrected++; in execmd_read_page_sector()
616 flctl->mtd.ecc_stats.failed++; in execmd_read_page_sector()
629 static void execmd_read_oob(struct mtd_info *mtd, int page_addr) in execmd_read_oob() argument
631 struct sh_flctl *flctl = mtd_to_flctl(mtd); in execmd_read_oob()
635 set_cmd_regs(mtd, NAND_CMD_READ0, in execmd_read_oob()
641 set_addr(mtd, (512 + 16) * i + 512 , page_addr); in execmd_read_oob()
650 static void execmd_write_page_sector(struct mtd_info *mtd) in execmd_write_page_sector() argument
652 struct sh_flctl *flctl = mtd_to_flctl(mtd); in execmd_write_page_sector()
658 set_cmd_regs(mtd, NAND_CMD_PAGEPROG, in execmd_write_page_sector()
669 write_ec_fiforeg(flctl, 16, mtd->writesize + 16 * sector); in execmd_write_page_sector()
676 static void execmd_write_oob(struct mtd_info *mtd) in execmd_write_oob() argument
678 struct sh_flctl *flctl = mtd_to_flctl(mtd); in execmd_write_oob()
684 set_cmd_regs(mtd, NAND_CMD_PAGEPROG, in execmd_write_oob()
689 set_addr(mtd, sector * 528 + 512, page_addr); in execmd_write_oob()
698 static void flctl_cmdfunc(struct mtd_info *mtd, unsigned int command, in flctl_cmdfunc() argument
701 struct sh_flctl *flctl = mtd_to_flctl(mtd); in flctl_cmdfunc()
715 execmd_read_page_sector(mtd, page_addr); in flctl_cmdfunc()
719 set_cmd_regs(mtd, command, (NAND_CMD_READSTART << 8) in flctl_cmdfunc()
722 set_cmd_regs(mtd, command, command); in flctl_cmdfunc()
724 set_addr(mtd, 0, page_addr); in flctl_cmdfunc()
726 flctl->read_bytes = mtd->writesize + mtd->oobsize; in flctl_cmdfunc()
735 execmd_read_oob(mtd, page_addr); in flctl_cmdfunc()
740 set_cmd_regs(mtd, command, (NAND_CMD_READSTART << 8) in flctl_cmdfunc()
742 set_addr(mtd, mtd->writesize, page_addr); in flctl_cmdfunc()
744 set_cmd_regs(mtd, command, command); in flctl_cmdfunc()
745 set_addr(mtd, 0, page_addr); in flctl_cmdfunc()
747 flctl->read_bytes = mtd->oobsize; in flctl_cmdfunc()
755 set_cmd_regs(mtd, command, (NAND_CMD_RNDOUTSTART << 8) in flctl_cmdfunc()
758 set_cmd_regs(mtd, command, command); in flctl_cmdfunc()
760 set_addr(mtd, column, 0); in flctl_cmdfunc()
762 flctl->read_bytes = mtd->writesize + mtd->oobsize - column; in flctl_cmdfunc()
766 set_cmd_regs(mtd, command, command); in flctl_cmdfunc()
771 set_addr(mtd, column, 0); in flctl_cmdfunc()
786 set_cmd_regs(mtd, NAND_CMD_ERASE1, in flctl_cmdfunc()
788 set_addr(mtd, -1, flctl->erase1_page_addr); in flctl_cmdfunc()
796 if (column >= mtd->writesize) { in flctl_cmdfunc()
797 column -= mtd->writesize; in flctl_cmdfunc()
814 set_cmd_regs(mtd, NAND_CMD_SEQIN, in flctl_cmdfunc()
816 set_addr(mtd, -1, -1); in flctl_cmdfunc()
823 if (flctl->seqin_column == mtd->writesize) in flctl_cmdfunc()
824 execmd_write_oob(mtd); in flctl_cmdfunc()
826 execmd_write_page_sector(mtd); in flctl_cmdfunc()
831 set_cmd_regs(mtd, command, (command << 8) | NAND_CMD_SEQIN); in flctl_cmdfunc()
832 set_addr(mtd, flctl->seqin_column, flctl->seqin_page_addr); in flctl_cmdfunc()
840 set_cmd_regs(mtd, command, command); in flctl_cmdfunc()
841 set_addr(mtd, -1, -1); in flctl_cmdfunc()
850 set_cmd_regs(mtd, command, command); in flctl_cmdfunc()
851 set_addr(mtd, -1, -1); in flctl_cmdfunc()
874 static void flctl_select_chip(struct mtd_info *mtd, int chipnr) in flctl_select_chip() argument
876 struct sh_flctl *flctl = mtd_to_flctl(mtd); in flctl_select_chip()
918 static void flctl_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) in flctl_write_buf() argument
920 struct sh_flctl *flctl = mtd_to_flctl(mtd); in flctl_write_buf()
926 static uint8_t flctl_read_byte(struct mtd_info *mtd) in flctl_read_byte() argument
928 struct sh_flctl *flctl = mtd_to_flctl(mtd); in flctl_read_byte()
936 static uint16_t flctl_read_word(struct mtd_info *mtd) in flctl_read_word() argument
938 struct sh_flctl *flctl = mtd_to_flctl(mtd); in flctl_read_word()
945 static void flctl_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) in flctl_read_buf() argument
947 struct sh_flctl *flctl = mtd_to_flctl(mtd); in flctl_read_buf()
953 static int flctl_chip_init_tail(struct mtd_info *mtd) in flctl_chip_init_tail() argument
955 struct sh_flctl *flctl = mtd_to_flctl(mtd); in flctl_chip_init_tail()
958 if (mtd->writesize == 512) { in flctl_chip_init_tail()
989 if (mtd->writesize == 512) { in flctl_chip_init_tail()
1124 flctl_mtd = &flctl->mtd; in flctl_probe()
1183 nand_release(&flctl->mtd); in flctl_remove()