[U-Boot] [PATCH 1/2] mx6qsabreauto: Add i2c to mx6qsabreauto board

2013-05-13 Thread Renato Frias
Add i2c2 and 3 to mx6qsabreauto board, i2c3 is multiplexed
use gpio to set steering.

Signed-off-by: Renato Frias b13...@freescale.com
---
 board/freescale/mx6qsabreauto/mx6qsabreauto.c |   50 +
 include/configs/mx6qsabreauto.h   |6 +++
 2 files changed, 56 insertions(+)

diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c 
b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
index bfe4868..d6df750 100644
--- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c
+++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
@@ -26,12 +26,14 @@
 #include asm/errno.h
 #include asm/gpio.h
 #include asm/imx-common/iomux-v3.h
+#include asm/imx-common/mxc_i2c.h
 #include asm/imx-common/boot_mode.h
 #include mmc.h
 #include fsl_esdhc.h
 #include miiphy.h
 #include netdev.h
 #include asm/arch/sys_proto.h
+#include i2c.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -46,6 +48,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP |  \
PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
 
+#define I2C_PAD_CTRL   (PAD_CTL_PUS_100K_UP |  \
+   PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
+   PAD_CTL_ODE | PAD_CTL_SRE_FAST)
+
+#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
+
 int dram_init(void)
 {
gd-ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
@@ -76,6 +84,41 @@ iomux_v3_cfg_t const enet_pads[] = {
MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL  | MUX_PAD_CTRL(ENET_PAD_CTRL),
 };
 
+/* I2C2 PMIC, iPod, Tuner, Codec, Touch, HDMI EDID, MIPI CSI2 card */
+struct i2c_pads_info i2c_pad_info1 = {
+   .scl = {
+   .i2c_mode = MX6_PAD_EIM_EB2__I2C2_SCL | PC,
+   .gpio_mode = MX6_PAD_EIM_EB2__GPIO_2_30 | PC,
+   .gp = IMX_GPIO_NR(2, 30)
+   },
+   .sda = {
+   .i2c_mode = MX6_PAD_KEY_ROW3__I2C2_SDA | PC,
+   .gpio_mode = MX6_PAD_KEY_ROW3__GPIO_4_13 | PC,
+   .gp = IMX_GPIO_NR(4, 13)
+   }
+};
+
+/*
+ * I2C3 MLB, Port Expanders (A, B, C), Video ADC, Light Sensor,
+ * Compass Sensor, Accelerometer, Res Touch
+ */
+struct i2c_pads_info i2c_pad_info2 = {
+   .scl = {
+   .i2c_mode = MX6_PAD_GPIO_3__I2C3_SCL | PC,
+   .gpio_mode = MX6_PAD_GPIO_3__GPIO_1_3 | PC,
+   .gp = IMX_GPIO_NR(1, 3)
+   },
+   .sda = {
+   .i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC,
+   .gpio_mode = MX6_PAD_EIM_D18__GPIO_3_18 | PC,
+   .gp = IMX_GPIO_NR(3, 18)
+   }
+};
+
+iomux_v3_cfg_t const i2c3_pads[] = {
+   MX6_PAD_EIM_A24__GPIO_5_4   | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
 static void setup_iomux_enet(void)
 {
imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
@@ -216,6 +259,13 @@ int board_init(void)
/* address of boot parameters */
gd-bd-bi_boot_params = PHYS_SDRAM + 0x100;
 
+   /* I2C 2 and 3 setup - I2C 3 hw mux with EIM */
+   setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, i2c_pad_info1);
+   /* I2C 3 Steer */
+   gpio_direction_output(IMX_GPIO_NR(5, 4), 1);
+   imx_iomux_v3_setup_multiple_pads(i2c3_pads, ARRAY_SIZE(i2c3_pads));
+   setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, i2c_pad_info2);
+
return 0;
 }
 
diff --git a/include/configs/mx6qsabreauto.h b/include/configs/mx6qsabreauto.h
index 1583c11..947ea60 100644
--- a/include/configs/mx6qsabreauto.h
+++ b/include/configs/mx6qsabreauto.h
@@ -38,4 +38,10 @@
 #define CONFIG_SYS_MMC_ENV_PART1   /* Boot partition 1 */
 #endif
 
+/* I2C Configs */
+#define CONFIG_CMD_I2C
+#define CONFIG_I2C_MULTI_BUS
+#define CONFIG_I2C_MXC
+#define CONFIG_SYS_I2C_SPEED   10
+
 #endif /* __MX6QSABREAUTO_CONFIG_H */
-- 
1.7.9.5


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


[U-Boot] [PATCH 2/2] mx6qsabreauto: Add Port Expander reset

2013-05-13 Thread Renato Frias
There are 3 IO expanders on the mx6qsabreauto all reset by the
same GPIO, just set it to high to use the IO.

Signed-off-by: Renato Frias b13...@freescale.com
---
 board/freescale/mx6qsabreauto/mx6qsabreauto.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c 
b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
index d6df750..eb2561e 100644
--- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c
+++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
@@ -119,6 +119,10 @@ iomux_v3_cfg_t const i2c3_pads[] = {
MX6_PAD_EIM_A24__GPIO_5_4   | MUX_PAD_CTRL(NO_PAD_CTRL),
 };
 
+iomux_v3_cfg_t const port_exp[] = {
+   MX6_PAD_SD2_DAT0__GPIO_1_15 | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
 static void setup_iomux_enet(void)
 {
imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
@@ -266,6 +270,9 @@ int board_init(void)
imx_iomux_v3_setup_multiple_pads(i2c3_pads, ARRAY_SIZE(i2c3_pads));
setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, i2c_pad_info2);
 
+   gpio_direction_output(IMX_GPIO_NR(1, 15), 1);
+   imx_iomux_v3_setup_multiple_pads(port_exp, ARRAY_SIZE(port_exp));
+
return 0;
 }
 
-- 
1.7.9.5


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


Re: [U-Boot] Add video support for mx51evk

2010-11-02 Thread Renato Frias
Hello Stefano Babic,

On Tue, Nov 2, 2010 at 4:40 AM, Stefano Babic sba...@denx.de wrote:

 However, it is really better to make the modification for the vision2
 inside the same patchset. This guarantees that both boards work when
 your patches go to mainline.

Ok! Should I send the patch for vision2, also?

 Thanks for pointing out, I have already seen the point, but at the end I
 forget to fix it ;-). Probably because there is no side-effects on this
 board, but this does not mean that the issue should not fixed for
 vision2, too.

This issue affects the video mx51evk, at least for the patch I sent.
If I don't edit lcd.c the board resets when writing to the
framebuffer, upon boot.

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


Re: [U-Boot] [PATCH 1/2] Add flexibility to mx51 video support

2010-11-02 Thread Renato Frias
Hello Stefano B,

On Tue, Nov 2, 2010 at 4:57 AM, Stefano Babic sba...@denx.de wrote:

 you patch seems to be corrupted and does not apply. It seems your mailer
 is responsible for this. It puts html code in the mail, too:

Shame on me! I apologize for the mess, I configured Outlook for plain text.
I'll submit again...

 I admit that I took the fix.id string from the linux driver, but it is
 not used at all in the code. If we do not find a useful reason for it,
 it should be probably better to get rid of it to avoid confusion.

Agree! I can not see usage for this, will remove from the patch.

 This is only a debug output to check the values in the panel_info
 structure and prints them without doing any computation. If you want to
 add the NBITS value (that in any case can be computed), please leave the
 original output of vl_bpix, too.

Agree! I will remove from the patch.

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


Re: [U-Boot] [PATCH 2/2] Add video support to mx51evk board

2010-11-02 Thread Renato Frias
Hello Stefano B,

On Tue, Nov 2, 2010 at 5:05 AM, Stefano Babic sba...@denx.de wrote:
 This patch is corrupted as the first one by your mailer.

I'm really sorry, I'll submit again.

 It seems you start with trailing whitespaces instead of tabs

I will fix on the next patch.

 With the vision2 I introduced constants to set pads (PAD_CTL_*). At
 least for new values, you should use it.

Ok!.

 Are the new defines inside a comment ?

Yes, they are. Only those working with the WVGA display will benefit from it.
There is no video support the LVDS or DVI output yet.
Do you have any recommendation here?

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


[U-Boot] [PATCH v2 1/3] Add flexibility to mx51 video support

2010-11-02 Thread Renato Frias
From: Renato Frias renato.fr...@freescale.com

This patch adds flexibility to mxc_ipuv3_fb.c by allowing the display
interface and pixel format to be passed to mx51_fb_init.

Signed-off-by: Renato Frias renato.fr...@freescale.com
---
Changes for v2:
- Removed fix.id string
- Removed NBITS calculation from debug message

 drivers/video/mxc_ipuv3_fb.c |   25 -
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/video/mxc_ipuv3_fb.c b/drivers/video/mxc_ipuv3_fb.c
index a66981c..b660d22 100644
--- a/drivers/video/mxc_ipuv3_fb.c
+++ b/drivers/video/mxc_ipuv3_fb.c
@@ -526,7 +526,7 @@ static struct fb_info *mxcfb_init_fbinfo(void)
  *
  * @return  Appropriate error code to the kernel common code
  */
-static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode)
+static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode, u32 
ipu_di)
 {
struct fb_info *fbi;
struct mxcfb_info *mxcfbi;
@@ -550,11 +550,10 @@ static int mxcfb_probe(u32 interface_pix_fmt, struct 
fb_videomode *mode)
mxcfbi-blank = FB_BLANK_POWERDOWN;
}
 
-   mxcfbi-ipu_di = 0;
+   mxcfbi-ipu_di = ipu_di;
 
ipu_disp_set_global_alpha(mxcfbi-ipu_ch, 1, 0x80);
ipu_disp_set_color_key(mxcfbi-ipu_ch, 0, 0);
-   strcpy(fbi-fix.id, DISP3 BG);
 
g_dp_in_use = 1;
 
@@ -625,9 +624,10 @@ void lcd_ctrl_init(void *lcdbase)
memset(lcdbase, 0, mem_len);
 }
 
-int mx51_fb_init(struct fb_videomode *mode)
+int mx51_fb_init(struct fb_videomode *mode, u32 ipu_di, u32 bppix)
 {
int ret;
+   uint32_t pixfmt = 0;
 
ret = ipu_probe();
if (ret)
@@ -635,8 +635,23 @@ int mx51_fb_init(struct fb_videomode *mode)
 
lcd_base += 56;
 
+   switch (bppix) {
+   case 32:
+   pixfmt = IPU_PIX_FMT_BGR32;
+   break;
+   case 24:
+   pixfmt = IPU_PIX_FMT_BGR24;
+   break;
+   case 18:
+   pixfmt = IPU_PIX_FMT_RGB666;
+   break;
+   case 16:
+   pixfmt = IPU_PIX_FMT_RGB565;
+   break;
+   }
+
debug(Framebuffer at 0x%x\n, (unsigned int)lcd_base);
-   ret = mxcfb_probe(IPU_PIX_FMT_RGB666, mode);
+   ret = mxcfb_probe(pixfmt, mode, ipu_di);
 
return ret;
 }
-- 
1.6.0.4

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


[U-Boot] [PATCH v2 2/3] Add video support to mx51evk board

2010-11-02 Thread Renato Frias
From: Renato Frias renato.fr...@freescale.com

Adds video support to mx51evk board, this board allows different displays.
This patch enables the WVGA TFT LCD panel only, on Display interface 1.
Remove comments from include/configs/mx51evk.h to use it.

Signed-off-by: Renato Frias renato.fr...@freescale.com
---
Changes for v2:
- Removed trailing whitespaces from struct fb_videomode
- Using PAD_CTL_* definitions
- Updated commit message

 board/freescale/mx51evk/mx51evk.c |   60 -
 include/configs/mx51evk.h |   11 +++
 2 files changed, 70 insertions(+), 1 deletions(-)

diff --git a/board/freescale/mx51evk/mx51evk.c 
b/board/freescale/mx51evk/mx51evk.c
index 2160d5a..3743121 100644
--- a/board/freescale/mx51evk/mx51evk.c
+++ b/board/freescale/mx51evk/mx51evk.c
@@ -34,9 +34,37 @@
 #include fsl_pmic.h
 #include mc13892.h
 
+#ifdef CONFIG_LCD
+#include linux/fb.h
+#include lcd.h
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static u32 system_rev;
+extern int mx51_fb_init(struct fb_videomode *mode, u32 ipu_di, u32 pix_fmt);
+
+#ifdef CONFIG_LCD
+static struct fb_videomode claa_wvga = {
+   CLAA07LC0ACW,
+   57, /* Refresh */
+   800,/* xres */
+   480,/* yres */
+   37037,  /* pixclock = 27Mhz */
+   40, /* left margin */
+   60, /* right margin */
+   10, /* upper margin */
+   10, /* lower margin */
+   20, /* hsync-len */
+   10, /* vsync-len */
+   0,  /* sync */
+   FB_VMODE_NONINTERLACED, /* vmode */
+   0,  /* flag */
+};
+
+static int wvga_ipu_di = 1;
+static int wvga_bppix = 16;
+#endif
 
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg esdhc_cfg[2] = {
@@ -148,6 +176,34 @@ static void setup_iomux_fec(void)
mxc_iomux_set_pad(MX51_PIN_NANDF_D11, 0x2180);
 }
 
+#ifdef CONFIG_LCD
+void setup_iomux_ipu(void)
+{
+   /* DISP2_DAT [0:15] are configured by default */
+   mxc_request_iomux(MX51_PIN_DI1_D1_CS, IOMUX_CONFIG_ALT4);
+   mxc_iomux_set_pad(MX51_PIN_DI1_D1_CS,
+   PAD_CTL_PKE_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
+   mxc_request_iomux(MUX_IN_GPIO3_IPP_IND_G_IN_4_SELECT_INPUT,
+   INPUT_CTL_PATH1);
+
+   /* DISP2_DRDY pin */
+   mxc_request_iomux(MX51_PIN_DI_GP4, IOMUX_CONFIG_ALT4);
+   mxc_iomux_set_pad(MX51_PIN_DI_GP4, PAD_CTL_PKE_ENABLE |
+   PAD_CTL_PUE_KEEPER | PAD_CTL_DRV_LOW);
+}
+
+void lcd_enable(void)
+{
+   int ret;
+
+   ret = mx51_fb_init(claa_wvga, wvga_ipu_di, wvga_bppix);
+   if (ret) {
+   puts(LCD cannot be configured\n);
+   }
+
+}
+#endif
+
 #ifdef CONFIG_MXC_SPI
 static void setup_iomux_spi(void)
 {
@@ -409,7 +465,9 @@ int board_init(void)
 
setup_iomux_uart();
setup_iomux_fec();
-
+#ifdef CONFIG_LCD
+   setup_iomux_ipu();
+#endif
return 0;
 }
 
diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h
index f98438d..cd931ea 100644
--- a/include/configs/mx51evk.h
+++ b/include/configs/mx51evk.h
@@ -211,6 +211,17 @@
 #define CONFIG_SYS_DDR_CLKSEL  0
 #define CONFIG_SYS_CLKTL_CBCDR 0x59E35100
 
+/*
+ * Framebuffer and LCD
+ */
+/*
+#define CONFIG_LCD
+#define CONFIG_VIDEO_MX5
+#define LCD_BPPLCD_COLOR16
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_16BPP
+*/
+
 /*---
  * FLASH and environment organization
  */
-- 
1.6.0.4

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


[U-Boot] [PATCH v2 3/3] Fix video support for vision2 board

2010-11-02 Thread Renato Frias
From: Renato Frias renato.fr...@freescale.com

Adds arguments to the mx51_fb_init call.

Signed-off-by: Renato Frias renato.fr...@freescale.com
---
Changes for v2:
- Includes fix to vision2 (this commit) on the patch set 

 board/ttcontrol/vision2/vision2.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/ttcontrol/vision2/vision2.c 
b/board/ttcontrol/vision2/vision2.c
index 071dad6..d818224 100644
--- a/board/ttcontrol/vision2/vision2.c
+++ b/board/ttcontrol/vision2/vision2.c
@@ -43,7 +43,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static u32 system_rev;
 
-extern int mx51_fb_init(struct fb_videomode *mode);
+extern int mx51_fb_init(struct fb_videomode *mode, u32 ipu_di, u32 pix_fmt);
 
 #ifdef CONFIG_HW_WATCHDOG
 #include watchdog.h
@@ -675,7 +675,7 @@ void lcd_enable(void)
mxc_gpio_set(2, 1);
mxc_request_iomux(MX51_PIN_GPIO1_2, IOMUX_CONFIG_ALT0);
 
-   ret = mx51_fb_init(nec_nl6448bc26_09c);
+   ret = mx51_fb_init(nec_nl6448bc26_09c, 0, 18);
if (ret)
puts(LCD cannot be configured\n);
 }
-- 
1.6.0.4

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