Lines Matching refs:mtd
140 struct mtd_info *mtd; member
172 #define CONV_TO_PAGES(x) ((u32)(x) / (u32)(mtd->writesize))
173 #define CONV_TO_BLOCKS(x) ((u32)(x) / (u32)(mtd->erasesize))
183 struct mtd_info *mtd; in nandbcb_get_info() local
191 mtd = get_nand_dev_by_index(dev); in nandbcb_get_info()
192 if (!mtd) { in nandbcb_get_info()
198 boot_cfg->mtd = mtd; in nandbcb_get_info()
208 struct mtd_info *mtd; in nandbcb_get_size() local
211 mtd = boot_cfg->mtd; in nandbcb_get_size()
215 &maxsize, MTD_DEV_TYPE_NAND, mtd->size)) in nandbcb_get_size()
232 struct mtd_info *mtd; in nandbcb_set_boot_config() local
236 if (!boot_cfg->mtd) { in nandbcb_set_boot_config()
240 mtd = boot_cfg->mtd; in nandbcb_set_boot_config()
253 g_pages_per_stride = mtd->erasesize / mtd->writesize; in nandbcb_set_boot_config()
255 g_boot_search_stride = mtd->writesize * g_pages_per_stride; in nandbcb_set_boot_config()
257 boot_cfg->stride_size_in_byte = g_boot_search_stride * mtd->writesize; in nandbcb_set_boot_config()
261 boot_cfg->search_area_size_in_bytes / mtd->writesize; in nandbcb_set_boot_config()
270 maxsize = ((u32)(maxsize + mtd->writesize - 1)) / (u32)mtd->writesize in nandbcb_set_boot_config()
271 * mtd->writesize; in nandbcb_set_boot_config()
428 struct mtd_info *mtd = boot_cfg->mtd; in fill_fcb() local
429 struct nand_chip *chip = mtd_to_nand(mtd); in fill_fcb()
433 mxs_nand_get_layout(mtd, &l); in fill_fcb()
443 fcb->pagesize = mtd->writesize; in fill_fcb()
444 fcb->oob_pagesize = mtd->writesize + mtd->oobsize; in fill_fcb()
445 fcb->sectors = mtd->erasesize / mtd->writesize; in fill_fcb()
461 fcb->phy_offset = mtd->writesize; in fill_fcb()
473 static int fill_dbbt_data(struct mtd_info *mtd, void *buf, int num_blocks) in fill_dbbt_data() argument
480 loff_t offset = (loff_t)n * mtd->erasesize; in fill_dbbt_data()
481 if (mtd_block_isbad(mtd, offset)) { in fill_dbbt_data()
501 struct mtd_info *mtd; in read_fcb() local
506 mtd = boot_cfg->mtd; in read_fcb()
507 if (mtd_block_isbad(mtd, off)) { in read_fcb()
512 fcb_raw_page = kzalloc(mtd->writesize + mtd->oobsize, GFP_KERNEL); in read_fcb()
527 mxs_nand_mode_fcb_62bit(mtd); in read_fcb()
529 mxs_nand_mode_fcb_40bit(mtd); in read_fcb()
531 ret = nand_read(mtd, off, &size, (u_char *)fcb); in read_fcb()
534 mxs_nand_mode_normal(mtd); in read_fcb()
542 .oobbuf = ((u8 *)fcb_raw_page) + mtd->writesize, in read_fcb()
543 .len = mtd->writesize, in read_fcb()
544 .ooblen = mtd->oobsize, in read_fcb()
548 ret = mtd_read_oob(mtd, off, &ops); in read_fcb()
570 struct mtd_info *mtd; in write_fcb() local
576 mtd = boot_cfg->mtd; in write_fcb()
584 fcb_raw_page = kzalloc(mtd->writesize + mtd->oobsize, in write_fcb()
609 memset(fcb_raw_page + mtd->writesize, 0xFF, 2); in write_fcb()
616 if (mtd_block_isbad(mtd, off)) { in write_fcb()
629 mxs_nand_mode_fcb_62bit(mtd); in write_fcb()
631 mxs_nand_mode_fcb_40bit(mtd); in write_fcb()
633 ret = nand_write(mtd, off, &size, (u_char *)fcb); in write_fcb()
636 mxs_nand_mode_normal(mtd); in write_fcb()
645 mtd->writesize, in write_fcb()
646 .len = mtd->writesize, in write_fcb()
647 .ooblen = mtd->oobsize, in write_fcb()
651 ret = mtd_write_oob(mtd, off, &ops); in write_fcb()
677 struct mtd_info *mtd; in read_dbbt() local
681 mtd = boot_cfg->mtd; in read_dbbt()
683 if (mtd_block_isbad(mtd, off)) { in read_dbbt()
690 ret = nand_read(mtd, off, &size, (u_char *)dbbt); in read_dbbt()
698 to = off + 4 * mtd->writesize; in read_dbbt()
699 size = mtd->writesize; in read_dbbt()
700 ret = nand_read(mtd, to, &size, dbbt_data_page); in read_dbbt()
717 struct mtd_info *mtd; in write_dbbt() local
720 mtd = boot_cfg->mtd; in write_dbbt()
724 size = mtd->writesize; in write_dbbt()
727 if (mtd_block_isbad(mtd, off)) { in write_dbbt()
733 ret = nand_write(mtd, off, &size, (u_char *)dbbt); in write_dbbt()
741 to = off + 4 * mtd->writesize; in write_dbbt()
742 ret = nand_write(mtd, to, &size, dbbt_data_page); in write_dbbt()
761 struct mtd_info *mtd = boot_cfg->mtd; in check_skip_length() local
773 block_start = offset & ~(loff_t)(mtd->erasesize - 1); in check_skip_length()
774 block_off = offset & (mtd->erasesize - 1); in check_skip_length()
775 block_len = mtd->erasesize - block_off; in check_skip_length()
777 if (!nand_block_isbad(mtd, block_start)) in check_skip_length()
796 struct mtd_info *mtd = boot_cfg->mtd; in nandbcb_get_next_good_blk_addr() local
808 bs_cfg->next_bs_addr = (u32)(offset + used + mtd->erasesize - 1) in nandbcb_get_next_good_blk_addr()
809 / (u32)mtd->erasesize * mtd->erasesize; in nandbcb_get_next_good_blk_addr()
817 struct mtd_info *mtd; in nandbcb_write_bs_skip_bad() local
825 mtd = boot_cfg->mtd; in nandbcb_write_bs_skip_bad()
836 length = ALIGN(size + FLASH_OFFSET_STANDARD, mtd->writesize); in nandbcb_write_bs_skip_bad()
838 length = ALIGN(size, mtd->writesize); in nandbcb_write_bs_skip_bad()
852 ret = nand_write_skip_bad(mtd, offset, &length, NULL, maxsize, in nandbcb_write_bs_skip_bad()
959 struct mtd_info *mtd; in nandbcb_init() local
967 mtd = boot_cfg->mtd; in nandbcb_init()
975 ret = nand_erase_opts(mtd, &opts); in nandbcb_init()
1019 dbbt_page = kzalloc(mtd->writesize, GFP_KERNEL); in nandbcb_init()
1026 dbbt_data_page = kzalloc(mtd->writesize, GFP_KERNEL); in nandbcb_init()
1037 ret = fill_dbbt_data(mtd, dbbt_data_page, CONV_TO_BLOCKS(maxsize)); in nandbcb_init()
1062 struct mtd_info *mtd; in do_nandbcb_bcbonly() local
1084 mtd = cfg.mtd; in do_nandbcb_bcbonly()
1088 cfg.boot_stream1_size = ALIGN(cfg.boot_stream1_size, mtd->writesize); in do_nandbcb_bcbonly()
1094 mtd->writesize); in do_nandbcb_bcbonly()
1107 ret = nand_erase_opts(mtd, &opts); in do_nandbcb_bcbonly()
1127 dbbt_page = kzalloc(mtd->writesize, GFP_KERNEL); in do_nandbcb_bcbonly()
1134 dbbt_data_page = kzalloc(mtd->writesize, GFP_KERNEL); in do_nandbcb_bcbonly()
1145 ret = fill_dbbt_data(mtd, dbbt_data_page, CONV_TO_BLOCKS(maxsize)); in do_nandbcb_bcbonly()
1174 struct mtd_info *mtd = boot_cfg->mtd; in dump_structure() local
1252 fcb->fw1_start, fcb->fw1_pages * mtd->writesize); in dump_structure()
1254 fcb->fw2_start, fcb->fw2_pages * mtd->writesize); in dump_structure()
1257 fcb->fw1_start, fcb->fw1_pages * mtd->writesize); in dump_structure()
1259 fcb->fw2_start, fcb->fw2_pages * mtd->writesize); in dump_structure()
1304 struct mtd_info *mtd = boot_cfg->mtd; in nandbcb_dump() local
1311 dbbt_data_page = kzalloc(mtd->writesize, GFP_KERNEL); in nandbcb_dump()
1318 dbbt_data_page_copy = kzalloc(mtd->writesize, GFP_KERNEL); in nandbcb_dump()
1384 mtd->writesize)) { in nandbcb_dump()