Lines Matching refs:mtd
112 static int bootrom_ooblayout_ecc(struct mtd_info *mtd, int section, in bootrom_ooblayout_ecc() argument
124 static int bootrom_ooblayout_free(struct mtd_info *mtd, int section, in bootrom_ooblayout_free() argument
165 static struct bf5xx_nand_info *mtd_to_nand_info(struct mtd_info *mtd) in mtd_to_nand_info() argument
167 return container_of(mtd_to_nand(mtd), struct bf5xx_nand_info, in mtd_to_nand_info()
190 static void bf5xx_nand_hwcontrol(struct mtd_info *mtd, int cmd, in bf5xx_nand_hwcontrol() argument
211 static int bf5xx_nand_devready(struct mtd_info *mtd) in bf5xx_nand_devready() argument
230 static int bf5xx_nand_correct_data_256(struct mtd_info *mtd, u_char *dat, in bf5xx_nand_correct_data_256() argument
233 struct bf5xx_nand_info *info = mtd_to_nand_info(mtd); in bf5xx_nand_correct_data_256()
309 static int bf5xx_nand_correct_data(struct mtd_info *mtd, u_char *dat, in bf5xx_nand_correct_data() argument
312 struct nand_chip *chip = mtd_to_nand(mtd); in bf5xx_nand_correct_data()
315 ret = bf5xx_nand_correct_data_256(mtd, dat, read_ecc, calc_ecc); in bf5xx_nand_correct_data()
326 ret = bf5xx_nand_correct_data_256(mtd, dat, read_ecc, calc_ecc); in bf5xx_nand_correct_data()
336 static void bf5xx_nand_enable_hwecc(struct mtd_info *mtd, int mode) in bf5xx_nand_enable_hwecc() argument
341 static int bf5xx_nand_calculate_ecc(struct mtd_info *mtd, in bf5xx_nand_calculate_ecc() argument
344 struct bf5xx_nand_info *info = mtd_to_nand_info(mtd); in bf5xx_nand_calculate_ecc()
345 struct nand_chip *chip = mtd_to_nand(mtd); in bf5xx_nand_calculate_ecc()
381 static void bf5xx_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) in bf5xx_nand_read_buf() argument
410 static uint8_t bf5xx_nand_read_byte(struct mtd_info *mtd) in bf5xx_nand_read_byte() argument
414 bf5xx_nand_read_buf(mtd, &val, 1); in bf5xx_nand_read_byte()
419 static void bf5xx_nand_write_buf(struct mtd_info *mtd, in bf5xx_nand_write_buf() argument
433 static void bf5xx_nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len) in bf5xx_nand_read_buf16() argument
451 static void bf5xx_nand_write_buf16(struct mtd_info *mtd, in bf5xx_nand_write_buf16() argument
478 static void bf5xx_nand_dma_rw(struct mtd_info *mtd, in bf5xx_nand_dma_rw() argument
481 struct bf5xx_nand_info *info = mtd_to_nand_info(mtd); in bf5xx_nand_dma_rw()
482 struct nand_chip *chip = mtd_to_nand(mtd); in bf5xx_nand_dma_rw()
486 mtd, buf, is_read); in bf5xx_nand_dma_rw()
544 static void bf5xx_nand_dma_read_buf(struct mtd_info *mtd, in bf5xx_nand_dma_read_buf() argument
547 struct bf5xx_nand_info *info = mtd_to_nand_info(mtd); in bf5xx_nand_dma_read_buf()
548 struct nand_chip *chip = mtd_to_nand(mtd); in bf5xx_nand_dma_read_buf()
550 dev_dbg(info->device, "mtd->%p, buf->%p, int %d\n", mtd, buf, len); in bf5xx_nand_dma_read_buf()
553 bf5xx_nand_dma_rw(mtd, buf, 1); in bf5xx_nand_dma_read_buf()
555 bf5xx_nand_read_buf(mtd, buf, len); in bf5xx_nand_dma_read_buf()
558 static void bf5xx_nand_dma_write_buf(struct mtd_info *mtd, in bf5xx_nand_dma_write_buf() argument
561 struct bf5xx_nand_info *info = mtd_to_nand_info(mtd); in bf5xx_nand_dma_write_buf()
562 struct nand_chip *chip = mtd_to_nand(mtd); in bf5xx_nand_dma_write_buf()
564 dev_dbg(info->device, "mtd->%p, buf->%p, len %d\n", mtd, buf, len); in bf5xx_nand_dma_write_buf()
567 bf5xx_nand_dma_rw(mtd, (uint8_t *)buf, 0); in bf5xx_nand_dma_write_buf()
569 bf5xx_nand_write_buf(mtd, buf, len); in bf5xx_nand_dma_write_buf()
572 static int bf5xx_nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, in bf5xx_nand_read_page_raw() argument
575 bf5xx_nand_read_buf(mtd, buf, mtd->writesize); in bf5xx_nand_read_page_raw()
576 bf5xx_nand_read_buf(mtd, chip->oob_poi, mtd->oobsize); in bf5xx_nand_read_page_raw()
581 static int bf5xx_nand_write_page_raw(struct mtd_info *mtd, in bf5xx_nand_write_page_raw() argument
585 bf5xx_nand_write_buf(mtd, buf, mtd->writesize); in bf5xx_nand_write_page_raw()
586 bf5xx_nand_write_buf(mtd, chip->oob_poi, mtd->oobsize); in bf5xx_nand_write_page_raw()
676 struct mtd_info *mtd = nand_to_mtd(&info->chip); in bf5xx_nand_add_partition() local
680 return mtd_device_register(mtd, parts, nr); in bf5xx_nand_add_partition()
699 static int bf5xx_nand_scan(struct mtd_info *mtd) in bf5xx_nand_scan() argument
701 struct nand_chip *chip = mtd_to_nand(mtd); in bf5xx_nand_scan()
704 ret = nand_scan_ident(mtd, 1, NULL); in bf5xx_nand_scan()
712 if (likely(mtd->writesize >= 512)) { in bf5xx_nand_scan()
725 return nand_scan_tail(mtd); in bf5xx_nand_scan()
741 struct mtd_info *mtd = NULL; in bf5xx_nand_probe() local
771 mtd = nand_to_mtd(&info->chip); in bf5xx_nand_probe()
788 nand_set_controller_data(chip, mtd); in bf5xx_nand_probe()
797 mtd->dev.parent = &pdev->dev; in bf5xx_nand_probe()
807 mtd_set_ooblayout(mtd, &bootrom_ooblayout_ops); in bf5xx_nand_probe()
823 if (bf5xx_nand_scan(mtd)) { in bf5xx_nand_probe()