sysreset: switch to using SYSRESET_POWER_OFF for poweroff
authorUrja Rannikko <urjaman@gmail.com>
Thu, 16 May 2019 21:48:41 +0000 (21:48 +0000)
committerKever Yang <kever.yang@rock-chips.com>
Mon, 19 Aug 2019 04:43:26 +0000 (12:43 +0800)
It seems that SYSRESET_POWER_OFF was added recently, and all previous code
used SYSRESET_POWER for poweroff. SYSRESET_POWER is supposed to be a
PMIC-level power cycle, not a poweroff.

(Comment by Simon Glass)
SYSRESET_POWER means to do a power reset (removing and reinstating all power)
SYSRESET_POWER_OFF means to turn the device off and leave it off

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
(Update comment to help understand the patch)
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
arch/arm/mach-stm32mp/cmd_poweroff.c
arch/sandbox/cpu/state.c
drivers/sysreset/sysreset_psci.c
drivers/sysreset/sysreset_sandbox.c

index f54dd1daf230d636be366b178d08197a2c5689aa..62347425a06b9364c547e54af64c54a91a2e609b 100644 (file)
@@ -14,7 +14,7 @@ int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        puts("poweroff ...\n");
        mdelay(100);
 
-       ret = sysreset_walk(SYSRESET_POWER);
+       ret = sysreset_walk(SYSRESET_POWER_OFF);
 
        if (ret == -EINPROGRESS)
                mdelay(1000);
index 2333240fda82b7059c8523dc4195511d5e351e96..dee5fde4f733caf0021907489b8c04a741eafb2e 100644 (file)
@@ -355,7 +355,6 @@ void state_reset_for_test(struct sandbox_state *state)
 {
        /* No reset yet, so mark it as such. Always allow power reset */
        state->last_sysreset = SYSRESET_COUNT;
-       state->sysreset_allowed[SYSRESET_POWER] = true;
        state->sysreset_allowed[SYSRESET_POWER_OFF] = true;
 
        memset(&state->wdt, '\0', sizeof(state->wdt));
index de2ec8aeb1ee73052e0ec5f03a6eb4dc3421c117..c7907b3226d96193c741f9bd56404051234b2a7a 100644 (file)
@@ -18,7 +18,7 @@ static int psci_sysreset_request(struct udevice *dev, enum sysreset_t type)
        case SYSRESET_COLD:
                function_id = PSCI_0_2_FN_SYSTEM_RESET;
                break;
-       case SYSRESET_POWER:
+       case SYSRESET_POWER_OFF:
                function_id = PSCI_0_2_FN_SYSTEM_OFF;
                break;
        default:
index 7dfd89460f0d5d3e0553550af0c9fa34271eaff5..69c22a70008fe5486d06459b4d569c398df93335 100644 (file)
@@ -57,13 +57,13 @@ 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();