summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorAshok Reddy Soma <ashok.reddy.soma@amd.com>2023-01-05 12:46:20 +0300
committerDario Binacchi <dario.binacchi@amarulasolutions.com>2023-02-27 18:28:30 +0300
commitcfb82f7c123e411b8cfb5d58c2c666f54cb9b66a (patch)
tree218b71e1d41f5abc807fc02818584e3b9d13666d /cmd
parent0024e7f72b689f8c2df731a69e20f47b6f8dc5a7 (diff)
downloadu-boot-cfb82f7c123e411b8cfb5d58c2c666f54cb9b66a.tar.xz
mtd: nand: Mark reserved blocks
Reserved blocks are used for storing bad block tables. With "nand bad" command, these reserved blocks are shown as bad blocks. This is leading to confusion when compared with Linux bad blocks. Hence, display "bbt reserved" when printing reserved blocks with "nand bad" command. To acheive this, return 2 which represents reserved from nand_isbad_bbt() instead of 1 in case of reserved blocks and catch it in cmd/nand.c. "nand bad" command display's hexadecimal numbers, so add "0x" prefix. Example log will show up as below. ZynqMP> nand bad Device 0 bad blocks: 0x00400000 0x16800000 0x16c00000 0x17000000 0x3d800000 0x3e400000 0xe8400000 0xff000000 (bbt reserved) 0xff400000 (bbt reserved) 0xff800000 (bbt reserved) 0xffc00000 (bbt reserved) 0x116800000 0x116c00000 0x1ff000000 (bbt reserved) 0x1ff400000 (bbt reserved) 0x1ff800000 (bbt reserved) 0x1ffc00000 (bbt reserved) Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> Acked-By: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/nand.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd/nand.c b/cmd/nand.c
index 9a723f5757..b41e54ec42 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -567,9 +567,12 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc,
if (strcmp(cmd, "bad") == 0) {
printf("\nDevice %d bad blocks:\n", dev);
- for (off = 0; off < mtd->size; off += mtd->erasesize)
- if (nand_block_isbad(mtd, off))
- printf(" %08llx\n", (unsigned long long)off);
+ for (off = 0; off < mtd->size; off += mtd->erasesize) {
+ ret = nand_block_isbad(mtd, off);
+ if (ret)
+ printf(" 0x%08llx%s\n", (unsigned long long)off,
+ ret == 2 ? "\t (bbt reserved)" : "");
+ }
return 0;
}