summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2022-12-11 09:40:25 -0500
committerTom Rini <[email protected]>2022-12-11 09:40:25 -0500
commit7a7b0856ca01f0dadc940f6f1bc6df44129ad9d0 (patch)
tree2bad16f7baf7283e4d8af9c11ad8ef89dd217ecb /cmd
parent8f170408774b30aa4ee91b3cc90ba09b564d4651 (diff)
parentfda2253d121f05921e419edffe615c607917792a (diff)
Merge tag 'u-boot-nand-20221211' of https://source.denx.de/u-boot/custodians/u-boot-nand-flash
Merge tag 'u-boot-nand-20221211' of https://source.denx.de/u-boot/custodians/u-boot-nand-flash - cmd: nand: Extend nand info to print ecc information - rawnand: omap_gpmc: driver model support (the first patches of the series) - mtd: nand: make Samsung SLC NAND usable again - cmd: mtd: check if a block has to be skipped or erased - spl: spl_legacy: fix invalid offset in SPL_COPY_PAYLOAD_ONLY
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mtd.c28
-rw-r--r--cmd/nand.c14
2 files changed, 28 insertions, 14 deletions
diff --git a/cmd/mtd.c b/cmd/mtd.c
index ad5cc9827d5..eb6e2d6892f 100644
--- a/cmd/mtd.c
+++ b/cmd/mtd.c
@@ -434,19 +434,31 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc,
erase_op.mtd = mtd;
erase_op.addr = off;
erase_op.len = mtd->erasesize;
- erase_op.scrub = scrub;
while (len) {
- ret = mtd_erase(mtd, &erase_op);
+ if (!scrub) {
+ ret = mtd_block_isbad(mtd, erase_op.addr);
+ if (ret < 0) {
+ printf("Failed to get bad block at 0x%08llx\n",
+ erase_op.addr);
+ ret = CMD_RET_FAILURE;
+ goto out_put_mtd;
+ }
- if (ret) {
- /* Abort if its not a bad block error */
- if (ret != -EIO)
- break;
- printf("Skipping bad block at 0x%08llx\n",
- erase_op.addr);
+ if (ret > 0) {
+ printf("Skipping bad block at 0x%08llx\n",
+ erase_op.addr);
+ ret = 0;
+ len -= mtd->erasesize;
+ erase_op.addr += mtd->erasesize;
+ continue;
+ }
}
+ ret = mtd_erase(mtd, &erase_op);
+ if (ret && ret != -EIO)
+ break;
+
len -= mtd->erasesize;
erase_op.addr += mtd->erasesize;
}
diff --git a/cmd/nand.c b/cmd/nand.c
index 5bb43794e90..9a723f57579 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -417,12 +417,14 @@ static void nand_print_and_set_info(int idx)
printf("%dx ", chip->numchips);
printf("%s, sector size %u KiB\n",
mtd->name, mtd->erasesize >> 10);
- printf(" Page size %8d b\n", mtd->writesize);
- printf(" OOB size %8d b\n", mtd->oobsize);
- printf(" Erase size %8d b\n", mtd->erasesize);
- printf(" subpagesize %8d b\n", chip->subpagesize);
- printf(" options 0x%08x\n", chip->options);
- printf(" bbt options 0x%08x\n", chip->bbt_options);
+ printf(" Page size %8d b\n", mtd->writesize);
+ printf(" OOB size %8d b\n", mtd->oobsize);
+ printf(" Erase size %8d b\n", mtd->erasesize);
+ printf(" ecc strength %8d bits\n", mtd->ecc_strength);
+ printf(" ecc step size %8d b\n", mtd->ecc_step_size);
+ printf(" subpagesize %8d b\n", chip->subpagesize);
+ printf(" options 0x%08x\n", chip->options);
+ printf(" bbt options 0x%08x\n", chip->bbt_options);
/* Set geometry info */
env_set_hex("nand_writesize", mtd->writesize);