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 v2 14/19] lcd: Add support for flushing LCD fb from dcache after update
Date: Wed, 13 Jun 2012 09:19:50 -0700	[thread overview]
Message-ID: <1339604395-6621-15-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1339604395-6621-1-git-send-email-sjg@chromium.org>

This provides an option for the LCD to flush the dcache after each update
(puts, scroll or clear).

Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Put the LCD cache flush logic into lcd_putc() instead of lcd_puts()

 common/cmd_echo.c |    3 ++-
 common/lcd.c      |   45 ++++++++++++++++++++++++++++++++++++++-------
 include/lcd.h     |    8 ++++++++
 3 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/common/cmd_echo.c b/common/cmd_echo.c
index 43a6da5..12efbab 100644
--- a/common/cmd_echo.c
+++ b/common/cmd_echo.c
@@ -44,8 +44,9 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		}
 	}
 
+	/* Use puts() so that the LCD sees it as a new line */
 	if (putnl)
-		putc('\n');
+		puts("\n");
 
 	return 0;
 }
diff --git a/common/lcd.c b/common/lcd.c
index c915a49..758f158 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -97,6 +97,9 @@ static void lcd_setbgcolor (int color);
 
 char lcd_is_enabled = 0;
 
+static char lcd_flush_dcache;	/* 1 to flush dcache after each lcd update */
+
+
 #ifdef	NOT_USED_SO_FAR
 static void lcd_getcolreg (ushort regno,
 				ushort *red, ushort *green, ushort *blue);
@@ -105,6 +108,28 @@ static int lcd_getfgcolor (void);
 
 /************************************************************************/
 
+/* Flush LCD activity to the caches */
+void lcd_sync(void)
+{
+	/*
+	 * flush_dcache_range() is declared in common.h but it seems that some
+	 * architectures do not actually implement it. Is there a way to find
+	 * out whether it exists? For now, ARM is safe.
+	 */
+#ifdef CONFIG_ARM
+	int line_length;
+
+	if (lcd_flush_dcache)
+		flush_dcache_range((u32)lcd_base,
+			(u32)(lcd_base + lcd_get_size(&line_length)));
+#endif
+}
+
+void lcd_set_flush_dcache(int flush)
+{
+	lcd_flush_dcache = (flush != 0);
+}
+
 /*----------------------------------------------------------------------*/
 
 static void console_scrollup (void)
@@ -114,6 +139,7 @@ static void console_scrollup (void)
 
 	/* Clear the last one */
 	memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE);
+	lcd_sync();
 }
 
 /*----------------------------------------------------------------------*/
@@ -144,6 +170,8 @@ static inline void console_newline (void)
 		/* Scroll everything up */
 		console_scrollup () ;
 		--console_row;
+	} else {
+		lcd_sync();
 	}
 }
 
@@ -369,13 +397,6 @@ int drv_lcd_init (void)
 }
 
 /*----------------------------------------------------------------------*/
-static
-int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
-{
-	lcd_clear();
-	return 0;
-}
-
 void lcd_clear(void)
 {
 #if LCD_BPP == LCD_MONOCHROME
@@ -417,6 +438,14 @@ void lcd_clear(void)
 
 	console_col = 0;
 	console_row = 0;
+	lcd_sync();
+}
+
+static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
+			char *const argv[])
+{
+	lcd_clear();
+	return 0;
 }
 
 U_BOOT_CMD(
@@ -611,6 +640,7 @@ void bitmap_plot (int x, int y)
 	}
 
 	WATCHDOG_RESET();
+	lcd_sync();
 }
 #endif /* CONFIG_LCD_LOGO */
 
@@ -809,6 +839,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		break;
 	};
 
+	lcd_sync();
 	return (0);
 }
 #endif
diff --git a/include/lcd.h b/include/lcd.h
index 5016d6b..7c2dae2 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -56,6 +56,14 @@ extern void lcd_initcolregs (void);
 /* gunzip_bmp used if CONFIG_VIDEO_BMP_GZIP */
 extern struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp);
 
+/**
+ * Set whether we need to flush the dcache when changing the LCD image. This
+ * defaults to off.
+ *
+ * @param flush		non-zero to flush cache after update, 0 to skip
+ */
+void lcd_set_flush_dcache(int flush);
+
 #if defined CONFIG_MPC823
 /*
  * LCD controller stucture for MPC823 CPU
-- 
1.7.7.3

  parent reply	other threads:[~2012-06-13 16:19 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13 16:19 [U-Boot] [PATCH v2 0/19] tegra: Add display driver and LCD support for Seaboard Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 01/19] Add gpio_request() to asm-generic header Simon Glass
2012-09-21 19:30   ` Anatolij Gustschin
2012-09-27 20:58     ` Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 05/19] tegra: Use const for pinmux_config_pingroup/table() Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 06/19] tegra: Add display support to funcmux Simon Glass
2012-06-14 23:24   ` Stephen Warren
2012-07-11  3:48     ` Simon Glass
2012-06-13 16:19 ` [PATCH v2 07/19] tegra: fdt: Add LCD definitions for Tegra Simon Glass
2012-06-13 16:19   ` [U-Boot] " Simon Glass
2012-06-14 23:32   ` Stephen Warren
2012-06-14 23:32     ` [U-Boot] " Stephen Warren
2012-07-11  4:44     ` Simon Glass
2012-07-11  4:44       ` [U-Boot] " Simon Glass
2012-07-11  5:48       ` Thierry Reding
2012-07-11  5:48         ` [U-Boot] " Thierry Reding
2012-07-12  8:21         ` Simon Glass
2012-07-12  8:21           ` [U-Boot] " Simon Glass
2012-07-12  8:40           ` Thierry Reding
2012-07-12  8:40             ` [U-Boot] " Thierry Reding
2012-07-12  9:22             ` Alex Courbot
2012-07-12  9:22               ` [U-Boot] " Alex Courbot
2012-06-13 16:19 ` [U-Boot] [PATCH v2 08/19] tegra: Add support for PWFM Simon Glass
2012-06-14 23:35   ` Stephen Warren
2012-07-11  4:45     ` Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 09/19] tegra: Add SOC support for display/lcd Simon Glass
2012-06-14 23:39   ` Stephen Warren
     [not found]     ` <CAPnjgZ2bqPx+dHD9m+NuFrAbBeP1PQxHokLMwvD1-3OnC6ZHtg@mail.gmail.com>
2012-07-11  5:12       ` Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 10/19] tegra: Add LCD driver Simon Glass
2012-06-14 23:45   ` Stephen Warren
2012-07-11  4:56     ` Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 11/19] tegra: Add LCD support to Nvidia boards Simon Glass
2012-06-14 23:47   ` Stephen Warren
2012-07-11  4:58     ` Simon Glass
2012-07-23 20:25       ` Stephen Warren
2012-09-27 19:15         ` Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 12/19] arm: Add control over cachability of memory regions Simon Glass
2012-06-14 23:49   ` Stephen Warren
2012-07-11  5:01     ` Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 13/19] lcd: Add CONFIG_LCD_ALIGNMENT to select frame buffer alignment Simon Glass
2012-06-13 16:19 ` Simon Glass [this message]
2012-06-14 23:51   ` [U-Boot] [PATCH v2 14/19] lcd: Add support for flushing LCD fb from dcache after update Stephen Warren
2012-07-11  5:06     ` Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 15/19] tegra: Align LCD frame buffer to section boundary Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 16/19] tegra: Support control of cache settings for LCD Simon Glass
     [not found] ` <1339604395-6621-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-06-13 16:19   ` [PATCH v2 02/19] fdt: Add debugging to fdtdec_get_int/addr() Simon Glass
2012-06-13 16:19     ` [U-Boot] " Simon Glass
2012-09-21 19:39     ` Anatolij Gustschin
2012-09-21 19:56       ` Anatolij Gustschin
2012-06-13 16:19   ` [PATCH v2 03/19] fdt: Add function to look up a phandle's register address Simon Glass
2012-06-13 16:19     ` [U-Boot] " Simon Glass
2012-06-14 23:17     ` Stephen Warren
2012-06-14 23:17       ` [U-Boot] " Stephen Warren
2012-07-11  5:10       ` Simon Glass
2012-07-11  5:10         ` [U-Boot] " Simon Glass
2012-06-13 16:19   ` [PATCH v2 04/19] fdt: Add header guard to fdtdec.h Simon Glass
2012-06-13 16:19     ` [U-Boot] " Simon Glass
2012-06-13 16:19   ` [PATCH v2 17/19] tegra: fdt: Add LCD definitions for Seaboard Simon Glass
2012-06-13 16:19     ` [U-Boot] " Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 18/19] lcd: Add CONSOLE_SCROLL_LINES option to speed console Simon Glass
2012-06-13 16:19 ` [U-Boot] [PATCH v2 19/19] tegra: Enable display/lcd support on Seaboard Simon Glass
2012-06-13 22:57 ` [U-Boot] [PATCH v2 0/19] tegra: Add display driver and LCD support for Seaboard Stephen Warren
2012-06-13 23:03   ` Stephen Warren
2012-06-13 23:09     ` Stephen Warren
2012-06-25 21:03   ` Tom Warren
2012-06-27  5:11     ` Simon Glass
2012-07-11 10:04       ` Simon Glass

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=1339604395-6621-15-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.