struct mtd_device *dev;
struct part_info *part_info;
u8 part_num;
- size_t actual;
debug("Initializing mtd_parts\n");
ret = mtdparts_init();
return ret;
}
- debug("Found partition '%s': offset=%08x size=%08x\n",
- part, part_info->offset, part_info->size);
- if (part_info->size < len) {
- printf("Warning: partition '%s' smaller than requested size: %u; truncating data to %u byte\n",
- part, len, part_info->size);
+ debug("Found partition '%s': offset=%08llx size=%08llx\n",
+ part, (u64)part_info->offset, (u64)part_info->size);
+
+ if (part_info->size < len)
len = part_info->size;
- }
+
debug("Reading NAND partition '%s' to %p\n", part, addr);
ret = nand_read_skip_bad(&nand_info[0], part_info->offset, &len,
- &actual, len, addr);
+ NULL, part_info->size, addr);
if (ret) {
printf("Failed to load partition '%s' to %p\n", part, addr);
return ret;
}
- if (actual < len)
- printf("Read only %u of %u bytes due to bad blocks\n",
- actual, len);
- debug("Read %u byte from partition '%s' @ offset %08x\n",
- len, part, part_info->offset);
+ debug("Read %u byte from partition '%s' @ offset %08llx\n",
+ len, part, (u64)part_info->offset);
return 0;
}
-#ifdef CONFIG_SPLASH_SCREEN_
+#if defined(CONFIG_SPLASH_SCREEN) && defined(CONFIG_MTDPARTS)
static int erase_flash(loff_t offs, size_t len)
{
nand_erase_options_t nand_erase_options;
struct part_info *part_info;
u8 part_num;
u_char *addr = (u_char *)gd->fb_base;
- size_t actual;
if (argc > 2)
return CMD_RET_USAGE;
debug("Initializing mtd_parts\n");
ret = mtdparts_init();
if (ret)
- return ret;
+ return CMD_RET_FAILURE;
debug("Trying to find NAND partition '%s'\n", part);
ret = find_dev_and_part(part, &dev, &part_num,
if (ret) {
printf("Failed to find flash partition '%s': %d\n",
part, ret);
-
- return ret;
+ return CMD_RET_FAILURE;
}
debug("Found partition '%s': offset=%08x size=%08x\n",
part, part_info->offset, part_info->size);
}
ret = nand_write_skip_bad(&nand_info[0], part_info->offset,
- &fbsize, &actual, part_info->size,
+ &fbsize, NULL, part_info->size,
addr, WITH_DROP_FFS);
if (ret) {
printf("Failed to write partition '%s'\n", part);
- return ret;
+ return CMD_RET_FAILURE;
}
- if (actual < fbsize)
- printf("Wrote only %u of %u bytes due to bad blocks\n",
- actual, fbsize);
debug("Wrote %u byte from %p to partition '%s' @ offset %08x\n",
fbsize, addr, part, part_info->offset);