Re: [U-Boot] [PATCH 8/8] arm: mx6: novena: Add proper LVDS display support

2014-12-30 Thread Stefano Babic
On 16/12/2014 14:09, Marek Vasut wrote:
> Repair the register configuration and add proper support for the
> display attached to both LVDS channels.
> 
> Signed-off-by: Marek Vasut 
> Cc: Igor Grinberg 
> Cc: Nikita Kiryanov 
> Cc: Sean Cross 
> Cc: Simon Glass 
> Cc: Stefano Babic 
> Cc: Tim Harvey 
> ---

After fixing checkpatch warnings:

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 8/8] arm: mx6: novena: Add proper LVDS display support

2014-12-16 Thread Marek Vasut
On Tuesday, December 16, 2014 at 05:22:31 PM, Simon Glass wrote:
> Hi Marek,
> 
> On 16 December 2014 at 06:09, Marek Vasut  wrote:
> > Repair the register configuration and add proper support for the
> > display attached to both LVDS channels.
> > 
> > Signed-off-by: Marek Vasut 
> > Cc: Igor Grinberg 
> > Cc: Nikita Kiryanov 
> > Cc: Sean Cross 
> > Cc: Simon Glass 
> > Cc: Stefano Babic 
> > Cc: Tim Harvey 
> > ---
> > 
> >  board/kosagi/novena/novena.c |   8 +
> >  board/kosagi/novena/novena.h |   8 +
> >  board/kosagi/novena/novena_spl.c |   7 +
> >  board/kosagi/novena/video.c  | 400
> >  --- include/configs/novena.h   
> >   |   1 +
> >  5 files changed, 401 insertions(+), 23 deletions(-)
> 
> Could perhaps move the board to driver model for I2C.

That's the plan, not only this one, but SoCFPGA in general and all the DENX 
boards.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 8/8] arm: mx6: novena: Add proper LVDS display support

2014-12-16 Thread Simon Glass
Hi Marek,

On 16 December 2014 at 06:09, Marek Vasut  wrote:
> Repair the register configuration and add proper support for the
> display attached to both LVDS channels.
>
> Signed-off-by: Marek Vasut 
> Cc: Igor Grinberg 
> Cc: Nikita Kiryanov 
> Cc: Sean Cross 
> Cc: Simon Glass 
> Cc: Stefano Babic 
> Cc: Tim Harvey 
> ---
>  board/kosagi/novena/novena.c |   8 +
>  board/kosagi/novena/novena.h |   8 +
>  board/kosagi/novena/novena_spl.c |   7 +
>  board/kosagi/novena/video.c  | 400 
> ---
>  include/configs/novena.h |   1 +
>  5 files changed, 401 insertions(+), 23 deletions(-)

Could perhaps move the board to driver model for I2C.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 8/8] arm: mx6: novena: Add proper LVDS display support

2014-12-16 Thread Marek Vasut
Repair the register configuration and add proper support for the
display attached to both LVDS channels.

Signed-off-by: Marek Vasut 
Cc: Igor Grinberg 
Cc: Nikita Kiryanov 
Cc: Sean Cross 
Cc: Simon Glass 
Cc: Stefano Babic 
Cc: Tim Harvey 
---
 board/kosagi/novena/novena.c |   8 +
 board/kosagi/novena/novena.h |   8 +
 board/kosagi/novena/novena_spl.c |   7 +
 board/kosagi/novena/video.c  | 400 ---
 include/configs/novena.h |   1 +
 5 files changed, 401 insertions(+), 23 deletions(-)

diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index e7a6adb..69f5be3 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -173,6 +173,14 @@ int board_init(void)
return 0;
 }
 
+int board_late_init(void)
+{
+#if defined(CONFIG_VIDEO_IPUV3)
+   setup_display_lvds();
+#endif
+   return 0;
+}
+
 int checkboard(void)
 {
puts("Board: Novena 4x\n");
diff --git a/board/kosagi/novena/novena.h b/board/kosagi/novena/novena.h
index 244004d..8f11583 100644
--- a/board/kosagi/novena/novena.h
+++ b/board/kosagi/novena/novena.h
@@ -10,9 +10,12 @@
 #define __BOARD_KOSAGI_NOVENA_NOVENA_H__
 
 #define NOVENA_AUDIO_PWRON IMX_GPIO_NR(5, 17)
+#define NOVENA_BACKLIGHT_PWM_GPIO  IMX_GPIO_NR(4, 29)
+#define NOVENA_BACKLIGHT_PWR_GPIO  IMX_GPIO_NR(4, 15)
 #define NOVENA_BUTTON_GPIO IMX_GPIO_NR(4, 14)
 #define NOVENA_FPGA_RESET_N_GPIO   IMX_GPIO_NR(5, 7)
 #define NOVENA_HDMI_GHOST_HPD  IMX_GPIO_NR(5, 4)
+#define NOVENA_ITE6251_PWR_GPIOIMX_GPIO_NR(5, 28)
 #define NOVENA_PCIE_DISABLE_GPIO   IMX_GPIO_NR(2, 16)
 #define NOVENA_PCIE_POWER_ON_GPIO  IMX_GPIO_NR(7, 12)
 #define NOVENA_PCIE_RESET_GPIO IMX_GPIO_NR(3, 29)
@@ -20,6 +23,11 @@
 #define NOVENA_SD_CD   IMX_GPIO_NR(1, 4)
 #define NOVENA_SD_WP   IMX_GPIO_NR(1, 2)
 
+#define NOVENA_IT6251_I2C_BUS  2
+#define NOVENA_IT6251_CHIPADDR 0x5c
+#define NOVENA_IT6251_LVDSADDR 0x5e
+
 void setup_display_clock(void);
+void setup_display_lvds(void);
 
 #endif /* __BOARD_KOSAGI_NOVENA_NOVENA_H__ */
diff --git a/board/kosagi/novena/novena_spl.c b/board/kosagi/novena/novena_spl.c
index 5ebc59b..b1688e0 100644
--- a/board/kosagi/novena/novena_spl.c
+++ b/board/kosagi/novena/novena_spl.c
@@ -386,6 +386,13 @@ static void novena_spl_setup_iomux_uart(void)
 static iomux_v3_cfg_t hdmi_pads[] = {
/* "Ghost HPD" pin */
MX6_PAD_EIM_A24__GPIO5_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL),
+
+   /* LCD_PWR_CTL */
+   MX6_PAD_CSI0_DAT10__GPIO5_IO28 | MUX_PAD_CTRL(NO_PAD_CTRL),
+   /* LCD_BL_ON */
+   MX6_PAD_KEY_ROW4__GPIO4_IO15 | MUX_PAD_CTRL(NO_PAD_CTRL),
+   /* GPIO_PWM1 */
+   MX6_PAD_DISP0_DAT8__GPIO4_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL),
 };
 
 static void novena_spl_setup_iomux_video(void)
diff --git a/board/kosagi/novena/video.c b/board/kosagi/novena/video.c
index fdcd100..6e9fd7d 100644
--- a/board/kosagi/novena/video.c
+++ b/board/kosagi/novena/video.c
@@ -1,6 +1,10 @@
 /*
  * Novena video output support
  *
+ * IT6251 code based on code Copyright (C) 2014 Sean Cross
+ * from https://github.com/xobs/novena-linux.git commit
+ * 3d85836ee1377d445531928361809612aa0a18db
+ *
  * Copyright (C) 2014 Marek Vasut 
  *
  * SPDX-License-Identifier:GPL-2.0+
@@ -29,11 +33,275 @@
 
 #include "novena.h"
 
+#define IT6251_VENDOR_ID_LOW   0x00
+#define IT6251_VENDOR_ID_HIGH  0x01
+#define IT6251_DEVICE_ID_LOW   0x02
+#define IT6251_DEVICE_ID_HIGH  0x03
+#define IT6251_SYSTEM_STATUS   0x0d
+#define IT6251_SYSTEM_STATUS_RINTSTATUS(1 << 0)
+#define IT6251_SYSTEM_STATUS_RHPDSTATUS(1 << 1)
+#define IT6251_SYSTEM_STATUS_RVIDEOSTABLE  (1 << 2)
+#define IT6251_SYSTEM_STATUS_RPLL_IOLOCK   (1 << 3)
+#define IT6251_SYSTEM_STATUS_RPLL_XPLOCK   (1 << 4)
+#define IT6251_SYSTEM_STATUS_RPLL_SPLOCK   (1 << 5)
+#define IT6251_SYSTEM_STATUS_RAUXFREQ_LOCK (1 << 6)
+#define IT6251_REF_STATE   0x0e
+#define IT6251_REF_STATE_MAIN_LINK_DISABLED(1 << 0)
+#define IT6251_REF_STATE_AUX_CHANNEL_READ  (1 << 1)
+#define IT6251_REF_STATE_CR_PATTERN(1 << 2)
+#define IT6251_REF_STATE_EQ_PATTERN(1 << 3)
+#define IT6251_REF_STATE_NORMAL_OPERATION  (1 << 4)
+#define IT6251_REF_STATE_MUTED (1 << 5)
+
+#define IT6251_REG_PCLK_CNT_LOW0x57
+#define IT6251_REG_PCLK_CNT_HIGH   0x58
+
+#define IT6521_RETRY_MAX   20
+
+static int it6251_is_stable(void)
+{
+   const unsigned int caddr = NOVENA_IT6251_CHIPADDR;
+   const unsigned int laddr = NOVENA_IT6251_LVDSADDR;
+   int stat