imx: ventana: add support for DLC-700JMGT4 and DLC-800FIGT3 LCD displays
[oweals/u-boot.git] / board / gateworks / gw_ventana / gw_ventana.c
index 9ea24f43f736262067fef49b2e38169884277dfe..d8eeb6d93161d82d16253a7ac2ee21a42d4ac506 100644 (file)
@@ -397,11 +397,11 @@ int board_phy_config(struct phy_device *phydev)
 
 int board_eth_init(bd_t *bis)
 {
-       setup_iomux_enet();
-
 #ifdef CONFIG_FEC_MXC
-       if (board_type != GW552x)
+       if (board_type != GW551x && board_type != GW552x) {
+               setup_iomux_enet();
                cpu_eth_init(bis);
+       }
 #endif
 
 #ifdef CONFIG_E1000
@@ -495,6 +495,48 @@ struct display_info_t const displays[] = {{
                .vsync_len      = 10,
                .sync           = FB_SYNC_EXT,
                .vmode          = FB_VMODE_NONINTERLACED
+} }, {
+       /* DLC700JMG-T-4 */
+       .bus    = 0,
+       .addr   = 0,
+       .detect = NULL,
+       .enable = enable_lvds,
+       .pixfmt = IPU_PIX_FMT_LVDS666,
+       .mode   = {
+               .name           = "DLC700JMGT4",
+               .refresh        = 60,
+               .xres           = 1024,         /* 1024x600active pixels */
+               .yres           = 600,
+               .pixclock       = 15385,        /* 64MHz */
+               .left_margin    = 220,
+               .right_margin   = 40,
+               .upper_margin   = 21,
+               .lower_margin   = 7,
+               .hsync_len      = 60,
+               .vsync_len      = 10,
+               .sync           = FB_SYNC_EXT,
+               .vmode          = FB_VMODE_NONINTERLACED
+} }, {
+       /* DLC800FIG-T-3 */
+       .bus    = 0,
+       .addr   = 0,
+       .detect = NULL,
+       .enable = enable_lvds,
+       .pixfmt = IPU_PIX_FMT_LVDS666,
+       .mode   = {
+               .name           = "DLC800FIGT3",
+               .refresh        = 60,
+               .xres           = 1024,         /* 1024x768 active pixels */
+               .yres           = 768,
+               .pixclock       = 15385,        /* 64MHz */
+               .left_margin    = 220,
+               .right_margin   = 40,
+               .upper_margin   = 21,
+               .lower_margin   = 7,
+               .hsync_len      = 60,
+               .vsync_len      = 10,
+               .sync           = FB_SYNC_EXT,
+               .vmode          = FB_VMODE_NONINTERLACED
 } } };
 size_t display_count = ARRAY_SIZE(displays);
 
@@ -679,6 +721,15 @@ static iomux_v3_cfg_t const gw54xx_gpio_pads[] = {
        IOMUX_PADS(PAD_DISP0_DAT23__GPIO5_IO17 | DIO_PAD_CFG),
 };
 
+static iomux_v3_cfg_t const gw551x_gpio_pads[] = {
+       /* PANLED# */
+       IOMUX_PADS(PAD_KEY_ROW0__GPIO4_IO07 | DIO_PAD_CFG),
+       /* PCI_RST# */
+       IOMUX_PADS(PAD_GPIO_0__GPIO1_IO00 | DIO_PAD_CFG),
+       /* PCIESKT_WDIS# */
+       IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG),
+};
+
 static iomux_v3_cfg_t const gw552x_gpio_pads[] = {
        /* PANLEDG# */
        IOMUX_PADS(PAD_KEY_COL0__GPIO4_IO06 | DIO_PAD_CFG),
@@ -720,6 +771,7 @@ struct ventana {
        int num_pads;
        /* DIO pinmux/val */
        struct dio_cfg dio_cfg[4];
+       int num_gpios;
        /* various gpios (0 if non-existent) */
        int leds[3];
        int pcie_rst;
@@ -765,6 +817,7 @@ static struct ventana gpio_cfg[] = {
                                4
                        },
                },
+               .num_gpios = 4,
                .leds = {
                        IMX_GPIO_NR(4, 6),
                        IMX_GPIO_NR(4, 10),
@@ -808,6 +861,7 @@ static struct ventana gpio_cfg[] = {
                                4
                        },
                },
+               .num_gpios = 4,
                .leds = {
                        IMX_GPIO_NR(4, 6),
                        IMX_GPIO_NR(4, 10),
@@ -850,6 +904,7 @@ static struct ventana gpio_cfg[] = {
                                0
                        },
                },
+               .num_gpios = 4,
                .leds = {
                        IMX_GPIO_NR(4, 6),
                        IMX_GPIO_NR(4, 7),
@@ -894,6 +949,7 @@ static struct ventana gpio_cfg[] = {
                                0
                        },
                },
+               .num_gpios = 4,
                .leds = {
                        IMX_GPIO_NR(4, 6),
                        IMX_GPIO_NR(4, 7),
@@ -937,6 +993,7 @@ static struct ventana gpio_cfg[] = {
                                4
                        },
                },
+               .num_gpios = 4,
                .leds = {
                        IMX_GPIO_NR(4, 6),
                        IMX_GPIO_NR(4, 7),
@@ -952,10 +1009,10 @@ static struct ventana gpio_cfg[] = {
                .wdis = IMX_GPIO_NR(5, 17),
        },
 
-       /* GW552x */
+       /* GW551x */
        {
-               .gpio_pads = gw552x_gpio_pads,
-               .num_pads = ARRAY_SIZE(gw552x_gpio_pads)/2,
+               .gpio_pads = gw551x_gpio_pads,
+               .num_pads = ARRAY_SIZE(gw551x_gpio_pads)/2,
                .dio_cfg = {
                        {
                                { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) },
@@ -976,18 +1033,46 @@ static struct ventana gpio_cfg[] = {
                                3
                        },
                        {
-                               { IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) },
-                               IMX_GPIO_NR(2, 10),
-                               { 0, 0 },
-                               0
+                               { IOMUX_PADS(PAD_SD1_CMD__GPIO1_IO18) },
+                               IMX_GPIO_NR(1, 18),
+                               { IOMUX_PADS(PAD_SD1_CMD__PWM4_OUT) },
+                               4
+                       },
+               },
+               .num_gpios = 2,
+               .leds = {
+                       IMX_GPIO_NR(4, 7),
+               },
+               .pcie_rst = IMX_GPIO_NR(1, 0),
+               .wdis = IMX_GPIO_NR(7, 12),
+       },
+
+       /* GW552x */
+       {
+               .gpio_pads = gw552x_gpio_pads,
+               .num_pads = ARRAY_SIZE(gw552x_gpio_pads)/2,
+               .dio_cfg = {
+                       {
+                               { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) },
+                               IMX_GPIO_NR(1, 19),
+                               { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) },
+                               2
+                       },
+                       {
+                               { IOMUX_PADS(PAD_SD1_DAT1__GPIO1_IO17) },
+                               IMX_GPIO_NR(1, 17),
+                               { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) },
+                               3
                        },
                },
+               .num_gpios = 4,
                .leds = {
                        IMX_GPIO_NR(4, 6),
                        IMX_GPIO_NR(4, 7),
                        IMX_GPIO_NR(4, 15),
                },
                .pcie_rst = IMX_GPIO_NR(1, 29),
+               .wdis = IMX_GPIO_NR(7, 12),
        },
 };
 
@@ -1138,6 +1223,8 @@ static void setup_board_gpio(int board)
                iomux_v3_cfg_t ctrl = DIO_PAD_CFG;
                unsigned cputype = is_cpu_type(MXC_CPU_MX6Q) ? 0 : 1;
 
+               if (!cfg->gpio_padmux[0] && !cfg->gpio_padmux[1])
+                       continue;
                sprintf(arg, "dio%d", i);
                if (!hwconfig(arg))
                        continue;
@@ -1430,7 +1517,7 @@ int misc_init_r(void)
                                sprintf(fdt, "%s-%s.dtb", cputype, str);
                                setenv("fdt_file1", fdt);
                        }
-                       if (board_type != GW552x)
+                       if (board_type != GW551x && board_type != GW552x)
                                str[4] = 'x';
                        str[5] = 'x';
                        str[6] = 0;
@@ -1453,6 +1540,10 @@ int misc_init_r(void)
                /* board serial-number */
                sprintf(str, "%6d", info->serial);
                setenv("serial#", str);
+
+               /* memory MB */
+               sprintf(str, "%d", (int) (gd->ram_size >> 20));
+               setenv("mem_mb", str);
        }
 
 
@@ -1549,6 +1640,17 @@ int ft_board_setup(void *blob, bd_t *bd)
        fdt_setprop(blob, 0, "board", info->model,
                    strlen((const char *)info->model) + 1);
 
+       /*
+        * disable serial2 node for GW54xx for compatibility with older
+        * 3.10.x kernel that improperly had this node enabled in the DT
+        */
+       if (board_type == GW54xx) {
+               i = fdt_path_offset(blob,
+                                   "/soc/aips-bus@02100000/serial@021ec000");
+               if (i)
+                       fdt_del_node(blob, i);
+       }
+
        /*
         * disable wdog1/wdog2 nodes for GW51xx below revC to work around
         * errata causing wdog timer to be unreliable.
@@ -1560,6 +1662,41 @@ int ft_board_setup(void *blob, bd_t *bd)
                        fdt_status_disabled(blob, i);
        }
 
+       /*
+        * isolate CSI0_DATA_EN for GW551x below revB to work around
+        * errata causing non functional digital video in (it is not hooked up)
+        */
+       else if (board_type == GW551x && rev == 'A') {
+               u32 *range = NULL;
+               int len;
+               const u32 *handle = NULL;
+
+               i = fdt_node_offset_by_compatible(blob, -1,
+                                                 "fsl,imx-tda1997x-video");
+               if (i)
+                       handle = fdt_getprop(blob, i, "pinctrl-0", NULL);
+               if (handle)
+                       i = fdt_node_offset_by_phandle(blob,
+                                                      fdt32_to_cpu(*handle));
+               if (i)
+                       range = (u32 *)fdt_getprop(blob, i, "fsl,pins", &len);
+               if (range) {
+                       len /= sizeof(u32);
+                       for (i = 0; i < len; i += 6) {
+                               u32 mux_reg = fdt32_to_cpu(range[i+0]);
+                               u32 conf_reg = fdt32_to_cpu(range[i+1]);
+                               /* mux PAD_CSI0_DATA_EN to GPIO */
+                               if (is_cpu_type(MXC_CPU_MX6Q) &&
+                                   mux_reg == 0x260 && conf_reg == 0x630)
+                                       range[i+3] = cpu_to_fdt32(0x5);
+                               else if (!is_cpu_type(MXC_CPU_MX6Q) &&
+                                   mux_reg == 0x08c && conf_reg == 0x3a0)
+                                       range[i+3] = cpu_to_fdt32(0x5);
+                       }
+                       fdt_setprop_inplace(blob, i, "fsl,pins", range, len);
+               }
+       }
+
        /*
         * Peripheral Config:
         *  remove nodes by alias path if EEPROM config tells us the