diff mbox series

[v2,31/38] dm: sysreset: Add a Kconfig option for the 'reset' command

Message ID 1613663886-83811-32-git-send-email-bmeng.cn@gmail.com
State Superseded
Delegated to: Priyanka Jain
Headers show
Series ppc: qemu: Convert qemu-ppce500 to driver model and enable additional driver support | expand

Commit Message

Bin Meng Feb. 18, 2021, 3:57 p.m. UTC
sysreset uclass driver provides an implementation of 'reset'
command using the sysreset_ APIs unconditionally. It also
supports the 'poweroff' command using the sysreset_ APIs,
but under a Kconfig option CONFIG_SYSRESET_CMD_POWEROFF.

Let's do the same for the 'reset' command, by introducing a
new Kconfig option CONFIG_SYSRESET_CMD_RESET, and set it to
on by default, to allow a board that don't have a sysreset
reset driver yet, but have a sysreset poweroff driver to
compile without any issue.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

Changes in v2:
- new patch: dm: sysreset: Add a Kconfig option for the 'reset' command

 drivers/sysreset/Kconfig           | 6 ++++++
 drivers/sysreset/sysreset-uclass.c | 2 ++
 2 files changed, 8 insertions(+)

Comments

Simon Glass Feb. 20, 2021, 11:55 a.m. UTC | #1
On Thu, 18 Feb 2021 at 09:00, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> sysreset uclass driver provides an implementation of 'reset'
> command using the sysreset_ APIs unconditionally. It also
> supports the 'poweroff' command using the sysreset_ APIs,
> but under a Kconfig option CONFIG_SYSRESET_CMD_POWEROFF.
>
> Let's do the same for the 'reset' command, by introducing a
> new Kconfig option CONFIG_SYSRESET_CMD_RESET, and set it to
> on by default, to allow a board that don't have a sysreset
> reset driver yet, but have a sysreset poweroff driver to
> compile without any issue.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
> Changes in v2:
> - new patch: dm: sysreset: Add a Kconfig option for the 'reset' command
>
>  drivers/sysreset/Kconfig           | 6 ++++++
>  drivers/sysreset/sysreset-uclass.c | 2 ++
>  2 files changed, 8 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Priyanka Jain Feb. 22, 2021, 9:15 a.m. UTC | #2
>-----Original Message-----
>From: Bin Meng <bmeng.cn@gmail.com>
>Sent: Thursday, February 18, 2021 9:28 PM
>To: Simon Glass <sjg@chromium.org>; Alexander Graf <agraf@csgraf.de>;
>Priyanka Jain <priyanka.jain@nxp.com>
>Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Tom Rini
><trini@konsulko.com>
>Subject: [PATCH v2 31/38] dm: sysreset: Add a Kconfig option for the 'reset'
>command
>
>sysreset uclass driver provides an implementation of 'reset'
>command using the sysreset_ APIs unconditionally. It also supports the
>'poweroff' command using the sysreset_ APIs, but under a Kconfig option
>CONFIG_SYSRESET_CMD_POWEROFF.
>
>Let's do the same for the 'reset' command, by introducing a new Kconfig
>option CONFIG_SYSRESET_CMD_RESET, and set it to on by default, to allow a
>board that don't have a sysreset reset driver yet, but have a sysreset
>poweroff driver to compile without any issue.
>
>Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
>---
>
>Changes in v2:
>- new patch: dm: sysreset: Add a Kconfig option for the 'reset' command
>
> drivers/sysreset/Kconfig           | 6 ++++++
> drivers/sysreset/sysreset-uclass.c | 2 ++
> 2 files changed, 8 insertions(+)
>

Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
diff mbox series

Patch

diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index 0e5c7c9..968dfa4 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -33,6 +33,12 @@  config TPL_SYSRESET
 
 if SYSRESET
 
+config SYSRESET_CMD_RESET
+	bool "sysreset implementation of the reset command"
+	default y
+	help
+	  Enable sysreset implementation of the reset command.
+
 if CMD_POWEROFF
 
 config SYSRESET_CMD_POWEROFF
diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
index a9908eb..6c9dc7a 100644
--- a/drivers/sysreset/sysreset-uclass.c
+++ b/drivers/sysreset/sysreset-uclass.c
@@ -119,6 +119,7 @@  void reset_cpu(ulong addr)
 }
 
 
+#if IS_ENABLED(CONFIG_SYSRESET_CMD_RESET)
 int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	printf("resetting ...\n");
@@ -128,6 +129,7 @@  int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 
 	return 0;
 }
+#endif
 
 #if IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
 int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])