When video is set up in SPL, U-Boot proper needs to use the correct
frame  buffer address to reserve particular location in memory, to avoid
displaying artifacts on the screen.

Put the framebuffer address and size in a bloblist to make them
available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined.

Signed-off-by: Nikhil M Jain <n-ja...@ti.com>
---
 common/board_f.c             | 13 ++++++++++++-
 drivers/video/video-uclass.c | 12 ++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/common/board_f.c b/common/board_f.c
index 1688e27071..02730ec3a4 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -411,7 +411,17 @@ __weak int arch_reserve_mmu(void)
 
 static int reserve_video(void)
 {
-       if (IS_ENABLED(CONFIG_VIDEO)) {
+#if (IS_ENABLED(CONFIG_VIDEO))
+       if (IS_ENABLED(CONFIG_SPL_VIDEO) && spl_phase() > PHASE_SPL &&
+           CONFIG_IS_ENABLED(BLOBLIST)) {
+               struct video_handoff *ho;
+
+               ho = bloblist_find(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho));
+               if (!ho)
+                       return log_msg_ret("blf", -ENOENT);
+               video_reserve_from_blob(ho);
+               gd->relocaddr = ho->fb;
+       } else {
                ulong addr;
                int ret;
 
@@ -423,6 +433,7 @@ static int reserve_video(void)
                      ((unsigned long)gd->relocaddr - addr) >> 10, addr);
                gd->relocaddr = addr;
        }
+#endif
 
        return 0;
 }
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 1264ad1101..324216b0f5 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -6,12 +6,14 @@
 #define LOG_CATEGORY UCLASS_VIDEO
 
 #include <common.h>
+#include <bloblist.h>
 #include <console.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
+#include <spl.h>
 #include <stdio_dev.h>
 #include <video.h>
 #include <video_console.h>
@@ -139,6 +141,16 @@ int video_reserve(ulong *addrp)
        debug("Video frame buffers from %lx to %lx\n", gd->video_bottom,
              gd->video_top);
 
+       if (spl_phase() == PHASE_SPL && CONFIG_IS_ENABLED(BLOBLIST)) {
+               struct video_handoff *ho;
+
+               ho = bloblist_add(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho), 0);
+               if (!ho)
+                       return log_msg_ret("blf", -ENOENT);
+               ho->fb = *addrp;
+               ho->size = size;
+       }
+
        return 0;
 }
 
-- 
2.34.1

Reply via email to