Lines Matching refs:nand
226 int (*erase)(struct nand_device *nand, const struct nand_pos *pos);
227 int (*markbad)(struct nand_device *nand, const struct nand_pos *pos);
228 bool (*isbad)(struct nand_device *nand, const struct nand_pos *pos);
258 int (*init_ctx)(struct nand_device *nand);
259 void (*cleanup_ctx)(struct nand_device *nand);
260 int (*prepare_io_req)(struct nand_device *nand,
262 int (*finish_io_req)(struct nand_device *nand,
298 void of_get_nand_ecc_user_config(struct nand_device *nand);
299 int nand_ecc_init_ctx(struct nand_device *nand);
300 void nand_ecc_cleanup_ctx(struct nand_device *nand);
301 int nand_ecc_prepare_io_req(struct nand_device *nand,
303 int nand_ecc_finish_io_req(struct nand_device *nand,
305 bool nand_ecc_is_strong_enough(struct nand_device *nand);
323 struct nand_ecc_engine *nand_ecc_get_sw_engine(struct nand_device *nand);
324 struct nand_ecc_engine *nand_ecc_get_on_die_hw_engine(struct nand_device *nand);
325 struct nand_ecc_engine *nand_ecc_get_on_host_hw_engine(struct nand_device *nand);
326 void nand_ecc_put_on_host_hw_engine(struct nand_device *nand);
362 struct nand_device *nand; member
372 struct nand_device *nand);
461 static inline struct mtd_info *nanddev_to_mtd(struct nand_device *nand) in nanddev_to_mtd() argument
463 return &nand->mtd; in nanddev_to_mtd()
472 static inline unsigned int nanddev_bits_per_cell(const struct nand_device *nand) in nanddev_bits_per_cell() argument
474 return nand->memorg.bits_per_cell; in nanddev_bits_per_cell()
483 static inline size_t nanddev_page_size(const struct nand_device *nand) in nanddev_page_size() argument
485 return nand->memorg.pagesize; in nanddev_page_size()
495 nanddev_per_page_oobsize(const struct nand_device *nand) in nanddev_per_page_oobsize() argument
497 return nand->memorg.oobsize; in nanddev_per_page_oobsize()
507 nanddev_pages_per_eraseblock(const struct nand_device *nand) in nanddev_pages_per_eraseblock() argument
509 return nand->memorg.pages_per_eraseblock; in nanddev_pages_per_eraseblock()
519 nanddev_pages_per_target(const struct nand_device *nand) in nanddev_pages_per_target() argument
521 return nand->memorg.pages_per_eraseblock * in nanddev_pages_per_target()
522 nand->memorg.eraseblocks_per_lun * in nanddev_pages_per_target()
523 nand->memorg.luns_per_target; in nanddev_pages_per_target()
532 static inline size_t nanddev_eraseblock_size(const struct nand_device *nand) in nanddev_eraseblock_size() argument
534 return nand->memorg.pagesize * nand->memorg.pages_per_eraseblock; in nanddev_eraseblock_size()
544 nanddev_eraseblocks_per_lun(const struct nand_device *nand) in nanddev_eraseblocks_per_lun() argument
546 return nand->memorg.eraseblocks_per_lun; in nanddev_eraseblocks_per_lun()
556 nanddev_eraseblocks_per_target(const struct nand_device *nand) in nanddev_eraseblocks_per_target() argument
558 return nand->memorg.eraseblocks_per_lun * nand->memorg.luns_per_target; in nanddev_eraseblocks_per_target()
567 static inline u64 nanddev_target_size(const struct nand_device *nand) in nanddev_target_size() argument
569 return (u64)nand->memorg.luns_per_target * in nanddev_target_size()
570 nand->memorg.eraseblocks_per_lun * in nanddev_target_size()
571 nand->memorg.pages_per_eraseblock * in nanddev_target_size()
572 nand->memorg.pagesize; in nanddev_target_size()
581 static inline unsigned int nanddev_ntargets(const struct nand_device *nand) in nanddev_ntargets() argument
583 return nand->memorg.ntargets; in nanddev_ntargets()
592 static inline unsigned int nanddev_neraseblocks(const struct nand_device *nand) in nanddev_neraseblocks() argument
594 return nand->memorg.ntargets * nand->memorg.luns_per_target * in nanddev_neraseblocks()
595 nand->memorg.eraseblocks_per_lun; in nanddev_neraseblocks()
604 static inline u64 nanddev_size(const struct nand_device *nand) in nanddev_size() argument
606 return nanddev_target_size(nand) * nanddev_ntargets(nand); in nanddev_size()
619 nanddev_get_memorg(struct nand_device *nand) in nanddev_get_memorg() argument
621 return &nand->memorg; in nanddev_get_memorg()
629 nanddev_get_ecc_conf(struct nand_device *nand) in nanddev_get_ecc_conf() argument
631 return &nand->ecc.ctx.conf; in nanddev_get_ecc_conf()
639 nanddev_get_ecc_nsteps(struct nand_device *nand) in nanddev_get_ecc_nsteps() argument
641 return nand->ecc.ctx.nsteps; in nanddev_get_ecc_nsteps()
649 nanddev_get_ecc_bytes_per_step(struct nand_device *nand) in nanddev_get_ecc_bytes_per_step() argument
651 return nand->ecc.ctx.total / nand->ecc.ctx.nsteps; in nanddev_get_ecc_bytes_per_step()
660 nanddev_get_ecc_requirements(struct nand_device *nand) in nanddev_get_ecc_requirements() argument
662 return &nand->ecc.requirements; in nanddev_get_ecc_requirements()
672 nanddev_set_ecc_requirements(struct nand_device *nand, in nanddev_set_ecc_requirements() argument
675 nand->ecc.requirements = *reqs; in nanddev_set_ecc_requirements()
678 int nanddev_init(struct nand_device *nand, const struct nand_ops *ops,
680 void nanddev_cleanup(struct nand_device *nand);
692 static inline int nanddev_register(struct nand_device *nand) in nanddev_register() argument
694 return mtd_device_register(&nand->mtd, NULL, 0); in nanddev_register()
707 static inline int nanddev_unregister(struct nand_device *nand) in nanddev_unregister() argument
709 return mtd_device_unregister(&nand->mtd); in nanddev_unregister()
719 static inline void nanddev_set_of_node(struct nand_device *nand, in nanddev_set_of_node() argument
722 mtd_set_of_node(&nand->mtd, np); in nanddev_set_of_node()
731 static inline struct device_node *nanddev_get_of_node(struct nand_device *nand) in nanddev_get_of_node() argument
733 return mtd_get_of_node(&nand->mtd); in nanddev_get_of_node()
746 static inline unsigned int nanddev_offs_to_pos(struct nand_device *nand, in nanddev_offs_to_pos() argument
753 pageoffs = do_div(tmp, nand->memorg.pagesize); in nanddev_offs_to_pos()
754 pos->page = do_div(tmp, nand->memorg.pages_per_eraseblock); in nanddev_offs_to_pos()
755 pos->eraseblock = do_div(tmp, nand->memorg.eraseblocks_per_lun); in nanddev_offs_to_pos()
756 pos->plane = pos->eraseblock % nand->memorg.planes_per_lun; in nanddev_offs_to_pos()
757 pos->lun = do_div(tmp, nand->memorg.luns_per_target); in nanddev_offs_to_pos()
801 static inline loff_t nanddev_pos_to_offs(struct nand_device *nand, in nanddev_pos_to_offs() argument
809 (pos->target * nand->memorg.luns_per_target)) * in nanddev_pos_to_offs()
810 nand->memorg.eraseblocks_per_lun) * in nanddev_pos_to_offs()
811 nand->memorg.pages_per_eraseblock); in nanddev_pos_to_offs()
813 return (loff_t)npages * nand->memorg.pagesize; in nanddev_pos_to_offs()
826 static inline unsigned int nanddev_pos_to_row(struct nand_device *nand, in nanddev_pos_to_row() argument
829 return (pos->lun << nand->rowconv.lun_addr_shift) | in nanddev_pos_to_row()
830 (pos->eraseblock << nand->rowconv.eraseblock_addr_shift) | in nanddev_pos_to_row()
842 static inline void nanddev_pos_next_target(struct nand_device *nand, in nanddev_pos_next_target() argument
860 static inline void nanddev_pos_next_lun(struct nand_device *nand, in nanddev_pos_next_lun() argument
863 if (pos->lun >= nand->memorg.luns_per_target - 1) in nanddev_pos_next_lun()
864 return nanddev_pos_next_target(nand, pos); in nanddev_pos_next_lun()
880 static inline void nanddev_pos_next_eraseblock(struct nand_device *nand, in nanddev_pos_next_eraseblock() argument
883 if (pos->eraseblock >= nand->memorg.eraseblocks_per_lun - 1) in nanddev_pos_next_eraseblock()
884 return nanddev_pos_next_lun(nand, pos); in nanddev_pos_next_eraseblock()
888 pos->plane = pos->eraseblock % nand->memorg.planes_per_lun; in nanddev_pos_next_eraseblock()
899 static inline void nanddev_pos_next_page(struct nand_device *nand, in nanddev_pos_next_page() argument
902 if (pos->page >= nand->memorg.pages_per_eraseblock - 1) in nanddev_pos_next_page()
903 return nanddev_pos_next_eraseblock(nand, pos); in nanddev_pos_next_page()
918 static inline void nanddev_io_iter_init(struct nand_device *nand, in nanddev_io_iter_init() argument
923 struct mtd_info *mtd = nanddev_to_mtd(nand); in nanddev_io_iter_init()
927 iter->req.dataoffs = nanddev_offs_to_pos(nand, offs, &iter->req.pos); in nanddev_io_iter_init()
934 nand->memorg.pagesize - iter->req.dataoffs, in nanddev_io_iter_init()
949 static inline void nanddev_io_iter_next_page(struct nand_device *nand, in nanddev_io_iter_next_page() argument
952 nanddev_pos_next_page(nand, &iter->req.pos); in nanddev_io_iter_next_page()
959 iter->req.datalen = min_t(unsigned int, nand->memorg.pagesize, in nanddev_io_iter_next_page()
976 static inline bool nanddev_io_iter_end(struct nand_device *nand, in nanddev_io_iter_end() argument
995 #define nanddev_io_for_each_page(nand, type, start, req, iter) \ argument
996 for (nanddev_io_iter_init(nand, type, start, req, iter); \
997 !nanddev_io_iter_end(nand, iter); \
998 nanddev_io_iter_next_page(nand, iter))
1000 bool nanddev_isbad(struct nand_device *nand, const struct nand_pos *pos);
1001 bool nanddev_isreserved(struct nand_device *nand, const struct nand_pos *pos);
1002 int nanddev_markbad(struct nand_device *nand, const struct nand_pos *pos);
1005 int nanddev_ecc_engine_init(struct nand_device *nand);
1006 void nanddev_ecc_engine_cleanup(struct nand_device *nand);
1008 static inline void *nand_to_ecc_ctx(struct nand_device *nand) in nand_to_ecc_ctx() argument
1010 return nand->ecc.ctx.priv; in nand_to_ecc_ctx()
1023 int nanddev_bbt_init(struct nand_device *nand);
1024 void nanddev_bbt_cleanup(struct nand_device *nand);
1025 int nanddev_bbt_update(struct nand_device *nand);
1026 int nanddev_bbt_get_block_status(const struct nand_device *nand,
1028 int nanddev_bbt_set_block_status(struct nand_device *nand, unsigned int entry,
1030 int nanddev_bbt_markbad(struct nand_device *nand, unsigned int block);
1042 static inline unsigned int nanddev_bbt_pos_to_entry(struct nand_device *nand, in nanddev_bbt_pos_to_entry() argument
1046 ((pos->lun + (pos->target * nand->memorg.luns_per_target)) * in nanddev_bbt_pos_to_entry()
1047 nand->memorg.eraseblocks_per_lun); in nanddev_bbt_pos_to_entry()
1056 static inline bool nanddev_bbt_is_initialized(struct nand_device *nand) in nanddev_bbt_is_initialized() argument
1058 return !!nand->bbt.cache; in nanddev_bbt_is_initialized()