aboutsummaryrefslogtreecommitdiff
path: root/cmd/extension_board.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-01-17 10:48:13 -0700
committerTom Rini <trini@konsulko.com>2023-01-23 18:11:41 -0500
commit18552d2a7288afd6f125b4ac99e5c27690c129b4 (patch)
treefe23bbdf4a4f0c19c160dcecc328ffa9b35a4d31 /cmd/extension_board.c
parent35ce14617edb6ee7c3004c396f19d2c451255358 (diff)
bootstd: Add a hunter for the extension feature
This needs to run before any bootdev is used, so add a hunter for it. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd/extension_board.c')
-rw-r--r--cmd/extension_board.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/cmd/extension_board.c b/cmd/extension_board.c
index f7685d47b8b7..2b672d888c68 100644
--- a/cmd/extension_board.c
+++ b/cmd/extension_board.c
@@ -5,7 +5,9 @@
*/
#include <common.h>
+#include <bootdev.h>
#include <command.h>
+#include <dm.h>
#include <malloc.h>
#include <extension_board.h>
#include <mapmem.h>
@@ -176,3 +178,26 @@ U_BOOT_CMD(extension, 3, 1, do_extensionops,
"extension list - lists available extension(s) board(s)\n"
"extension apply <extension number|all> - applies DT overlays corresponding to extension boards\n"
);
+
+static int extension_bootdev_hunt(struct bootdev_hunter *info, bool show)
+{
+ int ret;
+
+ ret = env_set_hex("extension_overlay_addr",
+ env_get_hex("fdtoverlay_addr_r", 0));
+ if (ret)
+ return log_msg_ret("env", ret);
+
+ ret = extension_scan(show);
+ if (ret < 0)
+ return log_msg_ret("ext", ret);
+
+ return 0;
+}
+
+/* extensions should have a uclass - for now we use UCLASS_SIMPLE_BUS uclass */
+BOOTDEV_HUNTER(extension_bootdev_hunter) = {
+ .prio = BOOTDEVP_1_PRE_SCAN,
+ .uclass = UCLASS_SIMPLE_BUS,
+ .hunt = extension_bootdev_hunt,
+};