Lines Matching refs:mtd
74 int (*late_init)(struct mtd_info *mtd);
91 static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd,
93 static void doc200x_select_chip(struct mtd_info *mtd, int chip);
300 static void doc2000_write_byte(struct mtd_info *mtd, u_char datum) in doc2000_write_byte() argument
302 struct nand_chip *this = mtd->priv; in doc2000_write_byte()
312 static u_char doc2000_read_byte(struct mtd_info *mtd) in doc2000_read_byte() argument
314 struct nand_chip *this = mtd->priv; in doc2000_read_byte()
327 static void doc2000_writebuf(struct mtd_info *mtd, const u_char *buf, int len) in doc2000_writebuf() argument
329 struct nand_chip *this = mtd->priv; in doc2000_writebuf()
344 static void doc2000_readbuf(struct mtd_info *mtd, u_char *buf, int len) in doc2000_readbuf() argument
346 struct nand_chip *this = mtd->priv; in doc2000_readbuf()
359 static void doc2000_readbuf_dword(struct mtd_info *mtd, u_char *buf, int len) in doc2000_readbuf_dword() argument
361 struct nand_chip *this = mtd->priv; in doc2000_readbuf_dword()
380 static uint16_t __init doc200x_ident_chip(struct mtd_info *mtd, int nr) in doc200x_ident_chip() argument
382 struct nand_chip *this = mtd->priv; in doc200x_ident_chip()
386 doc200x_select_chip(mtd, nr); in doc200x_ident_chip()
387 doc200x_hwcontrol(mtd, NAND_CMD_READID, in doc200x_ident_chip()
389 doc200x_hwcontrol(mtd, 0, NAND_CTRL_ALE | NAND_CTRL_CHANGE); in doc200x_ident_chip()
390 doc200x_hwcontrol(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); in doc200x_ident_chip()
397 ret = this->read_byte(mtd) << 8; in doc200x_ident_chip()
398 ret |= this->read_byte(mtd); in doc200x_ident_chip()
408 doc200x_hwcontrol(mtd, NAND_CMD_READID, in doc200x_ident_chip()
410 doc200x_hwcontrol(mtd, 0, NAND_CTRL_ALE | NAND_CTRL_CHANGE); in doc200x_ident_chip()
411 doc200x_hwcontrol(mtd, NAND_CMD_NONE, in doc200x_ident_chip()
426 static void __init doc2000_count_chips(struct mtd_info *mtd) in doc2000_count_chips() argument
428 struct nand_chip *this = mtd->priv; in doc2000_count_chips()
437 mfrid = doc200x_ident_chip(mtd, 0); in doc2000_count_chips()
441 if (doc200x_ident_chip(mtd, i) != mfrid) in doc2000_count_chips()
448 static int doc200x_wait(struct mtd_info *mtd, struct nand_chip *this) in doc200x_wait() argument
455 this->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1); in doc200x_wait()
457 status = (int)this->read_byte(mtd); in doc200x_wait()
462 static void doc2001_write_byte(struct mtd_info *mtd, u_char datum) in doc2001_write_byte() argument
464 struct nand_chip *this = mtd->priv; in doc2001_write_byte()
473 static u_char doc2001_read_byte(struct mtd_info *mtd) in doc2001_read_byte() argument
475 struct nand_chip *this = mtd->priv; in doc2001_read_byte()
487 static void doc2001_writebuf(struct mtd_info *mtd, const u_char *buf, int len) in doc2001_writebuf() argument
489 struct nand_chip *this = mtd->priv; in doc2001_writebuf()
500 static void doc2001_readbuf(struct mtd_info *mtd, u_char *buf, int len) in doc2001_readbuf() argument
502 struct nand_chip *this = mtd->priv; in doc2001_readbuf()
517 static u_char doc2001plus_read_byte(struct mtd_info *mtd) in doc2001plus_read_byte() argument
519 struct nand_chip *this = mtd->priv; in doc2001plus_read_byte()
532 static void doc2001plus_writebuf(struct mtd_info *mtd, const u_char *buf, int len) in doc2001plus_writebuf() argument
534 struct nand_chip *this = mtd->priv; in doc2001plus_writebuf()
550 static void doc2001plus_readbuf(struct mtd_info *mtd, u_char *buf, int len) in doc2001plus_readbuf() argument
552 struct nand_chip *this = mtd->priv; in doc2001plus_readbuf()
581 static void doc2001plus_select_chip(struct mtd_info *mtd, int chip) in doc2001plus_select_chip() argument
583 struct nand_chip *this = mtd->priv; in doc2001plus_select_chip()
602 this->cmdfunc(mtd, NAND_CMD_RESET, -1, -1); in doc2001plus_select_chip()
608 static void doc200x_select_chip(struct mtd_info *mtd, int chip) in doc200x_select_chip() argument
610 struct nand_chip *this = mtd->priv; in doc200x_select_chip()
625 doc200x_hwcontrol(mtd, NAND_CMD_NONE, 0 | NAND_CTRL_CHANGE); in doc200x_select_chip()
630 doc200x_hwcontrol(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); in doc200x_select_chip()
638 static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd, in doc200x_hwcontrol() argument
641 struct nand_chip *this = mtd->priv; in doc200x_hwcontrol()
656 doc2000_write_byte(mtd, cmd); in doc200x_hwcontrol()
658 doc2001_write_byte(mtd, cmd); in doc200x_hwcontrol()
662 static void doc2001plus_command(struct mtd_info *mtd, unsigned command, int column, int page_addr) in doc2001plus_command() argument
664 struct nand_chip *this = mtd->priv; in doc2001plus_command()
683 if (column >= mtd->writesize) { in doc2001plus_command()
685 column -= mtd->writesize; in doc2001plus_command()
746 while (!(this->read_byte(mtd) & 0x40)) ; in doc2001plus_command()
765 while (!this->dev_ready(mtd)) ; in doc2001plus_command()
768 static int doc200x_dev_ready(struct mtd_info *mtd) in doc200x_dev_ready() argument
770 struct nand_chip *this = mtd->priv; in doc200x_dev_ready()
801 static int doc200x_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip) in doc200x_block_bad() argument
808 static void doc200x_enable_hwecc(struct mtd_info *mtd, int mode) in doc200x_enable_hwecc() argument
810 struct nand_chip *this = mtd->priv; in doc200x_enable_hwecc()
827 static void doc2001plus_enable_hwecc(struct mtd_info *mtd, int mode) in doc2001plus_enable_hwecc() argument
829 struct nand_chip *this = mtd->priv; in doc2001plus_enable_hwecc()
847 static int doc200x_calculate_ecc(struct mtd_info *mtd, const u_char *dat, unsigned char *ecc_code) in doc200x_calculate_ecc() argument
849 struct nand_chip *this = mtd->priv; in doc200x_calculate_ecc()
906 static int doc200x_correct_data(struct mtd_info *mtd, u_char *dat, in doc200x_correct_data() argument
910 struct nand_chip *this = mtd->priv; in doc200x_correct_data()
1008 static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const char *id, int findmir… in find_media_headers() argument
1010 struct nand_chip *this = mtd->priv; in find_media_headers()
1016 for (offs = 0; offs < mtd->size; offs += mtd->erasesize) { in find_media_headers()
1017 ret = mtd_read(mtd, offs, mtd->writesize, &retlen, buf); in find_media_headers()
1018 if (retlen != mtd->writesize) in find_media_headers()
1042 ret = mtd_read(mtd, offs, mtd->writesize, &retlen, buf); in find_media_headers()
1043 if (retlen != mtd->writesize) { in find_media_headers()
1051 static inline int __init nftl_partscan(struct mtd_info *mtd, struct mtd_partition *parts) in nftl_partscan() argument
1053 struct nand_chip *this = mtd->priv; in nftl_partscan()
1063 buf = kmalloc(mtd->writesize, GFP_KERNEL); in nftl_partscan()
1067 if (!(numheaders = find_media_headers(mtd, buf, "ANAND", 1))) in nftl_partscan()
1084 blocks = mtd->size >> this->phys_erase_shift; in nftl_partscan()
1085 maxblocks = min(32768U, mtd->erasesize - psize); in nftl_partscan()
1109 mtd->erasesize <<= (0xff - mh->UnitSizeFactor); in nftl_partscan()
1110 printk(KERN_INFO "Setting virtual erase size to %d\n", mtd->erasesize); in nftl_partscan()
1111 blocks = mtd->size >> this->bbt_erase_shift; in nftl_partscan()
1112 maxblocks = min(32768U, mtd->erasesize - psize); in nftl_partscan()
1123 offs += mtd->erasesize; in nftl_partscan()
1139 if (offs < mtd->size) { in nftl_partscan()
1142 parts[numparts].size = mtd->size - offs; in nftl_partscan()
1153 static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partition *parts) in inftl_partscan() argument
1155 struct nand_chip *this = mtd->priv; in inftl_partscan()
1165 int end = mtd->size; in inftl_partscan()
1170 buf = kmalloc(mtd->writesize, GFP_KERNEL); in inftl_partscan()
1175 if (!find_media_headers(mtd, buf, "BNAND", 0)) in inftl_partscan()
1207 blocks = mtd->size >> vshift; in inftl_partscan()
1214 if (inftl_bbt_write && (blocks > mtd->erasesize)) { in inftl_partscan()
1243 parts[0].size = mtd->erasesize * ip->firstUnit; in inftl_partscan()
1272 static int __init nftl_scan_bbt(struct mtd_info *mtd) in nftl_scan_bbt() argument
1275 struct nand_chip *this = mtd->priv; in nftl_scan_bbt()
1282 numparts = nftl_partscan(mtd, parts); in nftl_scan_bbt()
1300 ret = this->scan_bbt(mtd); in nftl_scan_bbt()
1304 return mtd_device_register(mtd, parts, no_autopart ? 0 : 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()
1347 ret = this->scan_bbt(mtd); in inftl_scan_bbt()
1352 numparts = inftl_partscan(mtd, parts); in inftl_scan_bbt()
1358 return mtd_device_register(mtd, parts, no_autopart ? 0 : numparts); in inftl_scan_bbt()
1361 static inline int __init doc2000_init(struct mtd_info *mtd) in doc2000_init() argument
1363 struct nand_chip *this = mtd->priv; in doc2000_init()
1372 doc2000_count_chips(mtd); in doc2000_init()
1373 mtd->name = "DiskOnChip 2000 (NFTL Model)"; in doc2000_init()
1377 static inline int __init doc2001_init(struct mtd_info *mtd) in doc2001_init() argument
1379 struct nand_chip *this = mtd->priv; in doc2001_init()
1394 doc2000_count_chips(mtd); in doc2001_init()
1395 mtd->name = "DiskOnChip 2000 (INFTL Model)"; in doc2001_init()
1401 mtd->name = "DiskOnChip Millennium"; in doc2001_init()
1407 static inline int __init doc2001plus_init(struct mtd_info *mtd) in doc2001plus_init() argument
1409 struct nand_chip *this = mtd->priv; in doc2001plus_init()
1422 mtd->name = "DiskOnChip Millennium Plus"; in doc2001plus_init()
1430 struct mtd_info *mtd; in doc_probe() local
1523 for (mtd = doclist; mtd; mtd = doc->nextdoc) { in doc_probe()
1526 nand = mtd->priv; in doc_probe()
1561 mtd = kzalloc(len, GFP_KERNEL); in doc_probe()
1562 if (!mtd) { in doc_probe()
1567 nand = (struct nand_chip *) (mtd + 1); in doc_probe()
1572 mtd->priv = nand; in doc_probe()
1573 mtd->owner = THIS_MODULE; in doc_probe()
1604 numchips = doc2000_init(mtd); in doc_probe()
1606 numchips = doc2001plus_init(mtd); in doc_probe()
1608 numchips = doc2001_init(mtd); in doc_probe()
1610 if ((ret = nand_scan(mtd, numchips)) || (ret = doc->late_init(mtd))) { in doc_probe()
1615 kfree(mtd); in doc_probe()
1620 doclist = mtd; in doc_probe()
1638 struct mtd_info *mtd, *nextmtd; in release_nanddoc() local
1642 for (mtd = doclist; mtd; mtd = nextmtd) { in release_nanddoc()
1643 nand = mtd->priv; in release_nanddoc()
1647 nand_release(mtd); in release_nanddoc()
1650 kfree(mtd); in release_nanddoc()