Lines Matching refs:nand

152 	int (*erase)(struct nand_device *nand, const struct nand_pos *pos);
153 int (*markbad)(struct nand_device *nand, const struct nand_pos *pos);
154 bool (*isbad)(struct nand_device *nand, const struct nand_pos *pos);
220 static inline struct mtd_info *nanddev_to_mtd(struct nand_device *nand) in nanddev_to_mtd() argument
222 return nand->mtd; in nanddev_to_mtd()
231 static inline unsigned int nanddev_bits_per_cell(const struct nand_device *nand) in nanddev_bits_per_cell() argument
233 return nand->memorg.bits_per_cell; in nanddev_bits_per_cell()
242 static inline size_t nanddev_page_size(const struct nand_device *nand) in nanddev_page_size() argument
244 return nand->memorg.pagesize; in nanddev_page_size()
254 nanddev_per_page_oobsize(const struct nand_device *nand) in nanddev_per_page_oobsize() argument
256 return nand->memorg.oobsize; in nanddev_per_page_oobsize()
266 nanddev_pages_per_eraseblock(const struct nand_device *nand) in nanddev_pages_per_eraseblock() argument
268 return nand->memorg.pages_per_eraseblock; in nanddev_pages_per_eraseblock()
277 static inline size_t nanddev_eraseblock_size(const struct nand_device *nand) in nanddev_eraseblock_size() argument
279 return nand->memorg.pagesize * nand->memorg.pages_per_eraseblock; in nanddev_eraseblock_size()
289 nanddev_eraseblocks_per_lun(const struct nand_device *nand) in nanddev_eraseblocks_per_lun() argument
291 return nand->memorg.eraseblocks_per_lun; in nanddev_eraseblocks_per_lun()
300 static inline u64 nanddev_target_size(const struct nand_device *nand) in nanddev_target_size() argument
302 return (u64)nand->memorg.luns_per_target * in nanddev_target_size()
303 nand->memorg.eraseblocks_per_lun * in nanddev_target_size()
304 nand->memorg.pages_per_eraseblock * in nanddev_target_size()
305 nand->memorg.pagesize; in nanddev_target_size()
314 static inline unsigned int nanddev_ntargets(const struct nand_device *nand) in nanddev_ntargets() argument
316 return nand->memorg.ntargets; in nanddev_ntargets()
325 static inline unsigned int nanddev_neraseblocks(const struct nand_device *nand) in nanddev_neraseblocks() argument
327 return (u64)nand->memorg.luns_per_target * in nanddev_neraseblocks()
328 nand->memorg.eraseblocks_per_lun * in nanddev_neraseblocks()
329 nand->memorg.pages_per_eraseblock; in nanddev_neraseblocks()
338 static inline u64 nanddev_size(const struct nand_device *nand) in nanddev_size() argument
340 return nanddev_target_size(nand) * nanddev_ntargets(nand); in nanddev_size()
353 nanddev_get_memorg(struct nand_device *nand) in nanddev_get_memorg() argument
355 return &nand->memorg; in nanddev_get_memorg()
358 int nanddev_init(struct nand_device *nand, const struct nand_ops *ops,
360 void nanddev_cleanup(struct nand_device *nand);
372 static inline int nanddev_register(struct nand_device *nand) in nanddev_register() argument
374 return mtd_device_register(nand->mtd, NULL, 0); in nanddev_register()
387 static inline int nanddev_unregister(struct nand_device *nand) in nanddev_unregister() argument
389 return mtd_device_unregister(nand->mtd); in nanddev_unregister()
400 static inline void nanddev_set_of_node(struct nand_device *nand, in nanddev_set_of_node() argument
403 mtd_set_of_node(nand->mtd, np); in nanddev_set_of_node()
412 static inline const struct device_node *nanddev_get_of_node(struct nand_device *nand) in nanddev_get_of_node() argument
414 return mtd_get_of_node(nand->mtd); in nanddev_get_of_node()
424 static inline void nanddev_set_ofnode(struct nand_device *nand, ofnode node) in nanddev_set_ofnode() argument
426 mtd_set_ofnode(nand->mtd, node); in nanddev_set_ofnode()
440 static inline unsigned int nanddev_offs_to_pos(struct nand_device *nand, in nanddev_offs_to_pos() argument
447 pageoffs = do_div(tmp, nand->memorg.pagesize); in nanddev_offs_to_pos()
448 pos->page = do_div(tmp, nand->memorg.pages_per_eraseblock); in nanddev_offs_to_pos()
449 pos->eraseblock = do_div(tmp, nand->memorg.eraseblocks_per_lun); in nanddev_offs_to_pos()
450 pos->plane = pos->eraseblock % nand->memorg.planes_per_lun; in nanddev_offs_to_pos()
451 pos->lun = do_div(tmp, nand->memorg.luns_per_target); in nanddev_offs_to_pos()
495 static inline loff_t nanddev_pos_to_offs(struct nand_device *nand, in nanddev_pos_to_offs() argument
503 (pos->target * nand->memorg.luns_per_target)) * in nanddev_pos_to_offs()
504 nand->memorg.eraseblocks_per_lun) * in nanddev_pos_to_offs()
505 nand->memorg.pages_per_eraseblock); in nanddev_pos_to_offs()
507 return (loff_t)npages * nand->memorg.pagesize; in nanddev_pos_to_offs()
520 static inline unsigned int nanddev_pos_to_row(struct nand_device *nand, in nanddev_pos_to_row() argument
523 return (pos->lun << nand->rowconv.lun_addr_shift) | in nanddev_pos_to_row()
524 (pos->eraseblock << nand->rowconv.eraseblock_addr_shift) | in nanddev_pos_to_row()
536 static inline void nanddev_pos_next_target(struct nand_device *nand, in nanddev_pos_next_target() argument
554 static inline void nanddev_pos_next_lun(struct nand_device *nand, in nanddev_pos_next_lun() argument
557 if (pos->lun >= nand->memorg.luns_per_target - 1) in nanddev_pos_next_lun()
558 return nanddev_pos_next_target(nand, pos); in nanddev_pos_next_lun()
574 static inline void nanddev_pos_next_eraseblock(struct nand_device *nand, in nanddev_pos_next_eraseblock() argument
577 if (pos->eraseblock >= nand->memorg.eraseblocks_per_lun - 1) in nanddev_pos_next_eraseblock()
578 return nanddev_pos_next_lun(nand, pos); in nanddev_pos_next_eraseblock()
582 pos->plane = pos->eraseblock % nand->memorg.planes_per_lun; in nanddev_pos_next_eraseblock()
593 static inline void nanddev_pos_next_page(struct nand_device *nand, in nanddev_pos_next_page() argument
596 if (pos->page >= nand->memorg.pages_per_eraseblock - 1) in nanddev_pos_next_page()
597 return nanddev_pos_next_eraseblock(nand, pos); in nanddev_pos_next_page()
612 static inline void nanddev_io_iter_init(struct nand_device *nand, in nanddev_io_iter_init() argument
616 struct mtd_info *mtd = nanddev_to_mtd(nand); in nanddev_io_iter_init()
619 iter->req.dataoffs = nanddev_offs_to_pos(nand, offs, &iter->req.pos); in nanddev_io_iter_init()
626 nand->memorg.pagesize - iter->req.dataoffs, in nanddev_io_iter_init()
641 static inline void nanddev_io_iter_next_page(struct nand_device *nand, in nanddev_io_iter_next_page() argument
644 nanddev_pos_next_page(nand, &iter->req.pos); in nanddev_io_iter_next_page()
651 iter->req.datalen = min_t(unsigned int, nand->memorg.pagesize, in nanddev_io_iter_next_page()
668 static inline bool nanddev_io_iter_end(struct nand_device *nand, in nanddev_io_iter_end() argument
687 #define nanddev_io_for_each_page(nand, start, req, iter) \ argument
688 for (nanddev_io_iter_init(nand, start, req, iter); \
689 !nanddev_io_iter_end(nand, iter); \
690 nanddev_io_iter_next_page(nand, iter))
692 bool nanddev_isbad(struct nand_device *nand, const struct nand_pos *pos);
693 bool nanddev_isreserved(struct nand_device *nand, const struct nand_pos *pos);
694 int nanddev_erase(struct nand_device *nand, const struct nand_pos *pos);
695 int nanddev_markbad(struct nand_device *nand, const struct nand_pos *pos);
707 int nanddev_bbt_init(struct nand_device *nand);
708 void nanddev_bbt_cleanup(struct nand_device *nand);
709 int nanddev_bbt_update(struct nand_device *nand);
710 int nanddev_bbt_get_block_status(const struct nand_device *nand,
712 int nanddev_bbt_set_block_status(struct nand_device *nand, unsigned int entry,
714 int nanddev_bbt_markbad(struct nand_device *nand, unsigned int block);
726 static inline unsigned int nanddev_bbt_pos_to_entry(struct nand_device *nand, in nanddev_bbt_pos_to_entry() argument
730 ((pos->lun + (pos->target * nand->memorg.luns_per_target)) * in nanddev_bbt_pos_to_entry()
731 nand->memorg.eraseblocks_per_lun); in nanddev_bbt_pos_to_entry()
740 static inline bool nanddev_bbt_is_initialized(struct nand_device *nand) in nanddev_bbt_is_initialized() argument
742 return !!nand->bbt.cache; in nanddev_bbt_is_initialized()