Lines Matching +full:nand +full:- +full:ecc +full:- +full:engine

1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright 2017 - Free Electrons
6 * Boris Brezillon <boris.brezillon@free-electrons.com>
18 * struct nand_memory_organization - Memory organization structure
19 * @bits_per_cell: number of bits per NAND cell
27 * @ntargets: total number of targets exposed by the NAND device
55 * struct nand_row_converter - Information needed to convert an absolute offset
67 * struct nand_pos - NAND position object
68 * @target: the NAND target/die
74 * These information are usually used by specific sub-layers to select the
86 * enum nand_page_io_req_type - Direction of an I/O request
96 * struct nand_page_io_req - NAND I/O request object
107 * This object is used to pass per-page I/O requests to NAND sub-layers. This
109 * specific NAND layers can focus on translating these information into
135 * enum nand_ecc_engine_type - NAND ECC engine type
137 * @NAND_ECC_ENGINE_TYPE_NONE: No ECC correction
138 * @NAND_ECC_ENGINE_TYPE_SOFT: Software ECC correction
139 * @NAND_ECC_ENGINE_TYPE_ON_HOST: On host hardware ECC correction
140 * @NAND_ECC_ENGINE_TYPE_ON_DIE: On chip hardware ECC correction
151 * enum nand_ecc_placement - NAND ECC bytes placement
152 * @NAND_ECC_PLACEMENT_UNKNOWN: The actual position of the ECC bytes is unknown
153 * @NAND_ECC_PLACEMENT_OOB: The ECC bytes are located in the OOB area
154 * @NAND_ECC_PLACEMENT_INTERLEAVED: Syndrome layout, there are ECC bytes
165 * enum nand_ecc_algo - NAND ECC algorithm
168 * @NAND_ECC_ALGO_BCH: Bose-Chaudhuri-Hocquenghem algorithm
169 * @NAND_ECC_ALGO_RS: Reed-Solomon algorithm
179 * struct nand_ecc_props - NAND ECC properties
180 * @engine_type: ECC engine type
182 * @algo: ECC algorithm (if relevant)
183 * @strength: ECC strength
198 /* NAND ECC misc flags */
202 * struct nand_bbt - bad block table object
210 * struct nand_ops - NAND operations
212 * erasing, this has been taken care of by the generic NAND layer
215 * NAND layer. This method should just write the BBM (Bad Block
216 * Marker) so that future call to struct_nand_ops->isbad() return
223 * NAND layers (SPI NAND, raw 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);
232 * struct nand_ecc_context - Context for the ECC engine
233 * @conf: basic ECC engine parameters
234 * @nsteps: number of ECC steps
235 * @total: total number of bytes used for storing ECC codes, this is used by
237 * @priv: ECC engine driver private data
247 * struct nand_ecc_engine_ops - ECC engine operations
248 * @init_ctx: given a desired user configuration for the pointed NAND device,
249 * requests the ECC engine driver to setup a configuration with
253 * request to be performed with ECC correction.
255 * request and ensure proper ECC correction.
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,
267 * enum nand_ecc_engine_integration - How the NAND ECC engine is integrated
269 * @NAND_ECC_ENGINE_INTEGRATION_PIPELINED: Pipelined engine, performs on-the-fly
272 * @NAND_ECC_ENGINE_INTEGRATION_EXTERNAL: External engine, needs to bring the
282 * struct nand_ecc_engine - ECC engine abstraction for NAND devices
285 * @ops: ECC engine operations
286 * @integration: How the engine is integrated with the host
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);
308 int nand_ecc_register_on_host_hw_engine(struct nand_ecc_engine *engine);
309 int nand_ecc_unregister_on_host_hw_engine(struct nand_ecc_engine *engine);
312 nand_ecc_register_on_host_hw_engine(struct nand_ecc_engine *engine) in nand_ecc_register_on_host_hw_engine() argument
314 return -ENOTSUPP; in nand_ecc_register_on_host_hw_engine()
317 nand_ecc_unregister_on_host_hw_engine(struct nand_ecc_engine *engine) in nand_ecc_unregister_on_host_hw_engine() argument
319 return -ENOTSUPP; in nand_ecc_unregister_on_host_hw_engine()
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);
348 * struct nand_ecc_req_tweak_ctx - Help for automatically tweaking requests
350 * @nand: Related NAND device, to have access to its memory organization
362 struct nand_device *nand; member
372 struct nand_device *nand);
380 * struct nand_ecc - Information relative to the ECC
382 * @requirements: ECC requirements from the NAND chip perspective
383 * @user_conf: User desires in terms of ECC parameters
384 * @ctx: ECC context for the ECC engine, derived from the device @requirements
386 * @ondie_engine: On-die ECC engine reference, if any
387 * @engine: ECC engine actually bound
395 struct nand_ecc_engine *engine; member
399 * struct nand_device - NAND device
400 * @mtd: MTD instance attached to the NAND device
402 * @ecc: NAND ECC object attached to the NAND device
405 * @ops: NAND operations attached to the NAND device
407 * Generic NAND object. Specialized NAND layers (raw NAND, SPI NAND, OneNAND)
408 * should declare their own NAND object embedding a nand_device struct (that's
410 * struct_nand_device->memorg and struct_nand_device->ecc.requirements should
411 * be filled at device detection time to reflect the NAND device
413 * It will take care of converting NAND information into MTD ones, which means
414 * the specialized NAND layers should never manually tweak
415 * struct_nand_device->mtd except for the ->_read/write() hooks.
420 struct nand_ecc ecc; member
427 * struct nand_io_iter - NAND I/O iterator
433 * Can be used by specialized NAND layers to iterate over all pages covered
434 * by an MTD I/O request, which should greatly simplifies the boiler-plate
435 * code needed to read/write data from/to a NAND device.
445 * mtd_to_nanddev() - Get the NAND device attached to the MTD instance
448 * Return: the NAND device embedding @mtd.
456 * nanddev_to_mtd() - Get the MTD device attached to a NAND device
457 * @nand: NAND device
459 * Return: the MTD device embedded in @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()
467 * nanddev_bits_per_cell() - Get the number of bits per cell
468 * @nand: NAND device
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()
478 * nanddev_page_size() - Get NAND page size
479 * @nand: NAND device
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()
489 * nanddev_per_page_oobsize() - Get NAND OOB size
490 * @nand: NAND device
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()
501 * nanddev_pages_per_eraseblock() - Get the number of pages per eraseblock
502 * @nand: NAND device
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()
513 * nanddev_pages_per_target() - Get the number of pages per target
514 * @nand: NAND device
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()
527 * nanddev_per_page_oobsize() - Get NAND erase block size
528 * @nand: NAND device
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()
538 * nanddev_eraseblocks_per_lun() - Get the number of eraseblocks per LUN
539 * @nand: NAND device
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()
550 * nanddev_eraseblocks_per_target() - Get the number of eraseblocks per target
551 * @nand: NAND device
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()
562 * nanddev_target_size() - Get the total size provided by a single target/die
563 * @nand: NAND device
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()
576 * nanddev_ntarget() - Get the total of targets
577 * @nand: NAND device
579 * Return: the number of targets/dies exposed by @nand.
581 static inline unsigned int nanddev_ntargets(const struct nand_device *nand) in nanddev_ntargets() argument
583 return nand->memorg.ntargets; in nanddev_ntargets()
587 * nanddev_neraseblocks() - Get the total number of eraseblocks
588 * @nand: NAND device
590 * Return: the total number of eraseblocks exposed by @nand.
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()
599 * nanddev_size() - Get NAND size
600 * @nand: NAND device
602 * Return: the total size (in bytes) exposed by @nand.
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()
610 * nanddev_get_memorg() - Extract memory organization info from a NAND device
611 * @nand: NAND device
616 * Return: the memorg object embedded in the NAND device.
619 nanddev_get_memorg(struct nand_device *nand) in nanddev_get_memorg() argument
621 return &nand->memorg; in nanddev_get_memorg()
625 * nanddev_get_ecc_conf() - Extract the ECC configuration from a NAND device
626 * @nand: NAND device
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()
635 * nanddev_get_ecc_nsteps() - Extract the number of ECC steps
636 * @nand: NAND device
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()
645 * nanddev_get_ecc_bytes_per_step() - Extract the number of ECC bytes per step
646 * @nand: NAND device
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()
655 * nanddev_get_ecc_requirements() - Extract the ECC requirements from a NAND
657 * @nand: NAND device
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()
666 * nanddev_set_ecc_requirements() - Assign the ECC requirements of a NAND
668 * @nand: NAND device
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);
683 * nanddev_register() - Register a NAND device
684 * @nand: NAND device
686 * Register a NAND device.
688 * registering the MTD device embedded in @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()
698 * nanddev_unregister() - Unregister a NAND device
699 * @nand: NAND device
701 * Unregister a NAND device.
703 * unregistering the MTD device embedded in @nand.
707 static inline int nanddev_unregister(struct nand_device *nand) in nanddev_unregister() argument
709 return mtd_device_unregister(&nand->mtd); in nanddev_unregister()
713 * nanddev_set_of_node() - Attach a DT node to a NAND device
714 * @nand: NAND device
717 * Attach a DT node to a NAND device.
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()
726 * nanddev_get_of_node() - Retrieve the DT node attached to a NAND device
727 * @nand: NAND device
729 * Return: the DT node attached to @nand.
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()
737 * nanddev_offs_to_pos() - Convert an absolute NAND offset into a NAND position
738 * @nand: NAND device
739 * @offs: absolute NAND offset (usually passed by the MTD layer)
740 * @pos: a NAND position object to fill in
744 * Return: the offset within the NAND page pointed by @pos.
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()
758 pos->target = tmp; in nanddev_offs_to_pos()
764 * nanddev_pos_cmp() - Compare two NAND positions
765 * @a: First NAND position
766 * @b: Second NAND position
768 * Compares two NAND positions.
770 * Return: -1 if @a < @b, 0 if @a == @b and 1 if @a > @b.
775 if (a->target != b->target) in nanddev_pos_cmp()
776 return a->target < b->target ? -1 : 1; in nanddev_pos_cmp()
778 if (a->lun != b->lun) in nanddev_pos_cmp()
779 return a->lun < b->lun ? -1 : 1; in nanddev_pos_cmp()
781 if (a->eraseblock != b->eraseblock) in nanddev_pos_cmp()
782 return a->eraseblock < b->eraseblock ? -1 : 1; in nanddev_pos_cmp()
784 if (a->page != b->page) in nanddev_pos_cmp()
785 return a->page < b->page ? -1 : 1; in nanddev_pos_cmp()
791 * nanddev_pos_to_offs() - Convert a NAND position into an absolute offset
792 * @nand: NAND device
793 * @pos: the NAND position to convert
795 * Converts @pos NAND position into an absolute offset.
801 static inline loff_t nanddev_pos_to_offs(struct nand_device *nand, in nanddev_pos_to_offs() argument
806 npages = pos->page + in nanddev_pos_to_offs()
807 ((pos->eraseblock + in nanddev_pos_to_offs()
808 (pos->lun + in nanddev_pos_to_offs()
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()
817 * nanddev_pos_to_row() - Extract a row address from a NAND position
818 * @nand: NAND device
821 * Converts a NAND position into a row address that can then be passed to the
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()
831 pos->page; in nanddev_pos_to_row()
835 * nanddev_pos_next_target() - Move a position to the next target/die
836 * @nand: NAND device
840 * want to iterate over all targets/dies of a NAND device.
842 static inline void nanddev_pos_next_target(struct nand_device *nand, in nanddev_pos_next_target() argument
845 pos->page = 0; in nanddev_pos_next_target()
846 pos->plane = 0; in nanddev_pos_next_target()
847 pos->eraseblock = 0; in nanddev_pos_next_target()
848 pos->lun = 0; in nanddev_pos_next_target()
849 pos->target++; in nanddev_pos_next_target()
853 * nanddev_pos_next_lun() - Move a position to the next LUN
854 * @nand: NAND device
858 * iterate over all LUNs of a NAND device.
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()
866 pos->lun++; in nanddev_pos_next_lun()
867 pos->page = 0; in nanddev_pos_next_lun()
868 pos->plane = 0; in nanddev_pos_next_lun()
869 pos->eraseblock = 0; in nanddev_pos_next_lun()
873 * nanddev_pos_next_eraseblock() - Move a position to the next eraseblock
874 * @nand: NAND device
878 * want to iterate over all eraseblocks of a NAND device.
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()
886 pos->eraseblock++; in nanddev_pos_next_eraseblock()
887 pos->page = 0; in nanddev_pos_next_eraseblock()
888 pos->plane = pos->eraseblock % nand->memorg.planes_per_lun; in nanddev_pos_next_eraseblock()
892 * nanddev_pos_next_page() - Move a position to the next page
893 * @nand: NAND device
897 * iterate over all pages of a NAND device.
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()
905 pos->page++; in nanddev_pos_next_page()
909 * nand_io_iter_init - Initialize a NAND I/O iterator
910 * @nand: NAND device
913 * @iter: NAND I/O iterator
915 * Initializes a NAND iterator based on the information passed by the MTD
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()
925 iter->req.type = reqtype; in nanddev_io_iter_init()
926 iter->req.mode = req->mode; in nanddev_io_iter_init()
927 iter->req.dataoffs = nanddev_offs_to_pos(nand, offs, &iter->req.pos); in nanddev_io_iter_init()
928 iter->req.ooboffs = req->ooboffs; in nanddev_io_iter_init()
929 iter->oobbytes_per_page = mtd_oobavail(mtd, req); in nanddev_io_iter_init()
930 iter->dataleft = req->len; in nanddev_io_iter_init()
931 iter->oobleft = req->ooblen; in nanddev_io_iter_init()
932 iter->req.databuf.in = req->datbuf; in nanddev_io_iter_init()
933 iter->req.datalen = min_t(unsigned int, in nanddev_io_iter_init()
934 nand->memorg.pagesize - iter->req.dataoffs, in nanddev_io_iter_init()
935 iter->dataleft); in nanddev_io_iter_init()
936 iter->req.oobbuf.in = req->oobbuf; in nanddev_io_iter_init()
937 iter->req.ooblen = min_t(unsigned int, in nanddev_io_iter_init()
938 iter->oobbytes_per_page - iter->req.ooboffs, in nanddev_io_iter_init()
939 iter->oobleft); in nanddev_io_iter_init()
943 * nand_io_iter_next_page - Move to the next page
944 * @nand: NAND device
945 * @iter: NAND I/O iterator
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()
953 iter->dataleft -= iter->req.datalen; in nanddev_io_iter_next_page()
954 iter->req.databuf.in += iter->req.datalen; in nanddev_io_iter_next_page()
955 iter->oobleft -= iter->req.ooblen; in nanddev_io_iter_next_page()
956 iter->req.oobbuf.in += iter->req.ooblen; in nanddev_io_iter_next_page()
957 iter->req.dataoffs = 0; in nanddev_io_iter_next_page()
958 iter->req.ooboffs = 0; in nanddev_io_iter_next_page()
959 iter->req.datalen = min_t(unsigned int, nand->memorg.pagesize, in nanddev_io_iter_next_page()
960 iter->dataleft); in nanddev_io_iter_next_page()
961 iter->req.ooblen = min_t(unsigned int, iter->oobbytes_per_page, in nanddev_io_iter_next_page()
962 iter->oobleft); in nanddev_io_iter_next_page()
966 * nand_io_iter_end - Should end iteration or not
967 * @nand: NAND device
968 * @iter: NAND I/O iterator
970 * Check whether @iter has reached the end of the NAND portion it was asked to
976 static inline bool nanddev_io_iter_end(struct nand_device *nand, in nanddev_io_iter_end() argument
979 if (iter->dataleft || iter->oobleft) in nanddev_io_iter_end()
986 * nand_io_for_each_page - Iterate over all NAND pages contained in an MTD I/O
988 * @nand: NAND device
991 * @iter: NAND I/O iterator
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);
1004 /* ECC related functions */
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);
1033 * nanddev_bbt_pos_to_entry() - Convert a NAND position into a BBT entry
1034 * @nand: NAND device
1035 * @pos: the NAND position we want to get BBT entry for
1042 static inline unsigned int nanddev_bbt_pos_to_entry(struct nand_device *nand, in nanddev_bbt_pos_to_entry() argument
1045 return pos->eraseblock + in nanddev_bbt_pos_to_entry()
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()
1051 * nanddev_bbt_is_initialized() - Check if the BBT has been initialized
1052 * @nand: NAND device
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()
1061 /* MTD -> NAND helper functions. */