瀏覽代碼

tegra: Support control of cache settings for LCD

Add support for selecting the required cache mode for the LCD:
off, write-through or write-back.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
Simon Glass 12 年之前
父節點
當前提交
44706a8765
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      drivers/video/tegra.c

+ 11 - 0
drivers/video/tegra.c

@@ -146,6 +146,7 @@ static void update_panel_size(struct fdt_disp_config *config)
 void lcd_ctrl_init(void *lcdbase)
 void lcd_ctrl_init(void *lcdbase)
 {
 {
 	int line_length, size;
 	int line_length, size;
+	int type = DCACHE_OFF;
 
 
 	assert(disp_config);
 	assert(disp_config);
 
 
@@ -161,6 +162,16 @@ void lcd_ctrl_init(void *lcdbase)
 		update_panel_size(disp_config);
 		update_panel_size(disp_config);
 	size = lcd_get_size(&line_length);
 	size = lcd_get_size(&line_length);
 
 
+	/* Set up the LCD caching as requested */
+	if (config.cache_type & FDT_LCD_CACHE_WRITE_THROUGH)
+		type = DCACHE_WRITETHROUGH;
+	else if (config.cache_type & FDT_LCD_CACHE_WRITE_BACK)
+		type = DCACHE_WRITEBACK;
+	mmu_set_region_dcache_behaviour(disp_config->frame_buffer, size, type);
+
+	/* Enable flushing after LCD writes if requested */
+	lcd_set_flush_dcache(config.cache_type & FDT_LCD_CACHE_FLUSH);
+
 	debug("LCD frame buffer at %p\n", lcd_base);
 	debug("LCD frame buffer at %p\n", lcd_base);
 }
 }