diff options
author | Simon Glass <sjg@chromium.org> | 2012-10-17 13:24:54 +0000 |
---|---|---|
committer | Tom Warren <twarren@nvidia.com> | 2012-11-19 08:15:38 -0700 |
commit | 676d319ef5f450ca7845555f75de496b96cd688e (patch) | |
tree | 8bb6a995ac1613fb5a6c5b95f55d0fc9f1f9936c /common/lcd.c | |
parent | 0dde7f53797098cf7021f6a7ca6c15bfee405db1 (diff) | |
download | talos-obmc-uboot-676d319ef5f450ca7845555f75de496b96cd688e.tar.gz talos-obmc-uboot-676d319ef5f450ca7845555f75de496b96cd688e.zip |
lcd: Add CONFIG_LCD_ALIGNMENT to select frame buffer alignment
The normal alignment is PAGE_SIZE, but if this is defined, we can support
other alignments.
The motivation for this change is to make the display section-aligned on
ARM so that we can easily turn off data caching for the frame buffer region
without resorting to level 2 page tables.
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'common/lcd.c')
-rw-r--r-- | common/lcd.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/common/lcd.c b/common/lcd.c index b6be8002d2..37b03936f9 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -72,6 +72,10 @@ # endif #endif +#ifndef CONFIG_LCD_ALIGNMENT +#define CONFIG_LCD_ALIGNMENT PAGE_SIZE +#endif + DECLARE_GLOBAL_DATA_PTR; ulong lcd_setmem (ulong addr); @@ -326,6 +330,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; @@ -333,7 +343,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 */ @@ -445,15 +455,16 @@ 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 */ + size = ALIGN(size, CONFIG_LCD_ALIGNMENT); + addr = ALIGN(addr - CONFIG_LCD_ALIGNMENT + 1, CONFIG_LCD_ALIGNMENT); /* Allocate pages for the frame buffer. */ addr -= size; |