All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 11/17] lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU
Date: Sat, 14 Jan 2012 16:47:23 -0800	[thread overview]
Message-ID: <1326588449-1794-12-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1326588449-1794-1-git-send-email-sjg@chromium.org>

We want to make the display section-aligned on ARM so that we can easily
turn off data caching for this.

Is this useful for other architectures? We could perhaps generalise it by
adding the ability to specify the alignment size, but at least for ARM
it is easier to have it be an architecture feature set by the MMU's
system.h header.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 README        |   10 ++++++++++
 common/lcd.c  |   25 ++++++++++++++++++++-----
 include/lcd.h |    3 +++
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/README b/README
index 7adf7c7..d0b891f 100644
--- a/README
+++ b/README
@@ -1380,6 +1380,16 @@ The following options need to be configured:
 		Normally display is black on white background; define
 		CONFIG_SYS_WHITE_ON_BLACK to get it inverted.
 
+
+		CONFIG_ALIGN_LCD_TO_SECTION
+
+		Normally the LCD is page-aligned (tyically 4KB). If this is
+		defined then the LCD will be aligned to MMU_SECTION_SIZE
+		instead. This is useful for architectures where it is cheaper
+		to change data cache settings on a per-section basis (such as
+		ARM). Only enabled on ARM at present.
+
+
 - Splash Screen Support: CONFIG_SPLASH_SCREEN
 
 		If this option is set, the environment is checked for
diff --git a/common/lcd.c b/common/lcd.c
index bf1a6a9..be69d0d 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -35,6 +35,9 @@
 #include <stdarg.h>
 #include <linux/types.h>
 #include <stdio_dev.h>
+#ifdef CONFIG_ARM
+#include <asm/system.h>
+#endif
 #if defined(CONFIG_POST)
 #include <post.h>
 #endif
@@ -330,6 +333,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;
@@ -337,7 +346,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 */
 
@@ -449,15 +458,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;
diff --git a/include/lcd.h b/include/lcd.h
index d95feeb..148bb54 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -217,6 +217,9 @@ int	lcd_display_bitmap(ulong bmp_image, int x, int y);
 /* Allow boards to customize the information displayed */
 void lcd_show_board_info(void);
 
+/* Return the size of the LCD frame buffer, and the line length */
+int lcd_get_size(int *line_length);
+
 /************************************************************************/
 /* ** BITMAP DISPLAY SUPPORT						*/
 /************************************************************************/
-- 
1.7.7.3

  parent reply	other threads:[~2012-01-15  0:47 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-15  0:47 [U-Boot] [PATCH 0/17] tegra: Add display driver and LCD support for Seaboard Simon Glass
2012-01-15  0:47 ` [U-Boot] [PATCH 04/17] tegra: Add display support to funcmux Simon Glass
2012-01-15  1:36   ` Mike Frysinger
2012-06-13 12:15     ` Simon Glass
     [not found] ` <1326588449-1794-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-01-15  0:47   ` [PATCH 01/17] fdt: Add function to look up a phandle's register address Simon Glass
2012-01-15  0:47     ` [U-Boot] " Simon Glass
2012-01-15  0:47   ` [PATCH 02/17] fdt: Add header guard to fdtdec.h Simon Glass
2012-01-15  0:47     ` [U-Boot] " Simon Glass
2012-01-15  0:47   ` [PATCH 03/17] fdt: Correct GPIO name access in fdtdec Simon Glass
2012-01-15  0:47     ` [U-Boot] " Simon Glass
2012-01-15  0:47   ` [PATCH 05/17] tegra: fdt: Add LCD definitions for Tegra Simon Glass
2012-01-15  0:47     ` [U-Boot] " Simon Glass
2012-01-15  0:47   ` [PATCH 15/17] tegra: fdt: Add LCD definitions for Seaboard Simon Glass
2012-01-15  0:47     ` [U-Boot] " Simon Glass
2012-01-15  0:47 ` [U-Boot] [PATCH 06/17] tegra: Add support for PWFM Simon Glass
2012-01-15  0:47 ` [U-Boot] [PATCH 07/17] tegra: Add SOC support for display/lcd Simon Glass
2012-01-15  0:47 ` [U-Boot] [PATCH 08/17] tegra: Add LCD driver Simon Glass
2012-01-15  0:47 ` [U-Boot] [PATCH 09/17] tegra: Add LCD support to Nvidia boards Simon Glass
2012-01-15  0:47 ` [U-Boot] [PATCH 10/17] arm: Add control over cachability of memory regions Simon Glass
2012-02-10 20:38   ` Albert ARIBAUD
2012-03-04  6:20     ` Simon Glass
2012-01-15  0:47 ` Simon Glass [this message]
2012-01-15  1:38   ` [U-Boot] [PATCH 11/17] lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU Mike Frysinger
2012-06-13 12:23     ` Simon Glass
2012-01-15  0:47 ` [U-Boot] [PATCH 12/17] lcd: Add support for flushing LCD fb from dcache after update Simon Glass
2012-01-15  1:42   ` Mike Frysinger
2012-01-15  1:57     ` Simon Glass
2012-01-15  2:16       ` Mike Frysinger
2012-06-13 12:25         ` Simon Glass
2012-01-15  0:47 ` [U-Boot] [PATCH 13/17] tegra: Align LCD frame buffer to section boundary Simon Glass
2012-01-15  0:47 ` [U-Boot] [PATCH 14/17] tegra: Support control of cache settings for LCD Simon Glass
2012-01-15  0:47 ` [U-Boot] [PATCH 16/17] lcd: Add CONSOLE_SCROLL_LINES option to speed console Simon Glass
2012-01-15  0:47 ` [U-Boot] [PATCH 17/17] tegra: Enable display/lcd support on Seaboard Simon Glass
2012-04-19 12:41 ` [U-Boot] [PATCH 0/17] tegra: Add display driver and LCD support for Seaboard Christian Kroehnert
2012-07-14  8:03   ` Simon Glass
2012-07-17 16:11     ` Thierry Reding
2012-07-18  6:51       ` Simon Glass
2012-07-19 12:01         ` Christian Kroehnert
2012-07-24 19:16         ` Stephen Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326588449-1794-12-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.