public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd: reset: add parameters to specify reboot_mode
Date: Fri, 3 May 2019 22:33:13 +0200	[thread overview]
Message-ID: <b55d38ea-3e3e-906a-e440-3312e0c15a53@gmail.com> (raw)
In-Reply-To: <dfc72391-9219-293a-35a7-ce1c99d0b63a@denx.de>



On 03.05.19 22:27, Marek Vasut wrote:
> 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@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 ?

Ouch, I just saw the extra printf might have to be removed in a v2...

Anyway, except for that, I don't think it's platform or driver specific. 
It's just a way to make the cmd 'reset' take arguments that map to enum 
sysreset_t.

There is a problem in that other platforms without UCLASS_SYSRESET don't 
handle these arguments, but I thought UCLASS_SYSRESET would be the 
future, and the rest would be "legacy"?

Regards,
SImon

  reply	other threads:[~2019-05-03 20:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 20:25 [U-Boot] [PATCH] cmd: reset: add parameters to specify reboot_mode Simon Goldschmidt
2019-05-03 20:27 ` Marek Vasut
2019-05-03 20:33   ` Simon Goldschmidt [this message]
2019-05-03 20:37     ` Marek Vasut
2019-05-03 20:40       ` Simon Goldschmidt
2019-05-03 20:43         ` Marek Vasut
2019-05-03 21:10           ` Simon Glass
2019-05-04 18:23             ` Simon Goldschmidt
2019-07-10 18:50               ` Simon Goldschmidt
2019-07-29 10:47                 ` Simon Goldschmidt
2019-08-01 22:45                   ` Simon Glass
2019-08-02  5:53                     ` Simon Goldschmidt
2019-08-02 14:41                       ` Simon Glass
2019-10-09 18:13                         ` Simon Goldschmidt

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=b55d38ea-3e3e-906a-e440-3312e0c15a53@gmail.com \
    --to=simon.k.r.goldschmidt@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