Merge https://gitlab.denx.de/u-boot/custodians/u-boot-spi into next
[platform/kernel/u-boot.git] / board / ti / am57xx / board.c
index d70ab0c..511858a 100644 (file)
 #include <common.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <image.h>
 #include <init.h>
+#include <malloc.h>
+#include <net.h>
 #include <palmas.h>
 #include <sata.h>
 #include <serial.h>
@@ -35,6 +38,7 @@
 #include <ti-usb-phy-uboot.h>
 #include <mmc.h>
 #include <dm/uclass.h>
+#include <hang.h>
 
 #include "../common/board_detect.h"
 #include "mux_data.h"
@@ -57,6 +61,10 @@ static int board_bootmode_has_emmc(void);
 #define board_is_am571x_idk()  board_ti_is("AM571IDK")
 #define board_is_bbai()                board_ti_is("BBONE-AI")
 
+#define board_is_ti_idk()      board_is_am574x_idk() || \
+                               board_is_am572x_idk() || \
+                               board_is_am571x_idk()
+
 #ifdef CONFIG_DRIVER_TI_CPSW
 #include <cpsw.h>
 #endif
@@ -64,8 +72,7 @@ static int board_bootmode_has_emmc(void);
 DECLARE_GLOBAL_DATA_PTR;
 
 #define GPIO_ETH_LCD           GPIO_TO_PIN(2, 22)
-/* GPIO 7_11 */
-#define GPIO_DDR_VTT_EN 203
+#define GPIO_DDR_VTT_EN                GPIO_TO_PIN(7, 11)
 
 /* Touch screen controller to identify the LCD */
 #define OSD_TS_FT_BUS_ADDRESS  0
@@ -663,7 +670,7 @@ void am57x_idk_lcd_detect(void)
        struct udevice *dev;
 
        /* Only valid for IDKs */
-       if (board_is_x15() || board_is_am572x_evm() ||  board_is_bbai())
+       if (!board_is_ti_idk())
                return;
 
        /* Only AM571x IDK has gpio control detect.. so check that */
@@ -706,6 +713,18 @@ void am57x_idk_lcd_detect(void)
        }
 out:
        env_set("idk_lcd", idk_lcd);
+
+       /*
+        * On AM571x_IDK, no Display with J51 set to LCD is considered as an
+        * invalid configuration and we prevent boot to get user attention.
+        */
+       if (board_is_am571x_idk() && am571x_idk_needs_lcd() &&
+           !strncmp(idk_lcd, "no", 2)) {
+               printf("%s: Invalid HW configuration: display not detected/supported but J51 is set. Remove J51 to boot without display.\n",
+                      __func__);
+               hang();
+       }
+
        return;
 }