common: Drop image.h from common header
[oweals/u-boot.git] / board / st / stm32mp1 / stm32mp1.c
index c64f20ab08670fbb09503ff9bb9050b67575cc89..571492274f4a68b677a2616d6a49af877ea358f4 100644 (file)
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <env.h>
 #include <env_internal.h>
+#include <fdt_support.h>
 #include <g_dnl.h>
 #include <generic-phy.h>
 #include <hang.h>
@@ -19,6 +20,7 @@
 #include <malloc.h>
 #include <misc.h>
 #include <mtd_node.h>
+#include <net.h>
 #include <netdev.h>
 #include <phy.h>
 #include <remoteproc.h>
@@ -32,6 +34,7 @@
 #include <asm/arch/sys_proto.h>
 #include <jffs2/load_kernel.h>
 #include <linux/err.h>
+#include <linux/iopoll.h>
 #include <power/regulator.h>
 #include <usb/dwc2_udc.h>
 
@@ -430,7 +433,7 @@ static int board_check_usb_power(void)
        if (max_uV > USB_WARNING_LOW_THRESHOLD_UV &&
            max_uV <= USB_START_LOW_THRESHOLD_UV &&
            min_uV <= USB_LOW_THRESHOLD_UV) {
-               pr_err("*       WARNING 1.5mA power supply detected        *\n");
+               pr_err("*       WARNING 1.5A power supply detected        *\n");
                nb_blink = 3;
        }
 
@@ -463,10 +466,10 @@ static void sysconf_init(void)
        struct udevice *pwr_dev;
        struct udevice *pwr_reg;
        struct udevice *dev;
-       int ret;
        u32 otp = 0;
 #endif
-       u32 bootr;
+       int ret;
+       u32 bootr, val;
 
        syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
 
@@ -543,8 +546,15 @@ static void sysconf_init(void)
         */
        writel(SYSCFG_CMPENSETR_MPU_EN, syscfg + SYSCFG_CMPENSETR);
 
-       while (!(readl(syscfg + SYSCFG_CMPCR) & SYSCFG_CMPCR_READY))
-               ;
+       /* poll until ready (1s timeout) */
+       ret = readl_poll_timeout(syscfg + SYSCFG_CMPCR, val,
+                                val & SYSCFG_CMPCR_READY,
+                                1000000);
+       if (ret) {
+               pr_err("SYSCFG: I/O compensation failed, timeout.\n");
+               led_error_blink(10);
+       }
+
        clrbits_le32(syscfg + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
 #endif
 }
@@ -687,7 +697,6 @@ int board_init(void)
 
 int board_late_init(void)
 {
-       char *boot_device;
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
        const void *fdt_compat;
        int fdt_compat_len;
@@ -735,11 +744,6 @@ int board_late_init(void)
        board_check_usb_power();
 #endif /* CONFIG_ADC */
 
-       /* Check the boot-source to disable bootdelay */
-       boot_device = env_get("boot_device");
-       if (!strcmp(boot_device, "serial") || !strcmp(boot_device, "usb"))
-               env_set("bootdelay", "0");
-
        return 0;
 }