clk: sifive: fu540-prci: Add ddr clock initialization
[oweals/u-boot.git] / drivers / sysreset / sysreset_sandbox.c
index 75004d9f774dc0c6aaed8ddfd379943c729544f0..69c22a70008fe5486d06459b4d569c398df93335 100644 (file)
@@ -36,6 +36,11 @@ int sandbox_warm_sysreset_get_status(struct udevice *dev, char *buf, int size)
        return 0;
 }
 
+int sandbox_warm_sysreset_get_last(struct udevice *dev)
+{
+       return SYSRESET_WARM;
+}
+
 static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type)
 {
        struct sandbox_state *state = state_get_current();
@@ -52,12 +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:
+               if (!state->sysreset_allowed[type])
+                       return -EACCES;
+               sandbox_exit();
        default:
                return -ENOSYS;
        }
@@ -74,9 +83,21 @@ int sandbox_sysreset_get_status(struct udevice *dev, char *buf, int size)
        return 0;
 }
 
+int sandbox_sysreset_get_last(struct udevice *dev)
+{
+       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 = {
        .request        = sandbox_sysreset_request,
        .get_status     = sandbox_sysreset_get_status,
+       .get_last       = sandbox_sysreset_get_last,
 };
 
 static const struct udevice_id sandbox_sysreset_ids[] = {
@@ -94,6 +115,7 @@ U_BOOT_DRIVER(sysreset_sandbox) = {
 static struct sysreset_ops sandbox_warm_sysreset_ops = {
        .request        = sandbox_warm_sysreset_request,
        .get_status     = sandbox_warm_sysreset_get_status,
+       .get_last       = sandbox_warm_sysreset_get_last,
 };
 
 static const struct udevice_id sandbox_warm_sysreset_ids[] = {