Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <s...@chromium.org>
Acked-by: Anatolij Gustschin <ag...@denx.de>
---

Changes in v2: None

 common/board_f.c                  | 47 +++++++++++++++++++++++++++++----------
 include/asm-generic/global_data.h |  4 ++++
 2 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index 068db0d..c470b59 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -46,6 +46,7 @@
 #include <spi.h>
 #include <status_led.h>
 #include <trace.h>
+#include <video.h>
 #include <watchdog.h>
 #include <asm/errno.h>
 #include <asm/io.h>
@@ -437,21 +438,38 @@ static int reserve_mmu(void)
 }
 #endif
 
-#ifdef CONFIG_LCD
+#ifdef CONFIG_DM_VIDEO
+static int reserve_video(void)
+{
+       ulong addr;
+       int ret;
+
+       addr = gd->relocaddr;
+       ret = video_reserve(&addr);
+       if (ret)
+               return ret;
+       gd->relocaddr = addr;
+
+       return 0;
+}
+#else
+
+# ifdef CONFIG_LCD
 static int reserve_lcd(void)
 {
-#ifdef CONFIG_FB_ADDR
+#  ifdef CONFIG_FB_ADDR
        gd->fb_base = CONFIG_FB_ADDR;
-#else
+#  else
        /* reserve memory for LCD display (always full pages) */
        gd->relocaddr = lcd_setmem(gd->relocaddr);
        gd->fb_base = gd->relocaddr;
-#endif /* CONFIG_FB_ADDR */
+#  endif /* CONFIG_FB_ADDR */
+
        return 0;
 }
-#endif /* CONFIG_LCD */
+# endif /* CONFIG_LCD */
 
-#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
+# if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && 
\
                !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
                !defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K)
 static int reserve_legacy_video(void)
@@ -462,7 +480,8 @@ static int reserve_legacy_video(void)
 
        return 0;
 }
-#endif
+# endif
+#endif /* !CONFIG_DM_VIDEO */
 
 static int reserve_trace(void)
 {
@@ -957,15 +976,19 @@ static init_fnc_t init_sequence_f[] = {
                defined(CONFIG_ARM)
        reserve_mmu,
 #endif
-#ifdef CONFIG_LCD
+#ifdef CONFIG_DM_VIDEO
+       reserve_video,
+#else
+# ifdef CONFIG_LCD
        reserve_lcd,
-#endif
+# endif
        /* TODO: Why the dependency on CONFIG_8xx? */
-#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
+# if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && 
\
                !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
                !defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K)
-       reserve_video,
-#endif
+       reserve_legacy_video,
+# endif
+#endif /* CONFIG_DM_VIDEO */
        reserve_trace,
 #if !defined(CONFIG_BLACKFIN)
        reserve_uboot,
diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index 5d8b043..a587d3c 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -122,6 +122,10 @@ typedef struct global_data {
        struct membuff console_out;     /* console output */
        struct membuff console_in;      /* console input */
 #endif
+#ifdef CONFIG_DM_VIDEO
+       ulong video_top;                /* Top of video frame buffer area */
+       ulong video_bottom;             /* Bottom of video frame buffer area */
+#endif
 } gd_t;
 #endif
 
-- 
2.6.0.rc2.230.g3dd15c0

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to