Patchwork [U-Boot,RFC] : always relocate u-boot before the framebuffer

login
register
mail settings
Submitter Jeroen Hofstee
Date Dec. 29, 2012, 8:10 p.m.
Message ID <20121229211050.3249f8b7@black>
Download mbox | patch
Permalink /patch/208683/
State RFC
Headers show

Comments

Jeroen Hofstee - Dec. 29, 2012, 8:10 p.m.
> Currently CONFIG_FB_ADDR can be set to specify the location of the
> frame buffer. Since Linux places the frame buffer at the end of the
> RAM, it is nice to place it at the same position so the u-boot to
> linux transition can be made flicker free, by preserving the
> frame buffer. However u-boot and it's heap prefer to locate themselves
> at the end of the RAM as well and there is nothing which prevents them
> to overlap.
> 
> While this can be set/calculated manually, it would be nicer if the
> relocation would never take place to the region occupied by the
> frame buffer. A simple way to do so is to locate u-boot before the
> frame buffer, like it is already done when the frame buffer address is
> not set.
> 
> Currently there are 2 boards using the CONFIG_FB_ADDR and CONFIG_LCD
> on arm (trats, mimc200). Would it cause any problem to relocate
> u-boot below the frame buffer on these boards?

My apologies, I pasted half the patch, the intention is to always
set addr = gd->fb_base. 

This should be the complete one:
Wolfgang Denk - Dec. 29, 2012, 9:50 p.m.
Dear Jeroen Hofstee,

In message <20121229211050.3249f8b7@black> you wrote:
> 
> My apologies, I pasted half the patch, the intention is to always
> set addr = gd->fb_base. 

No, this is not correct.  If CONFIG_FB_ADDR is set, then it will
usually points to the start address of an on on-chip video memory
region.  There will be no RAM below this aread to relocate U-Boot to, 
i. e. you patch will break a number of systems.

Best regards,

Wolfgang Denk

Patch

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index e0cb635..4d0fc3c 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -371,9 +371,10 @@  void board_init_f(ulong bootflag)
        gd->fb_base = CONFIG_FB_ADDR;
 #else
        /* reserve memory for LCD display (always full pages) */
-       addr = lcd_setmem(addr);
-       gd->fb_base = addr;
+       gd->fb_base = lcd_setmem(addr);
 #endif /* CONFIG_FB_ADDR */
+       /* always continue placement below the frame buffer to not
overlap */
+       addr = gd->fb_base;
 #endif /* CONFIG_LCD */