Merge branch '2021-04-22-assorted-updates'

- Move LMB to Kconfig, improve functionality
- Add partlabel support to more fs cmds
diff --git a/.checkpatch.conf b/.checkpatch.conf
index ed0c215..9e40ea06 100644
--- a/.checkpatch.conf
+++ b/.checkpatch.conf
@@ -26,6 +26,9 @@
 # addresses are __aligned(2)".
 --ignore PREFER_ETHER_ADDR_COPY
 
+# ENOSYS is a conventionally used error, even though U-Boot lacks system calls.
+--ignore ENOSYS
+
 # A bit shorter of a description is OK with us.
 --min-conf-desc-length=2
 
diff --git a/arch/arc/include/asm/config.h b/arch/arc/include/asm/config.h
index d88c361..46e94be 100644
--- a/arch/arc/include/asm/config.h
+++ b/arch/arc/include/asm/config.h
@@ -8,6 +8,4 @@
 
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
-#define CONFIG_LMB
-
 #endif /*__ASM_ARC_CONFIG_H_ */
diff --git a/arch/arm/include/asm/config.h b/arch/arm/include/asm/config.h
index bf692ce..14860d8 100644
--- a/arch/arm/include/asm/config.h
+++ b/arch/arm/include/asm/config.h
@@ -6,7 +6,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #if defined(CONFIG_ARCH_LS1021A) || \
diff --git a/arch/m68k/include/asm/config.h b/arch/m68k/include/asm/config.h
index 7ea4436..221eb93 100644
--- a/arch/m68k/include/asm/config.h
+++ b/arch/m68k/include/asm/config.h
@@ -6,7 +6,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #endif
diff --git a/arch/microblaze/include/asm/config.h b/arch/microblaze/include/asm/config.h
index 3ae71b3..221eb93 100644
--- a/arch/microblaze/include/asm/config.h
+++ b/arch/microblaze/include/asm/config.h
@@ -6,8 +6,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
-
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #endif
diff --git a/arch/mips/include/asm/config.h b/arch/mips/include/asm/config.h
index 7ea4436..221eb93 100644
--- a/arch/mips/include/asm/config.h
+++ b/arch/mips/include/asm/config.h
@@ -6,7 +6,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #endif
diff --git a/arch/nds32/include/asm/config.h b/arch/nds32/include/asm/config.h
index 8964a58..6c1cbce 100644
--- a/arch/nds32/include/asm/config.h
+++ b/arch/nds32/include/asm/config.h
@@ -7,6 +7,5 @@
 
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
-#define CONFIG_LMB
 
 #endif
diff --git a/arch/powerpc/include/asm/config.h b/arch/powerpc/include/asm/config.h
index c9c9964..99b410d 100644
--- a/arch/powerpc/include/asm/config.h
+++ b/arch/powerpc/include/asm/config.h
@@ -18,7 +18,6 @@
   #define HWCONFIG_BUFFER_SIZE 256
 #endif
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #ifndef CONFIG_MAX_MEM_MAPPED
diff --git a/arch/riscv/include/asm/config.h b/arch/riscv/include/asm/config.h
index 156cb94..d911007 100644
--- a/arch/riscv/include/asm/config.h
+++ b/arch/riscv/include/asm/config.h
@@ -7,7 +7,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #endif
diff --git a/arch/sh/include/asm/config.h b/arch/sh/include/asm/config.h
index e1cd322..406156d 100644
--- a/arch/sh/include/asm/config.h
+++ b/arch/sh/include/asm/config.h
@@ -8,8 +8,6 @@
 
 #include <asm/processor.h>
 
-#define CONFIG_LMB
-
 /* Timer */
 #define CONFIG_SYS_TIMER_COUNTS_DOWN
 #define CONFIG_SYS_TIMER_COUNTER	(TMU_BASE + 0xc)	/* TCNT0 */
diff --git a/arch/x86/include/asm/config.h b/arch/x86/include/asm/config.h
index 7ea4436..221eb93 100644
--- a/arch/x86/include/asm/config.h
+++ b/arch/x86/include/asm/config.h
@@ -6,7 +6,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #endif
diff --git a/arch/xtensa/include/asm/config.h b/arch/xtensa/include/asm/config.h
index 5a95fc9..a1096ab 100644
--- a/arch/xtensa/include/asm/config.h
+++ b/arch/xtensa/include/asm/config.h
@@ -9,8 +9,6 @@
 
 #include <asm/arch/core.h>
 
-#define CONFIG_LMB
-
 /*
  * Make boot parameters available in the MMUv2 virtual memory layout by
  * restricting used physical memory to the first 128MB.
diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
index fbca482..a60198f 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -170,3 +170,6 @@
 CONFIG_ERRNO_STR=y
 # CONFIG_HEXDUMP is not set
 CONFIG_FDT_FIXUP_PARTITIONS=y
+# CONFIG_LMB_USE_MAX_REGIONS is not set
+CONFIG_LMB_MEMORY_REGIONS=2
+CONFIG_LMB_RESERVED_REGIONS=16
diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig
index ba9a660..8c71ca6 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -152,3 +152,6 @@
 CONFIG_ERRNO_STR=y
 # CONFIG_HEXDUMP is not set
 CONFIG_FDT_FIXUP_PARTITIONS=y
+# CONFIG_LMB_USE_MAX_REGIONS is not set
+CONFIG_LMB_MEMORY_REGIONS=2
+CONFIG_LMB_RESERVED_REGIONS=16
diff --git a/disk/part.c b/disk/part.c
index 80ced2b..5e7e59c 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -725,7 +725,7 @@
 	}
 
 	ret = blk_get_device_by_str(dev_iface, dev_str, dev_desc);
-	if (ret)
+	if (ret < 0)
 		goto cleanup;
 
 	ret = part_get_info_by_name(*dev_desc, part_str, part_info);
diff --git a/fs/fs.c b/fs/fs.c
index 900928c..b7936fd 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -385,8 +385,8 @@
 	}
 #endif
 
-	part = blk_get_device_part_str(ifname, dev_part_str, &fs_dev_desc,
-					&fs_partition, 1);
+	part = part_get_info_by_dev_and_name_or_num(ifname, dev_part_str, &fs_dev_desc,
+						    &fs_partition, 1);
 	if (part < 0)
 		return -1;
 
diff --git a/include/configs/10m50_devboard.h b/include/configs/10m50_devboard.h
index 768b4a6..3ffc744 100644
--- a/include/configs/10m50_devboard.h
+++ b/include/configs/10m50_devboard.h
@@ -35,11 +35,6 @@
 #define CONFIG_BOOTP_BOOTFILESIZE
 
 /*
- * FDT options
- */
-#define CONFIG_LMB
-
-/*
  * MEMORY ORGANIZATION
  * -Monitor at top of sdram.
  * -The heap is placed below the monitor
diff --git a/include/configs/3c120_devboard.h b/include/configs/3c120_devboard.h
index 30bbd71..3f065ff 100644
--- a/include/configs/3c120_devboard.h
+++ b/include/configs/3c120_devboard.h
@@ -35,11 +35,6 @@
 #define CONFIG_BOOTP_BOOTFILESIZE
 
 /*
- * FDT options
- */
-#define CONFIG_LMB
-
-/*
  * MEMORY ORGANIZATION
  * -Monitor at top of sdram.
  * -The heap is placed below the monitor
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 6e79d3f..8eeccdd 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -22,8 +22,6 @@
 #define CONFIG_SYS_TIMER_RATE		1000000
 #endif
 
-#define CONFIG_LMB
-
 #define CONFIG_HOST_MAX_DEVICES 4
 
 /*
diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h
index 641ed2c..f186dd6 100644
--- a/include/configs/x86-common.h
+++ b/include/configs/x86-common.h
@@ -16,8 +16,6 @@
  */
 #define CONFIG_PHYSMEM
 
-#define CONFIG_LMB
-
 #define CONFIG_SYS_BOOTM_LEN		(16 << 20)
 
 /* SATA AHCI storage */
diff --git a/include/image.h b/include/image.h
index 3ff3c03..459685d 100644
--- a/include/image.h
+++ b/include/image.h
@@ -434,7 +434,7 @@
 #define	BOOTM_STATE_OS_GO	(0x00000400)
 	int		state;
 
-#ifdef CONFIG_LMB
+#if defined(CONFIG_LMB) && !defined(USE_HOSTCC)
 	struct lmb	lmb;		/* for memory mgmt */
 #endif
 } bootm_headers_t;
diff --git a/include/lmb.h b/include/lmb.h
index e9f19b16..541e170 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -12,22 +12,54 @@
  * Copyright (C) 2001 Peter Bergner, IBM Corp.
  */
 
-#define MAX_LMB_REGIONS 8
-
+/**
+ * struct lmb_property - Description of one region.
+ *
+ * @base: Base address of the region.
+ * @size: Size of the region
+ */
 struct lmb_property {
 	phys_addr_t base;
 	phys_size_t size;
 };
 
+/**
+ * struct lmb_region - Description of a set of region.
+ *
+ * @cnt: Number of regions.
+ * @max: Size of the region array, max value of cnt.
+ * @region: Array of the region properties
+ */
 struct lmb_region {
 	unsigned long cnt;
-	phys_size_t size;
-	struct lmb_property region[MAX_LMB_REGIONS+1];
+	unsigned long max;
+#if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
+	struct lmb_property region[CONFIG_LMB_MAX_REGIONS];
+#else
+	struct lmb_property *region;
+#endif
 };
 
+/**
+ * struct lmb - Logical memory block handle.
+ *
+ * Clients provide storage for Logical memory block (lmb) handles.
+ * The content of the structure is managed by the lmb library.
+ * A lmb struct is  initialized by lmb_init() functions.
+ * The lmb struct is passed to all other lmb APIs.
+ *
+ * @memory: Description of memory regions.
+ * @reserved: Description of reserved regions.
+ * @memory_regions: Array of the memory regions (statically allocated)
+ * @reserved_regions: Array of the reserved regions (statically allocated)
+ */
 struct lmb {
 	struct lmb_region memory;
 	struct lmb_region reserved;
+#if !IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
+	struct lmb_property memory_regions[CONFIG_LMB_MEMORY_REGIONS];
+	struct lmb_property reserved_regions[CONFIG_LMB_RESERVED_REGIONS];
+#endif
 };
 
 extern void lmb_init(struct lmb *lmb);
diff --git a/include/part.h b/include/part.h
index 7f78271..419c859 100644
--- a/include/part.h
+++ b/include/part.h
@@ -230,7 +230,7 @@
  * @param[in] allow_whole_dev true to allow the user to select partition 0
  *		(which means the whole device), false to require a valid
  *		partition number >= 1
- * @return 0 on success, or a negative on error
+ * @return the partition number on success, or negative errno on error
  */
 int part_get_info_by_dev_and_name_or_num(const char *dev_iface,
 					 const char *dev_part_str,
@@ -275,6 +275,16 @@
 					  struct disk_partition *info,
 					  int allow_whole_dev)
 { *dev_desc = NULL; return -1; }
+static inline int
+part_get_info_by_dev_and_name_or_num(const char *dev_iface,
+				     const char *dev_part_str,
+				     struct blk_desc **dev_desc,
+				     struct disk_partition *part_info,
+				     int allow_whole_dev)
+{
+	*dev_desc = NULL;
+	return -ENOSYS;
+}
 #endif
 
 /*
diff --git a/lib/Kconfig b/lib/Kconfig
index ab8c9cc..6d2d41d 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -439,7 +439,7 @@
 	  is included. The LZ4 algorithm can run in-place as long as the
 	  compressed image is loaded to the end of the output buffer, and
 	  trades lower compression ratios for much faster decompression.
-	  
+
 	  NOTE: This implements the release version of the LZ4 frame
 	  format as generated by default by the 'lz4' command line tool.
 	  This is not the same as the outdated, less efficient legacy
@@ -700,6 +700,48 @@
 	  Support basic elf loading/validating functions.
 	  This supports for 32 bit and 64 bit versions.
 
+config LMB
+	bool "Enable the logical memory blocks library (lmb)"
+	default y if ARC || ARM || M68K || MICROBLAZE || MIPS || NDS32 || \
+		     NIOS2 || PPC || RISCV || SANDBOX || SH || X86 || XTENSA
+	help
+	  Support the library logical memory blocks.
+
+config LMB_USE_MAX_REGIONS
+	bool "Use a commun number of memory and reserved regions in lmb lib"
+	depends on LMB
+	default y
+	help
+	  Define the number of supported memory regions in the library logical
+	  memory blocks.
+	  This feature allow to reduce the lmb library size by using compiler
+	  optimization when LMB_MEMORY_REGIONS == LMB_RESERVED_REGIONS.
+
+config LMB_MAX_REGIONS
+	int "Number of memory and reserved regions in lmb lib"
+	depends on LMB && LMB_USE_MAX_REGIONS
+	default 8
+	help
+	  Define the number of supported regions, memory and reserved, in the
+	  library logical memory blocks.
+
+config LMB_MEMORY_REGIONS
+	int "Number of memory regions in lmb lib"
+	depends on LMB && !LMB_USE_MAX_REGIONS
+	default 8
+	help
+	  Define the number of supported memory regions in the library logical
+	  memory blocks.
+	  The minimal value is CONFIG_NR_DRAM_BANKS.
+
+config LMB_RESERVED_REGIONS
+	int "Number of reserved regions in lmb lib"
+	depends on LMB && !LMB_USE_MAX_REGIONS
+	default 8
+	help
+	  Define the number of supported reserved regions in the library logical
+	  memory blocks.
+
 endmenu
 
 config PHANDLE_CHECK_SEQ
diff --git a/lib/lmb.c b/lib/lmb.c
index d126f8d..c08c4d9 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -20,8 +20,6 @@
 
 	printf("lmb_dump_all:\n");
 	printf("    memory.cnt		   = 0x%lx\n", lmb->memory.cnt);
-	printf("    memory.size		   = 0x%llx\n",
-	       (unsigned long long)lmb->memory.size);
 	for (i = 0; i < lmb->memory.cnt; i++) {
 		printf("    memory.reg[0x%lx].base   = 0x%llx\n", i,
 		       (unsigned long long)lmb->memory.region[i].base);
@@ -30,8 +28,6 @@
 	}
 
 	printf("\n    reserved.cnt	   = 0x%lx\n", lmb->reserved.cnt);
-	printf("    reserved.size	   = 0x%llx\n",
-	       (unsigned long long)lmb->reserved.size);
 	for (i = 0; i < lmb->reserved.cnt; i++) {
 		printf("    reserved.reg[0x%lx].base = 0x%llx\n", i,
 		       (unsigned long long)lmb->reserved.region[i].base);
@@ -99,10 +95,17 @@
 
 void lmb_init(struct lmb *lmb)
 {
+#if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
+	lmb->memory.max = CONFIG_LMB_MAX_REGIONS;
+	lmb->reserved.max = CONFIG_LMB_MAX_REGIONS;
+#else
+	lmb->memory.max = CONFIG_LMB_MEMORY_REGIONS;
+	lmb->reserved.max = CONFIG_LMB_RESERVED_REGIONS;
+	lmb->memory.region = lmb->memory_regions;
+	lmb->reserved.region = lmb->reserved_regions;
+#endif
 	lmb->memory.cnt = 0;
-	lmb->memory.size = 0;
 	lmb->reserved.cnt = 0;
-	lmb->reserved.size = 0;
 }
 
 static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
@@ -185,7 +188,7 @@
 
 	if (coalesced)
 		return coalesced;
-	if (rgn->cnt >= MAX_LMB_REGIONS)
+	if (rgn->cnt >= rgn->max)
 		return -1;
 
 	/* Couldn't coalesce the LMB, so add it to the sorted table. */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index a2fcafd..3eda10e 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -948,7 +948,6 @@
 CONFIG_LINUX
 CONFIG_LINUX_RESET_VEC
 CONFIG_LITTLETON_LCD
-CONFIG_LMB
 CONFIG_LMS283GF05
 CONFIG_LOADADDR
 CONFIG_LOADCMD
diff --git a/test/dm/Makefile b/test/dm/Makefile
index 100e770..e7cb1ee 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -21,26 +21,39 @@
 obj-$(CONFIG_ACPIGEN) += acpi.o
 obj-$(CONFIG_ACPIGEN) += acpigen.o
 obj-$(CONFIG_ACPIGEN) += acpi_dp.o
+obj-$(CONFIG_ADC) += adc.o
 obj-$(CONFIG_SOUND) += audio.o
+obj-$(CONFIG_AXI) += axi.o
 obj-$(CONFIG_BLK) += blk.o
 obj-$(CONFIG_BUTTON) += button.o
 obj-$(CONFIG_DM_BOOTCOUNT) += bootcount.o
 obj-$(CONFIG_CLK) += clk.o clk_ccf.o
+obj-$(CONFIG_CPU) += cpu.o
 obj-$(CONFIG_CROS_EC) += cros_ec.o
 obj-$(CONFIG_DEVRES) += devres.o
+obj-$(CONFIG_DMA) += dma.o
 obj-$(CONFIG_VIDEO_MIPI_DSI) += dsi_host.o
 obj-$(CONFIG_DM_DSA) += dsa.o
 obj-$(CONFIG_DM_ETH) += eth.o
+ifneq ($(CONFIG_EFI_PARTITION),)
+obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o
+endif
 obj-$(CONFIG_FIRMWARE) += firmware.o
 obj-$(CONFIG_DM_GPIO) += gpio.o
 obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock.o
 obj-$(CONFIG_DM_I2C) += i2c.o
 obj-$(CONFIG_SOUND) += i2s.o
 obj-y += irq.o
+obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
 obj-$(CONFIG_LED) += led.o
 obj-$(CONFIG_DM_MAILBOX) += mailbox.o
+obj-$(CONFIG_DM_MDIO) += mdio.o
+obj-$(CONFIG_DM_MDIO_MUX) += mdio_mux.o
+obj-$(CONFIG_MISC) += misc.o
 obj-$(CONFIG_DM_MMC) += mmc.o
 obj-$(CONFIG_CMD_MUX) += mux-cmd.o
+obj-$(CONFIG_MULTIPLEXER) += mux-emul.o
+obj-$(CONFIG_MUX_MMIO) += mux-mmio.o
 obj-y += fdtdec.o
 obj-$(CONFIG_UT_DM) += nop.o
 obj-y += ofnode.o
@@ -48,58 +61,46 @@
 obj-y += of_extra.o
 obj-$(CONFIG_OSD) += osd.o
 obj-$(CONFIG_DM_VIDEO) += panel.o
+obj-$(CONFIG_EFI_PARTITION) += part.o
 obj-$(CONFIG_DM_PCI) += pci.o
 obj-$(CONFIG_P2SB) += p2sb.o
 obj-$(CONFIG_PCI_ENDPOINT) += pci_ep.o
 obj-$(CONFIG_PCH) += pch.o
 obj-$(CONFIG_PHY) += phy.o
+ifneq ($(CONFIG_PINMUX),)
+obj-$(CONFIG_PINCONF) += pinmux.o
+endif
 obj-$(CONFIG_POWER_DOMAIN) += power-domain.o
 obj-$(CONFIG_ACPI_PMC) += pmc.o
+obj-$(CONFIG_DM_PMIC) += pmic.o
 obj-$(CONFIG_DM_PWM) += pwm.o
+obj-$(CONFIG_QFW) += qfw.o
 obj-$(CONFIG_RAM) += ram.o
 obj-y += regmap.o
 obj-$(CONFIG_REMOTEPROC) += remoteproc.o
 obj-$(CONFIG_DM_RESET) += reset.o
 obj-$(CONFIG_SYSRESET) += sysreset.o
-obj-$(CONFIG_DM_RTC) += rtc.o
-obj-$(CONFIG_DM_SPI_FLASH) += sf.o
-obj-$(CONFIG_SMEM) += smem.o
-obj-$(CONFIG_DM_SPI) += spi.o
-obj-y += syscon.o
-obj-$(CONFIG_MUX_MMIO) += mux-mmio.o
-obj-$(CONFIG_MULTIPLEXER) += mux-emul.o
-obj-$(CONFIG_DM_USB) += usb.o
-obj-$(CONFIG_DM_PMIC) += pmic.o
 obj-$(CONFIG_DM_REGULATOR) += regulator.o
-obj-$(CONFIG_TIMER) += timer.o
-obj-$(CONFIG_DM_VIDEO) += video.o
-obj-$(CONFIG_ADC) += adc.o
-obj-$(CONFIG_SPMI) += spmi.o
-obj-$(CONFIG_WDT) += wdt.o
-obj-$(CONFIG_AXI) += axi.o
-obj-$(CONFIG_MISC) += misc.o
-obj-$(CONFIG_DM_SERIAL) += serial.o
-obj-$(CONFIG_CPU) += cpu.o
-obj-$(CONFIG_SOC_DEVICE) += soc.o
-obj-$(CONFIG_SOUND) += sound.o
-obj-$(CONFIG_SYSINFO) += sysinfo.o
-obj-$(CONFIG_TEE) += tee.o
-obj-$(CONFIG_VIRTIO_SANDBOX) += virtio.o
-obj-$(CONFIG_DMA) += dma.o
-obj-$(CONFIG_DM_MDIO) += mdio.o
-obj-$(CONFIG_DM_MDIO_MUX) += mdio_mux.o
 obj-$(CONFIG_DM_RNG) += rng.o
-obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
+obj-$(CONFIG_DM_RTC) += rtc.o
+obj-$(CONFIG_SCMI_FIRMWARE) += scmi.o
+obj-$(CONFIG_DM_SERIAL) += serial.o
+obj-$(CONFIG_DM_SPI_FLASH) += sf.o
 obj-$(CONFIG_SIMPLE_BUS) += simple-bus.o
 obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o
+obj-$(CONFIG_SMEM) += smem.o
+obj-$(CONFIG_SOC_DEVICE) += soc.o
+obj-$(CONFIG_SOUND) += sound.o
+obj-$(CONFIG_DM_SPI) += spi.o
+obj-$(CONFIG_SPMI) += spmi.o
+obj-y += syscon.o
 obj-$(CONFIG_RESET_SYSCON) += syscon-reset.o
-obj-$(CONFIG_SCMI_FIRMWARE) += scmi.o
-ifneq ($(CONFIG_PINMUX),)
-obj-$(CONFIG_PINCONF) += pinmux.o
-endif
-ifneq ($(CONFIG_EFI_PARTITION),)
-obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o
-endif
-obj-$(CONFIG_QFW) += qfw.o
+obj-$(CONFIG_SYSINFO) += sysinfo.o
+obj-$(CONFIG_TEE) += tee.o
+obj-$(CONFIG_TIMER) += timer.o
+obj-$(CONFIG_DM_USB) += usb.o
+obj-$(CONFIG_DM_VIDEO) += video.o
+obj-$(CONFIG_VIRTIO_SANDBOX) += virtio.o
+obj-$(CONFIG_WDT) += wdt.o
 endif
 endif # !SPL
diff --git a/test/dm/part.c b/test/dm/part.c
new file mode 100644
index 0000000..051e901
--- /dev/null
+++ b/test/dm/part.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 Sean Anderson <sean.anderson@seco.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <mmc.h>
+#include <part.h>
+#include <part_efi.h>
+#include <dm/test.h>
+#include <test/ut.h>
+
+static int dm_test_part(struct unit_test_state *uts)
+{
+	char str_disk_guid[UUID_STR_LEN + 1];
+	struct blk_desc *mmc_dev_desc;
+	struct disk_partition part_info;
+	struct disk_partition parts[2] = {
+		{
+			.start = 48, /* GPT data takes up the first 34 blocks or so */
+			.size = 1,
+			.name = "test1",
+		},
+		{
+			.start = 49,
+			.size = 1,
+			.name = "test2",
+		},
+	};
+
+	ut_asserteq(1, blk_get_device_by_str("mmc", "1", &mmc_dev_desc));
+	if (CONFIG_IS_ENABLED(RANDOM_UUID)) {
+		gen_rand_uuid_str(parts[0].uuid, UUID_STR_FORMAT_STD);
+		gen_rand_uuid_str(parts[1].uuid, UUID_STR_FORMAT_STD);
+		gen_rand_uuid_str(str_disk_guid, UUID_STR_FORMAT_STD);
+	}
+	ut_assertok(gpt_restore(mmc_dev_desc, str_disk_guid, parts,
+				ARRAY_SIZE(parts)));
+
+#define test(expected, part_str, whole) \
+	ut_asserteq(expected, \
+		    part_get_info_by_dev_and_name_or_num("mmc", part_str, \
+							 &mmc_dev_desc, \
+							 &part_info, whole))
+
+	test(-ENODEV, "", true);
+	env_set("bootdevice", "0");
+	test(0, "", true);
+	env_set("bootdevice", "1");
+	test(1, "", false);
+	test(1, "-", false);
+	env_set("bootdevice", "");
+	test(-EPROTONOSUPPORT, "0", false);
+	test(0, "0", true);
+	test(0, ":0", true);
+	test(0, ".0", true);
+	test(0, ".0:0", true);
+	test(-EINVAL, "#test1", true);
+	test(1, "1", false);
+	test(1, "1", true);
+	test(-ENOENT, "1:0", false);
+	test(0, "1:0", true);
+	test(1, "1:1", false);
+	test(2, "1:2", false);
+	test(1, "1.0", false);
+	test(0, "1.0:0", true);
+	test(1, "1.0:1", false);
+	test(2, "1.0:2", false);
+	test(-EINVAL, "1#bogus", false);
+	test(1, "1#test1", false);
+	test(2, "1#test2", false);
+
+	return 0;
+}
+DM_TEST(dm_test_part, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
diff --git a/test/lib/lmb.c b/test/lib/lmb.c
index 644ee78..0d8963f 100644
--- a/test/lib/lmb.c
+++ b/test/lib/lmb.c
@@ -659,3 +659,67 @@
 
 DM_TEST(lib_test_lmb_get_free_size,
 	UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
+static int lib_test_lmb_max_regions(struct unit_test_state *uts)
+{
+	const phys_addr_t ram = 0x00000000;
+	const phys_size_t ram_size = 0x8000000;
+	const phys_size_t blk_size = 0x10000;
+	phys_addr_t offset;
+	struct lmb lmb;
+	int ret, i;
+
+	lmb_init(&lmb);
+
+	ut_asserteq(lmb.memory.cnt, 0);
+	ut_asserteq(lmb.memory.max, 8);
+	ut_asserteq(lmb.reserved.cnt, 0);
+	ut_asserteq(lmb.reserved.max, 8);
+
+	/*  Add 8 memory regions */
+	for (i = 0; i < 8; i++) {
+		offset = ram + 2 * i * ram_size;
+		ret = lmb_add(&lmb, offset, ram_size);
+		ut_asserteq(ret, 0);
+	}
+	ut_asserteq(lmb.memory.cnt, 8);
+	ut_asserteq(lmb.reserved.cnt, 0);
+
+	/*  error for the 9th memory regions */
+	offset = ram + 2 * 8 * ram_size;
+	ret = lmb_add(&lmb, offset, ram_size);
+	ut_asserteq(ret, -1);
+
+	ut_asserteq(lmb.memory.cnt, 8);
+	ut_asserteq(lmb.reserved.cnt, 0);
+
+	/*  reserve 8 regions */
+	for (i = 0; i < 8; i++) {
+		offset = ram + 2 * i * blk_size;
+		ret = lmb_reserve(&lmb, offset, blk_size);
+		ut_asserteq(ret, 0);
+	}
+
+	ut_asserteq(lmb.memory.cnt, 8);
+	ut_asserteq(lmb.reserved.cnt, 8);
+
+	/*  error for the 9th reserved blocks */
+	offset = ram + 2 * 8 * blk_size;
+	ret = lmb_reserve(&lmb, offset, blk_size);
+	ut_asserteq(ret, -1);
+
+	ut_asserteq(lmb.memory.cnt, 8);
+	ut_asserteq(lmb.reserved.cnt, 8);
+
+	/*  check each regions */
+	for (i = 0; i < 8; i++)
+		ut_asserteq(lmb.memory.region[i].base, ram + 2 * i * ram_size);
+
+	for (i = 0; i < 8; i++)
+		ut_asserteq(lmb.reserved.region[i].base, ram + 2 * i * blk_size);
+
+	return 0;
+}
+
+DM_TEST(lib_test_lmb_max_regions,
+	UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);