summaryrefslogtreecommitdiff
path: root/common/board_f.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-01-18 19:52:21 -0700
committerSimon Glass <sjg@chromium.org>2016-01-20 19:10:15 -0700
commit5a54194515caa4f4183dc9086938456612749573 (patch)
tree65c18464f928cbe4763893de46c54c12276be05d /common/board_f.c
parent8703ef3fdbfda239bcc67818e9b0f6ddaa7f6ad4 (diff)
downloadu-boot-5a54194515caa4f4183dc9086938456612749573.tar.gz
u-boot-5a54194515caa4f4183dc9086938456612749573.tar.bz2
u-boot-5a54194515caa4f4183dc9086938456612749573.zip
dm: common: Add memory reservation for the video uclass
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 <sjg@chromium.org> Acked-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'common/board_f.c')
-rw-r--r--common/board_f.c47
1 files changed, 35 insertions, 12 deletions
diff --git a/common/board_f.c b/common/board_f.c
index 068db0d74e..c470b5921a 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,