Lines Matching refs:mtd
29 struct mtd_info mtd; member
53 concat_read(struct mtd_info *mtd, loff_t from, size_t len, in concat_read() argument
56 struct mtd_concat *concat = CONCAT(mtd); in concat_read()
84 mtd->ecc_stats.failed++; in concat_read()
87 mtd->ecc_stats.corrected++; in concat_read()
107 concat_write(struct mtd_info *mtd, loff_t to, size_t len, in concat_write() argument
110 struct mtd_concat *concat = CONCAT(mtd); in concat_write()
114 if (!(mtd->flags & MTD_WRITEABLE)) in concat_write()
154 concat_writev(struct mtd_info *mtd, const struct kvec *vecs, in concat_writev() argument
157 struct mtd_concat *concat = CONCAT(mtd); in concat_writev()
164 if (!(mtd->flags & MTD_WRITEABLE)) in concat_writev()
174 if ((to + total_len) > mtd->size) in concat_writev()
178 if (mtd->writesize > 1) { in concat_writev()
180 if (do_div(__to, mtd->writesize) || (total_len % mtd->writesize)) in concat_writev()
242 concat_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops) in concat_read_oob() argument
244 struct mtd_concat *concat = CONCAT(mtd); in concat_read_oob()
269 mtd->ecc_stats.failed++; in concat_read_oob()
272 mtd->ecc_stats.corrected++; in concat_read_oob()
299 concat_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops) in concat_write_oob() argument
301 struct mtd_concat *concat = CONCAT(mtd); in concat_write_oob()
305 if (!(mtd->flags & MTD_WRITEABLE)) in concat_write_oob()
349 static int concat_dev_erase(struct mtd_info *mtd, struct erase_info *erase) in concat_dev_erase() argument
360 erase->mtd = mtd; in concat_dev_erase()
368 err = mtd->erase(mtd, erase); in concat_dev_erase()
383 static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) in concat_erase() argument
385 struct mtd_concat *concat = CONCAT(mtd); in concat_erase()
391 if (!(mtd->flags & MTD_WRITEABLE)) in concat_erase()
394 if (instr->addr > concat->mtd.size) in concat_erase()
397 if (instr->len + instr->addr > concat->mtd.size) in concat_erase()
406 if (!concat->mtd.numeraseregions) { in concat_erase()
408 if (instr->addr & (concat->mtd.erasesize - 1)) in concat_erase()
410 if (instr->len & (concat->mtd.erasesize - 1)) in concat_erase()
415 concat->mtd.eraseregions; in concat_erase()
420 for (i = 0; i < concat->mtd.numeraseregions && in concat_erase()
435 for (; i < concat->mtd.numeraseregions && in concat_erase()
521 static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) in concat_lock() argument
523 struct mtd_concat *concat = CONCAT(mtd); in concat_lock()
526 if ((len + ofs) > mtd->size) in concat_lock()
559 static int concat_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) in concat_unlock() argument
561 struct mtd_concat *concat = CONCAT(mtd); in concat_unlock()
564 if ((len + ofs) > mtd->size) in concat_unlock()
597 static void concat_sync(struct mtd_info *mtd) in concat_sync() argument
599 struct mtd_concat *concat = CONCAT(mtd); in concat_sync()
608 static int concat_suspend(struct mtd_info *mtd) in concat_suspend() argument
610 struct mtd_concat *concat = CONCAT(mtd); in concat_suspend()
621 static void concat_resume(struct mtd_info *mtd) in concat_resume() argument
623 struct mtd_concat *concat = CONCAT(mtd); in concat_resume()
632 static int concat_block_isbad(struct mtd_info *mtd, loff_t ofs) in concat_block_isbad() argument
634 struct mtd_concat *concat = CONCAT(mtd); in concat_block_isbad()
640 if (ofs > mtd->size) in concat_block_isbad()
658 static int concat_block_markbad(struct mtd_info *mtd, loff_t ofs) in concat_block_markbad() argument
660 struct mtd_concat *concat = CONCAT(mtd); in concat_block_markbad()
666 if (ofs > mtd->size) in concat_block_markbad()
679 mtd->ecc_stats.badblocks++; in concat_block_markbad()
722 concat->mtd.type = subdev[0]->type; in mtd_concat_create()
723 concat->mtd.flags = subdev[0]->flags; in mtd_concat_create()
724 concat->mtd.size = subdev[0]->size; in mtd_concat_create()
725 concat->mtd.erasesize = subdev[0]->erasesize; in mtd_concat_create()
726 concat->mtd.writesize = subdev[0]->writesize; in mtd_concat_create()
727 concat->mtd.subpage_sft = subdev[0]->subpage_sft; in mtd_concat_create()
728 concat->mtd.oobsize = subdev[0]->oobsize; in mtd_concat_create()
729 concat->mtd.oobavail = subdev[0]->oobavail; in mtd_concat_create()
731 concat->mtd.writev = concat_writev; in mtd_concat_create()
733 concat->mtd.read_oob = concat_read_oob; in mtd_concat_create()
735 concat->mtd.write_oob = concat_write_oob; in mtd_concat_create()
737 concat->mtd.block_isbad = concat_block_isbad; in mtd_concat_create()
739 concat->mtd.block_markbad = concat_block_markbad; in mtd_concat_create()
741 concat->mtd.ecc_stats.badblocks = subdev[0]->ecc_stats.badblocks; in mtd_concat_create()
746 if (concat->mtd.type != subdev[i]->type) { in mtd_concat_create()
752 if (concat->mtd.flags != subdev[i]->flags) { in mtd_concat_create()
757 if ((concat->mtd.flags ^ subdev[i]-> in mtd_concat_create()
766 concat->mtd.flags |= in mtd_concat_create()
769 concat->mtd.size += subdev[i]->size; in mtd_concat_create()
770 concat->mtd.ecc_stats.badblocks += in mtd_concat_create()
772 if (concat->mtd.writesize != subdev[i]->writesize || in mtd_concat_create()
773 concat->mtd.subpage_sft != subdev[i]->subpage_sft || in mtd_concat_create()
774 concat->mtd.oobsize != subdev[i]->oobsize || in mtd_concat_create()
775 !concat->mtd.read_oob != !subdev[i]->read_oob || in mtd_concat_create()
776 !concat->mtd.write_oob != !subdev[i]->write_oob) { in mtd_concat_create()
786 concat->mtd.ecclayout = subdev[0]->ecclayout; in mtd_concat_create()
789 concat->mtd.name = name; in mtd_concat_create()
791 concat->mtd.erase = concat_erase; in mtd_concat_create()
792 concat->mtd.read = concat_read; in mtd_concat_create()
793 concat->mtd.write = concat_write; in mtd_concat_create()
794 concat->mtd.sync = concat_sync; in mtd_concat_create()
795 concat->mtd.lock = concat_lock; in mtd_concat_create()
796 concat->mtd.unlock = concat_unlock; in mtd_concat_create()
797 concat->mtd.suspend = concat_suspend; in mtd_concat_create()
798 concat->mtd.resume = concat_resume; in mtd_concat_create()
842 concat->mtd.erasesize = curr_erasesize; in mtd_concat_create()
843 concat->mtd.numeraseregions = 0; in mtd_concat_create()
854 concat->mtd.erasesize = max_erasesize; in mtd_concat_create()
855 concat->mtd.numeraseregions = num_erase_region; in mtd_concat_create()
856 concat->mtd.eraseregions = erase_region_p = in mtd_concat_create()
927 return &concat->mtd; in mtd_concat_create()
934 void mtd_concat_destroy(struct mtd_info *mtd) in mtd_concat_destroy() argument
936 struct mtd_concat *concat = CONCAT(mtd); in mtd_concat_destroy()
937 if (concat->mtd.numeraseregions) in mtd_concat_destroy()
938 kfree(concat->mtd.eraseregions); in mtd_concat_destroy()