2020-08-18 18:55:52

by Elliot Berman

[permalink] [raw]
Subject: [RESEND PATCH v1 0/4] Support spaces in reboot mode framework

Resending with updated recepients and cover subject.

PM8150 uses reboot-mode framework to set magic values for bootloader to read
during next boot. dm-verity wants to use "dm-verity device corrupted" [1] as
the restart command, however the reboot-mode framework does not support spaces
in the command line as devicetree property names cannot have spaces. In order
to support the PM8150 comamnds, this patch series adds two new optional array
properties to reboot-mode framework: reboot-mode-names and reboot-mode-magic.
The arrays supply the commands and magic values, respectively.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-verity-target.c?h=v5.5#n255

Elliot Berman (4):
dt-bindings: power: reset: Convert reboot-mode to YAML
dt-bindings: power: reset: Add alternate reboot mode format
power: reset: Add support for reboot mode alternate properties
arm64: dts: qcom: pm8150: Add reboot magic

.../bindings/power/reset/reboot-mode.txt | 25 ---------
.../bindings/power/reset/reboot-mode.yaml | 64 ++++++++++++++++++++++
arch/arm64/boot/dts/qcom/pm8150.dtsi | 5 ++
drivers/power/reset/reboot-mode.c | 42 +++++++++++++-
4 files changed, 110 insertions(+), 26 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/power/reset/reboot-mode.txt
create mode 100644 Documentation/devicetree/bindings/power/reset/reboot-mode.yaml

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2020-08-18 18:55:57

by Elliot Berman

[permalink] [raw]
Subject: [RESEND PATCH v1 1/4] dt-bindings: power: reset: Convert reboot-mode to YAML

Convert reboot-mode bindings to YAML.

Signed-off-by: Elliot Berman <[email protected]>
---
.../bindings/power/reset/reboot-mode.txt | 25 ------------
.../bindings/power/reset/reboot-mode.yaml | 47 ++++++++++++++++++++++
2 files changed, 47 insertions(+), 25 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/power/reset/reboot-mode.txt
create mode 100644 Documentation/devicetree/bindings/power/reset/reboot-mode.yaml

diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.txt b/Documentation/devicetree/bindings/power/reset/reboot-mode.txt
deleted file mode 100644
index de34f27..0000000
--- a/Documentation/devicetree/bindings/power/reset/reboot-mode.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-Generic reboot mode core map driver
-
-This driver get reboot mode arguments and call the write
-interface to store the magic value in special register
-or ram. Then the bootloader can read it and take different
-action according to the argument stored.
-
-All mode properties are vendor specific, it is a indication to tell
-the bootloader what to do when the system reboots, and should be named
-as mode-xxx = <magic> (xxx is mode name, magic should be a none-zero value).
-
-For example modes common on Android platform:
-- mode-normal: Normal reboot mode, system reboot with command "reboot".
-- mode-recovery: Android Recovery mode, it is a mode to format the device or update a new image.
-- mode-bootloader: Android fastboot mode, it's a mode to re-flash partitions on the Android based device.
-- mode-loader: A bootloader mode, it's a mode used to download image on Rockchip platform,
- usually used in development.
-
-Example:
- reboot-mode {
- mode-normal = <BOOT_NORMAL>;
- mode-recovery = <BOOT_RECOVERY>;
- mode-bootloader = <BOOT_FASTBOOT>;
- mode-loader = <BOOT_BL_DOWNLOAD>;
- }
diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
new file mode 100644
index 0000000..a6c9102
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/reset/reboot-mode.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic reboot mode core map
+
+maintainers:
+ - Andy Yan <[email protected]>
+
+description: |
+ This driver get reboot mode arguments and call the write
+ interface to store the magic value in special register
+ or ram. Then the bootloader can read it and take different
+ action according to the argument stored.
+
+ All mode properties are vendor specific, it is a indication to tell
+ the bootloader what to do when the system reboots, and should be named
+ as mode-xxx = <magic> (xxx is mode name, magic should be a non-zero value).
+
+ For example, modes common Android platform are:
+ - normal: Normal reboot mode, system reboot with command "reboot".
+ - recovery: Android Recovery mode, it is a mode to format the device or update a new image.
+ - bootloader: Android fastboot mode, it's a mode to re-flash partitions on the Android based device.
+ - loader: A bootloader mode, it's a mode used to download image on Rockchip platform,
+ usually used in development.
+
+properties:
+ mode-normal:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: |
+ Default value to set on a reboot if no command was provided.
+
+patternProperties:
+ "^mode-.*$":
+ $ref: /schemas/types.yaml#/definitions/uint32
+
+examples:
+ - |
+ reboot-mode {
+ mode-normal = <0>;
+ mode-recovery = <1>;
+ mode-bootloader = <2>;
+ mode-loader = <3>;
+ };
+...
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

2020-08-18 18:57:43

by Elliot Berman

[permalink] [raw]
Subject: [RESEND PATCH v1 4/4] arm64: dts: qcom: pm8150: Add reboot magic

Add reboot command magic values for pm8150 pon device.

Signed-off-by: Elliot Berman <[email protected]>
---
arch/arm64/boot/dts/qcom/pm8150.dtsi | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/pm8150.dtsi b/arch/arm64/boot/dts/qcom/pm8150.dtsi
index 1b64069..afd6231 100644
--- a/arch/arm64/boot/dts/qcom/pm8150.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8150.dtsi
@@ -50,6 +50,11 @@
pon: power-on@800 {
compatible = "qcom,pm8916-pon";
reg = <0x0800>;
+
+ reboot-mode-names = "bootloader", "recovery",
+ "dm-verity device corrupted";
+ reboot-mode-magic = <0x1>, <0x2>, <0x4>;
+
pwrkey {
compatible = "qcom,pm8941-pwrkey";
interrupts = <0x0 0x8 0x0 IRQ_TYPE_EDGE_BOTH>;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

2020-08-18 18:58:07

by Elliot Berman

[permalink] [raw]
Subject: [RESEND PATCH v1 2/4] dt-bindings: power: reset: Add alternate reboot mode format

Current reboot-mode device tree schema does not support reboot commands
with spaces in them [1]. Add an optional new node "reboot-mode-names"
and "reboot-mode-magic" which add an array of strings and u32s,
respectively which would permit any string in this framework.

[1]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-verity-target.c?h=v5.5#n255

Signed-off-by: Elliot Berman <[email protected]>
---
.../devicetree/bindings/power/reset/reboot-mode.yaml | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
index a6c9102..4ea6b33 100644
--- a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
+++ b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
@@ -19,6 +19,9 @@ description: |
the bootloader what to do when the system reboots, and should be named
as mode-xxx = <magic> (xxx is mode name, magic should be a non-zero value).

+ reboot-mode-magic and reboot-mode-names may be used in addition/instead of
+ mode-xxx style.
+
For example, modes common Android platform are:
- normal: Normal reboot mode, system reboot with command "reboot".
- recovery: Android Recovery mode, it is a mode to format the device or update a new image.
@@ -32,6 +35,14 @@ properties:
description: |
Default value to set on a reboot if no command was provided.

+ reboot-mode-names:
+ $ref: /schemas/types.yaml#/definitions/string-array
+ description: List of reboot commands, paired with reboot-mode-magic by index
+
+ reboot-mode-magic:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description: List of reboot magic, paired with reboot-mode-names by index
+
patternProperties:
"^mode-.*$":
$ref: /schemas/types.yaml#/definitions/uint32
@@ -44,4 +55,10 @@ examples:
mode-bootloader = <2>;
mode-loader = <3>;
};
+
+ - |
+ reboot-mode {
+ reboot-mode-names = "normal", "bootloader", "dm-verity device corrupted";
+ reboot-mode-magic = <0x0>, <0x1>, <0xf>;
+ };
...
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

2020-08-18 18:58:42

by Elliot Berman

[permalink] [raw]
Subject: [RESEND PATCH v1 3/4] power: reset: Add support for reboot mode alternate properties

Reboot mode driver does not currently support reboot commands with
spaces in them [1]. Add an optional new node "reboot-mode-names" and
"reboot-mode-magic" which add an array of strings and u32s, respectively
which would permit any string in this framework.

Signed-off-by: Elliot Berman <[email protected]>
---
drivers/power/reset/reboot-mode.c | 42 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)

diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index b4076b1..363734d 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -64,8 +64,9 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
struct mode_info *info;
struct property *prop;
struct device_node *np = reboot->dev->of_node;
+ const char *mode_name;
size_t len = strlen(PREFIX);
- int ret;
+ int ret, count, i;

INIT_LIST_HEAD(&reboot->head);

@@ -101,6 +102,45 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
list_add_tail(&info->list, &reboot->head);
}

+ count = of_property_count_u32_elems(np, "reboot-mode-magic");
+ for (i = 0; i < count; i++) {
+ info = devm_kzalloc(reboot->dev, sizeof(*info), GFP_KERNEL);
+ if (!info) {
+ ret = -ENOMEM;
+ goto error;
+ }
+
+ if (of_property_read_string_index(np, "reboot-mode-names", i,
+ &mode_name)) {
+ dev_err(reboot->dev, "unable to read reboot-mode-names[%d]\n",
+ i);
+ ret = -EINVAL;
+ goto error;
+ }
+ info->mode = kstrdup_const(mode_name, GFP_KERNEL);
+ if (!info->mode) {
+ ret = -ENOMEM;
+ goto error;
+ } else if (info->mode[0] == '\0') {
+ dev_err(reboot->dev, "invalid reboot-mode-names[%d]: too short!\n",
+ i);
+ kfree_const(info->mode);
+ ret = -EINVAL;
+ goto error;
+ }
+
+ if (of_property_read_u32_index(np, "reboot-mode-magic", i,
+ &info->magic)) {
+ dev_err(reboot->dev, "unable to read reboot-mode-magic[%d]\n",
+ i);
+ kfree_const(info->mode);
+ ret = -EINVAL;
+ goto error;
+ }
+
+ list_add_tail(&info->list, &reboot->head);
+ }
+
reboot->reboot_notifier.notifier_call = reboot_mode_notify;
register_reboot_notifier(&reboot->reboot_notifier);

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

2020-08-25 16:22:25

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [RESEND PATCH v1 1/4] dt-bindings: power: reset: Convert reboot-mode to YAML

Hi,

Thanks, queued.

-- Sebastian

On Tue, Aug 18, 2020 at 11:54:13AM -0700, Elliot Berman wrote:
> Convert reboot-mode bindings to YAML.
>
> Signed-off-by: Elliot Berman <[email protected]>
> ---
> .../bindings/power/reset/reboot-mode.txt | 25 ------------
> .../bindings/power/reset/reboot-mode.yaml | 47 ++++++++++++++++++++++
> 2 files changed, 47 insertions(+), 25 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/power/reset/reboot-mode.txt
> create mode 100644 Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
>
> diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.txt b/Documentation/devicetree/bindings/power/reset/reboot-mode.txt
> deleted file mode 100644
> index de34f27..0000000
> --- a/Documentation/devicetree/bindings/power/reset/reboot-mode.txt
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -Generic reboot mode core map driver
> -
> -This driver get reboot mode arguments and call the write
> -interface to store the magic value in special register
> -or ram. Then the bootloader can read it and take different
> -action according to the argument stored.
> -
> -All mode properties are vendor specific, it is a indication to tell
> -the bootloader what to do when the system reboots, and should be named
> -as mode-xxx = <magic> (xxx is mode name, magic should be a none-zero value).
> -
> -For example modes common on Android platform:
> -- mode-normal: Normal reboot mode, system reboot with command "reboot".
> -- mode-recovery: Android Recovery mode, it is a mode to format the device or update a new image.
> -- mode-bootloader: Android fastboot mode, it's a mode to re-flash partitions on the Android based device.
> -- mode-loader: A bootloader mode, it's a mode used to download image on Rockchip platform,
> - usually used in development.
> -
> -Example:
> - reboot-mode {
> - mode-normal = <BOOT_NORMAL>;
> - mode-recovery = <BOOT_RECOVERY>;
> - mode-bootloader = <BOOT_FASTBOOT>;
> - mode-loader = <BOOT_BL_DOWNLOAD>;
> - }
> diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> new file mode 100644
> index 0000000..a6c9102
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> @@ -0,0 +1,47 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/reset/reboot-mode.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Generic reboot mode core map
> +
> +maintainers:
> + - Andy Yan <[email protected]>
> +
> +description: |
> + This driver get reboot mode arguments and call the write
> + interface to store the magic value in special register
> + or ram. Then the bootloader can read it and take different
> + action according to the argument stored.
> +
> + All mode properties are vendor specific, it is a indication to tell
> + the bootloader what to do when the system reboots, and should be named
> + as mode-xxx = <magic> (xxx is mode name, magic should be a non-zero value).
> +
> + For example, modes common Android platform are:
> + - normal: Normal reboot mode, system reboot with command "reboot".
> + - recovery: Android Recovery mode, it is a mode to format the device or update a new image.
> + - bootloader: Android fastboot mode, it's a mode to re-flash partitions on the Android based device.
> + - loader: A bootloader mode, it's a mode used to download image on Rockchip platform,
> + usually used in development.
> +
> +properties:
> + mode-normal:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: |
> + Default value to set on a reboot if no command was provided.
> +
> +patternProperties:
> + "^mode-.*$":
> + $ref: /schemas/types.yaml#/definitions/uint32
> +
> +examples:
> + - |
> + reboot-mode {
> + mode-normal = <0>;
> + mode-recovery = <1>;
> + mode-bootloader = <2>;
> + mode-loader = <3>;
> + };
> +...
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>


Attachments:
(No filename) (4.21 kB)
signature.asc (849.00 B)
Download all attachments

2020-08-25 16:27:17

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [RESEND PATCH v1 2/4] dt-bindings: power: reset: Add alternate reboot mode format

Hi,

On Tue, Aug 18, 2020 at 11:54:14AM -0700, Elliot Berman wrote:
> Current reboot-mode device tree schema does not support reboot commands
> with spaces in them [1]. Add an optional new node "reboot-mode-names"
> and "reboot-mode-magic" which add an array of strings and u32s,
> respectively which would permit any string in this framework.
>
> [1]:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-verity-target.c?h=v5.5#n255
>
> Signed-off-by: Elliot Berman <[email protected]>
> ---

I'm waiting for an Ack from Rob for this one.

-- Sebastian

> .../devicetree/bindings/power/reset/reboot-mode.yaml | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> index a6c9102..4ea6b33 100644
> --- a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> +++ b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> @@ -19,6 +19,9 @@ description: |
> the bootloader what to do when the system reboots, and should be named
> as mode-xxx = <magic> (xxx is mode name, magic should be a non-zero value).
>
> + reboot-mode-magic and reboot-mode-names may be used in addition/instead of
> + mode-xxx style.
> +
> For example, modes common Android platform are:
> - normal: Normal reboot mode, system reboot with command "reboot".
> - recovery: Android Recovery mode, it is a mode to format the device or update a new image.
> @@ -32,6 +35,14 @@ properties:
> description: |
> Default value to set on a reboot if no command was provided.
>
> + reboot-mode-names:
> + $ref: /schemas/types.yaml#/definitions/string-array
> + description: List of reboot commands, paired with reboot-mode-magic by index
> +
> + reboot-mode-magic:
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + description: List of reboot magic, paired with reboot-mode-names by index
> +
> patternProperties:
> "^mode-.*$":
> $ref: /schemas/types.yaml#/definitions/uint32
> @@ -44,4 +55,10 @@ examples:
> mode-bootloader = <2>;
> mode-loader = <3>;
> };
> +
> + - |
> + reboot-mode {
> + reboot-mode-names = "normal", "bootloader", "dm-verity device corrupted";
> + reboot-mode-magic = <0x0>, <0x1>, <0xf>;
> + };
> ...
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>


Attachments:
(No filename) (2.54 kB)
signature.asc (849.00 B)
Download all attachments

2020-08-25 21:26:28

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [RESEND PATCH v1 2/4] dt-bindings: power: reset: Add alternate reboot mode format

On Tue, Aug 18, 2020 at 11:54:14AM -0700, Elliot Berman wrote:
> Current reboot-mode device tree schema does not support reboot commands
> with spaces in them [1]. Add an optional new node "reboot-mode-names"
> and "reboot-mode-magic" which add an array of strings and u32s,
> respectively which would permit any string in this framework.

Kind of a weak justification. The intent was for the names to be a key,
not a multi word description which your example seems to be. Is
"dm-verity device corrupted" something Android has already standardized
on?

>
> [1]:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-verity-target.c?h=v5.5#n255
>
> Signed-off-by: Elliot Berman <[email protected]>
> ---
> .../devicetree/bindings/power/reset/reboot-mode.yaml | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> index a6c9102..4ea6b33 100644
> --- a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> +++ b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> @@ -19,6 +19,9 @@ description: |
> the bootloader what to do when the system reboots, and should be named
> as mode-xxx = <magic> (xxx is mode name, magic should be a non-zero value).
>
> + reboot-mode-magic and reboot-mode-names may be used in addition/instead of
> + mode-xxx style.

It should be either/or in my opinion, not both.

> +
> For example, modes common Android platform are:
> - normal: Normal reboot mode, system reboot with command "reboot".
> - recovery: Android Recovery mode, it is a mode to format the device or update a new image.
> @@ -32,6 +35,14 @@ properties:
> description: |
> Default value to set on a reboot if no command was provided.
>
> + reboot-mode-names:
> + $ref: /schemas/types.yaml#/definitions/string-array
> + description: List of reboot commands, paired with reboot-mode-magic by index
> +
> + reboot-mode-magic:

'reboot-modes' would align with normal patterns.

> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + description: List of reboot magic, paired with reboot-mode-names by index
> +
> patternProperties:
> "^mode-.*$":
> $ref: /schemas/types.yaml#/definitions/uint32
> @@ -44,4 +55,10 @@ examples:
> mode-bootloader = <2>;
> mode-loader = <3>;
> };
> +
> + - |
> + reboot-mode {
> + reboot-mode-names = "normal", "bootloader", "dm-verity device corrupted";
> + reboot-mode-magic = <0x0>, <0x1>, <0xf>;
> + };
> ...
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>

2020-08-26 18:41:18

by Elliot Berman

[permalink] [raw]
Subject: Re: [RESEND PATCH v1 2/4] dt-bindings: power: reset: Add alternate reboot mode format

On 8/25/2020 5:25 PM, Rob Herring wrote:
> On Tue, Aug 18, 2020 at 11:54:14AM -0700, Elliot Berman wrote:
>> Current reboot-mode device tree schema does not support reboot commands
>> with spaces in them [1]. Add an optional new node "reboot-mode-names"
>> and "reboot-mode-magic" which add an array of strings and u32s,
>> respectively which would permit any string in this framework.
>
> Kind of a weak justification. The intent was for the names to be a key,
> not a multi word description which your example seems to be. Is
> "dm-verity device corrupted" something Android has already standardized
> on?

+Eric/Sami to comment further

I wonder if you're thinking it's better to change the kernel_restart in
dm-verity-target.c?

Alternatively, I could respin so that spaces in the reboot cmd is
replaced with "-" in reboot_mode_notify(). This way, there is no need to
change dm-verity driver or change devicetree schema. i.e.:

@@ -44,9 +44,13 @@ static int reboot_mode_notify(struct notifier_block
*this,
{
struct reboot_mode_driver *reboot;
unsigned int magic;
+ char *reboot_cmd;
+
+ reboot_cmd = kstrdup(cmd, GFP_KERNEL);
+ strreplace(reboot_cmd, ' ', '-');

reboot = container_of(this, struct reboot_mode_driver,
reboot_notifier);
- magic = get_reboot_mode_magic(reboot, cmd);
+ magic = get_reboot_mode_magic(reboot, reboot_cmd);
if (magic)
reboot->write(reboot, magic);

>
>>
>> [1]:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-verity-target.c?h=v5.5#n255
>>
>> Signed-off-by: Elliot Berman <[email protected]>
>> ---
>> .../devicetree/bindings/power/reset/reboot-mode.yaml | 17 +++++++++++++++++
>> 1 file changed, 17 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
>> index a6c9102..4ea6b33 100644
>> --- a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
>> +++ b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
>> @@ -19,6 +19,9 @@ description: |
>> the bootloader what to do when the system reboots, and should be named
>> as mode-xxx = <magic> (xxx is mode name, magic should be a non-zero value).
>>
>> + reboot-mode-magic and reboot-mode-names may be used in addition/instead of
>> + mode-xxx style.
>
> It should be either/or in my opinion, not both.

OK, I can fix in the next patch.

>
>> +
>> For example, modes common Android platform are:
>> - normal: Normal reboot mode, system reboot with command "reboot".
>> - recovery: Android Recovery mode, it is a mode to format the device or update a new image.
>> @@ -32,6 +35,14 @@ properties:
>> description: |
>> Default value to set on a reboot if no command was provided.
>>
>> + reboot-mode-names:
>> + $ref: /schemas/types.yaml#/definitions/string-array
>> + description: List of reboot commands, paired with reboot-mode-magic by index
>> +
>> + reboot-mode-magic:
>
> 'reboot-modes' would align with normal patterns.

Ditto

>
>> + $ref: /schemas/types.yaml#/definitions/uint32-array
>> + description: List of reboot magic, paired with reboot-mode-names by index
>> +
>> patternProperties:
>> "^mode-.*$":
>> $ref: /schemas/types.yaml#/definitions/uint32
>> @@ -44,4 +55,10 @@ examples:
>> mode-bootloader = <2>;
>> mode-loader = <3>;
>> };
>> +
>> + - |
>> + reboot-mode {
>> + reboot-mode-names = "normal", "bootloader", "dm-verity device corrupted";
>> + reboot-mode-magic = <0x0>, <0x1>, <0xf>;
>> + };
>> ...
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
>> a Linux Foundation Collaborative Project
>>