[PATCH V3 08/10] common: spl: spl: Remove video driver before u-boot proper

Nikhil M Jain n-jain1 at ti.com
Tue May 9 12:31:44 CEST 2023


Add method to remove video driver before loading u-boot proper, when
there is no bloblist passed to next stage, to avoid displaying of
artifacts in the next stage, if video is not defined in that stage.

Signed-off-by: Nikhil M Jain <n-jain1 at ti.com>
---
V3 (patch introduced):
- Remove video only if SPL_VIDEO_REMOVE is defined.

V2:
- No change.

 common/spl/spl.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 21a62521a9..8b67a37a26 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -35,6 +35,8 @@
 #include <mapmem.h>
 #include <dm/root.h>
 #include <dm/util.h>
+#include <dm/device-internal.h>
+#include <dm/uclass-internal.h>
 #include <linux/compiler.h>
 #include <fdt_support.h>
 #include <bootcount.h>
@@ -889,6 +891,19 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 		debug("Failed to stash bootstage: err=%d\n", ret);
 #endif
 
+#if IS_ENABLED(CONFIG_SPL_VIDEO_REMOVE)
+	struct udevice *dev;
+	int rc;
+
+	rc = uclass_find_first_device(UCLASS_VIDEO, &dev);
+	if (!rc && dev) {
+		rc = device_remove(dev, DM_REMOVE_NORMAL);
+		if (rc)
+			printf("Cannot remove video device '%s' (err=%d)\n",
+			       dev->name, rc);
+	}
+#endif
+
 	spl_board_prepare_for_boot();
 	jump_to_image_no_args(&spl_image);
 }
-- 
2.34.1



More information about the U-Boot mailing list