- Backport upstream Winbond W25N04KV Flash support. - Backport upstream GigaDevice series Flash support. - Backport pending Airoha AN8855 switch TPID value fix. - Backport Mediatek UART baudrate accuracy compensation support. - Pull mtk patchset from MTK SDK mtksoc-20250711 branch: Remove mt7622_rfb changes. The MTK SDK already dropped them. Replace Airoha ethernet PHY driver with new version. Split downstream snfi changes into independent patches. Add new Marvell CUX3410 PHY driver. Add new MediaTek built-in 2.5Gbps PHY driver. Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
80 lines
2.4 KiB
Diff
80 lines
2.4 KiB
Diff
From f180eb4beec9b0cf19e8c2418d2b01404797cb26 Mon Sep 17 00:00:00 2001
|
|
From: Weijie Gao <weijie.gao@mediatek.com>
|
|
Date: Mon, 25 Jul 2022 11:22:57 +0800
|
|
Subject: [PATCH 08/30] cmd: mtd: add markbad subcommand for NMBM testing
|
|
|
|
This patch adds:
|
|
* Mark bad block on lower mtd device and erase on upper mtd
|
|
device, which will trigger remapping:
|
|
$ mtd markbad spi-nand0 0x20000 (mark block1 as bad)
|
|
$ mtd erase nmbm0 0x20000 0x20000 (let nmbm detect the bad block and remap it)
|
|
|
|
* Clear bad block mark through:
|
|
$ mtd erase.dontskipbad spi-nand0 0x20000 0x20000
|
|
(After cleaning bad block mark, we need to rebuild nmbm manage table.)
|
|
|
|
Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
|
|
---
|
|
cmd/mtd.c | 39 +++++++++++++++++++++++++++++++++++++++
|
|
1 file changed, 39 insertions(+)
|
|
|
|
--- a/cmd/mtd.c
|
|
+++ b/cmd/mtd.c
|
|
@@ -728,6 +728,42 @@ out_put_mtd:
|
|
return CMD_RET_SUCCESS;
|
|
}
|
|
|
|
+static int do_mtd_markbad(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
+ char * const argv[])
|
|
+{
|
|
+ struct mtd_info *mtd;
|
|
+ loff_t off;
|
|
+ int ret;
|
|
+
|
|
+ if (argc < 3)
|
|
+ return CMD_RET_USAGE;
|
|
+
|
|
+ mtd = get_mtd_by_name(argv[1]);
|
|
+ if (IS_ERR(mtd) || !mtd)
|
|
+ return CMD_RET_FAILURE;
|
|
+
|
|
+ if (!mtd_can_have_bb(mtd)) {
|
|
+ printf("Only NAND-based devices can have mark blocks\n");
|
|
+ goto out_put_mtd;
|
|
+ }
|
|
+
|
|
+ off = simple_strtoull(argv[2], NULL, 0);
|
|
+
|
|
+ ret = mtd_block_markbad(mtd, off);
|
|
+ if (!ret) {
|
|
+ printf("MTD device %s block at 0x%08llx marked bad\n",
|
|
+ mtd->name, off);
|
|
+ } else {
|
|
+ printf("MTD device %s block at 0x%08llx mark bad failed\n",
|
|
+ mtd->name, off);
|
|
+ }
|
|
+
|
|
+out_put_mtd:
|
|
+ put_mtd_device(mtd);
|
|
+
|
|
+ return CMD_RET_SUCCESS;
|
|
+}
|
|
+
|
|
#ifdef CONFIG_AUTO_COMPLETE
|
|
static int mtd_name_complete(int argc, char *const argv[], char last_char,
|
|
int maxv, char *cmdv[])
|
|
@@ -775,6 +811,7 @@ U_BOOT_LONGHELP(mtd,
|
|
"\n"
|
|
"Specific functions:\n"
|
|
"mtd bad <name>\n"
|
|
+ "mtd markbad <name> <off>\n"
|
|
#if CONFIG_IS_ENABLED(CMD_MTD_OTP)
|
|
"mtd otpread <name> [u|f] <off> <size>\n"
|
|
"mtd otpwrite <name> <off> <hex string>\n"
|
|
@@ -815,4 +852,6 @@ U_BOOT_CMD_WITH_SUBCMDS(mtd, "MTD utils"
|
|
U_BOOT_SUBCMD_MKENT_COMPLETE(erase, 4, 0, do_mtd_erase,
|
|
mtd_name_complete),
|
|
U_BOOT_SUBCMD_MKENT_COMPLETE(bad, 2, 1, do_mtd_bad,
|
|
+ mtd_name_complete),
|
|
+ U_BOOT_SUBCMD_MKENT_COMPLETE(markbad, 3, 1, do_mtd_markbad,
|
|
mtd_name_complete));
|