Lines Matching refs:mtd
103 static int cafe_device_ready(struct mtd_info *mtd) in cafe_device_ready() argument
105 struct cafe_priv *cafe = mtd->priv; in cafe_device_ready()
119 static void cafe_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) in cafe_write_buf() argument
121 struct cafe_priv *cafe = mtd->priv; in cafe_write_buf()
134 static void cafe_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) in cafe_read_buf() argument
136 struct cafe_priv *cafe = mtd->priv; in cafe_read_buf()
148 static uint8_t cafe_read_byte(struct mtd_info *mtd) in cafe_read_byte() argument
150 struct cafe_priv *cafe = mtd->priv; in cafe_read_byte()
153 cafe_read_buf(mtd, &d, 1); in cafe_read_byte()
159 static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, in cafe_nand_cmdfunc() argument
162 struct cafe_priv *cafe = mtd->priv; in cafe_nand_cmdfunc()
183 if (mtd->writesize > 512 && in cafe_nand_cmdfunc()
185 column += mtd->writesize; in cafe_nand_cmdfunc()
203 if (mtd->size > mtd->writesize << 16) in cafe_nand_cmdfunc()
223 cafe->datalen = mtd->writesize + mtd->oobsize - column; in cafe_nand_cmdfunc()
242 else if (command == NAND_CMD_READ0 && mtd->writesize > 512) in cafe_nand_cmdfunc()
317 nand_wait_ready(mtd); in cafe_nand_cmdfunc()
321 static void cafe_select_chip(struct mtd_info *mtd, int chipnr) in cafe_select_chip() argument
323 struct cafe_priv *cafe = mtd->priv; in cafe_select_chip()
337 struct mtd_info *mtd = id; in cafe_nand_interrupt() local
338 struct cafe_priv *cafe = mtd->priv; in cafe_nand_interrupt()
348 static void cafe_nand_bug(struct mtd_info *mtd) in cafe_nand_bug() argument
353 static int cafe_nand_write_oob(struct mtd_info *mtd, in cafe_nand_write_oob() argument
358 chip->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize, page); in cafe_nand_write_oob()
359 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); in cafe_nand_write_oob()
360 chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1); in cafe_nand_write_oob()
361 status = chip->waitfunc(mtd, chip); in cafe_nand_write_oob()
367 static int cafe_nand_read_oob(struct mtd_info *mtd, struct nand_chip *chip, in cafe_nand_read_oob() argument
370 chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); in cafe_nand_read_oob()
371 chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); in cafe_nand_read_oob()
383 static int cafe_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip, in cafe_nand_read_page() argument
386 struct cafe_priv *cafe = mtd->priv; in cafe_nand_read_page()
392 chip->read_buf(mtd, buf, mtd->writesize); in cafe_nand_read_page()
393 chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); in cafe_nand_read_page()
449 mtd->ecc_stats.failed++; in cafe_nand_read_page()
452 mtd->ecc_stats.corrected += n; in cafe_nand_read_page()
521 static void cafe_nand_write_page_lowlevel(struct mtd_info *mtd, in cafe_nand_write_page_lowlevel() argument
524 struct cafe_priv *cafe = mtd->priv; in cafe_nand_write_page_lowlevel()
526 chip->write_buf(mtd, buf, mtd->writesize); in cafe_nand_write_page_lowlevel()
527 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); in cafe_nand_write_page_lowlevel()
533 static int cafe_nand_write_page(struct mtd_info *mtd, struct nand_chip *chip, in cafe_nand_write_page() argument
538 chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page); in cafe_nand_write_page()
541 chip->ecc.write_page_raw(mtd, chip, buf); in cafe_nand_write_page()
543 chip->ecc.write_page(mtd, chip, buf); in cafe_nand_write_page()
553 chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1); in cafe_nand_write_page()
554 status = chip->waitfunc(mtd, chip); in cafe_nand_write_page()
560 status = chip->errstat(mtd, chip, FL_WRITING, status, in cafe_nand_write_page()
566 chip->cmdfunc(mtd, NAND_CMD_CACHEDPROG, -1, -1); in cafe_nand_write_page()
567 status = chip->waitfunc(mtd, chip); in cafe_nand_write_page()
572 chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); in cafe_nand_write_page()
574 if (chip->verify_buf(mtd, buf, mtd->writesize)) in cafe_nand_write_page()
580 static int cafe_nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip) in cafe_nand_block_bad() argument
630 struct mtd_info *mtd; in cafe_nand_probe() local
650 mtd = kzalloc(sizeof(*mtd) + sizeof(struct cafe_priv), GFP_KERNEL); in cafe_nand_probe()
651 if (!mtd) { in cafe_nand_probe()
655 cafe = (void *)(&mtd[1]); in cafe_nand_probe()
657 mtd->priv = cafe; in cafe_nand_probe()
658 mtd->owner = THIS_MODULE; in cafe_nand_probe()
729 "CAFE NAND", mtd); in cafe_nand_probe()
763 if (nand_scan_ident(mtd, 2)) { in cafe_nand_probe()
769 if (mtd->writesize == 2048) in cafe_nand_probe()
773 if (mtd->writesize == 2048) { in cafe_nand_probe()
777 } else if (mtd->writesize == 512) { in cafe_nand_probe()
783 mtd->writesize); in cafe_nand_probe()
787 cafe->nand.ecc.size = mtd->writesize; in cafe_nand_probe()
798 err = nand_scan_tail(mtd); in cafe_nand_probe()
802 pci_set_drvdata(pdev, mtd); in cafe_nand_probe()
805 add_mtd_device(mtd); in cafe_nand_probe()
809 mtd->name = "cafe_nand"; in cafe_nand_probe()
811 nr_parts = parse_mtd_partitions(mtd, part_probes, &parts, 0); in cafe_nand_probe()
815 add_mtd_partitions(mtd, parts, nr_parts); in cafe_nand_probe()
823 free_irq(pdev->irq, mtd); in cafe_nand_probe()
829 kfree(mtd); in cafe_nand_probe()
836 struct mtd_info *mtd = pci_get_drvdata(pdev); in cafe_nand_remove() local
837 struct cafe_priv *cafe = mtd->priv; in cafe_nand_remove()
839 del_mtd_device(mtd); in cafe_nand_remove()
842 free_irq(pdev->irq, mtd); in cafe_nand_remove()
843 nand_release(mtd); in cafe_nand_remove()
847 kfree(mtd); in cafe_nand_remove()
861 struct mtd_info *mtd = pci_get_drvdata(pdev); in cafe_nand_resume() local
862 struct cafe_priv *cafe = mtd->priv; in cafe_nand_resume()