Lines Matching refs:mtd

88 static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd,
90 static void doc200x_select_chip(struct mtd_info *mtd, int chip);
297 static void doc2000_write_byte(struct mtd_info *mtd, u_char datum) in doc2000_write_byte() argument
299 struct nand_chip *this = mtd->priv; in doc2000_write_byte()
309 static u_char doc2000_read_byte(struct mtd_info *mtd) in doc2000_read_byte() argument
311 struct nand_chip *this = mtd->priv; in doc2000_read_byte()
324 static void doc2000_writebuf(struct mtd_info *mtd, const u_char *buf, int len) in doc2000_writebuf() argument
326 struct nand_chip *this = mtd->priv; in doc2000_writebuf()
341 static void doc2000_readbuf(struct mtd_info *mtd, u_char *buf, int len) in doc2000_readbuf() argument
343 struct nand_chip *this = mtd->priv; in doc2000_readbuf()
356 static void doc2000_readbuf_dword(struct mtd_info *mtd, u_char *buf, int len) in doc2000_readbuf_dword() argument
358 struct nand_chip *this = mtd->priv; in doc2000_readbuf_dword()
377 static uint16_t __init doc200x_ident_chip(struct mtd_info *mtd, int nr) in doc200x_ident_chip() argument
379 struct nand_chip *this = mtd->priv; in doc200x_ident_chip()
383 doc200x_select_chip(mtd, nr); in doc200x_ident_chip()
384 doc200x_hwcontrol(mtd, NAND_CMD_READID, in doc200x_ident_chip()
386 doc200x_hwcontrol(mtd, 0, NAND_CTRL_ALE | NAND_CTRL_CHANGE); in doc200x_ident_chip()
387 doc200x_hwcontrol(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); in doc200x_ident_chip()
394 ret = this->read_byte(mtd) << 8; in doc200x_ident_chip()
395 ret |= this->read_byte(mtd); in doc200x_ident_chip()
405 doc200x_hwcontrol(mtd, NAND_CMD_READID, in doc200x_ident_chip()
407 doc200x_hwcontrol(mtd, 0, NAND_CTRL_ALE | NAND_CTRL_CHANGE); in doc200x_ident_chip()
408 doc200x_hwcontrol(mtd, NAND_CMD_NONE, in doc200x_ident_chip()
423 static void __init doc2000_count_chips(struct mtd_info *mtd) in doc2000_count_chips() argument
425 struct nand_chip *this = mtd->priv; in doc2000_count_chips()
434 mfrid = doc200x_ident_chip(mtd, 0); in doc2000_count_chips()
438 if (doc200x_ident_chip(mtd, i) != mfrid) in doc2000_count_chips()
445 static int doc200x_wait(struct mtd_info *mtd, struct nand_chip *this) in doc200x_wait() argument
452 this->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1); in doc200x_wait()
454 status = (int)this->read_byte(mtd); in doc200x_wait()
459 static void doc2001_write_byte(struct mtd_info *mtd, u_char datum) in doc2001_write_byte() argument
461 struct nand_chip *this = mtd->priv; in doc2001_write_byte()
470 static u_char doc2001_read_byte(struct mtd_info *mtd) in doc2001_read_byte() argument
472 struct nand_chip *this = mtd->priv; in doc2001_read_byte()
484 static void doc2001_writebuf(struct mtd_info *mtd, const u_char *buf, int len) in doc2001_writebuf() argument
486 struct nand_chip *this = mtd->priv; in doc2001_writebuf()
497 static void doc2001_readbuf(struct mtd_info *mtd, u_char *buf, int len) in doc2001_readbuf() argument
499 struct nand_chip *this = mtd->priv; in doc2001_readbuf()
514 static u_char doc2001plus_read_byte(struct mtd_info *mtd) in doc2001plus_read_byte() argument
516 struct nand_chip *this = mtd->priv; in doc2001plus_read_byte()
529 static void doc2001plus_writebuf(struct mtd_info *mtd, const u_char *buf, int len) in doc2001plus_writebuf() argument
531 struct nand_chip *this = mtd->priv; in doc2001plus_writebuf()
547 static void doc2001plus_readbuf(struct mtd_info *mtd, u_char *buf, int len) in doc2001plus_readbuf() argument
549 struct nand_chip *this = mtd->priv; in doc2001plus_readbuf()
578 static void doc2001plus_select_chip(struct mtd_info *mtd, int chip) in doc2001plus_select_chip() argument
580 struct nand_chip *this = mtd->priv; in doc2001plus_select_chip()
599 this->cmdfunc(mtd, NAND_CMD_RESET, -1, -1); in doc2001plus_select_chip()
605 static void doc200x_select_chip(struct mtd_info *mtd, int chip) in doc200x_select_chip() argument
607 struct nand_chip *this = mtd->priv; in doc200x_select_chip()
622 doc200x_hwcontrol(mtd, NAND_CMD_NONE, 0 | NAND_CTRL_CHANGE); in doc200x_select_chip()
627 doc200x_hwcontrol(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); in doc200x_select_chip()
635 static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd, in doc200x_hwcontrol() argument
638 struct nand_chip *this = mtd->priv; in doc200x_hwcontrol()
653 doc2000_write_byte(mtd, cmd); in doc200x_hwcontrol()
655 doc2001_write_byte(mtd, cmd); in doc200x_hwcontrol()
659 static void doc2001plus_command(struct mtd_info *mtd, unsigned command, int column, int page_addr) in doc2001plus_command() argument
661 struct nand_chip *this = mtd->priv; in doc2001plus_command()
680 if (column >= mtd->writesize) { in doc2001plus_command()
682 column -= mtd->writesize; in doc2001plus_command()
743 while (!(this->read_byte(mtd) & 0x40)) ; in doc2001plus_command()
762 while (!this->dev_ready(mtd)) ; in doc2001plus_command()
765 static int doc200x_dev_ready(struct mtd_info *mtd) in doc200x_dev_ready() argument
767 struct nand_chip *this = mtd->priv; in doc200x_dev_ready()
798 static int doc200x_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip) in doc200x_block_bad() argument
805 static void doc200x_enable_hwecc(struct mtd_info *mtd, int mode) in doc200x_enable_hwecc() argument
807 struct nand_chip *this = mtd->priv; in doc200x_enable_hwecc()
824 static void doc2001plus_enable_hwecc(struct mtd_info *mtd, int mode) in doc2001plus_enable_hwecc() argument
826 struct nand_chip *this = mtd->priv; in doc2001plus_enable_hwecc()
844 static int doc200x_calculate_ecc(struct mtd_info *mtd, const u_char *dat, unsigned char *ecc_code) in doc200x_calculate_ecc() argument
846 struct nand_chip *this = mtd->priv; in doc200x_calculate_ecc()
903 static int doc200x_correct_data(struct mtd_info *mtd, u_char *dat, in doc200x_correct_data() argument
907 struct nand_chip *this = mtd->priv; in doc200x_correct_data()
1005 static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const char *id, int findmir… in find_media_headers() argument
1007 struct nand_chip *this = mtd->priv; in find_media_headers()
1013 for (offs = 0; offs < mtd->size; offs += mtd->erasesize) { in find_media_headers()
1014 ret = mtd_read(mtd, offs, mtd->writesize, &retlen, buf); in find_media_headers()
1015 if (retlen != mtd->writesize) in find_media_headers()
1039 ret = mtd_read(mtd, offs, mtd->writesize, &retlen, buf); in find_media_headers()
1040 if (retlen != mtd->writesize) { in find_media_headers()
1048 static inline int __init nftl_partscan(struct mtd_info *mtd, struct mtd_partition *parts) in nftl_partscan() argument
1050 struct nand_chip *this = mtd->priv; in nftl_partscan()
1060 buf = kmalloc(mtd->writesize, GFP_KERNEL); in nftl_partscan()
1064 if (!(numheaders = find_media_headers(mtd, buf, "ANAND", 1))) in nftl_partscan()
1081 blocks = mtd->size >> this->phys_erase_shift; in nftl_partscan()
1082 maxblocks = min(32768U, mtd->erasesize - psize); in nftl_partscan()
1106 mtd->erasesize <<= (0xff - mh->UnitSizeFactor); in nftl_partscan()
1107 printk(KERN_INFO "Setting virtual erase size to %d\n", mtd->erasesize); in nftl_partscan()
1108 blocks = mtd->size >> this->bbt_erase_shift; in nftl_partscan()
1109 maxblocks = min(32768U, mtd->erasesize - psize); in nftl_partscan()
1120 offs += mtd->erasesize; in nftl_partscan()
1136 if (offs < mtd->size) { in nftl_partscan()
1139 parts[numparts].size = mtd->size - offs; in nftl_partscan()
1150 static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partition *parts) in inftl_partscan() argument
1152 struct nand_chip *this = mtd->priv; in inftl_partscan()
1162 int end = mtd->size; in inftl_partscan()
1167 buf = kmalloc(mtd->writesize, GFP_KERNEL); in inftl_partscan()
1172 if (!find_media_headers(mtd, buf, "BNAND", 0)) in inftl_partscan()
1204 blocks = mtd->size >> vshift; in inftl_partscan()
1211 if (inftl_bbt_write && (blocks > mtd->erasesize)) { in inftl_partscan()
1240 parts[0].size = mtd->erasesize * ip->firstUnit; in inftl_partscan()
1269 static int __init nftl_scan_bbt(struct mtd_info *mtd) in nftl_scan_bbt() argument
1272 struct nand_chip *this = mtd->priv; in nftl_scan_bbt()
1279 numparts = nftl_partscan(mtd, parts); in nftl_scan_bbt()
1299 if ((ret = nand_scan_bbt(mtd, NULL))) in nftl_scan_bbt()
1301 mtd_device_register(mtd, NULL, 0); in nftl_scan_bbt()
1303 mtd_device_register(mtd, parts, numparts); in nftl_scan_bbt()
1307 static int __init inftl_scan_bbt(struct mtd_info *mtd) in inftl_scan_bbt() argument
1310 struct nand_chip *this = mtd->priv; in inftl_scan_bbt()
1349 if ((ret = nand_scan_bbt(mtd, NULL))) in inftl_scan_bbt()
1352 numparts = inftl_partscan(mtd, parts); in inftl_scan_bbt()
1358 mtd_device_register(mtd, NULL, 0); in inftl_scan_bbt()
1360 mtd_device_register(mtd, parts, numparts); in inftl_scan_bbt()
1364 static inline int __init doc2000_init(struct mtd_info *mtd) in doc2000_init() argument
1366 struct nand_chip *this = mtd->priv; in doc2000_init()
1375 doc2000_count_chips(mtd); in doc2000_init()
1376 mtd->name = "DiskOnChip 2000 (NFTL Model)"; in doc2000_init()
1380 static inline int __init doc2001_init(struct mtd_info *mtd) in doc2001_init() argument
1382 struct nand_chip *this = mtd->priv; in doc2001_init()
1397 doc2000_count_chips(mtd); in doc2001_init()
1398 mtd->name = "DiskOnChip 2000 (INFTL Model)"; in doc2001_init()
1404 mtd->name = "DiskOnChip Millennium"; in doc2001_init()
1410 static inline int __init doc2001plus_init(struct mtd_info *mtd) in doc2001plus_init() argument
1412 struct nand_chip *this = mtd->priv; in doc2001plus_init()
1425 mtd->name = "DiskOnChip Millennium Plus"; in doc2001plus_init()
1433 struct mtd_info *mtd; in doc_probe() local
1526 for (mtd = doclist; mtd; mtd = doc->nextdoc) { in doc_probe()
1529 nand = mtd->priv; in doc_probe()
1564 mtd = kzalloc(len, GFP_KERNEL); in doc_probe()
1565 if (!mtd) { in doc_probe()
1570 nand = (struct nand_chip *) (mtd + 1); in doc_probe()
1575 mtd->priv = nand; in doc_probe()
1576 mtd->owner = THIS_MODULE; in doc_probe()
1605 numchips = doc2000_init(mtd); in doc_probe()
1607 numchips = doc2001plus_init(mtd); in doc_probe()
1609 numchips = doc2001_init(mtd); in doc_probe()
1611 if ((ret = nand_scan(mtd, numchips))) { in doc_probe()
1618 nand_release(mtd); in doc_probe()
1619 kfree(mtd); in doc_probe()
1624 doclist = mtd; in doc_probe()
1642 struct mtd_info *mtd, *nextmtd; in release_nanddoc() local
1646 for (mtd = doclist; mtd; mtd = nextmtd) { in release_nanddoc()
1647 nand = mtd->priv; in release_nanddoc()
1651 nand_release(mtd); in release_nanddoc()
1654 kfree(mtd); in release_nanddoc()