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>
This commit is contained in:
Simon Glass 2016-01-18 19:52:21 -07:00
parent 8703ef3fdb
commit 5a54194515
2 changed files with 39 additions and 12 deletions

View file

@ -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,

View file

@ -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