imx: ventana: add support for DLC-700JMGT4 and DLC-800FIGT3 LCD displays
[oweals/u-boot.git] / board / gateworks / gw_ventana / gw_ventana.c
index 16f3e905345218aa0e137405b88ac2c3d3a40d85..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 != GW551x && 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);
 
@@ -1030,6 +1072,7 @@ static struct ventana gpio_cfg[] = {
                        IMX_GPIO_NR(4, 15),
                },
                .pcie_rst = IMX_GPIO_NR(1, 29),
+               .wdis = IMX_GPIO_NR(7, 12),
        },
 };
 
@@ -1497,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);
        }
 
 
@@ -1593,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.
@@ -1604,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