diff options
author | Simon Glass <sjg@chromium.org> | 2011-06-07 11:25:22 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:39:17 -0700 |
commit | ec735e197ce59c8c6830df819759a0b08d8a1195 (patch) | |
tree | 23974b9c364b4fdaa1d2fa5561cc917416c39a20 /common/lcd.c | |
parent | b49e49543568ae2f4ed5d88eba565cfe2caeb5fb (diff) |
Add CONFIG_ALIGN_LCD_TO_SECTION to make frame buffer MMU-friendly
We want to make the display section-aligned on ARM so that we can easily
turn off data caching for this.
BUG=chromium-os:13082
TEST=build and boot U-Boot on seaboard
Change-Id: Icbbc8cc473ff80b519bdd1c6520c9ed679260843
Reviewed-on: http://gerrit.chromium.org/gerrit/2240
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/lcd.c')
-rw-r--r-- | common/lcd.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/common/lcd.c b/common/lcd.c index 9e382aa7cd3..f829d9ad882 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -35,6 +35,7 @@ #include <stdarg.h> #include <linux/types.h> #include <stdio_dev.h> +#include <asm/system.h> #if defined(CONFIG_POST) #include <post.h> #endif @@ -335,6 +336,12 @@ static void test_pattern (void) /* ** GENERIC Initialization Routines */ /************************************************************************/ +int lcd_get_size(int *line_length) +{ + *line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8; + return *line_length * panel_info.vl_row; +} + int drv_lcd_init (void) { struct stdio_dev lcddev; @@ -342,7 +349,7 @@ int drv_lcd_init (void) lcd_base = (void *)(gd->fb_base); - lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8; + lcd_get_size(&lcd_line_length); lcd_init (lcd_base); /* LCD initialization */ @@ -455,15 +462,21 @@ static int lcd_init (void *lcdbase) ulong lcd_setmem (ulong addr) { ulong size; - int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8; + int line_length; debug ("LCD panel info: %d x %d, %d bit/pix\n", panel_info.vl_col, panel_info.vl_row, NBITS (panel_info.vl_bpix) ); - size = line_length * panel_info.vl_row; + size = lcd_get_size(&line_length); - /* Round up to nearest full page */ - size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); + /* Round up to nearest full page, or MMU section if defined */ +#ifdef CONFIG_ALIGN_LCD_TO_SECTION + size = ALIGN(size, MMU_SECTION_SIZE); + addr = ALIGN(addr- MMU_SECTION_SIZE + 1, MMU_SECTION_SIZE); +#else + size = ALIGN(size, PAGE_SIZE); + addr = ALIGN(addr - PAGE_SIZE + 1, PAGE_SIZE); +#endif /* Allocate pages for the frame buffer. */ addr -= size; |