public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif
@ 2015-10-29  7:54 Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 01/16] mxs: add parameter base_addr for mxs_set_lcdclk Peng Fan
                   ` (14 more replies)
  0 siblings, 15 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

Changes v3:
 1. Split patches into small ones.
 2. unified to use lcd base addr, but not interface index.
 3. Drop if (is_cpu_type(MXC_CPU_MX6UL)) for lcdif_power_down

Changes v2:
 1. Rebased on Latest U-Boot
 2. Add i.MX7 LCDIF support

This patch set is to introduce lcdif support for i.MX6/7.
Patchset tested on mx6ul_14x14/9x9_evk and mx7dsabresd boards.

[patch V2 2/14] not posted in V3, please see:
http://lists.denx.de/pipermail/u-boot/2015-October/230812.html


Peng Fan (16):
  mxs: add parameter base_addr for mxs_set_lcdclk
  sandisk: sfp: correct function name
  xfi3: correct function name
  mxs: regs-common.h must be wrapped with !__ASSEMBLY__
  imx: include linux/types.h for regs-common.h
  imx: imx-common: move lcdif structure and macro definition to
    imx-common
  imx: lcdif: use one register structure for i.MXes
  imx: mx6: fix register address
  imx: mx6: crm_reg: add LCDIF related macros
  imx: mx6: add clock api for lcdif
  imx: mx6ul_14x14_evk: support lcdif display
  video: mxsfb: introduce lcdif_power_down
  imx: mx6: implement reset_misc
  imx: imx-common: power down lcdif before boot os
  imx: mx7: compile misc.c for mx7
  imx: mx7dsabresd: support lcdif

 arch/arm/cpu/arm926ejs/mxs/clock.c                 |   2 +-
 arch/arm/cpu/armv7/mx6/clock.c                     | 245 +++++++++++++++++++++
 arch/arm/cpu/armv7/mx6/soc.c                       |   7 +
 arch/arm/imx-common/Makefile                       |   2 +-
 arch/arm/imx-common/cpu.c                          |   3 +
 arch/arm/include/asm/arch-mx6/clock.h              |   2 +
 arch/arm/include/asm/arch-mx6/crm_regs.h           |  34 ++-
 arch/arm/include/asm/arch-mx6/imx-regs.h           |  18 +-
 arch/arm/include/asm/arch-mx7/imx-regs.h           |  96 +-------
 arch/arm/include/asm/arch-mxs/clock.h              |   2 +-
 arch/arm/include/asm/arch-mxs/imx-regs.h           |   2 +-
 arch/arm/include/asm/imx-common/regs-common.h      |   2 +
 .../asm/{arch-mxs => imx-common}/regs-lcdif.h      |  30 ++-
 arch/arm/include/asm/imx-common/sys_proto.h        |   2 +
 board/creative/xfi3/xfi3.c                         |   2 +-
 board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c  |  63 ++++++
 board/freescale/mx7dsabresd/mx7dsabresd.c          |  64 ++++++
 board/sandisk/sansa_fuze_plus/sfp.c                |   2 +-
 drivers/video/mxsfb.c                              |  19 +-
 include/configs/mx6ul_14x14_evk.h                  |  18 ++
 include/configs/mx7dsabresd.h                      |  17 ++
 21 files changed, 512 insertions(+), 120 deletions(-)
 rename arch/arm/include/asm/{arch-mxs => imx-common}/regs-lcdif.h (92%)

-- 
1.8.4

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

* [U-Boot] [PATCH V3 01/16] mxs: add parameter base_addr for mxs_set_lcdclk
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-11-05  7:34   ` Anatolij Gustschin
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 03/16] xfi3: correct function name Peng Fan
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

Change mxs_set_lcdclk prototype to add a new parameter
base_addr. There are two LCD interfaces for i.MX6SX,
we may support LCDIF1 or LCDIF2.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
---

V3:
 Add __maybe_unused attribute

V2:
 none

 arch/arm/cpu/arm926ejs/mxs/clock.c    | 2 +-
 arch/arm/include/asm/arch-mxs/clock.h | 2 +-
 drivers/video/mxsfb.c                 | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mxs/clock.c b/arch/arm/cpu/arm926ejs/mxs/clock.c
index e9d8800..9491096 100644
--- a/arch/arm/cpu/arm926ejs/mxs/clock.c
+++ b/arch/arm/cpu/arm926ejs/mxs/clock.c
@@ -309,7 +309,7 @@ void mxs_set_ssp_busclock(unsigned int bus, uint32_t freq)
 		bus, tgtclk, freq);
 }
 
-void mxs_set_lcdclk(uint32_t freq)
+void mxs_set_lcdclk(uint32_t __maybe_unused lcd_base, uint32_t freq)
 {
 	struct mxs_clkctrl_regs *clkctrl_regs =
 		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;
diff --git a/arch/arm/include/asm/arch-mxs/clock.h b/arch/arm/include/asm/arch-mxs/clock.h
index fc9d75b..fdc5395 100644
--- a/arch/arm/include/asm/arch-mxs/clock.h
+++ b/arch/arm/include/asm/arch-mxs/clock.h
@@ -46,7 +46,7 @@ uint32_t mxc_get_clock(enum mxc_clock clk);
 void mxs_set_ioclk(enum mxs_ioclock io, uint32_t freq);
 void mxs_set_sspclk(enum mxs_sspclock ssp, uint32_t freq, int xtal);
 void mxs_set_ssp_busclock(unsigned int bus, uint32_t freq);
-void mxs_set_lcdclk(uint32_t freq);
+void mxs_set_lcdclk(uint32_t __maybe_unused lcd_base, uint32_t freq);
 
 /* Compatibility with the FEC Ethernet driver */
 #define	imx_get_fecclk()	mxc_get_clock(MXC_AHB_CLK)
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 03b0f88..eed57d5 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -55,7 +55,7 @@ static void mxs_lcd_init(GraphicDevice *panel,
 	uint8_t valid_data = 0;
 
 	/* Kick in the LCDIF clock */
-	mxs_set_lcdclk(PS2KHZ(mode->pixclock));
+	mxs_set_lcdclk(MXS_LCDIF_BASE, PS2KHZ(mode->pixclock));
 
 	/* Restart the LCDIF block */
 	mxs_reset_block(&regs->hw_lcdif_ctrl_reg);
-- 
1.8.4

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

* [U-Boot] [PATCH V3 03/16] xfi3: correct function name
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 01/16] mxs: add parameter base_addr for mxs_set_lcdclk Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 04/16] mxs: regs-common.h must be wrapped with !__ASSEMBLY__ Peng Fan
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

board_mxsfb_system_setup must be renamed mxsfb_system_setup.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
---

Changes v3:
 fix typo in commit info.

Changes v2:
 none

 board/creative/xfi3/xfi3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/creative/xfi3/xfi3.c b/board/creative/xfi3/xfi3.c
index 1d83ea8..509c671 100644
--- a/board/creative/xfi3/xfi3.c
+++ b/board/creative/xfi3/xfi3.c
@@ -163,7 +163,7 @@ static const struct {
 	{ 0x21, 0,  0x0000 },
 };
 
-void board_mxsfb_system_setup(void)
+void mxsfb_system_setup(void)
 {
 	struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE;
 	int i;
-- 
1.8.4

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

* [U-Boot] [PATCH V3 04/16] mxs: regs-common.h must be wrapped with !__ASSEMBLY__
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 01/16] mxs: add parameter base_addr for mxs_set_lcdclk Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 03/16] xfi3: correct function name Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 05/16] imx: include linux/types.h for regs-common.h Peng Fan
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

regs-common.h must be wrapped with #ifndef __ASSEMBLY__

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
---

Changes v3:
 new patch

 arch/arm/include/asm/arch-mxs/regs-lcdif.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-mxs/regs-lcdif.h b/arch/arm/include/asm/arch-mxs/regs-lcdif.h
index 8915d84..fff6379 100644
--- a/arch/arm/include/asm/arch-mxs/regs-lcdif.h
+++ b/arch/arm/include/asm/arch-mxs/regs-lcdif.h
@@ -13,9 +13,9 @@
 #ifndef __MX28_REGS_LCDIF_H__
 #define __MX28_REGS_LCDIF_H__
 
+#ifndef	__ASSEMBLY__
 #include <asm/imx-common/regs-common.h>
 
-#ifndef	__ASSEMBLY__
 struct mxs_lcdif_regs {
 	mxs_reg_32(hw_lcdif_ctrl)		/* 0x00 */
 	mxs_reg_32(hw_lcdif_ctrl1)		/* 0x10 */
-- 
1.8.4

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

* [U-Boot] [PATCH V3 05/16] imx: include linux/types.h for regs-common.h
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (2 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 04/16] mxs: regs-common.h must be wrapped with !__ASSEMBLY__ Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 06/16] imx: imx-common: move lcdif structure and macro definition to imx-common Peng Fan
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

There are uint8_t, uint32_t types in regs-common.h, so include
linux/types.h.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
---

Changes v3:
 new patch

 arch/arm/include/asm/imx-common/regs-common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/include/asm/imx-common/regs-common.h b/arch/arm/include/asm/imx-common/regs-common.h
index e54a220..7382674 100644
--- a/arch/arm/include/asm/imx-common/regs-common.h
+++ b/arch/arm/include/asm/imx-common/regs-common.h
@@ -10,6 +10,8 @@
 #ifndef __MXS_REGS_COMMON_H__
 #define __MXS_REGS_COMMON_H__
 
+#include <linux/types.h>
+
 /*
  * The i.MXS has interesting feature when it comes to register access. There
  * are four kinds of access to one particular register. Those are:
-- 
1.8.4

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

* [U-Boot] [PATCH V3 06/16] imx: imx-common: move lcdif structure and macro definition to imx-common
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (3 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 05/16] imx: include linux/types.h for regs-common.h Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 07/16] imx: lcdif: use one register structure for i.MXes Peng Fan
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

Move 'struct mxs_lcdif_regs' and lcdif related macro definitions to
arch/arm/include/asm/imx-common/regs-lcdif.h.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
---

Changes v3:
 Split [patch V2 4/14] into two parts, this is the first one, just
 move files.
Changes v2:
 none

 arch/arm/include/asm/arch-mxs/imx-regs.h                   | 2 +-
 arch/arm/include/asm/{arch-mxs => imx-common}/regs-lcdif.h | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename arch/arm/include/asm/{arch-mxs => imx-common}/regs-lcdif.h (100%)

diff --git a/arch/arm/include/asm/arch-mxs/imx-regs.h b/arch/arm/include/asm/arch-mxs/imx-regs.h
index 86914ef..8872438 100644
--- a/arch/arm/include/asm/arch-mxs/imx-regs.h
+++ b/arch/arm/include/asm/arch-mxs/imx-regs.h
@@ -15,8 +15,8 @@
 #include <asm/imx-common/regs-bch.h>
 #include <asm/arch/regs-digctl.h>
 #include <asm/imx-common/regs-gpmi.h>
+#include <asm/imx-common/regs-lcdif.h>
 #include <asm/arch/regs-i2c.h>
-#include <asm/arch/regs-lcdif.h>
 #include <asm/arch/regs-lradc.h>
 #include <asm/arch/regs-ocotp.h>
 #include <asm/arch/regs-pinctrl.h>
diff --git a/arch/arm/include/asm/arch-mxs/regs-lcdif.h b/arch/arm/include/asm/imx-common/regs-lcdif.h
similarity index 100%
rename from arch/arm/include/asm/arch-mxs/regs-lcdif.h
rename to arch/arm/include/asm/imx-common/regs-lcdif.h
-- 
1.8.4

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

* [U-Boot] [PATCH V3 07/16] imx: lcdif: use one register structure for i.MXes
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (4 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 06/16] imx: imx-common: move lcdif structure and macro definition to imx-common Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 08/16] imx: mx6: fix register address Peng Fan
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

Share one lcdif structure for i.MXes.
1. Discard struct mxs_lcdif_regs from imx-regs.h of i.MX7
2. Add i.MX6SX/6UL/7D support in imx-lcdif.h of imx-common

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
---

Changes v3:
 Split [patch v2 4/14], this is the second part, only contains neccessary
 changes to support i.MX6/7. Also merge [patch v2 13/14] into this patch.

Changes v2:
 none

 arch/arm/include/asm/arch-mx7/imx-regs.h     | 96 +---------------------------
 arch/arm/include/asm/imx-common/regs-lcdif.h | 28 ++++++--
 2 files changed, 22 insertions(+), 102 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx7/imx-regs.h b/arch/arm/include/asm/arch-mx7/imx-regs.h
index 4dc11ee..5851e12 100644
--- a/arch/arm/include/asm/arch-mx7/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx7/imx-regs.h
@@ -217,6 +217,7 @@
 #define SNVS_LPGPR	0x68
 
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
+#include <asm/imx-common/regs-lcdif.h>
 #include <asm/types.h>
 
 extern void imx_get_mac_from_fuse(int dev_id, unsigned char *mac);
@@ -1029,101 +1030,6 @@ struct rdc_sema_regs {
 	u16	rstgt;		/* Reset Gate */
 };
 
-/* eLCDIF controller registers */
-struct mxs_lcdif_regs {
-	u32	hw_lcdif_ctrl;			/* 0x00 */
-	u32	hw_lcdif_ctrl_set;
-	u32	hw_lcdif_ctrl_clr;
-	u32	hw_lcdif_ctrl_tog;
-	u32	hw_lcdif_ctrl1;			/* 0x10 */
-	u32	hw_lcdif_ctrl1_set;
-	u32	hw_lcdif_ctrl1_clr;
-	u32	hw_lcdif_ctrl1_tog;
-	u32	hw_lcdif_ctrl2;			/* 0x20 */
-	u32	hw_lcdif_ctrl2_set;
-	u32	hw_lcdif_ctrl2_clr;
-	u32	hw_lcdif_ctrl2_tog;
-	u32	hw_lcdif_transfer_count;	/* 0x30 */
-	u32	reserved1[3];
-	u32	hw_lcdif_cur_buf;		/* 0x40 */
-	u32	reserved2[3];
-	u32	hw_lcdif_next_buf;		/* 0x50 */
-	u32	reserved3[3];
-	u32	hw_lcdif_timing;		/* 0x60 */
-	u32	reserved4[3];
-	u32	hw_lcdif_vdctrl0;		/* 0x70 */
-	u32	hw_lcdif_vdctrl0_set;
-	u32	hw_lcdif_vdctrl0_clr;
-	u32	hw_lcdif_vdctrl0_tog;
-	u32	hw_lcdif_vdctrl1;		/* 0x80 */
-	u32	reserved5[3];
-	u32	hw_lcdif_vdctrl2;		/* 0x90 */
-	u32	reserved6[3];
-	u32	hw_lcdif_vdctrl3;		/* 0xa0 */
-	u32	reserved7[3];
-	u32	hw_lcdif_vdctrl4;		/* 0xb0 */
-	u32	reserved8[3];
-	u32	hw_lcdif_dvictrl0;		/* 0xc0 */
-	u32	reserved9[3];
-	u32	hw_lcdif_dvictrl1;		/* 0xd0 */
-	u32	reserved10[3];
-	u32	hw_lcdif_dvictrl2;		/* 0xe0 */
-	u32	reserved11[3];
-	u32	hw_lcdif_dvictrl3;		/* 0xf0 */
-	u32	reserved12[3];
-	u32	hw_lcdif_dvictrl4;		/* 0x100 */
-	u32	reserved13[3];
-	u32	hw_lcdif_csc_coeffctrl0;	/* 0x110 */
-	u32	reserved14[3];
-	u32	hw_lcdif_csc_coeffctrl1;	/* 0x120 */
-	u32	reserved15[3];
-	u32	hw_lcdif_csc_coeffctrl2;	/* 0x130 */
-	u32	reserved16[3];
-	u32	hw_lcdif_csc_coeffctrl3;	/* 0x140 */
-	u32	reserved17[3];
-	u32	hw_lcdif_csc_coeffctrl4;	/* 0x150 */
-	u32	reserved18[3];
-	u32	hw_lcdif_csc_offset;	/* 0x160 */
-	u32	reserved19[3];
-	u32	hw_lcdif_csc_limit;		/* 0x170 */
-	u32	reserved20[3];
-	u32	hw_lcdif_data;			/* 0x180 */
-	u32	reserved21[3];
-	u32	hw_lcdif_bm_error_stat;	/* 0x190 */
-	u32	reserved22[3];
-	u32	hw_lcdif_crc_stat;		/* 0x1a0 */
-	u32	reserved23[3];
-	u32	hw_lcdif_lcdif_stat;	/* 0x1b0 */
-	u32	reserved24[3];
-	u32	hw_lcdif_version;		/* 0x1c0 */
-	u32	reserved25[3];
-	u32	hw_lcdif_debug0;		/* 0x1d0 */
-	u32	reserved26[3];
-	u32	hw_lcdif_debug1;		/* 0x1e0 */
-	u32	reserved27[3];
-	u32	hw_lcdif_debug2;		/* 0x1f0 */
-	u32	reserved28[3];
-	u32	hw_lcdif_thres;			/* 0x200 */
-	u32	reserved29[3];
-	u32	hw_lcdif_as_ctrl;		/* 0x210 */
-	u32	reserved30[3];
-	u32	hw_lcdif_as_buf;		/* 0x220 */
-	u32	reserved31[3];
-	u32	hw_lcdif_as_next_buf;	/* 0x230 */
-	u32	reserved32[3];
-	u32	hw_lcdif_as_clrkeylow;	/* 0x240 */
-	u32	reserved33[3];
-	u32	hw_lcdif_as_clrkeyhigh;	/* 0x250 */
-	u32	reserved34[3];
-	u32	hw_lcdif_as_sync_delay;	/* 0x260 */
-	u32	reserved35[3];
-	u32	hw_lcdif_as_debug3;		/* 0x270 */
-	u32	reserved36[3];
-	u32	hw_lcdif_as_debug4;		/* 0x280 */
-	u32	reserved37[3];
-	u32	hw_lcdif_as_debug5;		/* 0x290 */
-};
-
 #define MXS_LCDIF_BASE ELCDIF1_IPS_BASE_ADDR
 
 #define	LCDIF_CTRL_SFTRST					(1 << 31)
diff --git a/arch/arm/include/asm/imx-common/regs-lcdif.h b/arch/arm/include/asm/imx-common/regs-lcdif.h
index fff6379..5a4f61f 100644
--- a/arch/arm/include/asm/imx-common/regs-lcdif.h
+++ b/arch/arm/include/asm/imx-common/regs-lcdif.h
@@ -1,5 +1,5 @@
 /*
- * Freescale i.MX28 LCDIF Register Definitions
+ * Freescale i.MX28/6SX/6UL/7D LCDIF Register Definitions
  *
  * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
  * on behalf of DENX Software Engineering GmbH
@@ -10,8 +10,8 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-#ifndef __MX28_REGS_LCDIF_H__
-#define __MX28_REGS_LCDIF_H__
+#ifndef __IMX_REGS_LCDIF_H__
+#define __IMX_REGS_LCDIF_H__
 
 #ifndef	__ASSEMBLY__
 #include <asm/imx-common/regs-common.h>
@@ -19,7 +19,8 @@
 struct mxs_lcdif_regs {
 	mxs_reg_32(hw_lcdif_ctrl)		/* 0x00 */
 	mxs_reg_32(hw_lcdif_ctrl1)		/* 0x10 */
-#if defined(CONFIG_MX28)
+#if defined(CONFIG_MX28) || defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || \
+	defined(CONFIG_MX7)
 	mxs_reg_32(hw_lcdif_ctrl2)		/* 0x20 */
 #endif
 	mxs_reg_32(hw_lcdif_transfer_count)	/* 0x20/0x30 */
@@ -54,7 +55,8 @@ struct mxs_lcdif_regs {
 #endif
 	mxs_reg_32(hw_lcdif_data)		/* 0x1b0/0x180 */
 	mxs_reg_32(hw_lcdif_bm_error_stat)	/* 0x1c0/0x190 */
-#if defined(CONFIG_MX28)
+#if defined(CONFIG_MX28) || defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || \
+	defined(CONFIG_MX7)
 	mxs_reg_32(hw_lcdif_crc_stat)		/* 0x1a0 */
 #endif
 	mxs_reg_32(hw_lcdif_lcdif_stat)		/* 0x1d0/0x1b0 */
@@ -62,6 +64,18 @@ struct mxs_lcdif_regs {
 	mxs_reg_32(hw_lcdif_debug0)		/* 0x1f0/0x1d0 */
 	mxs_reg_32(hw_lcdif_debug1)		/* 0x200/0x1e0 */
 	mxs_reg_32(hw_lcdif_debug2)		/* 0x1f0 */
+#if defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || defined(CONFIG_MX7)
+	mxs_reg_32(hw_lcdif_thres)
+	mxs_reg_32(hw_lcdif_as_ctrl)
+	mxs_reg_32(hw_lcdif_as_buf)
+	mxs_reg_32(hw_lcdif_as_next_buf)
+	mxs_reg_32(hw_lcdif_as_clrkeylow)
+	mxs_reg_32(hw_lcdif_as_clrkeyhigh)
+	mxs_reg_32(hw_lcdif_as_sync_delay)
+	mxs_reg_32(hw_lcdif_as_debug3)
+	mxs_reg_32(hw_lcdif_as_debug4)
+	mxs_reg_32(hw_lcdif_as_debug5)
+#endif
 };
 #endif
 
@@ -194,7 +208,7 @@ struct mxs_lcdif_regs {
 #if defined(CONFIG_MX23)
 #define	LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_MASK			(0xff << 24)
 #define	LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_OFFSET			24
-#elif defined(CONFIG_MX28)
+#else
 #define	LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_MASK			(0x3fff << 18)
 #define	LCDIF_VDCTRL2_HSYNC_PULSE_WIDTH_OFFSET			18
 #endif
@@ -214,4 +228,4 @@ struct mxs_lcdif_regs {
 #define	LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT_MASK		0x3ffff
 #define	LCDIF_VDCTRL4_DOTCLK_H_VALID_DATA_CNT_OFFSET		0
 
-#endif /* __MX28_REGS_LCDIF_H__ */
+#endif /* __IMX_REGS_LCDIF_H__ */
-- 
1.8.4

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

* [U-Boot] [PATCH V3 08/16] imx: mx6: fix register address
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (5 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 07/16] imx: lcdif: use one register structure for i.MXes Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 09/16] imx: mx6: crm_reg: add LCDIF related macros Peng Fan
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

1. Move WDOG3_BASE_ADDR to '#if !(defined(__ASSEMBLY__))'.
2. Add i.MX6UL LCDIF register base address. And Introduce
   LCDIF1_BASE_ADDR to support runtime check.
3. include <asm/imx-common/regs-lcdif.h> for imx-regs.h to avoid
   building error for mxsfb.c, since mxsfb.c use imx-regs.h.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
---

V3:
 none

V2:
 none

 arch/arm/include/asm/arch-mx6/imx-regs.h | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 74512ac..611e639 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -264,6 +264,7 @@
 #define CSU_BASE_ADDR               (AIPS2_OFF_BASE_ADDR + 0x40000)
 #define IP2APB_PERFMON1_BASE_ADDR   (AIPS2_OFF_BASE_ADDR + 0x44000)
 #define IP2APB_PERFMON2_BASE_ADDR   (AIPS2_OFF_BASE_ADDR + 0x48000)
+#define MX6UL_LCDIF1_BASE_ADDR      (AIPS2_OFF_BASE_ADDR + 0x48000)
 #ifdef CONFIG_MX6SX
 #define DEBUG_MONITOR_BASE_ADDR     (AIPS2_OFF_BASE_ADDR + 0x4C000)
 #else
@@ -300,8 +301,6 @@
 #define CSI1_BASE_ADDR              (AIPS3_ARB_BASE_ADDR + 0x14000)
 #define PXP_BASE_ADDR               (AIPS3_ARB_BASE_ADDR + 0x18000)
 #define CSI2_BASE_ADDR              (AIPS3_ARB_BASE_ADDR + 0x1C000)
-#define LCDIF1_BASE_ADDR            (AIPS3_ARB_BASE_ADDR + 0x20000)
-#define LCDIF2_BASE_ADDR            (AIPS3_ARB_BASE_ADDR + 0x24000)
 #define VADC_BASE_ADDR              (AIPS3_ARB_BASE_ADDR + 0x28000)
 #define VDEC_BASE_ADDR              (AIPS3_ARB_BASE_ADDR + 0x2C000)
 #define SPBA_BASE_ADDR              (AIPS3_ARB_BASE_ADDR + 0x3C000)
@@ -319,12 +318,11 @@
 #define PWM7_BASE_ADDR              (AIPS3_ARB_BASE_ADDR + 0xAC000)
 #define PWM8_BASE_ADDR              (AIPS3_ARB_BASE_ADDR + 0xB0000)
 #endif
+/* Only for i.MX6SX */
+#define LCDIF2_BASE_ADDR            (AIPS3_ARB_BASE_ADDR + 0x24000)
+#define MX6SX_LCDIF1_BASE_ADDR      (AIPS3_ARB_BASE_ADDR + 0x20000)
 #define MX6SX_WDOG3_BASE_ADDR       (AIPS3_ARB_BASE_ADDR + 0x88000)
 
-/* only for i.MX6SX/UL */
-#define WDOG3_BASE_ADDR (is_cpu_type(MXC_CPU_MX6UL) ?	\
-			 MX6UL_WDOG3_BASE_ADDR :  MX6SX_WDOG3_BASE_ADDR)
-
 #define CHIP_REV_1_0                 0x10
 #define CHIP_REV_1_2                 0x12
 #define CHIP_REV_1_5                 0x15
@@ -336,9 +334,17 @@
 #endif
 #define FEC_QUIRK_ENET_MAC
 
+#include <asm/imx-common/regs-lcdif.h>
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/types.h>
 
+/* only for i.MX6SX/UL */
+#define WDOG3_BASE_ADDR (is_cpu_type(MXC_CPU_MX6UL) ?	\
+			 MX6UL_WDOG3_BASE_ADDR :  MX6SX_WDOG3_BASE_ADDR)
+#define LCDIF1_BASE_ADDR (is_cpu_type(MXC_CPU_MX6UL)) ?	\
+			  MX6UL_LCDIF1_BASE_ADDR : MX6SX_LCDIF1_BASE_ADDR
+
+
 extern void imx_get_mac_from_fuse(int dev_id, unsigned char *mac);
 
 #define SRC_SCR_CORE_1_RESET_OFFSET     14
-- 
1.8.4

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

* [U-Boot] [PATCH V3 09/16] imx: mx6: crm_reg: add LCDIF related macros
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (6 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 08/16] imx: mx6: fix register address Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 10/16] imx: mx6: add clock api for lcdif Peng Fan
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

Add i.MX6UL/SX LCDIF related macros. Discard uneccessary
'#ifdef xxx'.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
---

V3:
 Add reviewed-by tag

V2:
 none

 arch/arm/include/asm/arch-mx6/crm_regs.h | 34 ++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx6/crm_regs.h b/arch/arm/include/asm/arch-mx6/crm_regs.h
index 10306cd..13e0a3d 100644
--- a/arch/arm/include/asm/arch-mx6/crm_regs.h
+++ b/arch/arm/include/asm/arch-mx6/crm_regs.h
@@ -174,6 +174,9 @@ struct mxc_ccm_reg {
 #define MXC_CCM_CBCMR_GPU3D_SHADER_PODF_OFFSET		29
 #define MXC_CCM_CBCMR_GPU3D_CORE_PODF_MASK		(0x7 << 26)
 #define MXC_CCM_CBCMR_GPU3D_CORE_PODF_OFFSET		26
+/* LCDIF on i.MX6SX/UL */
+#define MXC_CCM_CBCMR_LCDIF1_PODF_MASK                  (0x7 << 23)
+#define MXC_CCM_CBCMR_LCDIF1_PODF_OFFSET                23
 #define MXC_CCM_CBCMR_GPU2D_CORE_PODF_MASK		(0x7 << 23)
 #define MXC_CCM_CBCMR_GPU2D_CORE_PODF_OFFSET		23
 #define MXC_CCM_CBCMR_PRE_PERIPH2_CLK_SEL_MASK		(0x3 << 21)
@@ -210,7 +213,10 @@ struct mxc_ccm_reg {
 #define MXC_CCM_CSCMR1_ACLK_EMI_OFFSET			27
 #define MXC_CCM_CSCMR1_ACLK_EMI_SLOW_PODF_MASK		(0x7 << 23)
 #define MXC_CCM_CSCMR1_ACLK_EMI_SLOW_PODF_OFFSET	23
-/* ACLK_EMI_PODF is LCFIF2_PODF on MX6SX */
+/* LCFIF2_PODF on i.MX6SX */
+#define MXC_CCM_CSCMR1_LCDIF2_PODF_MASK			(0x7 << 20)
+#define MXC_CCM_CSCMR1_LCDIF2_PODF_OFFSET               20
+/* ACLK_EMI on i.MX6DQ/SDL/DQP */
 #define MXC_CCM_CSCMR1_ACLK_EMI_PODF_MASK		(0x7 << 20)
 #define MXC_CCM_CSCMR1_ACLK_EMI_PODF_OFFSET		20
 /* CSCMR1_GPMI/BCH exist on i.MX6UL */
@@ -400,6 +406,20 @@ struct mxc_ccm_reg {
 #define MXC_CCM_CSCDR2_ECSPI_CLK_PODF_OFFSET		19
 /* ECSPI_CLK_SEL exists on i.MX6SX/SL/QP */
 #define MXC_CCM_CSCDR2_ECSPI_CLK_SEL_MASK		(0x1 << 18)
+/* LCDIF1 on i.MX6SX/UL */
+#define MXC_CCM_CSCDR2_LCDIF1_PRED_SEL_MASK             (0x7 << 15)
+#define MXC_CCM_CSCDR2_LCDIF1_PRED_SEL_OFFSET           15
+#define MXC_CCM_CSCDR2_LCDIF1_PRE_DIV_MASK              (0x7 << 12)
+#define MXC_CCM_CSCDR2_LCDIF1_PRE_DIV_OFFSET            12
+#define MXC_CCM_CSCDR2_LCDIF1_CLK_SEL_MASK              (0x7 << 9)
+#define MXC_CCM_CSCDR2_LCDIF1_CLK_SEL_OFFSET            9
+/* LCDIF2 on i.MX6SX */
+#define MXC_CCM_CSCDR2_LCDIF2_PRED_SEL_MASK             (0x7 << 6)
+#define MXC_CCM_CSCDR2_LCDIF2_PRED_SEL_OFFSET           6
+#define MXC_CCM_CSCDR2_LCDIF2_PRE_DIV_MASK              (0x7 << 3)
+#define MXC_CCM_CSCDR2_LCDIF2_PRE_DIV_OFFSET            3
+#define MXC_CCM_CSCDR2_LCDIF2_CLK_SEL_MASK              (0x7 << 0)
+#define MXC_CCM_CSCDR2_LCDIF2_CLK_SEL_OFFSET             0
 
 /* All IPU2_DI1 are LCDIF1 on MX6SX */
 #define MXC_CCM_CHSCCDR_IPU2_DI1_PRE_CLK_SEL_MASK	(0x7 << 15)
@@ -622,17 +642,16 @@ struct mxc_ccm_reg {
 #define MXC_CCM_CCGR2_IPMUX3_MASK			(3 << MXC_CCM_CCGR2_IPMUX3_OFFSET)
 #define MXC_CCM_CCGR2_IPSYNC_IP2APB_TZASC1_IPGS_OFFSET	22
 #define MXC_CCM_CCGR2_IPSYNC_IP2APB_TZASC1_IPGS_MASK	(3 << MXC_CCM_CCGR2_IPSYNC_IP2APB_TZASC1_IPGS_OFFSET)
-#ifdef CONFIG_MX6SX
+/* i.MX6SX/UL LCD and PXP */
 #define MXC_CCM_CCGR2_LCD_OFFSET			28
 #define MXC_CCM_CCGR2_LCD_MASK				(3 << MXC_CCM_CCGR2_LCD_OFFSET)
 #define MXC_CCM_CCGR2_PXP_OFFSET			30
 #define MXC_CCM_CCGR2_PXP_MASK				(3 << MXC_CCM_CCGR2_PXP_OFFSET)
-#else
+
 #define MXC_CCM_CCGR2_IPSYNC_IP2APB_TZASC2_IPG_OFFSET	24
 #define MXC_CCM_CCGR2_IPSYNC_IP2APB_TZASC2_IPG_MASK	(3 << MXC_CCM_CCGR2_IPSYNC_IP2APB_TZASC2_IPG_OFFSET)
 #define MXC_CCM_CCGR2_IPSYNC_VDOA_IPG_MASTER_CLK_OFFSET	26
 #define MXC_CCM_CCGR2_IPSYNC_VDOA_IPG_MASTER_CLK_MASK	(3 << MXC_CCM_CCGR2_IPSYNC_VDOA_IPG_MASTER_CLK_OFFSET)
-#endif
 
 /* Exist on i.MX6SX */
 #define MXC_CCM_CCGR3_M4_OFFSET					2
@@ -685,6 +704,13 @@ struct mxc_ccm_reg {
 #define MXC_CCM_CCGR3_MMDC_CORE_IPG_CLK_P0_MASK			(3 << MXC_CCM_CCGR3_MMDC_CORE_IPG_CLK_P0_OFFSET)
 #define MXC_CCM_CCGR3_MMDC_CORE_IPG_CLK_P1_OFFSET		26
 #define MXC_CCM_CCGR3_MMDC_CORE_IPG_CLK_P1_MASK			(3 << MXC_CCM_CCGR3_MMDC_CORE_IPG_CLK_P1_OFFSET)
+
+#define MXC_CCM_CCGR3_DISP_AXI_OFFSET                           6
+#define MXC_CCM_CCGR3_DISP_AXI_MASK                             (3 << MXC_CCM_CCGR3_DISP_AXI_OFFSET)
+#define MXC_CCM_CCGR3_LCDIF2_PIX_OFFSET                         8
+#define MXC_CCM_CCGR3_LCDIF2_PIX_MASK                           (3 << MXC_CCM_CCGR3_LCDIF2_PIX_OFFSET)
+#define MXC_CCM_CCGR3_LCDIF1_PIX_OFFSET                         10
+#define MXC_CCM_CCGR3_LCDIF1_PIX_MASK                           (3 << MXC_CCM_CCGR3_LCDIF1_PIX_OFFSET)
 /* AXI on i.MX6UL */
 #define MXC_CCM_CCGR3_AXI_CLK_OFFSET				28
 #define MXC_CCM_CCGR3_AXI_CLK_MASK				(3 << MXC_CCM_CCGR3_AXI_CLK_OFFSET)
-- 
1.8.4

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

* [U-Boot] [PATCH V3 10/16] imx: mx6: add clock api for lcdif
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (7 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 09/16] imx: mx6: crm_reg: add LCDIF related macros Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 11/16] imx: mx6ul_14x14_evk: support lcdif display Peng Fan
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

Implement mxs_set_lcdclk, enable_lcdif_clock and enable_pll_video.
The three API can be used to configure lcdif related clock when
CONFIG_VIDEO_MXS enabled.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
---

V3:
 unified to use base addr for lcdif.
 fix LCDIF2 clock for i.MX6SX in mxs_set_lcdclk

V2:
 none

 arch/arm/cpu/armv7/mx6/clock.c        | 245 ++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mx6/clock.h |   2 +
 2 files changed, 247 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
index 11efd12..67e0f32 100644
--- a/arch/arm/cpu/armv7/mx6/clock.c
+++ b/arch/arm/cpu/armv7/mx6/clock.c
@@ -473,6 +473,251 @@ static u32 get_mmdc_ch0_clk(void)
 	}
 }
 
+#if defined(CONFIG_VIDEO_MXS)
+static int enable_pll_video(u32 pll_div, u32 pll_num, u32 pll_denom,
+			    u32 post_div)
+{
+	u32 reg = 0;
+	ulong start;
+
+	debug("pll5 div = %d, num = %d, denom = %d\n",
+	      pll_div, pll_num, pll_denom);
+
+	/* Power up PLL5 video */
+	writel(BM_ANADIG_PLL_VIDEO_POWERDOWN |
+	       BM_ANADIG_PLL_VIDEO_BYPASS |
+	       BM_ANADIG_PLL_VIDEO_DIV_SELECT |
+	       BM_ANADIG_PLL_VIDEO_POST_DIV_SELECT,
+	       &imx_ccm->analog_pll_video_clr);
+
+	/* Set div, num and denom */
+	switch (post_div) {
+	case 1:
+		writel(BF_ANADIG_PLL_VIDEO_DIV_SELECT(pll_div) |
+		       BF_ANADIG_PLL_VIDEO_POST_DIV_SELECT(0x2),
+		       &imx_ccm->analog_pll_video_set);
+		break;
+	case 2:
+		writel(BF_ANADIG_PLL_VIDEO_DIV_SELECT(pll_div) |
+		       BF_ANADIG_PLL_VIDEO_POST_DIV_SELECT(0x1),
+		       &imx_ccm->analog_pll_video_set);
+		break;
+	case 4:
+		writel(BF_ANADIG_PLL_VIDEO_DIV_SELECT(pll_div) |
+		       BF_ANADIG_PLL_VIDEO_POST_DIV_SELECT(0x0),
+		       &imx_ccm->analog_pll_video_set);
+		break;
+	default:
+		puts("Wrong test_div!\n");
+		return -EINVAL;
+	}
+
+	writel(BF_ANADIG_PLL_VIDEO_NUM_A(pll_num),
+	       &imx_ccm->analog_pll_video_num);
+	writel(BF_ANADIG_PLL_VIDEO_DENOM_B(pll_denom),
+	       &imx_ccm->analog_pll_video_denom);
+
+	/* Wait PLL5 lock */
+	start = get_timer(0);	/* Get current timestamp */
+
+	do {
+		reg = readl(&imx_ccm->analog_pll_video);
+		if (reg & BM_ANADIG_PLL_VIDEO_LOCK) {
+			/* Enable PLL out */
+			writel(BM_ANADIG_PLL_VIDEO_ENABLE,
+			       &imx_ccm->analog_pll_video_set);
+			return 0;
+		}
+	} while (get_timer(0) < (start + 10)); /* Wait 10ms */
+
+	puts("Lock PLL5 timeout\n");
+
+	return -ETIME;
+}
+
+/*
+ * 24M--> PLL_VIDEO -> LCDIFx_PRED -> LCDIFx_PODF -> LCD
+ *
+ * 'freq' using KHz as unit, see driver/video/mxsfb.c.
+ */
+void mxs_set_lcdclk(u32 base_addr, u32 freq)
+{
+	u32 reg = 0;
+	u32 hck = MXC_HCLK / 1000;
+	/* DIV_SELECT ranges from 27 to 54 */
+	u32 min = hck * 27;
+	u32 max = hck * 54;
+	u32 temp, best = 0;
+	u32 i, j, max_pred = 8, max_postd = 8, pred = 1, postd = 1;
+	u32 pll_div, pll_num, pll_denom, post_div = 1;
+
+	debug("mxs_set_lcdclk, freq = %dKHz\n", freq);
+
+	if ((!is_cpu_type(MXC_CPU_MX6SX)) && !is_cpu_type(MXC_CPU_MX6UL)) {
+		debug("This chip not support lcd!\n");
+		return;
+	}
+
+	if (base_addr == LCDIF1_BASE_ADDR) {
+		reg = readl(&imx_ccm->cscdr2);
+		/* Can't change clocks when clock not from pre-mux */
+		if ((reg & MXC_CCM_CSCDR2_LCDIF1_CLK_SEL_MASK) != 0)
+			return;
+	}
+
+	if (is_cpu_type(MXC_CPU_MX6SX)) {
+		reg = readl(&imx_ccm->cscdr2);
+		/* Can't change clocks when clock not from pre-mux */
+		if ((reg & MXC_CCM_CSCDR2_LCDIF2_CLK_SEL_MASK) != 0)
+			return;
+	}
+
+	temp = freq * max_pred * max_postd;
+	if (temp > max) {
+		puts("Please decrease freq, too large!\n");
+		return;
+	}
+	if (temp < min) {
+		/*
+		 * Register: PLL_VIDEO
+		 * Bit Field: POST_DIV_SELECT
+		 * 00 ? Divide by 4.
+		 * 01 ? Divide by 2.
+		 * 10 ? Divide by 1.
+		 * 11 ? Reserved
+		 * No need to check post_div(1)
+		 */
+		for (post_div = 2; post_div <= 4; post_div <<= 1) {
+			if ((temp * post_div) > min) {
+				freq *= post_div;
+				break;
+			}
+		}
+
+		if (post_div > 4) {
+			printf("Fail to set rate to %dkhz", freq);
+			return;
+		}
+	}
+
+	/* Choose the best pred and postd to match freq for lcd */
+	for (i = 1; i <= max_pred; i++) {
+		for (j = 1; j <= max_postd; j++) {
+			temp = freq * i * j;
+			if (temp > max || temp < min)
+				continue;
+			if (best == 0 || temp < best) {
+				best = temp;
+				pred = i;
+				postd = j;
+			}
+		}
+	}
+
+	if (best == 0) {
+		printf("Fail to set rate to %dKHz", freq);
+		return;
+	}
+
+	debug("best %d, pred = %d, postd = %d\n", best, pred, postd);
+
+	pll_div = best / hck;
+	pll_denom = 1000000;
+	pll_num = (best - hck * pll_div) * pll_denom / hck;
+
+	/*
+	 *                                  pll_num
+	 *             (24MHz * (pll_div + --------- ))
+	 *                                 pll_denom
+	 *freq KHz =  --------------------------------
+	 *             post_div * pred * postd * 1000
+	 */
+
+	if (base_addr == LCDIF1_BASE_ADDR) {
+		if (enable_pll_video(pll_div, pll_num, pll_denom, post_div))
+			return;
+
+		/* Select pre-lcd clock to PLL5 and set pre divider */
+		clrsetbits_le32(&imx_ccm->cscdr2,
+				MXC_CCM_CSCDR2_LCDIF1_PRED_SEL_MASK |
+				MXC_CCM_CSCDR2_LCDIF1_PRE_DIV_MASK,
+				(0x2 << MXC_CCM_CSCDR2_LCDIF1_PRED_SEL_OFFSET) |
+				((pred - 1) <<
+				 MXC_CCM_CSCDR2_LCDIF1_PRE_DIV_OFFSET));
+
+		/* Set the post divider */
+		clrsetbits_le32(&imx_ccm->cbcmr,
+				MXC_CCM_CBCMR_LCDIF1_PODF_MASK,
+				((postd - 1) <<
+				 MXC_CCM_CBCMR_LCDIF1_PODF_OFFSET));
+	} else if (is_cpu_type(MXC_CPU_MX6SX)) {
+		/* Setting LCDIF2 for i.MX6SX */
+		if (enable_pll_video(pll_div, pll_num, pll_denom, post_div))
+			return;
+
+		/* Select pre-lcd clock to PLL5 and set pre divider */
+		clrsetbits_le32(&imx_ccm->cscdr2,
+				MXC_CCM_CSCDR2_LCDIF2_PRED_SEL_MASK |
+				MXC_CCM_CSCDR2_LCDIF2_PRE_DIV_MASK,
+				(0x2 << MXC_CCM_CSCDR2_LCDIF2_PRED_SEL_OFFSET) |
+				((pred - 1) <<
+				 MXC_CCM_CSCDR2_LCDIF2_PRE_DIV_OFFSET));
+
+		/* Set the post divider */
+		clrsetbits_le32(&imx_ccm->cscmr1,
+				MXC_CCM_CSCMR1_LCDIF2_PODF_MASK,
+				((postd - 1) <<
+				 MXC_CCM_CSCMR1_LCDIF2_PODF_OFFSET));
+	}
+}
+
+int enable_lcdif_clock(u32 base_addr)
+{
+	u32 reg = 0;
+	u32 lcdif_clk_sel_mask, lcdif_ccgr3_mask;
+
+	if (is_cpu_type(MXC_CPU_MX6SX)) {
+		if ((base_addr == LCDIF1_BASE_ADDR) ||
+		    (base_addr == LCDIF2_BASE_ADDR)) {
+			puts("Wrong LCD interface!\n");
+			return -EINVAL;
+		}
+		/* Set to pre-mux clock at default */
+		lcdif_clk_sel_mask = (base_addr == LCDIF2_BASE_ADDR) ?
+			MXC_CCM_CSCDR2_LCDIF2_CLK_SEL_MASK :
+			MXC_CCM_CSCDR2_LCDIF1_CLK_SEL_MASK;
+		lcdif_ccgr3_mask = (base_addr == LCDIF2_BASE_ADDR) ?
+			(MXC_CCM_CCGR3_LCDIF2_PIX_MASK |
+			 MXC_CCM_CCGR3_DISP_AXI_MASK) :
+			(MXC_CCM_CCGR3_LCDIF1_PIX_MASK |
+			 MXC_CCM_CCGR3_DISP_AXI_MASK);
+	} else if (is_cpu_type(MXC_CPU_MX6UL)) {
+		if (base_addr != LCDIF1_BASE_ADDR) {
+			puts("Wrong LCD interface!\n");
+			return -EINVAL;
+		}
+		/* Set to pre-mux clock@default */
+		lcdif_clk_sel_mask = MXC_CCM_CSCDR2_LCDIF1_CLK_SEL_MASK;
+		lcdif_ccgr3_mask =  MXC_CCM_CCGR3_LCDIF1_PIX_MASK;
+	} else {
+		return 0;
+	}
+
+	reg = readl(&imx_ccm->cscdr2);
+	reg &= ~lcdif_clk_sel_mask;
+	writel(reg, &imx_ccm->cscdr2);
+
+	/* Enable the LCDIF pix clock */
+	reg = readl(&imx_ccm->CCGR3);
+	reg |= lcdif_ccgr3_mask;
+	writel(reg, &imx_ccm->CCGR3);
+
+	reg = readl(&imx_ccm->CCGR2);
+	reg |= MXC_CCM_CCGR2_LCD_MASK;
+	writel(reg, &imx_ccm->CCGR2);
+}
+#endif
+
 #ifdef CONFIG_FSL_QSPI
 /* qspi_num can be from 0 - 1 */
 void enable_qspi_clk(int qspi_num)
diff --git a/arch/arm/include/asm/arch-mx6/clock.h b/arch/arm/include/asm/arch-mx6/clock.h
index 2b220d6..1450523 100644
--- a/arch/arm/include/asm/arch-mx6/clock.h
+++ b/arch/arm/include/asm/arch-mx6/clock.h
@@ -66,6 +66,8 @@ int enable_spi_clk(unsigned char enable, unsigned spi_num);
 void enable_ipu_clock(void);
 int enable_fec_anatop_clock(int fec_id, enum enet_freq freq);
 void enable_enet_clk(unsigned char enable);
+int enable_lcdif_clock(u32 base_addr);
 void enable_qspi_clk(int qspi_num);
 void enable_thermal_clk(void);
+void mxs_set_lcdclk(u32 base_addr, u32 freq);
 #endif /* __ASM_ARCH_CLOCK_H */
-- 
1.8.4

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

* [U-Boot] [PATCH V3 11/16] imx: mx6ul_14x14_evk: support lcdif display
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (8 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 10/16] imx: mx6: add clock api for lcdif Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 12/16] video: mxsfb: introduce lcdif_power_down Peng Fan
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

Support lcdif display:
1. Add pinmux and pad settings for LCDIF
2. Introduce setup_lcd to do the settings for LCDIF
3. Enable VIDEO related macros in board header files
4. Add a new env videomode which is needed by mxsfb.c. The
   settings for videomode in this patch is for TFT43AB.
5. Tested on mx6ul 14x14/9x9 evk.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
---

V3:
 none
V2:
 Rebased to Latest U-Boot, resolve conflicts.

 board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c | 63 +++++++++++++++++++++++
 include/configs/mx6ul_14x14_evk.h                 | 18 +++++++
 2 files changed, 81 insertions(+)

diff --git a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
index 8650f35..f19994d 100644
--- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
+++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
@@ -52,6 +52,9 @@ DECLARE_GLOBAL_DATA_PTR;
 	PAD_CTL_SPEED_HIGH   |                                  \
 	PAD_CTL_DSE_48ohm   | PAD_CTL_SRE_FAST)
 
+#define LCD_PAD_CTRL    (PAD_CTL_HYS | PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \
+	PAD_CTL_PKE | PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm)
+
 #define MDIO_PAD_CTRL  (PAD_CTL_PUS_100K_UP | PAD_CTL_PUE |     \
 	PAD_CTL_DSE_48ohm   | PAD_CTL_SRE_FAST | PAD_CTL_ODE)
 
@@ -568,6 +571,62 @@ int board_phy_config(struct phy_device *phydev)
 }
 #endif
 
+#ifdef CONFIG_VIDEO_MXS
+static iomux_v3_cfg_t const lcd_pads[] = {
+	MX6_PAD_LCD_CLK__LCDIF_CLK | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_ENABLE__LCDIF_ENABLE | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_HSYNC__LCDIF_HSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_VSYNC__LCDIF_VSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA00__LCDIF_DATA00 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA01__LCDIF_DATA01 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA02__LCDIF_DATA02 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA03__LCDIF_DATA03 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA04__LCDIF_DATA04 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA05__LCDIF_DATA05 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA06__LCDIF_DATA06 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA07__LCDIF_DATA07 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA08__LCDIF_DATA08 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA09__LCDIF_DATA09 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA10__LCDIF_DATA10 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA11__LCDIF_DATA11 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA12__LCDIF_DATA12 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA13__LCDIF_DATA13 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA14__LCDIF_DATA14 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA15__LCDIF_DATA15 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA16__LCDIF_DATA16 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA17__LCDIF_DATA17 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA18__LCDIF_DATA18 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA19__LCDIF_DATA19 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA20__LCDIF_DATA20 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA21__LCDIF_DATA21 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA22__LCDIF_DATA22 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX6_PAD_LCD_DATA23__LCDIF_DATA23 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+
+	/* LCD_RST */
+	MX6_PAD_SNVS_TAMPER9__GPIO5_IO09 | MUX_PAD_CTRL(NO_PAD_CTRL),
+
+	/* Use GPIO for Brightness adjustment, duty cycle = period. */
+	MX6_PAD_GPIO1_IO08__GPIO1_IO08 | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+static int setup_lcd(void)
+{
+	enable_lcdif_clock(LCDIF1_BASE_ADDR);
+
+	imx_iomux_v3_setup_multiple_pads(lcd_pads, ARRAY_SIZE(lcd_pads));
+
+	/* Reset the LCD */
+	gpio_direction_output(IMX_GPIO_NR(5, 9) , 0);
+	udelay(500);
+	gpio_direction_output(IMX_GPIO_NR(5, 9) , 1);
+
+	/* Set Brightness to high */
+	gpio_direction_output(IMX_GPIO_NR(1, 8) , 1);
+
+	return 0;
+}
+#endif
+
 int board_early_init_f(void)
 {
 	setup_iomux_uart();
@@ -600,6 +659,10 @@ int board_init(void)
 	board_qspi_init();
 #endif
 
+#ifdef CONFIG_VIDEO_MXS
+	setup_lcd();
+#endif
+
 	return 0;
 }
 
diff --git a/include/configs/mx6ul_14x14_evk.h b/include/configs/mx6ul_14x14_evk.h
index d5faae6..5779632 100644
--- a/include/configs/mx6ul_14x14_evk.h
+++ b/include/configs/mx6ul_14x14_evk.h
@@ -77,6 +77,7 @@
 	"fdt_addr=0x83000000\0" \
 	"boot_fdt=try\0" \
 	"ip_dyn=yes\0" \
+	"videomode=video=ctfb:x:480,y:272,depth:24,pclk:108695,le:8,ri:4,up:2,lo:4,hs:41,vs:10,sync:0,vmode:0\0" \
 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
@@ -242,4 +243,21 @@
 
 #define CONFIG_IMX_THERMAL
 
+#define CONFIG_VIDEO
+#ifdef CONFIG_VIDEO
+#define CONFIG_CFB_CONSOLE
+#define CONFIG_VIDEO_MXS
+#define CONFIG_VIDEO_LOGO
+#define CONFIG_VIDEO_SW_CURSOR
+#define CONFIG_VGA_AS_SINGLE_DEVICE
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+#define CONFIG_SPLASH_SCREEN
+#define CONFIG_SPLASH_SCREEN_ALIGN
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_16BPP
+#define CONFIG_VIDEO_BMP_RLE8
+#define CONFIG_VIDEO_BMP_LOGO
+#define MXS_LCDIF_BASE MX6UL_LCDIF1_BASE_ADDR
+#endif
+
 #endif
-- 
1.8.4

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

* [U-Boot] [PATCH V3 12/16] video: mxsfb: introduce lcdif_power_down
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (9 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 11/16] imx: mx6ul_14x14_evk: support lcdif display Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-11-05  7:30   ` Anatolij Gustschin
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 13/16] imx: mx6: implement reset_misc Peng Fan
                   ` (3 subsequent siblings)
  14 siblings, 1 reply; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

Introudce a new function lcdif_power_down.

1. Waits for a VSYNC interrupt to guarantee the reset is done at the
   VSYNC edge, which somehow makes the LCDIF consume the display FIFO(?)
   and helps the LCDIF work normally at the kernel stage.
2. Add power down function to stop lcdif.

The reason to introduce lcdif_power_down is that we want lcdif to be in
initial state when doing uboot reset or before kernel boot to make
system stable, otherwise system may hang.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
---

V3:
 none
V2:
 none

 arch/arm/include/asm/imx-common/sys_proto.h |  2 ++
 drivers/video/mxsfb.c                       | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/arch/arm/include/asm/imx-common/sys_proto.h b/arch/arm/include/asm/imx-common/sys_proto.h
index 5673fb4..386c2dc 100644
--- a/arch/arm/include/asm/imx-common/sys_proto.h
+++ b/arch/arm/include/asm/imx-common/sys_proto.h
@@ -47,6 +47,8 @@ int fecmxc_initialize(bd_t *bis);
 u32 get_ahb_clk(void);
 u32 get_periph_clk(void);
 
+void lcdif_power_down(void);
+
 int mxs_reset_block(struct mxs_register_32 *reg);
 int mxs_wait_mask_set(struct mxs_register_32 *reg, u32 mask, u32 timeout);
 int mxs_wait_mask_clr(struct mxs_register_32 *reg, u32 mask, u32 timeout);
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index eed57d5..ddbb118 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -131,6 +131,23 @@ static void mxs_lcd_init(GraphicDevice *panel,
 	writel(LCDIF_CTRL_RUN, &regs->hw_lcdif_ctrl_set);
 }
 
+void lcdif_power_down(void)
+{
+	struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE;
+	int timeout = 1000000;
+
+	writel(panel.frameAdrs, &regs->hw_lcdif_cur_buf_reg);
+	writel(panel.frameAdrs, &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) &
+		    LCDIF_CTRL1_VSYNC_EDGE_IRQ)
+			break;
+		udelay(1);
+	}
+	mxs_reset_block((struct mxs_register_32 *)&regs->hw_lcdif_ctrl_reg);
+}
+
 void *video_hw_init(void)
 {
 	int bpp = -1;
-- 
1.8.4

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

* [U-Boot] [PATCH V3 13/16] imx: mx6: implement reset_misc
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (10 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 12/16] video: mxsfb: introduce lcdif_power_down Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 14/16] imx: imx-common: power down lcdif before boot os Peng Fan
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

We need to power down lcdif before uboot reset to make reset can pass
stress test.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
---

V3:
 lcdif_power_down should be applied to all i.MX6, but not only i.MX6UL,
 so drop the if (is_cpu_type(MXC_CPU_MX6UL)).

V2:
 none

 arch/arm/cpu/armv7/mx6/soc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 282302b..8fcb0df 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -392,6 +392,13 @@ const struct boot_mode soc_boot_modes[] = {
 	{NULL,		0},
 };
 
+void reset_misc(void)
+{
+#ifdef CONFIG_VIDEO_MXS
+	lcdif_power_down();
+#endif
+}
+
 void s_init(void)
 {
 	struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
-- 
1.8.4

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

* [U-Boot] [PATCH V3 14/16] imx: imx-common: power down lcdif before boot os
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (11 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 13/16] imx: mx6: implement reset_misc Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 15/16] imx: mx7: compile misc.c for mx7 Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 16/16] imx: mx7dsabresd: support lcdif Peng Fan
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

Need to call lcdif_power_down to make lcdif in initial state
before kernel boot. Similar issue for uboot reset with lcdif
enabled, system will hang after serveral times resetting. Need
to let lcdif initial state to make all go well.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
---

V3:
 none
V2:
 none

 arch/arm/imx-common/cpu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index d3d1fc5..656bb60 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -279,6 +279,9 @@ void arch_preboot_os(void)
 	/* disable video before launching O/S */
 	ipuv3_fb_shutdown();
 #endif
+#if defined(CONFIG_VIDEO_MXS)
+	lcdif_power_down();
+#endif
 }
 
 void set_chipselect_size(int const cs_size)
-- 
1.8.4

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

* [U-Boot] [PATCH V3 15/16] imx: mx7: compile misc.c for mx7
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (12 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 14/16] imx: imx-common: power down lcdif before boot os Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 16/16] imx: mx7dsabresd: support lcdif Peng Fan
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

Compile misc.c for mx7, since we need related function for
lcdif and nand.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Sanchayan Maity <maitysanchayan@gmail.com>
Cc: Stefan Agner <stefan@agner.ch>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
---

V3:
 none
V2:
 new patch
 
 arch/arm/imx-common/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index 1698d06..45b3371 100644
--- a/arch/arm/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -14,7 +14,7 @@ ifeq ($(SOC),$(filter $(SOC),mx5 mx6))
 obj-y	+= timer.o cpu.o speed.o
 obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o
 endif
-ifeq ($(SOC),$(filter $(SOC),mx6 mxs))
+ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs))
 obj-y	+= misc.o
 obj-$(CONFIG_SPL_BUILD)	+= spl.o
 endif
-- 
1.8.4

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

* [U-Boot] [PATCH V3 16/16] imx: mx7dsabresd: support lcdif
  2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
                   ` (13 preceding siblings ...)
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 15/16] imx: mx7: compile misc.c for mx7 Peng Fan
@ 2015-10-29  7:54 ` Peng Fan
  14 siblings, 0 replies; 18+ messages in thread
From: Peng Fan @ 2015-10-29  7:54 UTC (permalink / raw)
  To: u-boot

Support LCDIF for mx7dsabresd board:
1. Add pinmux settings
2. Add VIDEO related macro definition and videomode env settings.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
---

V3:
 none

V2:
 new patch

 board/freescale/mx7dsabresd/mx7dsabresd.c | 64 +++++++++++++++++++++++++++++++
 include/configs/mx7dsabresd.h             | 17 ++++++++
 2 files changed, 81 insertions(+)

diff --git a/board/freescale/mx7dsabresd/mx7dsabresd.c b/board/freescale/mx7dsabresd/mx7dsabresd.c
index ee9890b..6c863da 100644
--- a/board/freescale/mx7dsabresd/mx7dsabresd.c
+++ b/board/freescale/mx7dsabresd/mx7dsabresd.c
@@ -41,6 +41,9 @@ DECLARE_GLOBAL_DATA_PTR;
 #define I2C_PAD_CTRL    (PAD_CTL_DSE_3P3V_32OHM | PAD_CTL_SRE_SLOW | \
 	PAD_CTL_HYS | PAD_CTL_PUE | PAD_CTL_PUS_PU100KOHM)
 
+#define LCD_PAD_CTRL    (PAD_CTL_HYS | PAD_CTL_PUS_PU100KOHM | \
+	PAD_CTL_DSE_3P3V_49OHM)
+
 #ifdef CONFIG_SYS_I2C_MXC
 #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
 /* I2C1 for PMIC */
@@ -190,6 +193,63 @@ static void iox74lv_init(void)
 	gpio_direction_output(IOX_STCP, 1);
 };
 
+#ifdef CONFIG_VIDEO_MXS
+static iomux_v3_cfg_t const lcd_pads[] = {
+	MX7D_PAD_LCD_CLK__LCD_CLK | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_ENABLE__LCD_ENABLE | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_HSYNC__LCD_HSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_VSYNC__LCD_VSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA00__LCD_DATA0 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA01__LCD_DATA1 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA02__LCD_DATA2 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA03__LCD_DATA3 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA04__LCD_DATA4 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA05__LCD_DATA5 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA06__LCD_DATA6 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA07__LCD_DATA7 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA08__LCD_DATA8 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA09__LCD_DATA9 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA10__LCD_DATA10 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA11__LCD_DATA11 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA12__LCD_DATA12 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA13__LCD_DATA13 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA14__LCD_DATA14 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA15__LCD_DATA15 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA16__LCD_DATA16 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA17__LCD_DATA17 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA18__LCD_DATA18 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA19__LCD_DATA19 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA20__LCD_DATA20 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA21__LCD_DATA21 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA22__LCD_DATA22 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+	MX7D_PAD_LCD_DATA23__LCD_DATA23 | MUX_PAD_CTRL(LCD_PAD_CTRL),
+
+	MX7D_PAD_LCD_RESET__GPIO3_IO4	| MUX_PAD_CTRL(LCD_PAD_CTRL),
+};
+
+static iomux_v3_cfg_t const pwm_pads[] = {
+	/* Use GPIO for Brightness adjustment, duty cycle = period */
+	MX7D_PAD_GPIO1_IO01__GPIO1_IO1 | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+static int setup_lcd(void)
+{
+	imx_iomux_v3_setup_multiple_pads(lcd_pads, ARRAY_SIZE(lcd_pads));
+
+	imx_iomux_v3_setup_multiple_pads(pwm_pads, ARRAY_SIZE(pwm_pads));
+
+	/* Reset LCD */
+	gpio_direction_output(IMX_GPIO_NR(3, 4) , 0);
+	udelay(500);
+	gpio_direction_output(IMX_GPIO_NR(3, 4) , 1);
+
+	/* Set Brightness to high */
+	gpio_direction_output(IMX_GPIO_NR(1, 1) , 1);
+
+	return 0;
+}
+#endif
+
 #ifdef CONFIG_FEC_MXC
 static iomux_v3_cfg_t const fec1_pads[] = {
 	MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
@@ -417,6 +477,10 @@ int board_init(void)
 	setup_fec();
 #endif
 
+#ifdef CONFIG_VIDEO_MXS
+	setup_lcd();
+#endif
+
 	return 0;
 }
 
diff --git a/include/configs/mx7dsabresd.h b/include/configs/mx7dsabresd.h
index f16f9c1..b412ffc 100644
--- a/include/configs/mx7dsabresd.h
+++ b/include/configs/mx7dsabresd.h
@@ -76,6 +76,7 @@
 	"fdt_addr=0x83000000\0" \
 	"boot_fdt=try\0" \
 	"ip_dyn=yes\0" \
+	"videomode=video=ctfb:x:480,y:272,depth:24,pclk:108695,le:8,ri:4,up:2,lo:4,hs:41,vs:10,sync:0,vmode:0\0" \
 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
@@ -188,4 +189,20 @@
 
 #define CONFIG_IMX_THERMAL
 
+#define CONFIG_VIDEO
+#ifdef CONFIG_VIDEO
+#define CONFIG_CFB_CONSOLE
+#define CONFIG_VIDEO_MXS
+#define CONFIG_VIDEO_LOGO
+#define CONFIG_VIDEO_SW_CURSOR
+#define CONFIG_VGA_AS_SINGLE_DEVICE
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+#define CONFIG_SPLASH_SCREEN
+#define CONFIG_SPLASH_SCREEN_ALIGN
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_16BPP
+#define CONFIG_VIDEO_BMP_RLE8
+#define CONFIG_VIDEO_BMP_LOGO
+#endif
+
 #endif	/* __CONFIG_H */
-- 
1.8.4

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

* [U-Boot] [PATCH V3 12/16] video: mxsfb: introduce lcdif_power_down
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 12/16] video: mxsfb: introduce lcdif_power_down Peng Fan
@ 2015-11-05  7:30   ` Anatolij Gustschin
  0 siblings, 0 replies; 18+ messages in thread
From: Anatolij Gustschin @ 2015-11-05  7:30 UTC (permalink / raw)
  To: u-boot

On Thu, 29 Oct 2015 15:54:49 +0800
Peng Fan <Peng.Fan@freescale.com> wrote:

> Introudce a new function lcdif_power_down.
> 
> 1. Waits for a VSYNC interrupt to guarantee the reset is done at the
>    VSYNC edge, which somehow makes the LCDIF consume the display FIFO(?)
>    and helps the LCDIF work normally at the kernel stage.
> 2. Add power down function to stop lcdif.
> 
> The reason to introduce lcdif_power_down is that we want lcdif to be in
> initial state when doing uboot reset or before kernel boot to make
> system stable, otherwise system may hang.
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Anatolij Gustschin <agust@denx.de>
> ---
> 
> V3:
>  none
> V2:
>  none
> 
>  arch/arm/include/asm/imx-common/sys_proto.h |  2 ++
>  drivers/video/mxsfb.c                       | 17 +++++++++++++++++
>  2 files changed, 19 insertions(+)

Acked-by: Anatolij Gustschin <agust@denx.de>

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

* [U-Boot] [PATCH V3 01/16] mxs: add parameter base_addr for mxs_set_lcdclk
  2015-10-29  7:54 ` [U-Boot] [PATCH V3 01/16] mxs: add parameter base_addr for mxs_set_lcdclk Peng Fan
@ 2015-11-05  7:34   ` Anatolij Gustschin
  0 siblings, 0 replies; 18+ messages in thread
From: Anatolij Gustschin @ 2015-11-05  7:34 UTC (permalink / raw)
  To: u-boot

On Thu, 29 Oct 2015 15:54:39 +0800
Peng Fan <Peng.Fan@freescale.com> wrote:

> Change mxs_set_lcdclk prototype to add a new parameter
> base_addr. There are two LCD interfaces for i.MX6SX,
> we may support LCDIF1 or LCDIF2.
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Anatolij Gustschin <agust@denx.de>
> ---
> 
> V3:
>  Add __maybe_unused attribute
> 
> V2:
>  none
> 
>  arch/arm/cpu/arm926ejs/mxs/clock.c    | 2 +-
>  arch/arm/include/asm/arch-mxs/clock.h | 2 +-
>  drivers/video/mxsfb.c                 | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Acked-by: Anatolij Gustschin <agust@denx.de>

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

end of thread, other threads:[~2015-11-05  7:34 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-29  7:54 [U-Boot] [PATCH V3 00/16] imx: mx6/7: support lcdif Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 01/16] mxs: add parameter base_addr for mxs_set_lcdclk Peng Fan
2015-11-05  7:34   ` Anatolij Gustschin
2015-10-29  7:54 ` [U-Boot] [PATCH V3 03/16] xfi3: correct function name Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 04/16] mxs: regs-common.h must be wrapped with !__ASSEMBLY__ Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 05/16] imx: include linux/types.h for regs-common.h Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 06/16] imx: imx-common: move lcdif structure and macro definition to imx-common Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 07/16] imx: lcdif: use one register structure for i.MXes Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 08/16] imx: mx6: fix register address Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 09/16] imx: mx6: crm_reg: add LCDIF related macros Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 10/16] imx: mx6: add clock api for lcdif Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 11/16] imx: mx6ul_14x14_evk: support lcdif display Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 12/16] video: mxsfb: introduce lcdif_power_down Peng Fan
2015-11-05  7:30   ` Anatolij Gustschin
2015-10-29  7:54 ` [U-Boot] [PATCH V3 13/16] imx: mx6: implement reset_misc Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 14/16] imx: imx-common: power down lcdif before boot os Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 15/16] imx: mx7: compile misc.c for mx7 Peng Fan
2015-10-29  7:54 ` [U-Boot] [PATCH V3 16/16] imx: mx7dsabresd: support lcdif Peng Fan

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