summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2015-04-22 16:16:26 +0200
committerStefan Agner <stefan.agner@toradex.com>2015-04-22 16:16:26 +0200
commit1d7518ec3a5b91542ff98114f5488c267d338025 (patch)
tree2fca2e96bf7886972d0fe5787b2086ce34e17afe /drivers
parent0440936084e5f467b55f56d7d1fa8660732587bd (diff)
video: dcu: fix framebuffer to the end of memory
Fix the framebuffer location to the very end of the available memory. This allows to remove the area from available memory for the kernel, which in turn allows to display the splash screen through the while Linux kernel boot process. Ideas has been taken from the sunxi display driver, e.g. 20779ec3a5 ("sunxi: video: Dynamically reserve framebuffer memory")
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/fsl_dcu_fb.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/drivers/video/fsl_dcu_fb.c b/drivers/video/fsl_dcu_fb.c
index 530656e190..73285f55a9 100644
--- a/drivers/video/fsl_dcu_fb.c
+++ b/drivers/video/fsl_dcu_fb.c
@@ -6,8 +6,10 @@
* SPDX-License-Identifier: GPL-2.0+
*/
+#include <asm/errno.h>
#include <asm/io.h>
#include <common.h>
+#include <fdt_support.h>
#include <fsl_dcu_fb.h>
#include <linux/fb.h>
#include <malloc.h>
@@ -79,6 +81,8 @@
#define BPP_24_RGB888 5
#define BPP_32_ARGB8888 6
+DECLARE_GLOBAL_DATA_PTR;
+
/*
* This setting is used for the TWR_LCD_RGB card
*/
@@ -268,11 +272,16 @@ int fsl_dcu_init(unsigned int xres, unsigned int yres,
struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR;
unsigned int div, mode;
- /* Memory allocation for framebuffer */
info.screen_size =
info.var.xres * info.var.yres * (info.var.bits_per_pixel / 8);
- info.screen_base = (char *)memalign(ARCH_DMA_MINALIGN,
- roundup(info.screen_size, ARCH_DMA_MINALIGN));
+
+ if (info.screen_size > CONFIG_FSL_DCU_MAX_FB_SIZE)
+ return -ENOMEM;
+
+ /* Reserve framebuffer at the end of memory */
+ gd->fb_base = gd->bd->bi_dram[0].start +
+ gd->bd->bi_dram[0].size - info.screen_size;
+ info.screen_base = (char *)gd->fb_base;
memset(info.screen_base, 0, info.screen_size);
reset_total_layers();
@@ -322,6 +331,11 @@ int fsl_dcu_init(unsigned int xres, unsigned int yres,
return 0;
}
+ulong board_get_usable_ram_top(ulong total_size)
+{
+ return gd->ram_top - CONFIG_FSL_DCU_MAX_FB_SIZE;
+}
+
void *video_hw_init(void)
{
static GraphicDevice ctfb;
@@ -384,3 +398,21 @@ void *video_hw_init(void)
return &ctfb;
}
+
+#if defined(CONFIG_OF_BOARD_SETUP)
+int fsl_dcu_fixedfb_setup(void *blob)
+{
+ u64 start, size;
+ int ret;
+
+ start = gd->bd->bi_dram[0].start;
+ size = gd->fb_base - gd->bd->bi_dram[0].start;
+ ret = fdt_fixup_memory_banks(blob, &start, &size, 1);
+ if (ret) {
+ eprintf("Cannot setup fb: Error reserving memory\n");
+ return ret;
+ }
+
+ return 0;
+}
+#endif