summaryrefslogtreecommitdiffstats
path: root/commands/nand.c
diff options
context:
space:
mode:
Diffstat (limited to 'commands/nand.c')
-rw-r--r--commands/nand.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/commands/nand.c b/commands/nand.c
index c57b3945a8..d07444aee0 100644
--- a/commands/nand.c
+++ b/commands/nand.c
@@ -1,19 +1,6 @@
-/*
- * Copyright (c) 2008 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// SPDX-License-Identifier: GPL-2.0-only
+// SPDX-FileCopyrightText: © 2008 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
+
#include <common.h>
#include <command.h>
#include <fs.h>
@@ -26,6 +13,7 @@
#include <ioctl.h>
#include <nand.h>
#include <linux/mtd/mtd-abi.h>
+#include <linux/mtd/mtd.h>
#include <fcntl.h>
#include <libgen.h>
@@ -143,6 +131,8 @@ static int do_nand(int argc, char *argv[])
loff_t ofs;
int bad = 0;
+ printf("---- bad blocks ----\n");
+
for (ofs = 0; ofs < mtdinfo.size; ofs += mtdinfo.erasesize) {
if (ioctl(fd, MEMGETBADBLOCK, &ofs)) {
printf("Block at 0x%08llx is bad\n", ofs);
@@ -152,6 +142,8 @@ static int do_nand(int argc, char *argv[])
if (!bad)
printf("No bad blocks\n");
+
+ mtd_print_oob_info(mtdinfo.mtd);
}
out:
@@ -173,7 +165,7 @@ BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(nand)
.cmd = do_nand,
BAREBOX_CMD_DESC("NAND flash handling")
- BAREBOX_CMD_OPTS("[-adb] NANDDEV")
+ BAREBOX_CMD_OPTS("[-adbgi] NANDDEV")
BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP)
BAREBOX_CMD_HELP(cmd_nand_help)
BAREBOX_CMD_END