All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO
@ 2019-06-03 21:05 Igor Opaniuk
  2019-06-03 21:05 ` [U-Boot] [RFC 1/6] video: mxsfb: change mxs_lcd_init signature Igor Opaniuk
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Igor Opaniuk @ 2019-06-03 21:05 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

This series of patches refactors and extends NXP mxsfb video driver to
be build with DM_VIDEO enabled. DTS files must additionally include
'u-boot,dm-pre-reloc' property in soc and child nodes to enable driver
binding to mxsfb device.

Also enables DM_VIDEO by default for Colibri iMX7 eMMC edition.

Igor Opaniuk (6):
  video: mxsfb: change mxs_lcd_init signature
  video: mxsfb: reorder includes
  video: mxsfb: refactor video_hw_init()
  video: mxsfb: add DM_VIDEO support
  ARM: dts: colibri_imx7: Add lcdif node
  colibri_imx7_emmc: enable DM_VIDEO

 arch/arm/dts/imx7-colibri-emmc.dts  |   2 +
 arch/arm/dts/imx7-colibri.dtsi      |  28 ++++
 arch/arm/mach-imx/cpu.c             |   2 +-
 arch/arm/mach-imx/mx7/soc.c         |   2 +-
 configs/colibri_imx7_emmc_defconfig |   2 +-
 drivers/video/mxsfb.c               | 219 +++++++++++++++++++++++-----
 include/configs/colibri_imx7.h      |   2 +-
 7 files changed, 213 insertions(+), 44 deletions(-)

-- 
2.17.1

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

* [U-Boot] [RFC 1/6] video: mxsfb: change mxs_lcd_init signature
  2019-06-03 21:05 [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO Igor Opaniuk
@ 2019-06-03 21:05 ` Igor Opaniuk
  2019-06-03 21:05 ` [U-Boot] [RFC 2/6] video: mxsfb: reorder includes Igor Opaniuk
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Igor Opaniuk @ 2019-06-03 21:05 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

Provide directly framebuffer address instead of pointer to
GraphicDevice struct, which will let to re-use this function in
DM_VIDEO configurations.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---
 drivers/video/mxsfb.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 02fde05908..0f3a10b0f6 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -46,8 +46,7 @@ __weak void mxsfb_system_setup(void)
  * 	 le:89,ri:164,up:23,lo:10,hs:10,vs:10,sync:0,vmode:0
  */
 
-static void mxs_lcd_init(GraphicDevice *panel,
-			struct ctfb_res_modes *mode, int bpp)
+static void mxs_lcd_init(u32 fb_addr, struct ctfb_res_modes *mode, int bpp)
 {
 	struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE;
 	uint32_t word_len = 0, bus_width = 0;
@@ -112,8 +111,8 @@ static void mxs_lcd_init(GraphicDevice *panel,
 	writel((0 << LCDIF_VDCTRL4_DOTCLK_DLY_SEL_OFFSET) | mode->xres,
 		&regs->hw_lcdif_vdctrl4);
 
-	writel(panel->frameAdrs, &regs->hw_lcdif_cur_buf);
-	writel(panel->frameAdrs, &regs->hw_lcdif_next_buf);
+	writel(fb_addr, &regs->hw_lcdif_cur_buf);
+	writel(fb_addr, &regs->hw_lcdif_next_buf);
 
 	/* Flush FIFO first */
 	writel(LCDIF_CTRL1_FIFO_CLEAR, &regs->hw_lcdif_ctrl1_set);
@@ -214,7 +213,7 @@ void *video_hw_init(void)
 	printf("%s\n", panel.modeIdent);
 
 	/* Start framebuffer */
-	mxs_lcd_init(&panel, &mode, bpp);
+	mxs_lcd_init(panel.frameAdrs, &mode, bpp);
 
 #ifdef CONFIG_VIDEO_MXS_MODE_SYSTEM
 	/*
-- 
2.17.1

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

* [U-Boot] [RFC 2/6] video: mxsfb: reorder includes
  2019-06-03 21:05 [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO Igor Opaniuk
  2019-06-03 21:05 ` [U-Boot] [RFC 1/6] video: mxsfb: change mxs_lcd_init signature Igor Opaniuk
@ 2019-06-03 21:05 ` Igor Opaniuk
  2019-06-03 21:05 ` [U-Boot] [RFC 3/6] video: mxsfb: refactor video_hw_init() Igor Opaniuk
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Igor Opaniuk @ 2019-06-03 21:05 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

Follow alphabetical order of includes, which simplifies detecting duplicate
includes etc.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---
 drivers/video/mxsfb.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 0f3a10b0f6..059fbf2b05 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -5,16 +5,15 @@
  * Copyright (C) 2011-2013 Marek Vasut <marex@denx.de>
  */
 #include <common.h>
+#include <linux/errno.h>
 #include <malloc.h>
 #include <video_fb.h>
 
-#include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
-#include <linux/errno.h>
-#include <asm/io.h>
-
 #include <asm/mach-imx/dma.h>
+#include <asm/io.h>
 
 #include "videomodes.h"
 
-- 
2.17.1

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

* [U-Boot] [RFC 3/6] video: mxsfb: refactor video_hw_init()
  2019-06-03 21:05 [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO Igor Opaniuk
  2019-06-03 21:05 ` [U-Boot] [RFC 1/6] video: mxsfb: change mxs_lcd_init signature Igor Opaniuk
  2019-06-03 21:05 ` [U-Boot] [RFC 2/6] video: mxsfb: reorder includes Igor Opaniuk
@ 2019-06-03 21:05 ` Igor Opaniuk
  2019-06-03 21:05 ` [U-Boot] [RFC 4/6] video: mxsfb: add DM_VIDEO support Igor Opaniuk
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Igor Opaniuk @ 2019-06-03 21:05 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

Refactor video_hw_init() function, and introduce an independent function
for the common procedure of initialization.

Currently video_hw_init() is only in charge of parsing configuration from
env("videomode") and filling struct GraphicPanel, and new
mxs_probe_common() does hw specific initialization (invocation of
mxs_lcd_init() etc.)

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---
 drivers/video/mxsfb.c | 68 ++++++++++++++++++++++++++-----------------
 1 file changed, 41 insertions(+), 27 deletions(-)

diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 059fbf2b05..6e269409d6 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -128,6 +128,37 @@ static void mxs_lcd_init(u32 fb_addr, struct ctfb_res_modes *mode, int bpp)
 	writel(LCDIF_CTRL_RUN, &regs->hw_lcdif_ctrl_set);
 }
 
+static int mxs_probe_common(struct ctfb_res_modes *mode, int bpp, void *fb)
+{
+	/* Start framebuffer */
+	mxs_lcd_init((u32)fb, mode, bpp);
+
+#ifdef CONFIG_VIDEO_MXS_MODE_SYSTEM
+	/*
+	 * If the LCD runs in system mode, the LCD refresh has to be triggered
+	 * manually by setting the RUN bit in HW_LCDIF_CTRL register. To avoid
+	 * having to set this bit manually after every single change in the
+	 * framebuffer memory, we set up specially crafted circular DMA, which
+	 * sets the RUN bit, then waits until it gets cleared and repeats this
+	 * infinitelly. This way, we get smooth continuous updates of the LCD.
+	 */
+	struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE;
+
+	memset(&desc, 0, sizeof(struct mxs_dma_desc));
+	desc.address = (dma_addr_t)&desc;
+	desc.cmd.data = MXS_DMA_DESC_COMMAND_NO_DMAXFER | MXS_DMA_DESC_CHAIN |
+			MXS_DMA_DESC_WAIT4END |
+			(1 << MXS_DMA_DESC_PIO_WORDS_OFFSET);
+	desc.cmd.pio_words[0] = readl(&regs->hw_lcdif_ctrl) | LCDIF_CTRL_RUN;
+	desc.cmd.next = (uint32_t)&desc.cmd;
+
+	/* Execute the DMA chain. */
+	mxs_dma_circ_start(MXS_DMA_CHANNEL_AHB_APBH_LCDIF, &desc);
+#endif
+
+	return 0;
+}
+
 void lcdif_power_down(void)
 {
 	struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE;
@@ -151,8 +182,9 @@ void lcdif_power_down(void)
 void *video_hw_init(void)
 {
 	int bpp = -1;
+	int ret = 0;
 	char *penv;
-	void *fb;
+	void *fb = NULL;
 	struct ctfb_res_modes mode;
 
 	puts("Video: ");
@@ -167,8 +199,7 @@ void *video_hw_init(void)
 	bpp = video_get_params(&mode, penv);
 
 	/* fill in Graphic device struct */
-	sprintf(panel.modeIdent, "%dx%dx%d",
-			mode.xres, mode.yres, bpp);
+	sprintf(panel.modeIdent, "%dx%dx%d", mode.xres, mode.yres, bpp);
 
 	panel.winSizeX = mode.xres;
 	panel.winSizeY = mode.yres;
@@ -211,31 +242,14 @@ void *video_hw_init(void)
 
 	printf("%s\n", panel.modeIdent);
 
-	/* Start framebuffer */
-	mxs_lcd_init(panel.frameAdrs, &mode, bpp);
-
-#ifdef CONFIG_VIDEO_MXS_MODE_SYSTEM
-	/*
-	 * If the LCD runs in system mode, the LCD refresh has to be triggered
-	 * manually by setting the RUN bit in HW_LCDIF_CTRL register. To avoid
-	 * having to set this bit manually after every single change in the
-	 * framebuffer memory, we set up specially crafted circular DMA, which
-	 * sets the RUN bit, then waits until it gets cleared and repeats this
-	 * infinitelly. This way, we get smooth continuous updates of the LCD.
-	 */
-	struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE;
+	ret = mxs_probe_common(&mode, bpp, fb);
+	if (ret)
+		goto dealloc_fb;
 
-	memset(&desc, 0, sizeof(struct mxs_dma_desc));
-	desc.address = (dma_addr_t)&desc;
-	desc.cmd.data = MXS_DMA_DESC_COMMAND_NO_DMAXFER | MXS_DMA_DESC_CHAIN |
-			MXS_DMA_DESC_WAIT4END |
-			(1 << MXS_DMA_DESC_PIO_WORDS_OFFSET);
-	desc.cmd.pio_words[0] = readl(&regs->hw_lcdif_ctrl) | LCDIF_CTRL_RUN;
-	desc.cmd.next = (uint32_t)&desc.cmd;
+	return (void *)&panel;
 
-	/* Execute the DMA chain. */
-	mxs_dma_circ_start(MXS_DMA_CHANNEL_AHB_APBH_LCDIF, &desc);
-#endif
+dealloc_fb:
+	free(fb);
 
-	return (void *)&panel;
+	return NULL;
 }
-- 
2.17.1

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

* [U-Boot] [RFC 4/6] video: mxsfb: add DM_VIDEO support
  2019-06-03 21:05 [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO Igor Opaniuk
                   ` (2 preceding siblings ...)
  2019-06-03 21:05 ` [U-Boot] [RFC 3/6] video: mxsfb: refactor video_hw_init() Igor Opaniuk
@ 2019-06-03 21:05 ` Igor Opaniuk
  2019-06-03 21:06 ` [U-Boot] [RFC 5/6] ARM: dts: colibri_imx7: Add lcdif node Igor Opaniuk
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Igor Opaniuk @ 2019-06-03 21:05 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

Extend the driver to build with DM_VIDEO enabled. DTS files
must additionally include 'u-boot,dm-pre-reloc' property in
soc and child nodes to enable driver binding to mxsfb device.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---
 arch/arm/mach-imx/cpu.c        |   2 +-
 arch/arm/mach-imx/mx7/soc.c    |   2 +-
 drivers/video/mxsfb.c          | 145 +++++++++++++++++++++++++++++++--
 include/configs/colibri_imx7.h |   2 +-
 4 files changed, 139 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index 6b83f92662..64a0670fcf 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -298,7 +298,7 @@ void arch_preboot_os(void)
 	/* disable video before launching O/S */
 	ipuv3_fb_shutdown();
 #endif
-#if defined(CONFIG_VIDEO_MXS)
+#if defined(CONFIG_VIDEO_MXS) && !defined(CONFIG_DM_VIDEO)
 	lcdif_power_down();
 #endif
 }
diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c
index 7cfdff0981..4a914fca5e 100644
--- a/arch/arm/mach-imx/mx7/soc.c
+++ b/arch/arm/mach-imx/mx7/soc.c
@@ -369,7 +369,7 @@ void s_init(void)
 void reset_misc(void)
 {
 #ifndef CONFIG_SPL_BUILD
-#ifdef CONFIG_VIDEO_MXS
+#if defined(CONFIG_VIDEO_MXS) && !defined(CONFIG_DM_VIDEO)
 	lcdif_power_down();
 #endif
 #endif
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 6e269409d6..f02ba20138 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -5,8 +5,10 @@
  * Copyright (C) 2011-2013 Marek Vasut <marex@denx.de>
  */
 #include <common.h>
+#include <dm.h>
 #include <linux/errno.h>
 #include <malloc.h>
+#include <video.h>
 #include <video_fb.h>
 
 #include <asm/arch/clock.h>
@@ -18,8 +20,11 @@
 #include "videomodes.h"
 
 #define	PS2KHZ(ps)	(1000000000UL / (ps))
+#define HZ2PS(hz)	(1000000000UL / ((hz) / 1000))
+
+#define BITS_PP		18
+#define BYTES_PP	4
 
-static GraphicDevice panel;
 struct mxs_dma_desc desc;
 
 /**
@@ -128,10 +133,10 @@ static void mxs_lcd_init(u32 fb_addr, struct ctfb_res_modes *mode, int bpp)
 	writel(LCDIF_CTRL_RUN, &regs->hw_lcdif_ctrl_set);
 }
 
-static int mxs_probe_common(struct ctfb_res_modes *mode, int bpp, void *fb)
+static int mxs_probe_common(struct ctfb_res_modes *mode, int bpp, u32 fb)
 {
 	/* Start framebuffer */
-	mxs_lcd_init((u32)fb, mode, bpp);
+	mxs_lcd_init(fb, mode, bpp);
 
 #ifdef CONFIG_VIDEO_MXS_MODE_SYSTEM
 	/*
@@ -159,16 +164,16 @@ static int mxs_probe_common(struct ctfb_res_modes *mode, int bpp, void *fb)
 	return 0;
 }
 
-void lcdif_power_down(void)
+static int mxs_remove_common(u32 fb)
 {
 	struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE;
 	int timeout = 1000000;
 
-	if (!panel.frameAdrs)
-		return;
+	if (!fb)
+		return -EINVAL;
 
-	writel(panel.frameAdrs, &regs->hw_lcdif_cur_buf_reg);
-	writel(panel.frameAdrs, &regs->hw_lcdif_next_buf_reg);
+	writel(fb, &regs->hw_lcdif_cur_buf_reg);
+	writel(fb, &regs->hw_lcdif_next_buf_reg);
 	writel(LCDIF_CTRL1_VSYNC_EDGE_IRQ, &regs->hw_lcdif_ctrl1_clr);
 	while (--timeout) {
 		if (readl(&regs->hw_lcdif_ctrl1_reg) &
@@ -177,6 +182,17 @@ void lcdif_power_down(void)
 		udelay(1);
 	}
 	mxs_reset_block((struct mxs_register_32 *)&regs->hw_lcdif_ctrl_reg);
+
+	return 0;
+}
+
+#ifndef CONFIG_DM_VIDEO
+
+static GraphicDevice panel;
+
+void lcdif_power_down(void)
+{
+	mxs_remove_common(panel.frameAdrs);
 }
 
 void *video_hw_init(void)
@@ -242,7 +258,7 @@ void *video_hw_init(void)
 
 	printf("%s\n", panel.modeIdent);
 
-	ret = mxs_probe_common(&mode, bpp, fb);
+	ret = mxs_probe_common(&mode, bpp, (u32)fb);
 	if (ret)
 		goto dealloc_fb;
 
@@ -253,3 +269,114 @@ dealloc_fb:
 
 	return NULL;
 }
+#else /* ifndef CONFIG_DM_VIDEO */
+
+static int mxs_video_probe(struct udevice *dev)
+{
+	struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
+	struct video_priv *uc_priv = dev_get_uclass_priv(dev);
+
+	struct ctfb_res_modes mode;
+	struct display_timing timings;
+	int bpp = -1;
+	u32 fb_start, fb_end;
+	int ret;
+
+	debug("%s() plat: base 0x%lx, size 0x%x\n",
+	       __func__, plat->base, plat->size);
+
+	ret = ofnode_decode_display_timing(dev_ofnode(dev), 0, &timings);
+	if (ret) {
+		dev_err(dev, "failed to get any display timings\n");
+		return -EINVAL;
+	}
+
+	mode.xres = timings.hactive.typ;
+	mode.yres = timings.vactive.typ;
+	mode.left_margin = timings.hback_porch.typ;
+	mode.right_margin = timings.hfront_porch.typ;
+	mode.upper_margin = timings.vback_porch.typ;
+	mode.lower_margin = timings.vfront_porch.typ;
+	mode.hsync_len = timings.hsync_len.typ;
+	mode.vsync_len = timings.vsync_len.typ;
+	mode.pixclock = HZ2PS(timings.pixelclock.typ);
+
+	bpp = BITS_PP;
+
+	ret = mxs_probe_common(&mode, bpp, plat->base);
+	if (ret)
+		return ret;
+
+	switch (bpp) {
+	case 24:
+	case 18:
+		uc_priv->bpix = VIDEO_BPP32;
+		break;
+	case 16:
+		uc_priv->bpix = VIDEO_BPP16;
+		break;
+	case 8:
+		uc_priv->bpix = VIDEO_BPP8;
+		break;
+	default:
+		dev_err(dev, "invalid bpp specified (bpp = %i)\n", bpp);
+		return -EINVAL;
+	}
+
+	uc_priv->xsize = mode.xres;
+	uc_priv->ysize = mode.yres;
+
+	/* Enable dcache for the frame buffer */
+	fb_start = plat->base & ~(MMU_SECTION_SIZE - 1);
+	fb_end = plat->base + plat->size;
+	fb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT);
+	mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start,
+					DCACHE_WRITEBACK);
+	video_set_flush_dcache(dev, true);
+
+	return ret;
+}
+
+static int mxs_video_bind(struct udevice *dev)
+{
+	struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
+	struct display_timing timings;
+	int ret;
+
+	ret = ofnode_decode_display_timing(dev_ofnode(dev), 0, &timings);
+	if (ret) {
+		dev_err(dev, "failed to get any display timings\n");
+		return -EINVAL;
+	}
+
+	plat->size = timings.hactive.typ * timings.vactive.typ * BYTES_PP;
+
+	return 0;
+}
+
+static int mxs_video_remove(struct udevice *dev)
+{
+	struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
+
+	mxs_remove_common(plat->base);
+
+	return 0;
+}
+
+static const struct udevice_id mxs_video_ids[] = {
+	{ .compatible = "fsl,imx23-lcdif" },
+	{ .compatible = "fsl,imx28-lcdif" },
+	{ .compatible = "fsl,imx7ulp-lcdif" },
+	{ /* sentinel */ }
+};
+
+U_BOOT_DRIVER(mxs_video) = {
+	.name	= "mxs_video",
+	.id	= UCLASS_VIDEO,
+	.of_match = mxs_video_ids,
+	.bind	= mxs_video_bind,
+	.probe	= mxs_video_probe,
+	.remove = mxs_video_remove,
+	.flags	= DM_FLAG_PRE_RELOC,
+};
+#endif /* ifndef CONFIG_DM_VIDEO */
diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h
index 7dfc92c085..c3b353b2c2 100644
--- a/include/configs/colibri_imx7.h
+++ b/include/configs/colibri_imx7.h
@@ -225,7 +225,7 @@
 #define CONFIG_SYS_DFU_DATA_BUF_SIZE	SZ_16M
 #define DFU_DEFAULT_POLL_TIMEOUT	300
 
-#ifdef CONFIG_VIDEO
+#if defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
 #define CONFIG_VIDEO_MXS
 #define CONFIG_VIDEO_LOGO
 #define CONFIG_SPLASH_SCREEN
-- 
2.17.1

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

* [U-Boot] [RFC 5/6] ARM: dts: colibri_imx7: Add lcdif node
  2019-06-03 21:05 [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO Igor Opaniuk
                   ` (3 preceding siblings ...)
  2019-06-03 21:05 ` [U-Boot] [RFC 4/6] video: mxsfb: add DM_VIDEO support Igor Opaniuk
@ 2019-06-03 21:06 ` Igor Opaniuk
  2019-06-04 22:06   ` Fabio Estevam
  2019-06-03 21:06 ` [U-Boot] [RFC 6/6] colibri_imx7_emmc: enable DM_VIDEO Igor Opaniuk
  2019-06-04 21:38 ` [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO Anatolij Gustschin
  6 siblings, 1 reply; 11+ messages in thread
From: Igor Opaniuk @ 2019-06-03 21:06 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

Extend lcdif DT node with proper display-timings for mxsfb driver.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---
 arch/arm/dts/imx7-colibri-emmc.dts |  2 ++
 arch/arm/dts/imx7-colibri.dtsi     | 28 ++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/arch/arm/dts/imx7-colibri-emmc.dts b/arch/arm/dts/imx7-colibri-emmc.dts
index efd600091d..8db2a62707 100644
--- a/arch/arm/dts/imx7-colibri-emmc.dts
+++ b/arch/arm/dts/imx7-colibri-emmc.dts
@@ -11,8 +11,10 @@
 	compatible = "toradex,imx7d-colibri-emmc", "fsl,imx7d";
 
 	aliases {
+		u-boot,dm-pre-reloc;
 		mmc0 = &usdhc3;
 		mmc1 = &usdhc1;
+		display1 = &lcdif;
 	};
 
 	chosen {
diff --git a/arch/arm/dts/imx7-colibri.dtsi b/arch/arm/dts/imx7-colibri.dtsi
index a85702f519..81717c233d 100644
--- a/arch/arm/dts/imx7-colibri.dtsi
+++ b/arch/arm/dts/imx7-colibri.dtsi
@@ -111,3 +111,31 @@
 		>;
 	};
 };
+
+&lcdif {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+
+	display-timings {
+		native-mode = <&timing_vga>;
+
+		/* Standard VGA timing */
+		timing_vga: 640x480 {
+			u-boot,dm-pre-reloc;
+			clock-frequency = <25175000>;
+			hactive = <640>;
+			vactive = <480>;
+			hback-porch = <48>;
+			hfront-porch = <16>;
+			vback-porch = <33>;
+			vfront-porch = <10>;
+			hsync-len = <96>;
+			vsync-len = <2>;
+
+			de-active = <1>;
+			hsync-active = <0>;
+			vsync-active = <0>;
+			pixelclk-active = <0>;
+		};
+	};
+};
-- 
2.17.1

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

* [U-Boot] [RFC 6/6] colibri_imx7_emmc: enable DM_VIDEO
  2019-06-03 21:05 [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO Igor Opaniuk
                   ` (4 preceding siblings ...)
  2019-06-03 21:06 ` [U-Boot] [RFC 5/6] ARM: dts: colibri_imx7: Add lcdif node Igor Opaniuk
@ 2019-06-03 21:06 ` Igor Opaniuk
  2019-06-04 21:38 ` [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO Anatolij Gustschin
  6 siblings, 0 replies; 11+ messages in thread
From: Igor Opaniuk @ 2019-06-03 21:06 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

Enable DM_VIDEO for Colibri iMX7 eMMC version.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---
 configs/colibri_imx7_emmc_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/colibri_imx7_emmc_defconfig b/configs/colibri_imx7_emmc_defconfig
index f35cabaed6..392d4ab8d0 100644
--- a/configs/colibri_imx7_emmc_defconfig
+++ b/configs/colibri_imx7_emmc_defconfig
@@ -63,6 +63,6 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b67
 CONFIG_USB_GADGET_PRODUCT_NUM=0x4000
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
-CONFIG_VIDEO=y
+CONFIG_DM_VIDEO=y
 CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.17.1

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

* [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO
  2019-06-03 21:05 [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO Igor Opaniuk
                   ` (5 preceding siblings ...)
  2019-06-03 21:06 ` [U-Boot] [RFC 6/6] colibri_imx7_emmc: enable DM_VIDEO Igor Opaniuk
@ 2019-06-04 21:38 ` Anatolij Gustschin
  6 siblings, 0 replies; 11+ messages in thread
From: Anatolij Gustschin @ 2019-06-04 21:38 UTC (permalink / raw)
  To: u-boot

On Tue,  4 Jun 2019 00:05:55 +0300
Igor Opaniuk igor.opaniuk at gmail.com wrote:
...
> Igor Opaniuk (6):
>   video: mxsfb: change mxs_lcd_init signature
>   video: mxsfb: reorder includes
>   video: mxsfb: refactor video_hw_init()
>   video: mxsfb: add DM_VIDEO support
>   ARM: dts: colibri_imx7: Add lcdif node
>   colibri_imx7_emmc: enable DM_VIDEO
> 
>  arch/arm/dts/imx7-colibri-emmc.dts  |   2 +
>  arch/arm/dts/imx7-colibri.dtsi      |  28 ++++
>  arch/arm/mach-imx/cpu.c             |   2 +-
>  arch/arm/mach-imx/mx7/soc.c         |   2 +-
>  configs/colibri_imx7_emmc_defconfig |   2 +-
>  drivers/video/mxsfb.c               | 219 +++++++++++++++++++++++-----
>  include/configs/colibri_imx7.h      |   2 +-
>  7 files changed, 213 insertions(+), 44 deletions(-)

Series applied to u-boot-video/master, thanks!

--
Anatolij

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

* [U-Boot] [RFC 5/6] ARM: dts: colibri_imx7: Add lcdif node
  2019-06-03 21:06 ` [U-Boot] [RFC 5/6] ARM: dts: colibri_imx7: Add lcdif node Igor Opaniuk
@ 2019-06-04 22:06   ` Fabio Estevam
  2019-06-05 13:29     ` Igor Opaniuk
  0 siblings, 1 reply; 11+ messages in thread
From: Fabio Estevam @ 2019-06-04 22:06 UTC (permalink / raw)
  To: u-boot

Hi Igor,

On Mon, Jun 3, 2019 at 6:06 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote:

> +&lcdif {
> +       u-boot,dm-pre-reloc;
> +       status = "okay";
> +
> +       display-timings {
> +               native-mode = <&timing_vga>;
> +
> +               /* Standard VGA timing */
> +               timing_vga: 640x480 {
> +                       u-boot,dm-pre-reloc;
> +                       clock-frequency = <25175000>;
> +                       hactive = <640>;
> +                       vactive = <480>;
> +                       hback-porch = <48>;
> +                       hfront-porch = <16>;
> +                       vback-porch = <33>;
> +                       vfront-porch = <10>;
> +                       hsync-len = <96>;
> +                       vsync-len = <2>;
> +
> +                       de-active = <1>;
> +                       hsync-active = <0>;
> +                       vsync-active = <0>;
> +                       pixelclk-active = <0>

This is the deprecated style mxsfb fbdev binding.

In the kernel we no longer use this style as documented in
Documentation/devicetree/bindings/display/mxsfb.txt

If we follow this route in U-Boot then we will diverge from the kernel
recommended bindings.

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

* [U-Boot] [RFC 5/6] ARM: dts: colibri_imx7: Add lcdif node
  2019-06-04 22:06   ` Fabio Estevam
@ 2019-06-05 13:29     ` Igor Opaniuk
  2019-06-05 13:55       ` Igor Opaniuk
  0 siblings, 1 reply; 11+ messages in thread
From: Igor Opaniuk @ 2019-06-05 13:29 UTC (permalink / raw)
  To: u-boot

Hi Fabio,

On Wed, Jun 5, 2019 at 1:06 AM Fabio Estevam <festevam@gmail.com> wrote:
>
> Hi Igor,
>
> On Mon, Jun 3, 2019 at 6:06 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote:
>
> > +&lcdif {
> > +       u-boot,dm-pre-reloc;
> > +       status = "okay";
> > +
> > +       display-timings {
> > +               native-mode = <&timing_vga>;
> > +
> > +               /* Standard VGA timing */
> > +               timing_vga: 640x480 {
> > +                       u-boot,dm-pre-reloc;
> > +                       clock-frequency = <25175000>;
> > +                       hactive = <640>;
> > +                       vactive = <480>;
> > +                       hback-porch = <48>;
> > +                       hfront-porch = <16>;
> > +                       vback-porch = <33>;
> > +                       vfront-porch = <10>;
> > +                       hsync-len = <96>;
> > +                       vsync-len = <2>;
> > +
> > +                       de-active = <1>;
> > +                       hsync-active = <0>;
> > +                       vsync-active = <0>;
> > +                       pixelclk-active = <0>
>
> This is the deprecated style mxsfb fbdev binding.
>
> In the kernel we no longer use this style as documented in
> Documentation/devicetree/bindings/display/mxsfb.txt
>
> If we follow this route in U-Boot then we will diverge from the kernel
> recommended bindings.

Initially I copy-pasted the whole DT node "as it is" from the linux
kernel dts, but found out that existing
DT wrapper for parsing display timings
(ofnode_decode_display_timing())) isn't able to parse it properly,
so I just changed it to conform the same structure as similar nodes in
other DTS files.

Thanks for letting me know, probably ofnode_decode_display_timing()
implementation should
be adjusted as well.

Regards,
Igor



-- 
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk

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

* [U-Boot] [RFC 5/6] ARM: dts: colibri_imx7: Add lcdif node
  2019-06-05 13:29     ` Igor Opaniuk
@ 2019-06-05 13:55       ` Igor Opaniuk
  0 siblings, 0 replies; 11+ messages in thread
From: Igor Opaniuk @ 2019-06-05 13:55 UTC (permalink / raw)
  To: u-boot

Hi Fabio,

On Wed, Jun 5, 2019 at 4:29 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote:
>
> Hi Fabio,
>
> On Wed, Jun 5, 2019 at 1:06 AM Fabio Estevam <festevam@gmail.com> wrote:
> >
> > Hi Igor,
> >
> > On Mon, Jun 3, 2019 at 6:06 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote:
> >
> > > +&lcdif {
> > > +       u-boot,dm-pre-reloc;
> > > +       status = "okay";
> > > +
> > > +       display-timings {
> > > +               native-mode = <&timing_vga>;
> > > +
> > > +               /* Standard VGA timing */
> > > +               timing_vga: 640x480 {
> > > +                       u-boot,dm-pre-reloc;
> > > +                       clock-frequency = <25175000>;
> > > +                       hactive = <640>;
> > > +                       vactive = <480>;
> > > +                       hback-porch = <48>;
> > > +                       hfront-porch = <16>;
> > > +                       vback-porch = <33>;
> > > +                       vfront-porch = <10>;
> > > +                       hsync-len = <96>;
> > > +                       vsync-len = <2>;
> > > +
> > > +                       de-active = <1>;
> > > +                       hsync-active = <0>;
> > > +                       vsync-active = <0>;
> > > +                       pixelclk-active = <0>
> >
> > This is the deprecated style mxsfb fbdev binding.
> >
> > In the kernel we no longer use this style as documented in
> > Documentation/devicetree/bindings/display/mxsfb.txt
> >
> > If we follow this route in U-Boot then we will diverge from the kernel
> > recommended bindings.
>
> Initially I copy-pasted the whole DT node "as it is" from the linux
> kernel dts, but found out that existing
> DT wrapper for parsing display timings
> (ofnode_decode_display_timing())) isn't able to parse it properly,
> so I just changed it to conform the same structure as similar nodes in
> other DTS files.
>
> Thanks for letting me know, probably ofnode_decode_display_timing()
> implementation should
> be adjusted as well.

Nevermind, I've double-checked ofnode_decode_display_timing()
implementation and all instances of display-timings nodes,
it definitely should be able parse the same structure as defined in
the Linux devicetree bindings.

Probably I just messed up with something.

> Regards,
> Igor
>
>
>
> --
> Best regards - Freundliche Grüsse - Meilleures salutations
>
> Igor Opaniuk
>
> mailto: igor.opaniuk at gmail.com
> skype: igor.opanyuk
> +380 (93) 836 40 67
> http://ua.linkedin.com/in/iopaniuk



-- 
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk

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

end of thread, other threads:[~2019-06-05 13:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-03 21:05 [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO Igor Opaniuk
2019-06-03 21:05 ` [U-Boot] [RFC 1/6] video: mxsfb: change mxs_lcd_init signature Igor Opaniuk
2019-06-03 21:05 ` [U-Boot] [RFC 2/6] video: mxsfb: reorder includes Igor Opaniuk
2019-06-03 21:05 ` [U-Boot] [RFC 3/6] video: mxsfb: refactor video_hw_init() Igor Opaniuk
2019-06-03 21:05 ` [U-Boot] [RFC 4/6] video: mxsfb: add DM_VIDEO support Igor Opaniuk
2019-06-03 21:06 ` [U-Boot] [RFC 5/6] ARM: dts: colibri_imx7: Add lcdif node Igor Opaniuk
2019-06-04 22:06   ` Fabio Estevam
2019-06-05 13:29     ` Igor Opaniuk
2019-06-05 13:55       ` Igor Opaniuk
2019-06-03 21:06 ` [U-Boot] [RFC 6/6] colibri_imx7_emmc: enable DM_VIDEO Igor Opaniuk
2019-06-04 21:38 ` [U-Boot] [RFC 0/6] Convert mxsfb to DM_VIDEO Anatolij Gustschin

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.