int ret = 0;
mtd = boot_cfg->mtd;
- if (mtd_block_isbad(mtd, off)) {
- printf("Block %d is bad, skipped\n", (int)CONV_TO_BLOCKS(off));
- return 1;
- }
fcb_raw_page = kzalloc(mtd->writesize + mtd->oobsize, GFP_KERNEL);
if (!fcb_raw_page) {
else if (plat_config.misc_flags & FCB_ENCODE_BCH_40b)
mxs_nand_mode_fcb_40bit(mtd);
- ret = nand_read(mtd, off, &size, (u_char *)fcb);
+ ret = nand_read_skip_bad(mtd, off, &size, NULL, mtd->size, (u_char *)fcb);
/* switch BCH back */
mxs_nand_mode_normal(mtd);
for (i = 0; i < g_boot_search_count; i++) {
if (mtd_block_isbad(mtd, off)) {
printf("Block %d is bad, skipped\n", i);
+ off += mtd->erasesize;
continue;
}
void *dbbt_data_page, loff_t off)
{
size_t size;
+ size_t actual_size;
struct mtd_info *mtd;
loff_t to;
int ret;
mtd = boot_cfg->mtd;
- if (mtd_block_isbad(mtd, off)) {
- printf("Block %d is bad, skipped\n",
- (int)CONV_TO_BLOCKS(off));
- return 1;
- }
-
size = sizeof(struct dbbt_block);
- ret = nand_read(mtd, off, &size, (u_char *)dbbt);
+ ret = nand_read_skip_bad(mtd, off, &size, &actual_size, mtd->size, (u_char *)dbbt);
printf("NAND DBBT read from 0x%llx offset 0x%zx read: %s\n",
off, size, ret ? "ERROR" : "OK");
if (ret)
/* dbbtpages == 0 if no bad blocks */
if (dbbt->dbbtpages > 0) {
- to = off + 4 * mtd->writesize;
+ to = off + 4 * mtd->writesize + actual_size - size;
size = mtd->writesize;
- ret = nand_read(mtd, to, &size, dbbt_data_page);
+ ret = nand_read_skip_bad(mtd, to, &size, NULL, mtd->size, dbbt_data_page);
printf("DBBT data read from 0x%llx offset 0x%zx read: %s\n",
to, size, ret ? "ERROR" : "OK");
if (mtd_block_isbad(mtd, off)) {
printf("Block %d is bad, skipped\n",
(int)(i + CONV_TO_BLOCKS(off)));
+ off += mtd->erasesize;
continue;
}