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
649 nanddev_io_for_each_page(nand, NAND_PAGE_READ, from, ops, &iter) { in spinand_mtd_read()
683 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_write() local
693 nanddev_io_for_each_page(nand, NAND_PAGE_WRITE, to, ops, &iter) { in spinand_mtd_write()
714 static bool spinand_isbad(struct nand_device *nand, const struct nand_pos *pos) in spinand_isbad() argument
716 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_isbad()
736 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_block_isbad() local
737 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_mtd_block_isbad()
741 nanddev_offs_to_pos(nand, offs, &pos); in spinand_mtd_block_isbad()
743 ret = nanddev_isbad(nand, &pos); in spinand_mtd_block_isbad()
749 static int spinand_markbad(struct nand_device *nand, const struct nand_pos *pos) in spinand_markbad() argument
751 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_markbad()
775 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_block_markbad() local
776 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_mtd_block_markbad()
780 nanddev_offs_to_pos(nand, offs, &pos); in spinand_mtd_block_markbad()
782 ret = nanddev_markbad(nand, &pos); in spinand_mtd_block_markbad()
788 static int spinand_erase(struct nand_device *nand, const struct nand_pos *pos) in spinand_erase() argument
790 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_erase()
833 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_block_isreserved() local
837 nanddev_offs_to_pos(nand, offs, &pos); in spinand_mtd_block_isreserved()
839 ret = nanddev_isreserved(nand, &pos); in spinand_mtd_block_isreserved()
848 struct nand_device *nand = spinand_to_nand(spinand); in spinand_create_dirmap() local
850 .length = nanddev_page_size(nand) + in spinand_create_dirmap()
851 nanddev_per_page_oobsize(nand), in spinand_create_dirmap()
856 info.offset = plane << fls(nand->memorg.pagesize); in spinand_create_dirmap()
874 if (nand->ecc.engine->integration != NAND_ECC_ENGINE_INTEGRATION_PIPELINED) { in spinand_create_dirmap()
904 struct nand_device *nand = spinand_to_nand(spinand); in spinand_create_dirmaps() local
909 nand->memorg.planes_per_lun, in spinand_create_dirmaps()
914 for (i = 0; i < nand->memorg.planes_per_lun; i++) { in spinand_create_dirmaps()
1014 struct nand_device *nand = spinand_to_nand(spinand); in spinand_select_op_variant() local
1022 nbytes = nanddev_per_page_oobsize(nand) + in spinand_select_op_variant()
1023 nanddev_page_size(nand); in spinand_select_op_variant()
1065 struct nand_device *nand = spinand_to_nand(spinand); in spinand_match_and_init() local
1078 nand->memorg = table[i].memorg; in spinand_match_and_init()
1079 nanddev_set_ecc_requirements(nand, &table[i].eccreq); in spinand_match_and_init()
1112 struct nand_device *nand = spinand_to_nand(spinand); in spinand_detect() local
1126 if (nand->memorg.ntargets > 1 && !spinand->select_target) { in spinand_detect()
1136 nanddev_size(nand) >> 20, nanddev_eraseblock_size(nand) >> 10, in spinand_detect()
1137 nanddev_page_size(nand), nanddev_per_page_oobsize(nand)); in spinand_detect()
1145 struct nand_device *nand = spinand_to_nand(spinand); in spinand_init_flash() local
1169 for (i = 0; i < nand->memorg.ntargets; i++) { in spinand_init_flash()
1205 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_init() local
1225 spinand->databuf = kzalloc(nanddev_page_size(nand) + in spinand_init()
1226 nanddev_per_page_oobsize(nand), in spinand_init()
1233 spinand->oobbuf = spinand->databuf + nanddev_page_size(nand); in spinand_init()
1243 ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); in spinand_init()
1248 nand->ecc.defaults.engine_type = NAND_ECC_ENGINE_TYPE_ON_DIE; in spinand_init()
1249 nand->ecc.ondie_engine = &spinand_ondie_ecc_engine; in spinand_init()
1252 ret = nanddev_ecc_engine_init(nand); in spinand_init()
1265 if (nand->ecc.engine) { in spinand_init()
1274 mtd->ecc_strength = nanddev_get_ecc_conf(nand)->strength; in spinand_init()
1275 mtd->ecc_step_size = nanddev_get_ecc_conf(nand)->step_size; in spinand_init()
1288 nanddev_ecc_engine_cleanup(nand); in spinand_init()
1291 nanddev_cleanup(nand); in spinand_init()
1304 struct nand_device *nand = spinand_to_nand(spinand); in spinand_cleanup() local
1306 nanddev_cleanup(nand); in spinand_cleanup()