#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>
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);
*/
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
}