]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: st: common: simplify MTD device parsing
authorPatrice Chotard <patrice.chotard@foss.st.com>
Fri, 17 Nov 2023 17:01:07 +0000 (18:01 +0100)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Fri, 15 Dec 2023 14:41:23 +0000 (15:41 +0100)
Simplify the way all MTD devices are parsed.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
board/st/common/stm32mp_dfu.c

index ded3bf81961af136dc93e8eb9c3dfbf844f75573..77edb86e78c1361e4f161f3ead263a5d7a490f58 100644 (file)
@@ -123,24 +123,9 @@ void set_dfu_alt_info(char *interface, char *devstr)
                /* probe all MTD devices */
                mtd_probe_devices();
 
-               /* probe SPI flash device on a bus */
-               if (!uclass_get_device(UCLASS_SPI_FLASH, 0, &dev)) {
-                       mtd = get_mtd_device_nm("nor0");
-                       if (!IS_ERR_OR_NULL(mtd))
+               mtd_for_each_device(mtd)
+                       if (!mtd_is_partition(mtd))
                                board_get_alt_info_mtd(mtd, buf);
-
-                       mtd = get_mtd_device_nm("nor1");
-                       if (!IS_ERR_OR_NULL(mtd))
-                               board_get_alt_info_mtd(mtd, buf);
-               }
-
-               mtd = get_mtd_device_nm("nand0");
-               if (!IS_ERR_OR_NULL(mtd))
-                       board_get_alt_info_mtd(mtd, buf);
-
-               mtd = get_mtd_device_nm("spi-nand0");
-               if (!IS_ERR_OR_NULL(mtd))
-                       board_get_alt_info_mtd(mtd, buf);
        }
 
        if (IS_ENABLED(CONFIG_DFU_VIRT)) {