summaryrefslogtreecommitdiff
path: root/drivers/sysreset
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-11-23 21:29:28 -0700
committerSimon Glass <sjg@chromium.org>2018-12-05 06:01:34 -0700
commit2a07269062a8e63dadc23be0f8b0d4638da7d2d2 (patch)
tree5b0f9056117025030bfdc318c77ab8be99aa91a7 /drivers/sysreset
parente628bba785a310e80193f9a34c0b53fcb2136c46 (diff)
sandbox: sysreset: Update to support power-on reset
If U-Boot is started from SPL or TPL, then those earlier phases deal with the reset cause. On real hardware this cause may be lost once it is read. Emulate that behaviour in sandbox by reporting a warm reset when a previous phase has run since start-up. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/sysreset')
-rw-r--r--drivers/sysreset/sysreset_sandbox.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/sysreset/sysreset_sandbox.c b/drivers/sysreset/sysreset_sandbox.c
index 7f6d4186e1..38e2a7e241 100644
--- a/drivers/sysreset/sysreset_sandbox.c
+++ b/drivers/sysreset/sysreset_sandbox.c
@@ -84,7 +84,13 @@ int sandbox_sysreset_get_status(struct udevice *dev, char *buf, int size)
int sandbox_sysreset_get_last(struct udevice *dev)
{
- return SYSRESET_COLD;
+ struct sandbox_state *state = state_get_current();
+
+ /*
+ * The first phase is a power reset, after that we assume we don't
+ * know.
+ */
+ return state->jumped_fname ? SYSRESET_WARM : SYSRESET_POWER;
}
static struct sysreset_ops sandbox_sysreset_ops = {