[U-Boot] [PATCH] cmd: reset: add parameters to specify reboot_mode

Marek Vasut marex at denx.de
Fri May 3 20:27:55 UTC 2019


On 5/3/19 10:25 PM, Simon Goldschmidt wrote:
> This patch adds parameter support for the 'reset' command to specify
> the reboot mode (cold vs. warm).
> 
> Checking these parameters is implemented in the DM implementation.
> 
> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt at gmail.com>
> ---
> 
>  cmd/boot.c                         |  4 ++--
>  drivers/sysreset/sysreset-uclass.c | 17 ++++++++++++++++-
>  2 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/cmd/boot.c b/cmd/boot.c
> index 9150fce80b..c3f33a9ca3 100644
> --- a/cmd/boot.c
> +++ b/cmd/boot.c
> @@ -56,9 +56,9 @@ U_BOOT_CMD(
>  #endif
>  
>  U_BOOT_CMD(
> -	reset, 1, 0,	do_reset,
> +	reset, 2, 0,	do_reset,
>  	"Perform RESET of the CPU",
> -	""
> +	"[<cold|warm>] - type of reboot"
>  );
>  
>  #ifdef CONFIG_CMD_POWEROFF
> diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
> index ad831c703a..fbda3f44f2 100644
> --- a/drivers/sysreset/sysreset-uclass.c
> +++ b/drivers/sysreset/sysreset-uclass.c
> @@ -111,9 +111,24 @@ void reset_cpu(ulong addr)
>  
>  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  {
> +	enum sysreset_t reboot_mode = SYSRESET_COLD;
> +
> +	if (argc > 1 && argv[1]) {
> +		switch (*argv[1]) {
> +		case 'w':
> +			reboot_mode = SYSRESET_WARM;
> +			printf("warm ");
> +			break;
> +		case 'c':
> +			reboot_mode = SYSRESET_COLD;
> +			printf("cold ");
> +			break;

This looks like a platform or driver specific stuff ?

-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list