Lines Matching refs:mtd
155 struct mtd_info mtd; member
248 static void omap_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) in omap_hwcontrol() argument
250 struct omap_nand_info *info = container_of(mtd, in omap_hwcontrol()
251 struct omap_nand_info, mtd); in omap_hwcontrol()
271 static void omap_read_buf8(struct mtd_info *mtd, u_char *buf, int len) in omap_read_buf8() argument
273 struct nand_chip *nand = mtd->priv; in omap_read_buf8()
284 static void omap_write_buf8(struct mtd_info *mtd, const u_char *buf, int len) in omap_write_buf8() argument
286 struct omap_nand_info *info = container_of(mtd, in omap_write_buf8()
287 struct omap_nand_info, mtd); in omap_write_buf8()
307 static void omap_read_buf16(struct mtd_info *mtd, u_char *buf, int len) in omap_read_buf16() argument
309 struct nand_chip *nand = mtd->priv; in omap_read_buf16()
320 static void omap_write_buf16(struct mtd_info *mtd, const u_char * buf, int len) in omap_write_buf16() argument
322 struct omap_nand_info *info = container_of(mtd, in omap_write_buf16()
323 struct omap_nand_info, mtd); in omap_write_buf16()
345 static void omap_read_buf_pref(struct mtd_info *mtd, u_char *buf, int len) in omap_read_buf_pref() argument
347 struct omap_nand_info *info = container_of(mtd, in omap_read_buf_pref()
348 struct omap_nand_info, mtd); in omap_read_buf_pref()
356 omap_read_buf16(mtd, buf, len % 4); in omap_read_buf_pref()
358 omap_read_buf8(mtd, buf, len % 4); in omap_read_buf_pref()
369 omap_read_buf16(mtd, (u_char *)p, len); in omap_read_buf_pref()
371 omap_read_buf8(mtd, (u_char *)p, len); in omap_read_buf_pref()
392 static void omap_write_buf_pref(struct mtd_info *mtd, in omap_write_buf_pref() argument
395 struct omap_nand_info *info = container_of(mtd, in omap_write_buf_pref()
396 struct omap_nand_info, mtd); in omap_write_buf_pref()
416 omap_write_buf16(mtd, (u_char *)p, len); in omap_write_buf_pref()
418 omap_write_buf8(mtd, (u_char *)p, len); in omap_write_buf_pref()
458 static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr, in omap_nand_dma_transfer() argument
461 struct omap_nand_info *info = container_of(mtd, in omap_nand_dma_transfer()
462 struct omap_nand_info, mtd); in omap_nand_dma_transfer()
533 is_write == 0 ? omap_read_buf16(mtd, (u_char *) addr, len) in omap_nand_dma_transfer()
534 : omap_write_buf16(mtd, (u_char *) addr, len); in omap_nand_dma_transfer()
536 is_write == 0 ? omap_read_buf8(mtd, (u_char *) addr, len) in omap_nand_dma_transfer()
537 : omap_write_buf8(mtd, (u_char *) addr, len); in omap_nand_dma_transfer()
547 static void omap_read_buf_dma_pref(struct mtd_info *mtd, u_char *buf, int len) in omap_read_buf_dma_pref() argument
549 if (len <= mtd->oobsize) in omap_read_buf_dma_pref()
550 omap_read_buf_pref(mtd, buf, len); in omap_read_buf_dma_pref()
553 omap_nand_dma_transfer(mtd, buf, len, 0x0); in omap_read_buf_dma_pref()
562 static void omap_write_buf_dma_pref(struct mtd_info *mtd, in omap_write_buf_dma_pref() argument
565 if (len <= mtd->oobsize) in omap_write_buf_dma_pref()
566 omap_write_buf_pref(mtd, buf, len); in omap_write_buf_dma_pref()
569 omap_nand_dma_transfer(mtd, (u_char *) buf, len, 0x1); in omap_write_buf_dma_pref()
624 static void omap_read_buf_irq_pref(struct mtd_info *mtd, u_char *buf, int len) in omap_read_buf_irq_pref() argument
626 struct omap_nand_info *info = container_of(mtd, in omap_read_buf_irq_pref()
627 struct omap_nand_info, mtd); in omap_read_buf_irq_pref()
630 if (len <= mtd->oobsize) { in omap_read_buf_irq_pref()
631 omap_read_buf_pref(mtd, buf, len); in omap_read_buf_irq_pref()
660 omap_read_buf16(mtd, buf, len); in omap_read_buf_irq_pref()
662 omap_read_buf8(mtd, buf, len); in omap_read_buf_irq_pref()
671 static void omap_write_buf_irq_pref(struct mtd_info *mtd, in omap_write_buf_irq_pref() argument
674 struct omap_nand_info *info = container_of(mtd, in omap_write_buf_irq_pref()
675 struct omap_nand_info, mtd); in omap_write_buf_irq_pref()
680 if (len <= mtd->oobsize) { in omap_write_buf_irq_pref()
681 omap_write_buf_pref(mtd, buf, len); in omap_write_buf_irq_pref()
719 omap_write_buf16(mtd, buf, len); in omap_write_buf_irq_pref()
721 omap_write_buf8(mtd, buf, len); in omap_write_buf_irq_pref()
886 static int omap_correct_data(struct mtd_info *mtd, u_char *dat, in omap_correct_data() argument
889 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, in omap_correct_data()
890 mtd); in omap_correct_data()
928 static int omap_calculate_ecc(struct mtd_info *mtd, const u_char *dat, in omap_calculate_ecc() argument
931 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, in omap_calculate_ecc()
932 mtd); in omap_calculate_ecc()
954 static void omap_enable_hwecc(struct mtd_info *mtd, int mode) in omap_enable_hwecc() argument
956 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, in omap_enable_hwecc()
957 mtd); in omap_enable_hwecc()
958 struct nand_chip *chip = mtd->priv; in omap_enable_hwecc()
1002 static int omap_wait(struct mtd_info *mtd, struct nand_chip *chip) in omap_wait() argument
1004 struct nand_chip *this = mtd->priv; in omap_wait()
1005 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, in omap_wait()
1006 mtd); in omap_wait()
1031 static int omap_dev_ready(struct mtd_info *mtd) in omap_dev_ready() argument
1034 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, in omap_dev_ready()
1035 mtd); in omap_dev_ready()
1057 static void __maybe_unused omap_enable_hwecc_bch(struct mtd_info *mtd, int mode) in omap_enable_hwecc_bch() argument
1061 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, in omap_enable_hwecc_bch()
1062 mtd); in omap_enable_hwecc_bch()
1064 struct nand_chip *chip = mtd->priv; in omap_enable_hwecc_bch()
1162 static int __maybe_unused omap_calculate_ecc_bch(struct mtd_info *mtd, in omap_calculate_ecc_bch() argument
1165 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, in omap_calculate_ecc_bch()
1166 mtd); in omap_calculate_ecc_bch()
1334 static int omap_elm_correct_data(struct mtd_info *mtd, u_char *data, in omap_elm_correct_data() argument
1337 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, in omap_elm_correct_data()
1338 mtd); in omap_elm_correct_data()
1507 static int omap_write_page_bch(struct mtd_info *mtd, struct nand_chip *chip, in omap_write_page_bch() argument
1515 chip->ecc.hwctl(mtd, NAND_ECC_WRITE); in omap_write_page_bch()
1518 chip->write_buf(mtd, buf, mtd->writesize); in omap_write_page_bch()
1521 chip->ecc.calculate(mtd, buf, &ecc_calc[0]); in omap_write_page_bch()
1527 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); in omap_write_page_bch()
1546 static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, in omap_read_page_bch() argument
1553 uint32_t oob_pos = mtd->writesize + chip->ecc.layout->eccpos[0]; in omap_read_page_bch()
1558 chip->ecc.hwctl(mtd, NAND_ECC_READ); in omap_read_page_bch()
1561 chip->read_buf(mtd, buf, mtd->writesize); in omap_read_page_bch()
1564 chip->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_pos, -1); in omap_read_page_bch()
1565 chip->read_buf(mtd, oob, chip->ecc.total); in omap_read_page_bch()
1568 chip->ecc.calculate(mtd, buf, ecc_calc); in omap_read_page_bch()
1572 stat = chip->ecc.correct(mtd, buf, ecc_code, ecc_calc); in omap_read_page_bch()
1575 mtd->ecc_stats.failed++; in omap_read_page_bch()
1577 mtd->ecc_stats.corrected += stat; in omap_read_page_bch()
1657 struct mtd_info *mtd; in omap_nand_probe() local
1686 mtd = &info->mtd; in omap_nand_probe()
1687 mtd->priv = &info->nand; in omap_nand_probe()
1688 mtd->dev.parent = &pdev->dev; in omap_nand_probe()
1726 if (nand_scan_ident(mtd, 1, NULL)) { in omap_nand_probe()
1841 (mtd->writesize / in omap_nand_probe()
1865 (mtd->writesize / in omap_nand_probe()
1877 nand_chip->ecc.priv = nand_bch_init(mtd, in omap_nand_probe()
1902 (mtd->writesize / in omap_nand_probe()
1912 info->mtd.writesize / nand_chip->ecc.size, in omap_nand_probe()
1929 (mtd->writesize / in omap_nand_probe()
1941 nand_chip->ecc.priv = nand_bch_init(mtd, in omap_nand_probe()
1966 info->mtd.writesize / nand_chip->ecc.size, in omap_nand_probe()
1973 (mtd->writesize / in omap_nand_probe()
1996 info->mtd.writesize / nand_chip->ecc.size, in omap_nand_probe()
2003 (mtd->writesize / in omap_nand_probe()
2022 ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset; in omap_nand_probe()
2024 if (mtd->oobsize < (ecclayout->eccbytes + BADBLOCK_MARKER_LENGTH)) { in omap_nand_probe()
2027 ecclayout->eccbytes, mtd->oobsize); in omap_nand_probe()
2035 if (nand_scan_tail(mtd)) { in omap_nand_probe()
2041 mtd_device_parse_register(mtd, NULL, &ppdata, pdata->parts, in omap_nand_probe()
2044 platform_set_drvdata(pdev, mtd); in omap_nand_probe()
2060 struct mtd_info *mtd = platform_get_drvdata(pdev); in omap_nand_remove() local
2061 struct nand_chip *nand_chip = mtd->priv; in omap_nand_remove()
2062 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, in omap_nand_remove()
2063 mtd); in omap_nand_remove()
2070 nand_release(mtd); in omap_nand_remove()