diff mbox

[U-Boot,09/11] pxa_lcd: make driver cache-aware

Message ID 1458524230-10827-9-git-send-email-anarsoul@gmail.com
State Accepted
Commit 59deb7fe8d23c8ec2b659d99323ec4a2ec19148a
Delegated to: Tom Rini
Headers show

Commit Message

Vasily Khoruzhick March 21, 2016, 1:37 a.m. UTC
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 drivers/video/pxa_lcd.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Marek Vasut March 21, 2016, 1:52 a.m. UTC | #1
On 03/21/2016 02:37 AM, Vasily Khoruzhick wrote:
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
>  drivers/video/pxa_lcd.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)

Why don't you just allocate the piece of LCD memory as non-cachable ?
Tom Rini March 27, 2016, 10:29 p.m. UTC | #2
On Sun, Mar 20, 2016 at 06:37:08PM -0700, Vasily Khoruzhick wrote:

> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>

Applied to u-boot/master, thanks!
Marek Vasut March 27, 2016, 11:27 p.m. UTC | #3
On 03/28/2016 12:29 AM, Tom Rini wrote:
> On Sun, Mar 20, 2016 at 06:37:08PM -0700, Vasily Khoruzhick wrote:
> 
>> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> 
> Applied to u-boot/master, thanks!
> 
NAK, this is pure wrong. The memory area should be non-cacheable. Please
remove the patch from the tree.
Tom Rini March 28, 2016, 12:58 a.m. UTC | #4
On Mon, Mar 28, 2016 at 01:27:27AM +0200, Marek Vasut wrote:
> On 03/28/2016 12:29 AM, Tom Rini wrote:
> > On Sun, Mar 20, 2016 at 06:37:08PM -0700, Vasily Khoruzhick wrote:
> > 
> >> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> > 
> > Applied to u-boot/master, thanks!
> > 
> NAK, this is pure wrong. The memory area should be non-cacheable. Please
> remove the patch from the tree.

Sorry, reverted.
diff mbox

Patch

diff --git a/drivers/video/pxa_lcd.c b/drivers/video/pxa_lcd.c
index ba4f897..d64c25b 100644
--- a/drivers/video/pxa_lcd.c
+++ b/drivers/video/pxa_lcd.c
@@ -353,6 +353,9 @@  void lcd_ctrl_init (void *lcdbase)
 	pxafb_init(&panel_info);
 	pxafb_setup_gpio(&panel_info);
 	pxafb_enable_controller(&panel_info);
+
+	/* Enable flushing if we enabled dcache */
+	lcd_set_flush_dcache(1);
 }
 
 /*----------------------------------------------------------------------*/
@@ -565,6 +568,10 @@  static int pxafb_init (vidinfo_t *vid)
 	fbi->dmadesc_fblow->fidr  = 0;
 	fbi->dmadesc_fblow->ldcmd = BYTES_PER_PANEL;
 
+	flush_dcache_range((u32)fbi->dmadesc_fblow,
+			   (u32)fbi->dmadesc_fblow +
+			   sizeof(*fbi->dmadesc_fblow));
+
 	fbi->fdadr1 = (u_long)fbi->dmadesc_fblow; /* only used in dual-panel mode */
 
 	fbi->dmadesc_fbhigh->fsadr = fbi->screen;
@@ -580,11 +587,20 @@  static int pxafb_init (vidinfo_t *vid)
 		/* assume any mode with <12 bpp is palette driven */
 		fbi->dmadesc_palette->fdadr = (u_long)fbi->dmadesc_fbhigh;
 		fbi->dmadesc_fbhigh->fdadr = (u_long)fbi->dmadesc_palette;
+		flush_dcache_range((u32)fbi->dmadesc_fbhigh,
+				   (u32)fbi->dmadesc_fbhigh +
+				   sizeof(*fbi->dmadesc_fbhigh));
+		flush_dcache_range((u32)fbi->dmadesc_palette,
+				   (u32)fbi->dmadesc_palette +
+				   sizeof(*fbi->dmadesc_palette));
 		/* flips back and forth between pal and fbhigh */
 		fbi->fdadr0 = (u_long)fbi->dmadesc_palette;
 	}
 	else
 	{
+		flush_dcache_range((u32)fbi->dmadesc_fbhigh,
+				   (u32)fbi->dmadesc_fbhigh +
+				   sizeof(*fbi->dmadesc_fbhigh));
 		/* palette shouldn't be loaded in true-color mode */
 		fbi->dmadesc_fbhigh->fdadr = (u_long)fbi->dmadesc_fbhigh;
 		fbi->fdadr0 = (u_long)fbi->dmadesc_fbhigh; /* no pal just fbhigh */