]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/karo/tx6/tx6qdl.c
karo: tx6: set LCD x, y dimensions to 0 when disabling LCD
[karo-tx-uboot.git] / board / karo / tx6 / tx6qdl.c
index 271ceb6dfd97fa533b00a51239339e50240d027f..5a0e2a819359cce05be1d6ff5579869b3dc17be1 100644 (file)
@@ -454,8 +454,6 @@ static int tx6_pmic_probe(void)
 
        debug("%s@%d: \n", __func__, __LINE__);
 
-//     i2c_init_all();
-
        for (i = 0; i < ARRAY_SIZE(tx6_mod_revs); i++) {
                u8 i2c_addr = tx6_mod_revs[i].addr;
                int ret = i2c_probe(i2c_addr);
@@ -479,7 +477,7 @@ int board_init(void)
        debug("%s@%d: \n", __func__, __LINE__);
 
        pmic_id = tx6_pmic_probe();
-       if (pmic_id >= 0)
+       if (pmic_id >= 0 && pmic_id < ARRAY_SIZE(tx6_mod_revs))
                pmic_addr = tx6_mod_revs[pmic_id].addr;
 
        printf("Board: Ka-Ro TX6%s-%d%d%d%c\n",
@@ -511,7 +509,7 @@ int board_init(void)
                return 0;
        }
 
-       ret = tx6_pmic_init(pmic_addr);
+       ret = tx6_pmic_init(pmic_addr, NULL, 0);
        if (ret) {
                printf("Failed to setup PMIC voltages: %d\n", ret);
                hang();
@@ -805,14 +803,12 @@ static const struct gpio stk5_gpios[] = {
 };
 
 #ifdef CONFIG_LCD
-static u16 tx6_cmap[256];
 vidinfo_t panel_info = {
        /* set to max. size supported by SoC */
        .vl_col = 1920,
        .vl_row = 1080,
 
        .vl_bpix = LCD_COLOR32,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
-       .cmap = tx6_cmap,
 };
 
 static struct fb_videomode tx6_fb_modes[] = {
@@ -1095,6 +1091,7 @@ void lcd_ctrl_init(void *lcdbase)
 
        if (!lcd_enabled) {
                debug("LCD disabled\n");
+               goto disable;
                return;
        }
 
@@ -1102,6 +1099,7 @@ void lcd_ctrl_init(void *lcdbase)
                debug("Disabling LCD\n");
                lcd_enabled = 0;
                setenv("splashimage", NULL);
+               goto disable;
                return;
        }
 
@@ -1111,6 +1109,7 @@ void lcd_ctrl_init(void *lcdbase)
        if (video_mode == NULL) {
                debug("Disabling LCD\n");
                lcd_enabled = 0;
+               goto disable;
                return;
        }
        vm = video_mode;
@@ -1124,6 +1123,7 @@ void lcd_ctrl_init(void *lcdbase)
                                fb_mode.xres, fb_mode.yres,
                                panel_info.vl_col, panel_info.vl_row);
                        lcd_enabled = 0;
+                       goto disable;
                        return;
                }
        }
@@ -1215,12 +1215,14 @@ void lcd_ctrl_init(void *lcdbase)
                        printf(" %s", p->name);
                }
                printf("\n");
+               goto disable;
                return;
        }
        if (p->xres > panel_info.vl_col || p->yres > panel_info.vl_row) {
                printf("video resolution: %dx%d exceeds hardware limits: %dx%d\n",
                        p->xres, p->yres, panel_info.vl_col, panel_info.vl_row);
                lcd_enabled = 0;
+               goto disable;
                return;
        }
        panel_info.vl_col = p->xres;
@@ -1279,6 +1281,7 @@ void lcd_ctrl_init(void *lcdbase)
                lcd_enabled = 0;
                printf("Invalid %s bus width: %d\n", is_lvds() ? "LVDS" : "LCD",
                        lcd_bus_width);
+               goto disable;
                return;
        }
        if (is_lvds()) {
@@ -1290,6 +1293,7 @@ void lcd_ctrl_init(void *lcdbase)
                if (lvds_chan_mask == 0) {
                        printf("No LVDS channel active\n");
                        lcd_enabled = 0;
+                       goto disable;
                        return;
                }
 
@@ -1319,6 +1323,13 @@ void lcd_ctrl_init(void *lcdbase)
        } else {
                debug("Skipping initialization of LCD controller\n");
        }
+       return;
+
+disable:
+       lcd_enabled = 0;
+       panel_info.vl_col = 0;
+       panel_info.vl_row = 0;
+
 }
 #else
 #define lcd_enabled 0
@@ -1380,7 +1391,6 @@ static void tx6qdl_set_cpu_clock(void)
 
 int board_late_init(void)
 {
-       int ret = 0;
        const char *baseboard;
 
        debug("%s@%d: \n", __func__, __LINE__);
@@ -1425,7 +1435,8 @@ int board_late_init(void)
        } else {
                printf("WARNING: Unsupported baseboard: '%s'\n",
                        baseboard);
-               ret = -EINVAL;
+               if (!had_ctrlc())
+                       return -EINVAL;
        }
 
 exit:
@@ -1433,7 +1444,7 @@ exit:
 
        gpio_set_value(TX6_RESET_OUT_GPIO, 1);
        clear_ctrlc();
-       return ret;
+       return 0;
 }
 
 #ifdef CONFIG_SERIAL_TAG