From 5ead1aa09ac96ac64dd09779114060a41edc5502 Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Fri, 25 Dec 2020 11:28:07 +0800 Subject: [PATCH] rockchip: spl: only allow do reset after dm setup Without this, there is a dead loop path: hang() => spl_hang_reset() => do_reset() => failed to reset => hang()! Signed-off-by: Joseph Chen Change-Id: I8553bde97bd45ca63e5a12aca1acfc939301b04f --- arch/arm/mach-rockchip/spl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c index 8c6cf5d752..0e92ee5da2 100644 --- a/arch/arm/mach-rockchip/spl.c +++ b/arch/arm/mach-rockchip/spl.c @@ -381,8 +381,11 @@ void spl_hang_reset(void) { printf("# Reset the board to bootrom #\n"); #if defined(CONFIG_SPL_SYSRESET) && defined(CONFIG_SPL_DRIVERS_MISC_SUPPORT) - writel(BOOT_BROM_DOWNLOAD, CONFIG_ROCKCHIP_BOOT_MODE_REG); - do_reset(NULL, 0, 0, NULL); + /* reset is available after dm setup */ + if (gd->flags & GD_FLG_SPL_EARLY_INIT) { + writel(BOOT_BROM_DOWNLOAD, CONFIG_ROCKCHIP_BOOT_MODE_REG); + do_reset(NULL, 0, 0, NULL); + } #endif }