diff mbox series

[RESEND,v1,2/4] dt-bindings: power: reset: Add alternate reboot mode format

Message ID 1597776856-12014-3-git-send-email-eberman@codeaurora.org
State New
Headers show
Series [RESEND,v1,1/4] dt-bindings: power: reset: Convert reboot-mode to YAML | expand

Commit Message

Elliot Berman Aug. 18, 2020, 6:54 p.m. UTC
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 <eberman@codeaurora.org>
---
 .../devicetree/bindings/power/reset/reboot-mode.yaml    | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Sebastian Reichel Aug. 25, 2020, 4:23 p.m. UTC | #1
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 <eberman@codeaurora.org>
> ---

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
>
Rob Herring Aug. 25, 2020, 9:25 p.m. UTC | #2
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 <eberman@codeaurora.org>
> ---
>  .../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
>
diff mbox series

Patch

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>;
+    };
 ...