Lines Matching full:nand
10 #define pr_fmt(fmt) "spi-nand: " fmt
52 struct nand_device *nand = spinand_to_nand(spinand); in spinand_get_cfg() local
55 spinand->cur_target >= nand->memorg.ntargets)) in spinand_get_cfg()
64 struct nand_device *nand = spinand_to_nand(spinand); in spinand_set_cfg() local
68 spinand->cur_target >= nand->memorg.ntargets)) in spinand_set_cfg()
108 * spinand_select_target() - Select a specific NAND target/die
118 struct nand_device *nand = spinand_to_nand(spinand); in spinand_select_target() local
121 if (WARN_ON(target >= nand->memorg.ntargets)) in spinand_select_target()
127 if (nand->memorg.ntargets == 1) { in spinand_select_target()
142 struct nand_device *nand = spinand_to_nand(spinand); in spinand_init_cfg_cache() local
148 nand->memorg.ntargets, in spinand_init_cfg_cache()
154 for (target = 0; target < nand->memorg.ntargets; target++) { in spinand_init_cfg_cache()
205 struct nand_device *nand = spinand_to_nand(spinand); in spinand_load_page_op() local
206 unsigned int row = nanddev_pos_to_row(nand, &req->pos); in spinand_load_page_op()
215 struct nand_device *nand = spinand_to_nand(spinand); in spinand_read_from_cache_op() local
216 struct mtd_info *mtd = nanddev_to_mtd(nand); in spinand_read_from_cache_op()
225 nbytes = nanddev_page_size(nand); in spinand_read_from_cache_op()
230 nbytes += nanddev_per_page_oobsize(nand); in spinand_read_from_cache_op()
233 column = nanddev_page_size(nand); in spinand_read_from_cache_op()
273 struct nand_device *nand = spinand_to_nand(spinand); in spinand_write_to_cache_op() local
274 struct mtd_info *mtd = nanddev_to_mtd(nand); in spinand_write_to_cache_op()
287 nbytes = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand); in spinand_write_to_cache_op()
326 struct nand_device *nand = spinand_to_nand(spinand); in spinand_program_op() local
327 unsigned int row = nanddev_pos_to_row(nand, &req->pos); in spinand_program_op()
336 struct nand_device *nand = spinand_to_nand(spinand); in spinand_erase_op() local
337 unsigned int row = nanddev_pos_to_row(nand, pos); in spinand_erase_op()
405 struct nand_device *nand = spinand_to_nand(spinand); in spinand_check_ecc_status() local
420 return nand->eccreq.strength; in spinand_check_ecc_status()
486 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_read() local
498 nanddev_io_for_each_page(nand, from, ops, &iter) { in spinand_mtd_read()
536 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_write() local
546 nanddev_io_for_each_page(nand, to, ops, &iter) { in spinand_mtd_write()
568 static bool spinand_isbad(struct nand_device *nand, const struct nand_pos *pos) in spinand_isbad() argument
570 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_isbad()
590 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_block_isbad() local
591 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_mtd_block_isbad()
595 nanddev_offs_to_pos(nand, offs, &pos); in spinand_mtd_block_isbad()
597 ret = nanddev_isbad(nand, &pos); in spinand_mtd_block_isbad()
603 static int spinand_markbad(struct nand_device *nand, const struct nand_pos *pos) in spinand_markbad() argument
605 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_markbad()
631 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_block_markbad() local
632 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_mtd_block_markbad()
636 nanddev_offs_to_pos(nand, offs, &pos); in spinand_mtd_block_markbad()
638 ret = nanddev_markbad(nand, &pos); in spinand_mtd_block_markbad()
644 static int spinand_erase(struct nand_device *nand, const struct nand_pos *pos) in spinand_erase() argument
646 struct spinand_device *spinand = nand_to_spinand(nand); in spinand_erase()
685 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_mtd_block_isreserved() local
689 nanddev_offs_to_pos(nand, offs, &pos); in spinand_mtd_block_isreserved()
691 ret = nanddev_isreserved(nand, &pos); in spinand_mtd_block_isreserved()
700 struct nand_device *nand = spinand_to_nand(spinand); in spinand_create_dirmap() local
702 .length = nanddev_page_size(nand) + in spinand_create_dirmap()
703 nanddev_per_page_oobsize(nand), in spinand_create_dirmap()
708 info.offset = plane << fls(nand->memorg.pagesize); in spinand_create_dirmap()
731 struct nand_device *nand = spinand_to_nand(spinand); in spinand_create_dirmaps() local
736 nand->memorg.planes_per_lun, in spinand_create_dirmaps()
741 for (i = 0; i < nand->memorg.planes_per_lun; i++) { in spinand_create_dirmaps()
802 struct nand_device *nand = spinand_to_nand(spinand); in spinand_select_op_variant() local
810 nbytes = nanddev_per_page_oobsize(nand) + in spinand_select_op_variant()
811 nanddev_page_size(nand); in spinand_select_op_variant()
835 * @spinand: SPI NAND object
836 * @table: SPI NAND device description table
839 * Should be used by SPI NAND manufacturer drivers when they want to find a
841 * entry in the SPI NAND description table. If a match is found, the spinand
851 struct nand_device *nand = spinand_to_nand(spinand); in spinand_match_and_init() local
861 nand->memorg = table[i].memorg; in spinand_match_and_init()
862 nand->eccreq = table[i].eccreq; in spinand_match_and_init()
894 struct nand_device *nand = spinand_to_nand(spinand); in spinand_detect() local
914 if (nand->memorg.ntargets > 1 && !spinand->select_target) { in spinand_detect()
921 "%s SPI NAND was found.\n", spinand->manufacturer->name); in spinand_detect()
924 nanddev_size(nand) >> 20, nanddev_eraseblock_size(nand) >> 10, in spinand_detect()
925 nanddev_page_size(nand), nanddev_per_page_oobsize(nand)); in spinand_detect()
958 struct nand_device *nand = mtd_to_nanddev(mtd); in spinand_init() local
978 spinand->databuf = kzalloc(nanddev_page_size(nand) + in spinand_init()
979 nanddev_per_page_oobsize(nand), in spinand_init()
986 spinand->oobbuf = spinand->databuf + nanddev_page_size(nand); in spinand_init()
1003 "Failed to initialize the SPI NAND chip (err = %d)\n", in spinand_init()
1017 for (i = 0; i < nand->memorg.ntargets; i++) { in spinand_init()
1027 ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); in spinand_init()
1057 nanddev_cleanup(nand); in spinand_init()
1070 struct nand_device *nand = spinand_to_nand(spinand); in spinand_cleanup() local
1072 nanddev_cleanup(nand); in spinand_cleanup()
1131 { .name = "spi-nand" },
1137 { .compatible = "spi-nand" },
1146 .name = "spi-nand",
1155 MODULE_DESCRIPTION("SPI NAND framework");