Skip to contentSkip to conversation

cmd: reset: fixes related to Qualcomm's edl

PATCH In review Quentin Schulz 3 participants 8 messages May 7 – May 11

lore
Share & tools
lore
#0 lore raw

v2 cover cmd: reset: fixes related to Qualcomm's edl

Fix a missed dependency on the edl reset command option for deciding when to show the option in the help text.

Fix typo in reset command usage documentation.

Fix missing edl reset option in reset command usage documentation.

---
Changes in v2:
- added patch 1, fixing edl option being shown even when not usable,
- added patch 2, fixing "Do warm WARM" typo,
- added -edl to the synopsis,
- added requirement on CONFIG_SYSRESET_CMD_RESET_ARGS=y to docs,
- added info that an error message will be printed on unsupported
platforms but that the command will still succeed,
- Link to v1: https://patch.msgid.link/[email protected]

---
Quentin Schulz (3):
cmd: boot: fix edl being shown when not supported
doc: usage: cmd: reset: fix typo
doc: usage: cmd: reset: specify when the -edl option is available

 cmd/boot.c              |  3 +++
 doc/usage/cmd/reset.rst | 12 +++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

---
base-commit: 3cdd19089f1b1b7cd08530f33ff4708abcfd426c
change-id: 20260428-doc-sysreset-qcom-f5d21aa84142

Best regards,

Signature · 1 line
Quentin Schulz <[email protected]>
#1 lore raw

PATCH v2 1/3 cmd: boot: fix edl being shown when not supported

From: Quentin Schulz <[email protected]>

edl is implemented in the sysreset_ops.request_arg callback of the qcom-psci sysreset driver. That callback is only called from sysreset_request_arg() which is compiled only when CONFIG_SYSRESET_CMD_RESET_ARGS=y.

Therefore, only show the edl option if that symbol is enabled.

It is in a separate if block because any option but -w will only be handled when CONFIG_SYSRESET_CMD_RESET_ARGS=y as seen with the implementation in do_reset() in drivers/sysreset/sysreset-uclass.c.

Fixes ef06c5d76ff4 ("cmd: boot: Add '-edl' option to reset command documentation")
---
 cmd/boot.c | 3 +++
 1 file changed, 3 insertions(+)
cmd/boot.c +3 -0
index d80f9d8c05d..29cdf4a9a81 100644
@@ -60,8 +60,11 @@ U_BOOT_CMD(
 	reset, 2, 0,	do_reset,
 	"Perform RESET of the CPU",
 	"- cold boot without level specifier\n"
+#if IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_ARGS)
+// All options handled by sysreset drivers via their sysreset_ops.request_arg callback
 #ifdef CONFIG_SYSRESET_QCOM_PSCI
 	"reset -edl - Boot to Emergency DownLoad mode\n"
+#endif
 #endif
 	"reset -w - warm reset if implemented"
 );
Signature · 1 line
2.54.0
Reviewed-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] cmd: boot: fix edl being shown when not supported

Hi Quentin,

Quoted 21 lines · Quentin Schulz

cmd: boot: fix edl being shown when not supported

edl is implemented in the sysreset_ops.request_arg callback of the qcom-psci sysreset driver. That callback is only called from sysreset_request_arg() which is compiled only when CONFIG_SYSRESET_CMD_RESET_ARGS=y.

Therefore, only show the edl option if that symbol is enabled.

It is in a separate if block because any option but -w will only be handled when CONFIG_SYSRESET_CMD_RESET_ARGS=y as seen with the implementation in do_reset() in drivers/sysreset/sysreset-uclass.c.

Fixes ef06c5d76ff4 ("cmd: boot: Add '-edl' option to reset command documentation")

cmd/boot.c | 3 +++

 1 file changed, 3 insertions(+)

cmd/boot.c U_BOOT_CMD( · line 68

Quoted 9 lines
cmd/boot.c +3 -0
@@ -60,8 +60,11 @@ U_BOOT_CMD(
      reset, 2, 0,    do_reset,
      "Perform RESET of the CPU",
      "- cold boot without level specifier\n"
+#if IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_ARGS)
+// All options handled by sysreset drivers via their sysreset_ops.request_arg callback
 #ifdef CONFIG_SYSRESET_QCOM_PSCI
      "reset -edl - Boot to Emergency DownLoad mode\n"
+#endif
 #endif

Should SYSRESET_QCOM_PSCI select SYSRESET_CMD_RESET_ARGS ?

Regards,
Simon

#3 lore raw

Re: [PATCH v2 1/3] cmd: boot: fix edl being shown when not supported

Hi Simon,

Quoted 36 lines · Simon Glass

Hi Quentin,

Quoted 21 lines · Quentin Schulz

cmd: boot: fix edl being shown when not supported

edl is implemented in the sysreset_ops.request_arg callback of the qcom-psci sysreset driver. That callback is only called from sysreset_request_arg() which is compiled only when CONFIG_SYSRESET_CMD_RESET_ARGS=y.

Therefore, only show the edl option if that symbol is enabled.

It is in a separate if block because any option but -w will only be handled when CONFIG_SYSRESET_CMD_RESET_ARGS=y as seen with the implementation in do_reset() in drivers/sysreset/sysreset-uclass.c.

Fixes ef06c5d76ff4 ("cmd: boot: Add '-edl' option to reset command documentation")

cmd/boot.c | 3 +++

  1 file changed, 3 insertions(+)

cmd/boot.c U_BOOT_CMD( · line 68

Quoted 9 lines
cmd/boot.c +3 -0
@@ -60,8 +60,11 @@ U_BOOT_CMD(
       reset, 2, 0,    do_reset,
       "Perform RESET of the CPU",
       "- cold boot without level specifier\n"
+#if IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_ARGS)
+// All options handled by sysreset drivers via their sysreset_ops.request_arg callback
  #ifdef CONFIG_SYSRESET_QCOM_PSCI
       "reset -edl - Boot to Emergency DownLoad mode\n"
+#endif
  #endif
Quoted 2 lines

Should SYSRESET_QCOM_PSCI select SYSRESET_CMD_RESET_ARGS ?

I don't think so, it can work without? But that's up to Varadarajan/Casey to tell us.

Cheers,
Quentin

#4 lore raw

PATCH v2 2/3 doc: usage: cmd: reset: fix typo

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

"Do warm WARM" doesn't mean anything, I'm assuming the intent was to say "Do WARM reset" so reword.

Fixes 34e452dd0252 ("doc: usage: Group all shell command docs into cmd/ sub-directory")
---
 doc/usage/cmd/reset.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/usage/cmd/reset.rst +1 -1
index 366b17eea16..88261293924 100644
@@ -20,7 +20,7 @@ Perform reset of the CPU. By default does COLD reset, which resets CPU,
 DDR and peripherals, on some boards also resets external PMIC.
 
 -w
-    Do warm WARM, reset CPU but keep peripheral/DDR/PMIC active.
+    Do WARM reset: reset CPU but keep peripheral/DDR/PMIC active.
 
 -edl
     Boot to Emergency DownLoad mode on supported Qualcomm platforms.
Signature · 1 line
2.54.0
Reviewed-by on v2 2/3
#5 lore raw

Re: [PATCH v2 2/3] doc: usage: cmd: reset: fix typo

Quoted 10 lines · Quentin Schulz

doc: usage: cmd: reset: fix typo

"Do warm WARM" doesn't mean anything, I'm assuming the intent was to say "Do WARM reset" so reword.

Fixes 34e452dd0252 ("doc: usage: Group all shell command docs into cmd/ sub-directory")

doc/usage/cmd/reset.rst | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
#6 lore raw

PATCH v2 3/3 doc: usage: cmd: reset: specify when the -edl option is available

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

The option is only available when CONFIG_SYSRESET_QCOM_PSCI is enabled, so let's make that explicit in the boot cmd documentation.

Due to the implementation in drivers/sysreset/sysreset-uclass.c do_reset() function, all options to the reset command are passed to all sysreset drivers' sysreset_ops.request_arg callback (including -w) which is only available when CONFIG_SYSRESET_CMD_RESET_ARGS=y. -w, however, works also without this option.

Fixes ef06c5d76ff4 ("cmd: boot: Add '-edl' option to reset command documentation")
---
 doc/usage/cmd/reset.rst | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
doc/usage/cmd/reset.rst +8 -2
index 88261293924..79bc8b9deca 100644
@@ -11,7 +11,9 @@ Synopsis
 
 ::
 
-    reset [-w]
+    reset
+    reset -w
+    reset -edl
 
 Description
 -----------
@@ -22,8 +24,12 @@ DDR and peripherals, on some boards also resets external PMIC.
 -w
     Do WARM reset: reset CPU but keep peripheral/DDR/PMIC active.
 
+All other options require CONFIG_SYSRESET_CMD_RESET_ARGS=y.
+
 -edl
-    Boot to Emergency DownLoad mode on supported Qualcomm platforms.
+    Boot to Emergency DownLoad mode on supported Qualcomm platforms. Unsupported
+    platforms will print an error message but the command will successfully
+    return (having done nothing). Requires CONFIG_SYSRESET_QCOM_PSCI=y.
 
 Return value
 ------------
Signature · 1 line
2.54.0
Reviewed-by on v2 3/3
#7 lore raw

Re: [PATCH v2 3/3] doc: usage: cmd: reset: specify when the -edl option is available

Hi Quentin,

Quoted 11 lines · Quentin Schulz

doc: usage: cmd: reset: specify when the -edl option is available

The option is only available when CONFIG_SYSRESET_QCOM_PSCI is enabled, so let's make that explicit in the boot cmd documentation.

Due to the implementation in drivers/sysreset/sysreset-uclass.c do_reset() function, all options to the reset command are passed to all sysreset drivers' sysreset_ops.request_arg callback (including -w) which is only available when CONFIG_SYSRESET_CMD_RESET_ARGS=y. -w, however, works also without this option.

Quoted 5 lines
Fixes ef06c5d76ff4 ("cmd: boot: Add '-edl' option to reset command documentation")

doc/usage/cmd/reset.rst | 10 ++++++++--

 1 file changed, 8 insertions(+), 2 deletions(-)

nits below

doc/usage/cmd/reset.rst DDR and peripherals, on some boards also resets external PMIC. · line 32

Quoted 12 lines
doc/usage/cmd/reset.rst +5 -1
@@ -22,8 +24,12 @@ DDR and peripherals, on some boards also resets external PMIC.
 -w
     Do WARM reset: reset CPU but keep peripheral/DDR/PMIC active.
 
+All other options require CONFIG_SYSRESET_CMD_RESET_ARGS=y.
+
 -edl
-    Boot to Emergency DownLoad mode on supported Qualcomm platforms.
+    Boot to Emergency DownLoad mode on supported Qualcomm platforms. Unsupported
+    platforms will print an error message but the command will successfully
+    return (having done nothing).

When sysreset_walk_arg() returns anything other than -EINPROGRESS (e.g. -EPROTONOSUPPORT from qcom_psci_sysreset_request_arg(), or -ENOSYS when CONFIG_SYSRESET_QCOM_PSCI is not enabled), execution falls through to sysreset_walk_halt(reset_type) with reset_type still SYSRESET_COLD

So 'reset -edl' on an unsupported platform actually performs a cold reset (or hang() if no driver implements it).

doc/usage/cmd/reset.rst Synopsis · line 16

Quoted 4 lines
doc/usage/cmd/reset.rst +3 -1
-    reset [-w]
+    reset
+    reset -w
+    reset -edl

nit: I would suggest 'reset [-w | -edl]'

Regards,
Simon