Skip to contentSkip to conversation

sun6i: cpu_reset: Do not return from cpu_reset()

PATCH New Hans de Goede 2 participants 2 messages Jun 14, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sun6i: cpu_reset: Do not return from cpu_reset()

Currently on sun6i after a "reset" the prompt returns and the user can even type stuff until the watchdog triggers and does the actual reset.

This is somewhat unexpected behavior for the "reset" command, this commit adds an endless loop to wait for the watchdog to trigger so that we do not return to the prompt.

---
 arch/arm/cpu/armv7/sunxi/board.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/cpu/armv7/sunxi/board.c +1 -0
index bd0d819..0fe641f 100644
@@ -220,6 +220,7 @@ void reset_cpu(ulong addr)
 	writel(WDT_CFG_RESET, &wdog->cfg);
 	writel(WDT_MODE_EN, &wdog->mode);
 	writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl);
+	while (1) { }
 #endif
 }
 
Signature · 1 line
2.3.6
#1 lore raw

PATCH 1/1 sun6i: cpu_reset: Do not return from cpu_reset()

Quoted 4 lines · Hans de Goede

Currently on sun6i after a "reset" the prompt returns and the user can even type stuff until the watchdog triggers and does the actual reset.

This is somewhat unexpected behavior for the "reset" command,

It certainly is!

Quoted 5 lines

this
commit adds an endless loop to wait for the watchdog to trigger so that we do not return to the prompt.

Might be worth throwing a cpu_relax or some such in there too?

Quoted 16 lines
---
 arch/arm/cpu/armv7/sunxi/board.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/cpu/armv7/sunxi/board.c +1 -0
index bd0d819..0fe641f 100644
@@ -220,6 +220,7 @@ void reset_cpu(ulong addr)
 	writel(WDT_CFG_RESET, &wdog->cfg);
 	writel(WDT_MODE_EN, &wdog->mode);
 	writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl);
+	while (1) { }
 #endif
 }