]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
board: sandbox: Convert extension support to UCLASS framework
authorKory Maincent (TI.com) <kory.maincent@bootlin.com>
Thu, 30 Oct 2025 16:45:07 +0000 (17:45 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 3 Nov 2025 16:02:39 +0000 (10:02 -0600)
Migrate sandbox extension board detection from legacy implementation to
the new UCLASS-based extension board framework.

Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/Kconfig
board/sandbox/sandbox.c

index 7e05e0c2263470ff397e09729f07f43170b79063..5bb65a29f8daf965d36e7fcdd6cededf04dca1f3 100644 (file)
@@ -215,7 +215,7 @@ config SANDBOX
        select SYSRESET_CMD_POWEROFF if CMD_POWEROFF
        select SYS_CACHE_SHIFT_4
        select IRQ
-       select SUPPORT_EXTENSION_SCAN if CMDLINE
+       select SUPPORT_DM_EXTENSION_SCAN if CMDLINE
        select SUPPORT_ACPI
        imply BITREVERSE
        select BLOBLIST
index c5d7b9651a97e2b01f06e041be4d5443f3b6a611..d46db6d492f3b979c0700e4904d66929971fbbb4 100644 (file)
@@ -110,28 +110,33 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
        return fdt_add_mem_rsv(fdt, 0x00d02000, 0x4000);
 }
 
-#ifdef CONFIG_CMD_EXTENSION
-int extension_board_scan(struct list_head *extension_list)
+#if CONFIG_IS_ENABLED(SUPPORT_DM_EXTENSION_SCAN) && \
+       !CONFIG_IS_ENABLED(XPL_BUILD)
+static int sandbox_extension_board_scan(struct udevice *dev,
+                                       struct alist *extension_list)
 {
        int i;
 
        for (i = 0; i < 2; i++) {
-               struct extension *extension;
-
-               extension = calloc(1, sizeof(struct extension));
-               if (!extension)
+               struct extension extension = {0};
+
+               snprintf(extension.overlay, sizeof(extension.overlay), "overlay%d.dtbo", i);
+               snprintf(extension.name, sizeof(extension.name), "extension board %d", i);
+               snprintf(extension.owner, sizeof(extension.owner), "sandbox");
+               snprintf(extension.version, sizeof(extension.version), "1.1");
+               snprintf(extension.other, sizeof(extension.other), "Fictional extension board");
+               if (!alist_add(extension_list, extension))
                        return -ENOMEM;
-
-               snprintf(extension->overlay, sizeof(extension->overlay), "overlay%d.dtbo", i);
-               snprintf(extension->name, sizeof(extension->name), "extension board %d", i);
-               snprintf(extension->owner, sizeof(extension->owner), "sandbox");
-               snprintf(extension->version, sizeof(extension->version), "1.1");
-               snprintf(extension->other, sizeof(extension->other), "Fictional extension board");
-               list_add_tail(&extension->list, extension_list);
        }
 
        return i;
 }
+
+U_BOOT_EXTENSION(sandbox_extension, sandbox_extension_board_scan);
+
+U_BOOT_DRVINFO(sandbox_extension) = {
+       .name = "sandbox_extension",
+};
 #endif
 
 #ifdef CONFIG_BOARD_LATE_INIT