Lines Matching refs:nand
53 struct nand_device *nand = spinand_to_nand(spinand); in spinand_get_cfg() local
56 spinand->cur_target >= nand->memorg.ntargets)) in spinand_get_cfg()
65 struct nand_device *nand = spinand_to_nand(spinand); in spinand_set_cfg() local
69 spinand->cur_target >= nand->memorg.ntargets)) in spinand_set_cfg()
119 struct nand_device *nand = spinand_to_nand(spinand); in spinand_select_target() local
122 if (WARN_ON(target >= nand->memorg.ntargets)) in spinand_select_target()
128 if (nand->memorg.ntargets == 1) { in spinand_select_target()
143 struct nand_device *nand = spinand_to_nand(spinand); in spinand_read_cfg() local
147 for (target = 0; target < nand->memorg.ntargets; target++) { in spinand_read_cfg()
167 struct nand_device *nand = spinand_to_nand(spinand); in spinand_init_cfg_cache() local
171 nand->memorg.ntargets, in spinand_init_cfg_cache()
205 struct nand_device *nand = spinand_to_nand(spinand); in spinand_check_ecc_status() local
220 return nanddev_get_ecc_conf(nand)->strength; in spinand_check_ecc_status()
256 static int spinand_ondie_ecc_init_ctx(struct nand_device *nand) in spinand_ondie_ecc_init_ctx() argument
258 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_ondie_ecc_init_ctx()
259 struct mtd_info *mtd = nanddev_to_mtd(nand); in spinand_ondie_ecc_init_ctx()
262 nand->ecc.ctx.conf.engine_type = NAND_ECC_ENGINE_TYPE_ON_DIE; in spinand_ondie_ecc_init_ctx()
263 nand->ecc.ctx.conf.step_size = nand->ecc.requirements.step_size; in spinand_ondie_ecc_init_ctx()
264 nand->ecc.ctx.conf.strength = nand->ecc.requirements.strength; in spinand_ondie_ecc_init_ctx()
270 nand->ecc.ctx.priv = engine_conf; in spinand_ondie_ecc_init_ctx()
280 static void spinand_ondie_ecc_cleanup_ctx(struct nand_device *nand) in spinand_ondie_ecc_cleanup_ctx() argument
282 kfree(nand->ecc.ctx.priv); in spinand_ondie_ecc_cleanup_ctx()
285 static int spinand_ondie_ecc_prepare_io_req(struct nand_device *nand, in spinand_ondie_ecc_prepare_io_req() argument
288 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_ondie_ecc_prepare_io_req()
291 memset(spinand->oobbuf, 0xff, nanddev_per_page_oobsize(nand)); in spinand_ondie_ecc_prepare_io_req()
297 static int spinand_ondie_ecc_finish_io_req(struct nand_device *nand, in spinand_ondie_ecc_finish_io_req() argument
300 struct spinand_ondie_ecc_conf *engine_conf = nand->ecc.ctx.priv; in spinand_ondie_ecc_finish_io_req()
301 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_ondie_ecc_finish_io_req()
333 static void spinand_ondie_ecc_save_status(struct nand_device *nand, u8 status) in spinand_ondie_ecc_save_status() argument
335 struct spinand_ondie_ecc_conf *engine_conf = nand->ecc.ctx.priv; in spinand_ondie_ecc_save_status()
337 if (nand->ecc.ctx.conf.engine_type == NAND_ECC_ENGINE_TYPE_ON_DIE && in spinand_ondie_ecc_save_status()
352 struct nand_device *nand = spinand_to_nand(spinand); in spinand_load_page_op() local
353 unsigned int row = nanddev_pos_to_row(nand, &req->pos); in spinand_load_page_op()
362 struct nand_device *nand = spinand_to_nand(spinand); in spinand_read_from_cache_op() local
372 nbytes = nanddev_page_size(nand); in spinand_read_from_cache_op()
377 nbytes += nanddev_per_page_oobsize(nand); in spinand_read_from_cache_op()
380 column = nanddev_page_size(nand); in spinand_read_from_cache_op()
423 struct nand_device *nand = spinand_to_nand(spinand); in spinand_write_to_cache_op() local
440 nbytes = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand); in spinand_write_to_cache_op()
441 memset(spinand->databuf, 0xff, nanddev_page_size(nand)); in spinand_write_to_cache_op()
482 struct nand_device *nand = spinand_to_nand(spinand); in spinand_program_op() local
483 unsigned int row = nanddev_pos_to_row(nand, &req->pos); in spinand_program_op()
492 struct nand_device *nand = spinand_to_nand(spinand); in spinand_erase_op() local
493 unsigned int row = nanddev_pos_to_row(nand, pos); in spinand_erase_op()
572 struct nand_device *nand = spinand_to_nand(spinand); in spinand_read_page() local
576 ret = nand_ecc_prepare_io_req(nand, (struct nand_page_io_req *)req); in spinand_read_page()
591 spinand_ondie_ecc_save_status(nand, status); in spinand_read_page()
597 return nand_ecc_finish_io_req(nand, (struct nand_page_io_req *)req); in spinand_read_page()
603 struct nand_device *nand = spinand_to_nand(spinand); in spinand_write_page() local
607 ret = nand_ecc_prepare_io_req(nand, (struct nand_page_io_req *)req); in spinand_write_page()
630 return nand_ecc_finish_io_req(nand, (struct nand_page_io_req *)req); in spinand_write_page()
637 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_read() local
652 nanddev_io_for_each_page(nand, NAND_PAGE_READ, from, ops, &iter) { in spinand_mtd_read()
693 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_write() local
703 nanddev_io_for_each_page(nand, NAND_PAGE_WRITE, to, ops, &iter) { in spinand_mtd_write()
724 static bool spinand_isbad(struct nand_device *nand, const struct nand_pos *pos) in spinand_isbad() argument
726 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_isbad()
746 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_block_isbad() local
747 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_mtd_block_isbad()
751 nanddev_offs_to_pos(nand, offs, &pos); in spinand_mtd_block_isbad()
753 ret = nanddev_isbad(nand, &pos); in spinand_mtd_block_isbad()
759 static int spinand_markbad(struct nand_device *nand, const struct nand_pos *pos) in spinand_markbad() argument
761 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_markbad()
785 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_block_markbad() local
786 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_mtd_block_markbad()
790 nanddev_offs_to_pos(nand, offs, &pos); in spinand_mtd_block_markbad()
792 ret = nanddev_markbad(nand, &pos); in spinand_mtd_block_markbad()
798 static int spinand_erase(struct nand_device *nand, const struct nand_pos *pos) in spinand_erase() argument
800 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_erase()
843 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_block_isreserved() local
847 nanddev_offs_to_pos(nand, offs, &pos); in spinand_mtd_block_isreserved()
849 ret = nanddev_isreserved(nand, &pos); in spinand_mtd_block_isreserved()
858 struct nand_device *nand = spinand_to_nand(spinand); in spinand_create_dirmap() local
860 .length = nanddev_page_size(nand) + in spinand_create_dirmap()
861 nanddev_per_page_oobsize(nand), in spinand_create_dirmap()
866 info.offset = plane << fls(nand->memorg.pagesize); in spinand_create_dirmap()
884 if (nand->ecc.engine->integration != NAND_ECC_ENGINE_INTEGRATION_PIPELINED) { in spinand_create_dirmap()
914 struct nand_device *nand = spinand_to_nand(spinand); in spinand_create_dirmaps() local
919 nand->memorg.planes_per_lun, in spinand_create_dirmaps()
924 for (i = 0; i < nand->memorg.planes_per_lun; i++) { in spinand_create_dirmaps()
1027 struct nand_device *nand = spinand_to_nand(spinand); in spinand_select_op_variant() local
1035 nbytes = nanddev_per_page_oobsize(nand) + in spinand_select_op_variant()
1036 nanddev_page_size(nand); in spinand_select_op_variant()
1078 struct nand_device *nand = spinand_to_nand(spinand); in spinand_match_and_init() local
1091 nand->memorg = table[i].memorg; in spinand_match_and_init()
1092 nanddev_set_ecc_requirements(nand, &table[i].eccreq); in spinand_match_and_init()
1125 struct nand_device *nand = spinand_to_nand(spinand); in spinand_detect() local
1139 if (nand->memorg.ntargets > 1 && !spinand->select_target) { in spinand_detect()
1149 nanddev_size(nand) >> 20, nanddev_eraseblock_size(nand) >> 10, in spinand_detect()
1150 nanddev_page_size(nand), nanddev_per_page_oobsize(nand)); in spinand_detect()
1158 struct nand_device *nand = spinand_to_nand(spinand); in spinand_init_flash() local
1182 for (i = 0; i < nand->memorg.ntargets; i++) { in spinand_init_flash()
1218 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_init() local
1238 spinand->databuf = kzalloc(nanddev_page_size(nand) + in spinand_init()
1239 nanddev_per_page_oobsize(nand), in spinand_init()
1246 spinand->oobbuf = spinand->databuf + nanddev_page_size(nand); in spinand_init()
1256 ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); in spinand_init()
1261 nand->ecc.defaults.engine_type = NAND_ECC_ENGINE_TYPE_ON_DIE; in spinand_init()
1262 nand->ecc.ondie_engine = &spinand_ondie_ecc_engine; in spinand_init()
1265 ret = nanddev_ecc_engine_init(nand); in spinand_init()
1278 if (nand->ecc.engine) { in spinand_init()
1287 mtd->ecc_strength = nanddev_get_ecc_conf(nand)->strength; in spinand_init()
1288 mtd->ecc_step_size = nanddev_get_ecc_conf(nand)->step_size; in spinand_init()
1301 nanddev_ecc_engine_cleanup(nand); in spinand_init()
1304 nanddev_cleanup(nand); in spinand_init()
1317 struct nand_device *nand = spinand_to_nand(spinand); in spinand_cleanup() local
1319 nanddev_cleanup(nand); in spinand_cleanup()