Lines Matching full:nand

8 #include <linux/mtd/nand.h>
19 * It can run for arbitrary NAND flash chips with different block and OOB sizes. Currently there
20 * are only two known devices in the wild that have NAND flash and make use of this ECC engine
99 static inline void *nand_to_ctx(struct nand_device *nand) in nand_to_ctx() argument
101 return nand->ecc.ctx.priv; in nand_to_ctx()
104 static inline struct rtl_ecc_engine *nand_to_rtlc(struct nand_device *nand) in nand_to_rtlc() argument
106 struct nand_ecc_engine *eng = nand->ecc.engine; in nand_to_rtlc()
114 struct nand_device *nand = mtd_to_nanddev(mtd); in rtl_ecc_ooblayout_ecc() local
115 struct rtl_ecc_ctx *ctx = nand_to_ctx(nand); in rtl_ecc_ooblayout_ecc()
129 struct nand_device *nand = mtd_to_nanddev(mtd); in rtl_ecc_ooblayout_free() local
130 struct rtl_ecc_ctx *ctx = nand_to_ctx(nand); in rtl_ecc_ooblayout_free()
169 * and 6 free bytes. In case the NAND area has been erased and all data and oob is in rtl_ecc_wait_for_engine()
222 static int rtl_ecc_prepare_io_req(struct nand_device *nand, struct nand_page_io_req *req) in rtl_ecc_prepare_io_req() argument
224 struct rtl_ecc_engine *rtlc = nand_to_rtlc(nand); in rtl_ecc_prepare_io_req()
225 struct rtl_ecc_ctx *ctx = nand_to_ctx(nand); in rtl_ecc_prepare_io_req()
255 static int rtl_ecc_finish_io_req(struct nand_device *nand, struct nand_page_io_req *req) in rtl_ecc_finish_io_req() argument
257 struct rtl_ecc_engine *rtlc = nand_to_rtlc(nand); in rtl_ecc_finish_io_req()
258 struct rtl_ecc_ctx *ctx = nand_to_ctx(nand); in rtl_ecc_finish_io_req()
259 struct mtd_info *mtd = nanddev_to_mtd(nand); in rtl_ecc_finish_io_req()
308 static int rtl_ecc_check_support(struct nand_device *nand) in rtl_ecc_check_support() argument
310 struct mtd_info *mtd = nanddev_to_mtd(nand); in rtl_ecc_check_support()
311 struct device *dev = nand->ecc.engine->dev; in rtl_ecc_check_support()
320 if (nand->ecc.user_conf.algo != NAND_ECC_ALGO_BCH || in rtl_ecc_check_support()
321 nand->ecc.user_conf.strength != RTL_ECC_ALLOWED_STRENGTH || in rtl_ecc_check_support()
322 nand->ecc.user_conf.placement != NAND_ECC_PLACEMENT_OOB || in rtl_ecc_check_support()
323 nand->ecc.user_conf.step_size != RTL_ECC_BLOCK_SIZE) { in rtl_ecc_check_support()
332 static int rtl_ecc_init_ctx(struct nand_device *nand) in rtl_ecc_init_ctx() argument
334 struct nand_ecc_props *conf = &nand->ecc.ctx.conf; in rtl_ecc_init_ctx()
335 struct rtl_ecc_engine *rtlc = nand_to_rtlc(nand); in rtl_ecc_init_ctx()
336 struct mtd_info *mtd = nanddev_to_mtd(nand); in rtl_ecc_init_ctx()
337 int strength = nand->ecc.user_conf.strength; in rtl_ecc_init_ctx()
338 struct device *dev = nand->ecc.engine->dev; in rtl_ecc_init_ctx()
342 ret = rtl_ecc_check_support(nand); in rtl_ecc_init_ctx()
350 nand->ecc.ctx.priv = ctx; in rtl_ecc_init_ctx()
364 ret = nand_ecc_init_req_tweaking(&ctx->req_ctx, nand); in rtl_ecc_init_ctx()
375 static void rtl_ecc_cleanup_ctx(struct nand_device *nand) in rtl_ecc_cleanup_ctx() argument
377 struct rtl_ecc_ctx *ctx = nand_to_ctx(nand); in rtl_ecc_cleanup_ctx()
454 .name = "rtl-nand-ecc-engine",
464 MODULE_DESCRIPTION("Realtek NAND hardware ECC controller");