public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Urja Rannikko <urjaman@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] sysreset: switch to using SYSRESET_POWER_OFF for poweroff
Date: Mon, 13 May 2019 12:17:12 +0000	[thread overview]
Message-ID: <20190513121714.7370-1-urjaman@gmail.com> (raw)

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.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
---
Note: I didnt touch the test/dm/sysreset.c code yet, mostly because
I wanted to get feedback on this first and that i'd need to understand
the tests properly to do that (and i havent used them before at all).
---
 arch/arm/mach-stm32mp/cmd_poweroff.c | 2 +-
 arch/sandbox/cpu/state.c             | 2 +-
 drivers/power/pmic/stpmic1.c         | 2 +-
 drivers/sysreset/sysreset_psci.c     | 2 +-
 drivers/sysreset/sysreset_sandbox.c  | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-stm32mp/cmd_poweroff.c b/arch/arm/mach-stm32mp/cmd_poweroff.c
index f54dd1daf2..62347425a0 100644
--- a/arch/arm/mach-stm32mp/cmd_poweroff.c
+++ b/arch/arm/mach-stm32mp/cmd_poweroff.c
@@ -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);
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index d3b9c05985..dee5fde4f7 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -355,7 +355,7 @@ 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));
 	memset(state->spi, '\0', sizeof(state->spi));
diff --git a/drivers/power/pmic/stpmic1.c b/drivers/power/pmic/stpmic1.c
index 65296c5fc3..eb735f4fe3 100644
--- a/drivers/power/pmic/stpmic1.c
+++ b/drivers/power/pmic/stpmic1.c
@@ -221,7 +221,7 @@ static int stpmic1_sysreset_request(struct udevice *dev, enum sysreset_t type)
 	struct udevice *pmic_dev;
 	int ret;
 
-	if (type != SYSRESET_POWER)
+	if (type != SYSRESET_POWER_OFF)
 		return -EPROTONOSUPPORT;
 
 	ret = uclass_get_device_by_driver(UCLASS_PMIC,
diff --git a/drivers/sysreset/sysreset_psci.c b/drivers/sysreset/sysreset_psci.c
index de2ec8aeb1..c7907b3226 100644
--- a/drivers/sysreset/sysreset_psci.c
+++ b/drivers/sysreset/sysreset_psci.c
@@ -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:
diff --git a/drivers/sysreset/sysreset_sandbox.c b/drivers/sysreset/sysreset_sandbox.c
index 38e2a7e241..8bc9f4b4cc 100644
--- a/drivers/sysreset/sysreset_sandbox.c
+++ b/drivers/sysreset/sysreset_sandbox.c
@@ -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;
 	default:
-- 
2.21.0

             reply	other threads:[~2019-05-13 12:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-13 12:17 Urja Rannikko [this message]
2019-05-13 12:17 ` [U-Boot] [PATCH 2/3] sysreset: move stm32mp sysreset poweroff implementation to sysreset uclass Urja Rannikko
2019-05-14 16:07   ` Patrice CHOTARD
2019-05-16 11:41     ` Urja Rannikko
2019-05-13 12:17 ` [U-Boot] [PATCH 3/3] rk8xx: add a sysreset driver for poweroff Urja Rannikko
2019-05-18 16:08   ` Simon Glass
2019-05-16  7:44 ` [U-Boot] [PATCH 1/3] sysreset: switch to using SYSRESET_POWER_OFF " Patrick DELAUNAY
2019-05-16 11:37   ` Urja Rannikko
2019-05-20 13:38     ` Patrick DELAUNAY
2019-07-26  7:37       ` Kever Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190513121714.7370-1-urjaman@gmail.com \
    --to=urjaman@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox