[U-Boot] [PATCH 04/25] exynos: video: Drop the static lcd_base_addr variable

Simon Glass sjg at chromium.org
Fri Jan 15 00:59:53 CET 2016


Drop this and use parameters instead.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/video/exynos/exynos_fb.c   | 21 +++------------------
 drivers/video/exynos/exynos_fb.h   |  2 +-
 drivers/video/exynos/exynos_fimd.c | 26 +++++++++++---------------
 3 files changed, 15 insertions(+), 34 deletions(-)

diff --git a/drivers/video/exynos/exynos_fb.c b/drivers/video/exynos/exynos_fb.c
index 90d2038..a3acdcc 100644
--- a/drivers/video/exynos/exynos_fb.c
+++ b/drivers/video/exynos/exynos_fb.c
@@ -45,22 +45,9 @@ ushort *configuration_get_cmap(void)
 #endif
 }
 
-static void exynos_lcd_init_mem(void *lcdbase, struct vidinfo *vid)
+static void exynos_lcd_init(struct vidinfo *vid, ulong lcd_base)
 {
-	unsigned long palette_size;
-	unsigned int fb_size;
-
-	fb_size = vid->vl_row * vid->vl_col * (NBITS(vid->vl_bpix) >> 3);
-
-	palette_size = NBITS(vid->vl_bpix) == 8 ? 256 : 16;
-
-	exynos_fimd_lcd_init_mem((unsigned long)lcdbase,
-			(unsigned long)fb_size, palette_size);
-}
-
-static void exynos_lcd_init(struct vidinfo *vid)
-{
-	exynos_fimd_lcd_init(vid);
+	exynos_fimd_lcd_init(vid, lcd_base);
 
 	/* Enable flushing after LCD writes if requested */
 	lcd_set_flush_dcache(1);
@@ -297,9 +284,7 @@ void lcd_ctrl_init(void *lcdbase)
 	panel_width = panel_info.vl_width;
 	panel_height = panel_info.vl_height;
 
-	exynos_lcd_init_mem(lcdbase, &panel_info);
-
-	exynos_lcd_init(&panel_info);
+	exynos_lcd_init(&panel_info, (ulong)lcdbase);
 }
 
 void lcd_enable(void)
diff --git a/drivers/video/exynos/exynos_fb.h b/drivers/video/exynos/exynos_fb.h
index 2c2f94b..833be6a 100644
--- a/drivers/video/exynos/exynos_fb.h
+++ b/drivers/video/exynos/exynos_fb.h
@@ -35,7 +35,7 @@ enum exynos_cpu_auto_cmd_rate {
 
 void exynos_fimd_lcd_init_mem(unsigned long screen_base, unsigned long fb_size,
 	unsigned long palette_size);
-void exynos_fimd_lcd_init(vidinfo_t *vid);
+void exynos_fimd_lcd_init(struct vidinfo *vid, ulong lcd_base_address);
 unsigned long exynos_fimd_calc_fbsize(void);
 
 #endif
diff --git a/drivers/video/exynos/exynos_fimd.c b/drivers/video/exynos/exynos_fimd.c
index e6fb5d1..a1de9ac 100644
--- a/drivers/video/exynos/exynos_fimd.c
+++ b/drivers/video/exynos/exynos_fimd.c
@@ -21,16 +21,9 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static unsigned long *lcd_base_addr;
 static struct vidinfo *pvid;
 static struct exynos_fb *fimd_ctrl;
 
-void exynos_fimd_lcd_init_mem(u_long screen_base, u_long fb_size,
-		u_long palette_size)
-{
-	lcd_base_addr = (unsigned long *)screen_base;
-}
-
 static void exynos_fimd_set_dualrgb(unsigned int enabled)
 {
 	unsigned int cfg = 0;
@@ -47,7 +40,8 @@ static void exynos_fimd_set_dualrgb(unsigned int enabled)
 	writel(cfg, &fimd_ctrl->dualrgb);
 }
 
-static void exynos_fimd_set_dp_clkcon(unsigned int enabled)
+static void exynos_fimd_set_dp_clkcon(struct vidinfo *pvid,
+				      unsigned int enabled)
 {
 	unsigned int cfg = 0;
 
@@ -57,7 +51,7 @@ static void exynos_fimd_set_dp_clkcon(unsigned int enabled)
 	writel(cfg, &fimd_ctrl->dp_mie_clkcon);
 }
 
-static void exynos_fimd_set_par(unsigned int win_id)
+static void exynos_fimd_set_par(struct vidinfo *pvid, unsigned int win_id)
 {
 	unsigned int cfg = 0;
 
@@ -109,11 +103,13 @@ static void exynos_fimd_set_par(unsigned int win_id)
 			EXYNOS_VIDOSD(win_id));
 }
 
-static void exynos_fimd_set_buffer_address(unsigned int win_id)
+static void exynos_fimd_set_buffer_address(struct vidinfo *pvid,
+					   unsigned int win_id,
+					   ulong lcd_base_addr)
 {
 	unsigned long start_addr, end_addr;
 
-	start_addr = (unsigned long)lcd_base_addr;
+	start_addr = lcd_base_addr;
 	end_addr = start_addr + ((pvid->vl_col * (NBITS(pvid->vl_bpix) / 8)) *
 				pvid->vl_row);
 
@@ -289,7 +285,7 @@ void exynos_fimd_disable_sysmmu(void)
 	}
 }
 
-void exynos_fimd_lcd_init(struct vidinfo *vid)
+void exynos_fimd_lcd_init(struct vidinfo *vid, ulong lcd_base_address)
 {
 	unsigned int cfg = 0, rgb_mode;
 	unsigned int offset;
@@ -367,10 +363,10 @@ void exynos_fimd_lcd_init(struct vidinfo *vid)
 	writel(cfg, &fimd_ctrl->vidcon0);
 
 	/* set par */
-	exynos_fimd_set_par(pvid->win_id);
+	exynos_fimd_set_par(pvid, pvid->win_id);
 
 	/* set memory address */
-	exynos_fimd_set_buffer_address(pvid->win_id);
+	exynos_fimd_set_buffer_address(pvid, pvid->win_id, lcd_base_address);
 
 	/* set buffer size */
 	cfg = EXYNOS_VIDADDR_PAGEWIDTH(pvid->vl_col * NBITS(pvid->vl_bpix) / 8) |
@@ -393,7 +389,7 @@ void exynos_fimd_lcd_init(struct vidinfo *vid)
 	/* window on */
 	exynos_fimd_window_on(pvid->win_id);
 
-	exynos_fimd_set_dp_clkcon(pvid->dp_enabled);
+	exynos_fimd_set_dp_clkcon(pvid, pvid->dp_enabled);
 }
 
 unsigned long exynos_fimd_calc_fbsize(void)
-- 
2.6.0.rc2.230.g3dd15c0



More information about the U-Boot mailing list