clk: sifive: fu540-prci: Add ddr clock initialization
[oweals/u-boot.git] / drivers / sysreset / sysreset_sandbox.c
index 7f6d4186e16b60e5fb913a14ff57f8a7c23e94b4..69c22a70008fe5486d06459b4d569c398df93335 100644 (file)
@@ -57,15 +57,16 @@ static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type)
        case SYSRESET_COLD:
                state->last_sysreset = type;
                break;
-       case SYSRESET_POWER:
+       case SYSRESET_POWER_OFF:
                state->last_sysreset = type;
                if (!state->sysreset_allowed[type])
                        return -EACCES;
                sandbox_exit();
                break;
-       case SYSRESET_POWER_OFF:
+       case SYSRESET_POWER:
                if (!state->sysreset_allowed[type])
                        return -EACCES;
+               sandbox_exit();
        default:
                return -ENOSYS;
        }
@@ -84,7 +85,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 = {