summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMarek Behún <marek.behun@nic.cz>2021-05-26 15:08:23 +0300
committerJagan Teki <jagan@amarulasolutions.com>2021-06-24 09:24:32 +0300
commit3c58c79b5ff1fb75780be18b86d1ae64b19c2136 (patch)
tree8a4e19316db6dbf50f99158e596ea2e60d0a3e87 /drivers/mtd
parent69e57c4753dd5428e9e5ed6d1399c8532f744efc (diff)
downloadu-boot-3c58c79b5ff1fb75780be18b86d1ae64b19c2136.tar.xz
mtd: probe SPI NOR devices in mtd_probe_devices()
In order for `mtd list` U-Boot command to list SPI NOR devices without the need to run `sf probe` before, we have to probe SPI NOR devices in mtd_probe_devices(). Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Pali Rohár <pali@kernel.org> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com> Cc: Priyanka Jain <priyanka.jain@nxp.com> Cc: Simon Glass <sjg@chromium.org> Cc: Heiko Schocher <hs@denx.de> Cc: Patrick Delaunay <patrick.delaunay@st.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtd_uboot.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
index a652d431ba..90767ec417 100644
--- a/drivers/mtd/mtd_uboot.c
+++ b/drivers/mtd/mtd_uboot.c
@@ -115,6 +115,18 @@ static void mtd_probe_uclass_mtd_devs(void)
static void mtd_probe_uclass_mtd_devs(void) { }
#endif
+#if IS_ENABLED(CONFIG_DM_SPI_FLASH) && IS_ENABLED(CONFIG_SPI_FLASH_MTD)
+static void mtd_probe_uclass_spi_nor_devs(void)
+{
+ struct udevice *dev;
+
+ uclass_foreach_dev_probe(UCLASS_SPI_FLASH, dev)
+ ;
+}
+#else
+static void mtd_probe_uclass_spi_nor_devs(void) { }
+#endif
+
#if defined(CONFIG_MTD_PARTITIONS)
#define MTDPARTS_MAXLEN 512
@@ -310,6 +322,7 @@ int mtd_probe_devices(void)
struct mtd_info *mtd;
mtd_probe_uclass_mtd_devs();
+ mtd_probe_uclass_spi_nor_devs();
/*
* Check if mtdparts/mtdids changed, if the MTD dev list was updated
@@ -370,6 +383,7 @@ int mtd_probe_devices(void)
int mtd_probe_devices(void)
{
mtd_probe_uclass_mtd_devs();
+ mtd_probe_uclass_spi_nor_devs();
return 0;
}