[PATCH 2/2] configs: sandbox: test: dm: blk: Enable NVMXIP QSPI and update test

Marek Vasut marek.vasut+renesas at mailbox.org
Sun Aug 13 23:46:59 CEST 2023


Enable NVMXIP QSPI driver on sandbox, since it is already enabled
on sandbox64. Update blk tests to match.

Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
---
Cc: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
Cc: Simon Glass <sjg at chromium.org>
---
 configs/sandbox_defconfig |  1 +
 test/dm/blk.c             | 63 +++++++++++++++++++++++++++++++--------
 2 files changed, 52 insertions(+), 12 deletions(-)

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 1cd1c2ed7cd..f451a94362e 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -227,6 +227,7 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_SST=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_NVMXIP_QSPI=y
 CONFIG_MULTIPLEXER=y
 CONFIG_MUX_MMIO=y
 CONFIG_NVME_PCI=y
diff --git a/test/dm/blk.c b/test/dm/blk.c
index 446c4423e6f..d268a441c99 100644
--- a/test/dm/blk.c
+++ b/test/dm/blk.c
@@ -82,12 +82,12 @@ static int dm_test_blk_usb(struct unit_test_state *uts)
 	ut_asserteq_ptr(usb_dev, dev_get_parent(dev));
 
 	/* Check we have one block device for each mass storage device */
-	ut_asserteq(6, count_blk_devices());
+	ut_asserteq(8, count_blk_devices());
 
 	/* Now go around again, making sure the old devices were unbound */
 	ut_assertok(usb_stop());
 	ut_assertok(usb_init());
-	ut_asserteq(6, count_blk_devices());
+	ut_asserteq(8, count_blk_devices());
 	ut_assertok(usb_stop());
 
 	return 0;
@@ -184,6 +184,10 @@ static int dm_test_blk_iter(struct unit_test_state *uts)
 	 */
 	ut_assertok(blk_first_device_err(BLKF_FIXED, &dev));
 	ut_asserteq_str("mmc2.blk", dev->name);
+	ut_assertok(blk_next_device_err(BLKF_FIXED, &dev));
+	ut_asserteq_str("nvmxip-qspi1 at 08000000.blk#1", dev->name);
+	ut_assertok(blk_next_device_err(BLKF_FIXED, &dev));
+	ut_asserteq_str("nvmxip-qspi2 at 08200000.blk#2", dev->name);
 	ut_asserteq(-ENODEV, blk_next_device_err(BLKF_FIXED, &dev));
 
 	ut_assertok(blk_first_device_err(BLKF_REMOVABLE, &dev));
@@ -198,16 +202,23 @@ static int dm_test_blk_iter(struct unit_test_state *uts)
 	ut_asserteq_str("mmc1.blk", dev->name);
 	ut_assertok(blk_next_device_err(BLKF_BOTH, &dev));
 	ut_asserteq_str("mmc0.blk", dev->name);
+	ut_assertok(blk_next_device_err(BLKF_BOTH, &dev));
+	ut_asserteq_str("nvmxip-qspi1 at 08000000.blk#1", dev->name);
+	ut_assertok(blk_next_device_err(BLKF_BOTH, &dev));
+	ut_asserteq_str("nvmxip-qspi2 at 08200000.blk#2", dev->name);
 	ut_asserteq(-ENODEV, blk_next_device_err(BLKF_FIXED, &dev));
 
-	ut_asserteq(1, blk_count_devices(BLKF_FIXED));
+	ut_asserteq(3, blk_count_devices(BLKF_FIXED));
 	ut_asserteq(2, blk_count_devices(BLKF_REMOVABLE));
-	ut_asserteq(3, blk_count_devices(BLKF_BOTH));
+	ut_asserteq(5, blk_count_devices(BLKF_BOTH));
 
 	i = 0;
 	blk_foreach_probe(BLKF_FIXED, dev)
-		ut_asserteq_str((i++, "mmc2.blk"), dev->name);
-	ut_asserteq(1, i);
+		ut_asserteq_str((++i == 1 ? "mmc2.blk" :
+				i == 2 ? "nvmxip-qspi1 at 08000000.blk#1" :
+				"nvmxip-qspi2 at 08200000.blk#2"),
+				dev->name);
+	ut_asserteq(3, i);
 
 	i = 0;
 	blk_foreach_probe(BLKF_REMOVABLE, dev)
@@ -216,9 +227,13 @@ static int dm_test_blk_iter(struct unit_test_state *uts)
 
 	i = 0;
 	blk_foreach_probe(BLKF_BOTH, dev)
-		ut_asserteq_str((++i == 1 ? "mmc2.blk" : i == 2 ?
-			"mmc1.blk" : "mmc0.blk"), dev->name);
-	ut_asserteq(3, i);
+		ut_asserteq_str((++i == 1 ? "mmc2.blk" :
+				i == 2 ? "mmc1.blk" :
+				i == 3 ? "mmc0.blk" :
+				i == 4 ? "nvmxip-qspi1 at 08000000.blk#1" :
+				"nvmxip-qspi2 at 08200000.blk#2"),
+				dev->name);
+	ut_asserteq(5, i);
 
 	return 0;
 }
@@ -242,6 +257,14 @@ static int dm_test_blk_flags(struct unit_test_state *uts)
 	ut_assertnonnull(dev);
 	ut_asserteq_str("mmc0.blk", dev->name);
 
+	ut_assertok(blk_find_next(BLKF_BOTH, &dev));
+	ut_assertnonnull(dev);
+	ut_asserteq_str("nvmxip-qspi1 at 08000000.blk#1", dev->name);
+
+	ut_assertok(blk_find_next(BLKF_BOTH, &dev));
+	ut_assertnonnull(dev);
+	ut_asserteq_str("nvmxip-qspi2 at 08200000.blk#2", dev->name);
+
 	ut_asserteq(-ENODEV, blk_find_next(BLKF_BOTH, &dev));
 	ut_assertnull(dev);
 
@@ -265,6 +288,14 @@ static int dm_test_blk_flags(struct unit_test_state *uts)
 	ut_assertnonnull(dev);
 	ut_asserteq_str("mmc0.blk", dev->name);
 
+	ut_assertok(blk_next_device_err(BLKF_BOTH, &dev));
+	ut_assertnonnull(dev);
+	ut_asserteq_str("nvmxip-qspi1 at 08000000.blk#1", dev->name);
+
+	ut_assertok(blk_next_device_err(BLKF_BOTH, &dev));
+	ut_assertnonnull(dev);
+	ut_asserteq_str("nvmxip-qspi2 at 08200000.blk#2", dev->name);
+
 	ut_asserteq(-ENODEV, blk_next_device_err(BLKF_BOTH, &dev));
 
 	/* Look only for fixed devices */
@@ -272,6 +303,14 @@ static int dm_test_blk_flags(struct unit_test_state *uts)
 	ut_assertnonnull(dev);
 	ut_asserteq_str("mmc2.blk", dev->name);
 
+	ut_assertok(blk_next_device_err(BLKF_FIXED, &dev));
+	ut_assertnonnull(dev);
+	ut_asserteq_str("nvmxip-qspi1 at 08000000.blk#1", dev->name);
+
+	ut_assertok(blk_next_device_err(BLKF_FIXED, &dev));
+	ut_assertnonnull(dev);
+	ut_asserteq_str("nvmxip-qspi2 at 08200000.blk#2", dev->name);
+
 	ut_asserteq(-ENODEV, blk_next_device_err(BLKF_FIXED, &dev));
 
 	/* Look only for removable devices */
@@ -317,13 +356,13 @@ static int dm_test_blk_foreach(struct unit_test_state *uts)
 	blk_foreach_probe(BLKF_BOTH, dev)
 		found |= 1 << dectoul(&dev->name[3], NULL);
 	ut_asserteq(7, found);
-	ut_asserteq(3, blk_count_devices(BLKF_BOTH));
+	ut_asserteq(5, blk_count_devices(BLKF_BOTH));
 
 	found = 0;
 	blk_foreach_probe(BLKF_FIXED, dev)
 		found |= 1 << dectoul(&dev->name[3], NULL);
-	ut_asserteq(4, found);
-	ut_asserteq(1, blk_count_devices(BLKF_FIXED));
+	ut_asserteq(5, found);
+	ut_asserteq(3, blk_count_devices(BLKF_FIXED));
 
 	found = 0;
 	blk_foreach_probe(BLKF_REMOVABLE, dev)
-- 
2.40.1



More information about the U-Boot mailing list