[U-Boot] [PATCH] cmd: mtdparts: Probe MTD devices in mtdparts_init()

Stefan Roese sr at denx.de
Tue Oct 30 09:51:51 UTC 2018


Calling "mtdparts" currently fails when its called before any other mtd
command (or ubi command) has been called. The MTD devices are not
probed at this point and therefore it fails e.g. with this message:

=> mtdparts
Device spi-nand0 not found!

This patch adds a call to mtd_probe_devices() to mtdparts_init() to
solve this issue. This also fixes a problem when calling "ubi part"
as first flash storage related command. Here also the warning from
above is printed without this patch.

Signed-off-by: Stefan Roese <sr at denx.de>
Cc: Miquel Raynal <miquel.raynal at bootlin.com>
Cc: Boris Brezillon <boris.brezillon at bootlin.com>
Cc: Jagan Teki <jagan at openedev.com>
---
 cmd/mtdparts.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index f7ed1a0779..d90e568143 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -73,6 +73,7 @@
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
+#include <mtd.h>
 #include <jffs2/load_kernel.h>
 #include <linux/list.h>
 #include <linux/ctype.h>
@@ -1726,6 +1727,9 @@ int mtdparts_init(void)
 	char tmp_ep[PARTITION_MAXLEN + 1];
 	char tmp_parts[MTDPARTS_MAXLEN];
 
+	/* First probe all MTD devices */
+	mtd_probe_devices();
+
 	debug("\n---mtdparts_init---\n");
 	if (!initialized) {
 		INIT_LIST_HEAD(&mtdids);
-- 
2.19.1



More information about the U-Boot mailing list