mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/9] video: stm: remove unnecessary info function
@ 2015-07-06 10:36 Sascha Hauer
  2015-07-06 10:36 ` [PATCH 2/9] video: stm: copy platform_data to driver data Sascha Hauer
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Sascha Hauer @ 2015-07-06 10:36 UTC (permalink / raw)
  To: Barebox List

devinfo will show the information without the help of the driver anyway.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/stm.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index bf913f1..abaaf5d 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -453,17 +453,6 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 	return 0;
 }
 
-static void stmfb_info(struct device_d *hw_dev)
-{
-	struct imx_fb_platformdata *pdata = hw_dev->platform_data;
-	unsigned u;
-
-	printf(" Supported video modes:\n");
-	for (u = 0; u < pdata->mode_cnt; u++)
-		printf("  - '%s': %u x %u\n", pdata->mode_list[u].name,
-			pdata->mode_list[u].xres, pdata->mode_list[u].yres);
-}
-
 /*
  * There is only one video hardware instance available.
  * It makes no sense to dynamically allocate this data
@@ -529,8 +518,6 @@ static int stmfb_probe(struct device_d *hw_dev)
 		fbi.info.modes.num_modes = modes->num_modes;
 	}
 
-	hw_dev->info = stmfb_info;
-
 	ret = register_framebuffer(&fbi.info);
 	if (ret != 0) {
 		dev_err(hw_dev, "Failed to register framebuffer\n");
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/9] video: stm: copy platform_data to driver data
  2015-07-06 10:36 [PATCH 1/9] video: stm: remove unnecessary info function Sascha Hauer
@ 2015-07-06 10:36 ` Sascha Hauer
  2015-07-06 10:36 ` [PATCH 3/9] video: stm: code buswidth in platform data as decimal Sascha Hauer
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2015-07-06 10:36 UTC (permalink / raw)
  To: Barebox List

Copy the individual fields of struct imx_fb_platformdata to the
driver data rather than keeping a pointer to platform_data. This
works better with device tree where no platform_data * is
available.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/stm.c | 42 ++++++++++++++++++++++++++----------------
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index abaaf5d..c58b62c 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -144,8 +144,13 @@ struct imxfb_info {
 	unsigned memory_size;
 	struct fb_info info;
 	struct device_d *hw_dev;
-	struct imx_fb_platformdata *pdata;
 	struct clk *clk;
+	void *fixed_screen;
+	unsigned fixed_screen_size;
+	unsigned flags;
+	unsigned ld_intf_width;
+	void (*enable)(int enable);
+	unsigned dotclk_delay;
 };
 
 /* the RGB565 true colour mode */
@@ -258,14 +263,14 @@ static void stmfb_enable_controller(struct fb_info *fb_info)
 	writel(CTRL1_FIFO_CLEAR, fbi->base + HW_LCDIF_CTRL1 + STMP_OFFSET_REG_CLR);
 
 	/* enable LCD using LCD_RESET signal*/
-	if (fbi->pdata->flags & USE_LCD_RESET)
+	if (fbi->flags & USE_LCD_RESET)
 		writel(CTRL1_RESET,  fbi->base + HW_LCDIF_CTRL1 + STMP_OFFSET_REG_SET);
 
 	/* start the engine right now */
 	writel(CTRL_RUN, fbi->base + HW_LCDIF_CTRL + STMP_OFFSET_REG_SET);
 
-	if (fbi->pdata->enable)
-		fbi->pdata->enable(1);
+	if (fbi->enable)
+		fbi->enable(1);
 }
 
 static void stmfb_disable_controller(struct fb_info *fb_info)
@@ -276,11 +281,11 @@ static void stmfb_disable_controller(struct fb_info *fb_info)
 
 
 	/* disable LCD using LCD_RESET signal*/
-	if (fbi->pdata->flags & USE_LCD_RESET)
+	if (fbi->flags & USE_LCD_RESET)
 		writel(CTRL1_RESET,  fbi->base + HW_LCDIF_CTRL1 + STMP_OFFSET_REG_CLR);
 
-	if (fbi->pdata->enable)
-		fbi->pdata->enable(0);
+	if (fbi->enable)
+		fbi->enable(0);
 
 	/*
 	 * Even if we disable the controller here, it will still continue
@@ -306,7 +311,6 @@ static void stmfb_disable_controller(struct fb_info *fb_info)
 static int stmfb_activate_var(struct fb_info *fb_info)
 {
 	struct imxfb_info *fbi = fb_info->priv;
-	struct imx_fb_platformdata *pdata = fbi->pdata;
 	struct fb_videomode *mode = fb_info->mode;
 	uint32_t reg;
 	unsigned size;
@@ -317,11 +321,11 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 	size = calc_line_length(mode->xres, fb_info->bits_per_pixel) *
 		mode->yres;
 
-	if (pdata && pdata->fixed_screen) {
-		if (pdata->fixed_screen_size < size)
+	if (fbi->fixed_screen) {
+		if (fbi->fixed_screen_size < size)
 			return -ENOMEM;
-		fb_info->screen_base = pdata->fixed_screen;
-		fbi->memory_size = pdata->fixed_screen_size;
+		fb_info->screen_base = fbi->fixed_screen;
+		fbi->memory_size = fbi->fixed_screen_size;
 	} else {
 		fb_info->screen_base = xrealloc(fb_info->screen_base, size);
 		fbi->memory_size = size;
@@ -349,7 +353,8 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 	/*
 	 * Configure videomode and interface mode
 	 */
-	reg |= SET_BUS_WIDTH(pdata->ld_intf_width);
+	reg |= SET_BUS_WIDTH(fbi->ld_intf_width);
+
 	switch (fb_info->bits_per_pixel) {
 	case 8:
 		reg |= SET_WORD_LENGTH(1);
@@ -370,7 +375,8 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 	case 32:
 		pr_debug("Setting up an RGB888/666 mode\n");
 		reg |= SET_WORD_LENGTH(3);
-		switch (pdata->ld_intf_width) {
+
+		switch (fbi->ld_intf_width) {
 		case STMLCDIF_8BIT:
 			dev_dbg(fbi->hw_dev,
 				"Unsupported LCD bus width mapping\n");
@@ -442,7 +448,7 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 
 	writel(
 #ifdef CONFIG_ARCH_IMX28
-		SET_DOTCLK_DLY(pdata->dotclk_delay) |
+		SET_DOTCLK_DLY(fbi->dotclk_delay) |
 #endif
 		SET_DOTCLK_H_VALID_DATA_CNT(mode->xres),
 		fbi->base + HW_LCDIF_VDCTRL4);
@@ -480,7 +486,6 @@ static int stmfb_probe(struct device_d *hw_dev)
 	/* add runtime hardware info */
 	fbi.hw_dev = hw_dev;
 	fbi.base = dev_request_mem_region(hw_dev, 0);
-	fbi.pdata = pdata;
 	fbi.clk = clk_get(hw_dev, NULL);
 	if (IS_ERR(fbi.clk))
 		return PTR_ERR(fbi.clk);
@@ -493,6 +498,11 @@ static int stmfb_probe(struct device_d *hw_dev)
 		fbi.info.modes.modes = pdata->mode_list;
 		fbi.info.modes.num_modes = pdata->mode_cnt;
 		fbi.info.mode = &fbi.info.modes.modes[0];
+		fbi.flags = pdata->flags;
+		fbi.enable = pdata->enable;
+		fbi.fixed_screen = pdata->fixed_screen;
+		fbi.fixed_screen_size = pdata->fixed_screen_size;
+		fbi.ld_intf_width = pdata->ld_intf_width;
 		if (pdata->bits_per_pixel)
 			fbi.info.bits_per_pixel = pdata->bits_per_pixel;
 	} else {
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/9] video: stm: code buswidth in platform data as decimal
  2015-07-06 10:36 [PATCH 1/9] video: stm: remove unnecessary info function Sascha Hauer
  2015-07-06 10:36 ` [PATCH 2/9] video: stm: copy platform_data to driver data Sascha Hauer
@ 2015-07-06 10:36 ` Sascha Hauer
  2015-07-06 10:36 ` [PATCH 4/9] video: stm: use uncached memory Sascha Hauer
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2015-07-06 10:36 UTC (permalink / raw)
  To: Barebox List

Instead of putting hardware specific bit masks in platform_data just
use the decimal interface width and encode this in the driver. This
makes it easier to create the platform_data and helps device tree
based implementations.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/chumby_falconwing/falconwing.c |  2 +-
 arch/arm/boards/freescale-mx28-evk/mx28-evk.c  |  2 +-
 arch/arm/boards/karo-tx28/tx28-stk5.c          |  2 +-
 arch/arm/mach-mxs/include/mach/fb.h            |  7 +-----
 drivers/video/stm.c                            | 32 +++++++++++++++++++++-----
 5 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/arch/arm/boards/chumby_falconwing/falconwing.c b/arch/arm/boards/chumby_falconwing/falconwing.c
index 5e569bc..c866043 100644
--- a/arch/arm/boards/chumby_falconwing/falconwing.c
+++ b/arch/arm/boards/chumby_falconwing/falconwing.c
@@ -83,7 +83,7 @@ static struct imx_fb_platformdata fb_mode = {
 	.mode_list = &falconwing_vmode,
 	.mode_cnt = 1,
 	/* the NMA35 is a 24 bit display, but only 18 bits are connected */
-	.ld_intf_width = STMLCDIF_18BIT,
+	.ld_intf_width = 18,
 	.enable = chumby_fb_enable,
 	.fixed_screen = (void *)(0x40000000 + SZ_64M - MAX_FB_SIZE),
 	.fixed_screen_size = MAX_FB_SIZE,
diff --git a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
index d77a6c7..fc12375 100644
--- a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
+++ b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
@@ -226,7 +226,7 @@ static struct imx_fb_platformdata mx28_evk_fb_pdata = {
 	.mode_list = mx28_evk_vmodes,
 	.mode_cnt = ARRAY_SIZE(mx28_evk_vmodes),
 	.dotclk_delay = 0,			/* no adaption required */
-	.ld_intf_width = STMLCDIF_24BIT,	/* full 24 bit */
+	.ld_intf_width = 24,
 	.bits_per_pixel = 32,
 	.fixed_screen = NULL,
 	.enable = mx28_evk_fb_enable,
diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c
index 9b86d1c..d67607b 100644
--- a/arch/arm/boards/karo-tx28/tx28-stk5.c
+++ b/arch/arm/boards/karo-tx28/tx28-stk5.c
@@ -195,7 +195,7 @@ static struct imx_fb_platformdata tx28_fb_pdata = {
 	.mode_list = tx28evk_vmodes,
 	.mode_cnt = ARRAY_SIZE(tx28evk_vmodes),
 	.dotclk_delay = 0,	/* no adaption required */
-	.ld_intf_width = STMLCDIF_24BIT,	/* full 24 bit */
+	.ld_intf_width = 24,
 	.fixed_screen = (void *)(0x40000000 + SZ_128M - MAX_FB_SIZE),
 	.fixed_screen_size = MAX_FB_SIZE,
 	.enable = tx28_fb_enable,
diff --git a/arch/arm/mach-mxs/include/mach/fb.h b/arch/arm/mach-mxs/include/mach/fb.h
index 2b6825f..ad28f79 100644
--- a/arch/arm/mach-mxs/include/mach/fb.h
+++ b/arch/arm/mach-mxs/include/mach/fb.h
@@ -15,11 +15,6 @@
 
 #include <fb.h>
 
-#define STMLCDIF_8BIT 1	/** pixel data bus to the display is of 8 bit width */
-#define STMLCDIF_16BIT 0 /** pixel data bus to the display is of 16 bit width */
-#define STMLCDIF_18BIT 2 /** pixel data bus to the display is of 18 bit width */
-#define STMLCDIF_24BIT 3 /** pixel data bus to the display is of 24 bit width */
-
 /** LC display uses active high data enable signal */
 #define FB_SYNC_DE_HIGH_ACT	(1 << 27)
 /** LC display will latch its data at clock's rising edge */
@@ -38,7 +33,7 @@ struct imx_fb_platformdata {
 	unsigned mode_cnt;
 
 	unsigned dotclk_delay;	/**< refer manual HW_LCDIF_VDCTRL4 register */
-	unsigned ld_intf_width;	/**< refer STMLCDIF_* macros */
+	unsigned ld_intf_width;	/* interface width in bits */
 	unsigned bits_per_pixel;
 
 	void *fixed_screen;	/**< if != NULL use this as framebuffer memory */
diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index c58b62c..92bff9c 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -36,7 +36,10 @@
 # define CTRL_VSYNC_MODE (1 << 18)
 # define CTRL_DOTCLK_MODE (1 << 17)
 # define CTRL_DATA_SELECT (1 << 16)
-# define SET_BUS_WIDTH(x) (((x) & 0x3) << 10)
+# define CTRL_BUS_WIDTH_8 (1 << 10)
+# define CTRL_BUS_WIDTH_16 (0 << 10)
+# define CTRL_BUS_WIDTH_18 (2 << 10)
+# define CTRL_BUS_WIDTH_24 (3 << 10)
 # define SET_WORD_LENGTH(x) (((x) & 0x3) << 8)
 # define GET_WORD_LENGTH(x) (((x) >> 8) & 0x3)
 # define CTRL_MASTER (1 << 5)
@@ -353,7 +356,24 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 	/*
 	 * Configure videomode and interface mode
 	 */
-	reg |= SET_BUS_WIDTH(fbi->ld_intf_width);
+	switch (fbi->ld_intf_width) {
+	case 8:
+		reg |= CTRL_BUS_WIDTH_8;
+		break;
+	case 16:
+		reg |= CTRL_BUS_WIDTH_16;
+		break;
+	case 18:
+		reg |= CTRL_BUS_WIDTH_18;
+		break;
+	case 24:
+		reg |= CTRL_BUS_WIDTH_24;
+		break;
+	default:
+		dev_err(fbi->hw_dev, "Unsupported interface width %d\n",
+				fbi->ld_intf_width);
+		return -EINVAL;
+	}
 
 	switch (fb_info->bits_per_pixel) {
 	case 8:
@@ -377,12 +397,12 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 		reg |= SET_WORD_LENGTH(3);
 
 		switch (fbi->ld_intf_width) {
-		case STMLCDIF_8BIT:
+		case 8:
 			dev_dbg(fbi->hw_dev,
 				"Unsupported LCD bus width mapping\n");
 			break;
-		case STMLCDIF_16BIT:
-		case STMLCDIF_18BIT:
+		case 16:
+		case 18:
 			/* 24 bit to 18 bit mapping
 			 * which means: ignore the upper 2 bits in
 			 * each colour component
@@ -393,7 +413,7 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 			fb_info->blue = def_rgb666[BLUE];
 			fb_info->transp =  def_rgb666[TRANSP];
 			break;
-		case STMLCDIF_24BIT:
+		case 24:
 			/* real 24 bit */
 			fb_info->red = def_rgb888[RED];
 			fb_info->green = def_rgb888[GREEN];
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/9] video: stm: use uncached memory
  2015-07-06 10:36 [PATCH 1/9] video: stm: remove unnecessary info function Sascha Hauer
  2015-07-06 10:36 ` [PATCH 2/9] video: stm: copy platform_data to driver data Sascha Hauer
  2015-07-06 10:36 ` [PATCH 3/9] video: stm: code buswidth in platform data as decimal Sascha Hauer
@ 2015-07-06 10:36 ` Sascha Hauer
  2015-07-06 10:36 ` [PATCH 5/9] video: stm: read interface width from device tree Sascha Hauer
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2015-07-06 10:36 UTC (permalink / raw)
  To: Barebox List

To avoid caching effects on the display use uncached memory.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/stm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index 92bff9c..c825092 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -24,6 +24,8 @@
 #include <errno.h>
 #include <xfuncs.h>
 #include <io.h>
+#include <dma.h>
+#include <asm/mmu.h>
 #include <stmp-device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
@@ -329,8 +331,13 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 			return -ENOMEM;
 		fb_info->screen_base = fbi->fixed_screen;
 		fbi->memory_size = fbi->fixed_screen_size;
+		remap_range(fbi->fixed_screen,
+				fbi->fixed_screen_size,
+				mmu_get_pte_uncached_flags());
 	} else {
-		fb_info->screen_base = xrealloc(fb_info->screen_base, size);
+		fb_info->screen_base = dma_alloc_coherent(size, NULL);
+		if (!fb_info->screen_base)
+			return -ENOMEM;
 		fbi->memory_size = size;
 	}
 
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 5/9] video: stm: read interface width from device tree
  2015-07-06 10:36 [PATCH 1/9] video: stm: remove unnecessary info function Sascha Hauer
                   ` (2 preceding siblings ...)
  2015-07-06 10:36 ` [PATCH 4/9] video: stm: use uncached memory Sascha Hauer
@ 2015-07-06 10:36 ` Sascha Hauer
  2015-07-06 10:36 ` [PATCH 6/9] video: stm: read bits-per-pixel " Sascha Hauer
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2015-07-06 10:36 UTC (permalink / raw)
  To: Barebox List

The interface width has not been initialized when probed from device
tree. Fix that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/stm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index c825092..dd80a98 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -553,6 +553,12 @@ static int stmfb_probe(struct device_d *hw_dev)
 
 		fbi.info.modes.modes = modes->modes;
 		fbi.info.modes.num_modes = modes->num_modes;
+
+		ret = of_property_read_u32(display, "bus-width", &fbi.ld_intf_width);
+		if (ret < 0) {
+			dev_err(hw_dev, "failed to get bus-width property\n");
+			return -EINVAL;
+		}
 	}
 
 	ret = register_framebuffer(&fbi.info);
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 6/9] video: stm: read bits-per-pixel from device tree
  2015-07-06 10:36 [PATCH 1/9] video: stm: remove unnecessary info function Sascha Hauer
                   ` (3 preceding siblings ...)
  2015-07-06 10:36 ` [PATCH 5/9] video: stm: read interface width from device tree Sascha Hauer
@ 2015-07-06 10:36 ` Sascha Hauer
  2015-07-06 10:36 ` [PATCH 7/9] video: stm: honor display_flags Sascha Hauer
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2015-07-06 10:36 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/stm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index dd80a98..3d64238 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -559,6 +559,9 @@ static int stmfb_probe(struct device_d *hw_dev)
 			dev_err(hw_dev, "failed to get bus-width property\n");
 			return -EINVAL;
 		}
+
+		of_property_read_u32(display, "bits-per-pixel",
+				&fbi.info.bits_per_pixel);
 	}
 
 	ret = register_framebuffer(&fbi.info);
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 7/9] video: stm: honor display_flags
  2015-07-06 10:36 [PATCH 1/9] video: stm: remove unnecessary info function Sascha Hauer
                   ` (4 preceding siblings ...)
  2015-07-06 10:36 ` [PATCH 6/9] video: stm: read bits-per-pixel " Sascha Hauer
@ 2015-07-06 10:36 ` Sascha Hauer
  2015-07-06 10:36 ` [PATCH 8/9] video: Add generic fixup handler to reserve fb memory Sascha Hauer
  2015-07-06 10:36 ` [PATCH 9/9] video: stm: reserve framebuffer memory for Linux Sascha Hauer
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2015-07-06 10:36 UTC (permalink / raw)
  To: Barebox List

stmfb uses custom flags FB_SYNC_DE_HIGH_ACT and FB_SYNC_CLK_INVERT.
These have generic counterparts in display_flags. Honor them aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/stm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index 3d64238..f0f5ce0 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -449,9 +449,11 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 		reg |= VDCTRL0_HSYNC_POL;
 	if (mode->sync & FB_SYNC_VERT_HIGH_ACT)
 		reg |= VDCTRL0_VSYNC_POL;
-	if (mode->sync & FB_SYNC_DE_HIGH_ACT)
+	if (mode->sync & FB_SYNC_DE_HIGH_ACT ||
+			mode->display_flags & DISPLAY_FLAGS_DE_LOW)
 		reg |= VDCTRL0_ENABLE_POL;
-	if (mode->sync & FB_SYNC_CLK_INVERT)
+	if (mode->sync & FB_SYNC_CLK_INVERT ||
+			mode->display_flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
 		reg |= VDCTRL0_DOTCLK_POL;
 
 	reg |= SET_VSYNC_PULSE_WIDTH(mode->vsync_len);
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 8/9] video: Add generic fixup handler to reserve fb memory
  2015-07-06 10:36 [PATCH 1/9] video: stm: remove unnecessary info function Sascha Hauer
                   ` (5 preceding siblings ...)
  2015-07-06 10:36 ` [PATCH 7/9] video: stm: honor display_flags Sascha Hauer
@ 2015-07-06 10:36 ` Sascha Hauer
  2015-07-06 10:36 ` [PATCH 9/9] video: stm: reserve framebuffer memory for Linux Sascha Hauer
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2015-07-06 10:36 UTC (permalink / raw)
  To: Barebox List

When a framebuffer is kept enabled when Linux starts its framebuffer
memory should be reserved. Otherwise Linux may overwrite its contents.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/fb.c | 21 +++++++++++++++++++++
 include/fb.h       |  1 +
 2 files changed, 22 insertions(+)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index e30ab59..931c99c 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -103,6 +103,27 @@ static int fb_setup_mode(struct fb_info *info)
 	return 0;
 }
 
+static int fb_of_reserve_fixup(struct device_node *root, void *context)
+{
+	struct fb_info *info = context;
+
+	if (!info->enabled)
+		return 0;
+
+	of_add_reserve_entry((unsigned long)info->screen_base,
+			(unsigned long)info->screen_base + info->screen_size);
+
+	return 0;
+}
+
+void fb_of_reserve_add_fixup(struct fb_info *info)
+{
+	if (!IS_ENABLED(CONFIG_OFDEVICE))
+		return;
+
+	of_register_fixup(fb_of_reserve_fixup, info);
+}
+
 static int fb_set_modename(struct param_d *param, void *priv)
 {
 	struct fb_info *info = priv;
diff --git a/include/fb.h b/include/fb.h
index 2db6ad6..a693f4b 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -159,5 +159,6 @@ int fb_register_simplefb(struct fb_info *info);
 int edid_to_display_timings(struct display_timings *, unsigned char *edid);
 void *edid_read_i2c(struct i2c_adapter *adapter);
 void fb_edid_add_modes(struct fb_info *info);
+void fb_of_reserve_add_fixup(struct fb_info *info);
 
 #endif /* __FB_H */
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 9/9] video: stm: reserve framebuffer memory for Linux
  2015-07-06 10:36 [PATCH 1/9] video: stm: remove unnecessary info function Sascha Hauer
                   ` (6 preceding siblings ...)
  2015-07-06 10:36 ` [PATCH 8/9] video: Add generic fixup handler to reserve fb memory Sascha Hauer
@ 2015-07-06 10:36 ` Sascha Hauer
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2015-07-06 10:36 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/stm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index f0f5ce0..1b42a18 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -566,6 +566,8 @@ static int stmfb_probe(struct device_d *hw_dev)
 				&fbi.info.bits_per_pixel);
 	}
 
+	fb_of_reserve_add_fixup(&fbi.info);
+
 	ret = register_framebuffer(&fbi.info);
 	if (ret != 0) {
 		dev_err(hw_dev, "Failed to register framebuffer\n");
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-07-06 10:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-06 10:36 [PATCH 1/9] video: stm: remove unnecessary info function Sascha Hauer
2015-07-06 10:36 ` [PATCH 2/9] video: stm: copy platform_data to driver data Sascha Hauer
2015-07-06 10:36 ` [PATCH 3/9] video: stm: code buswidth in platform data as decimal Sascha Hauer
2015-07-06 10:36 ` [PATCH 4/9] video: stm: use uncached memory Sascha Hauer
2015-07-06 10:36 ` [PATCH 5/9] video: stm: read interface width from device tree Sascha Hauer
2015-07-06 10:36 ` [PATCH 6/9] video: stm: read bits-per-pixel " Sascha Hauer
2015-07-06 10:36 ` [PATCH 7/9] video: stm: honor display_flags Sascha Hauer
2015-07-06 10:36 ` [PATCH 8/9] video: Add generic fixup handler to reserve fb memory Sascha Hauer
2015-07-06 10:36 ` [PATCH 9/9] video: stm: reserve framebuffer memory for Linux Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox