[2/4] dt-bindings: power: reset: atmel,at91sam9260-shdwc: convert to yaml

Message ID 20230523061512.195271-3-claudiu.beznea@microchip.com
State New
Headers
Series dt-bindings: power: reset: at91: convert to YAML |

Commit Message

Claudiu Beznea May 23, 2023, 6:15 a.m. UTC
  Convert Atmel shutdown controller to YAML.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 .../devicetree/bindings/arm/atmel-sysregs.txt | 31 -------
 .../power/reset/atmel,at91sam9260-shdwc.yaml  | 81 +++++++++++++++++++
 2 files changed, 81 insertions(+), 31 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/reset/atmel,at91sam9260-shdwc.yaml
  

Comments

Conor Dooley May 23, 2023, 6:27 p.m. UTC | #1
Hey Claudiu,

On Tue, May 23, 2023 at 09:15:10AM +0300, Claudiu Beznea wrote:
> Convert Atmel shutdown controller to YAML.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

> diff --git a/Documentation/devicetree/bindings/power/reset/atmel,at91sam9260-shdwc.yaml b/Documentation/devicetree/bindings/power/reset/atmel,at91sam9260-shdwc.yaml
> new file mode 100644
> index 000000000000..3b3162677db3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/reset/atmel,at91sam9260-shdwc.yaml
> @@ -0,0 +1,81 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

I think you'll need an explict Ack from Rob as the text binding has no
licence text.

> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/reset/atmel,at91sam9260-shdwc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Atmel SHDWC Shutdown Controller
> +
> +maintainers:
> +  - Claudiu Beznea <claudiu.beznea@microchip.com>
> +
> +description: |
> +  Atmel SHDWC shutdown controller controls the power supplies VDDIO and VDDCORE
> +  and the wake-up detection on debounced input lines.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - atmel,at91sam9260-shdwc
> +      - atmel,at91sam9rl-shdwc
> +      - atmel,at91sam9x5-shdwc

For my own curiosity, is this x a wildcard or part of the product name?
Quick google was slightly confusing.

> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 1
> +
> +  atmel,wakeup-mode:
> +    description: operation mode of the wakeup mode
> +    $ref: /schemas/types.yaml#/definitions/string
> +    enum: [ none, high, low, any ]
> +
> +  atmel,wakeup-counter:
> +    description: counter on wake-up 0
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]

This can just be
minimum: 0
maximum: 15
I think.

Otherwise, looks good to me.

Thanks,
Conor.
  
Nicolas Ferre May 24, 2023, 8:12 a.m. UTC | #2
Conor,

On 23/05/2023 at 20:27, Conor Dooley wrote:

[..]

>> +      - atmel,at91sam9x5-shdwc
> For my own curiosity, is this x a wildcard or part of the product name?
> Quick google was slightly confusing.

In this special case, the x is indeed a wildcard, but as the underlying 
silicon is the same, we choose (a long time ago) to anyway go with this 
naming for the "5 series" (which does not contain the sam9g45 BTW, to 
make things easier ;-)).

Regards,
   Nicolas

-- 
Nicolas Ferre
  

Patch

diff --git a/Documentation/devicetree/bindings/arm/atmel-sysregs.txt b/Documentation/devicetree/bindings/arm/atmel-sysregs.txt
index ab1b352344ae..e6b2fb291b45 100644
--- a/Documentation/devicetree/bindings/arm/atmel-sysregs.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-sysregs.txt
@@ -52,37 +52,6 @@  Example:
 		reg = <0xe3804000 0x1000>;
 };
 
-SHDWC Shutdown Controller
-
-required properties:
-- compatible: Should be "atmel,<chip>-shdwc".
-  <chip> can be "at91sam9260", "at91sam9rl" or "at91sam9x5".
-- reg: Should contain registers location and length
-- clocks: phandle to input clock.
-
-optional properties:
-- atmel,wakeup-mode: String, operation mode of the wakeup mode.
-  Supported values are: "none", "high", "low", "any".
-- atmel,wakeup-counter: Counter on Wake-up 0 (between 0x0 and 0xf).
-
-optional at91sam9260 properties:
-- atmel,wakeup-rtt-timer: boolean to enable Real-time Timer Wake-up.
-
-optional at91sam9rl properties:
-- atmel,wakeup-rtc-timer: boolean to enable Real-time Clock Wake-up.
-- atmel,wakeup-rtt-timer: boolean to enable Real-time Timer Wake-up.
-
-optional at91sam9x5 properties:
-- atmel,wakeup-rtc-timer: boolean to enable Real-time Clock Wake-up.
-
-Example:
-
-	shdwc@fffffd10 {
-		compatible = "atmel,at91sam9260-shdwc";
-		reg = <0xfffffd10 0x10>;
-		clocks = <&clk32k>;
-	};
-
 SHDWC SAMA5D2-Compatible Shutdown Controller
 
 1) shdwc node
diff --git a/Documentation/devicetree/bindings/power/reset/atmel,at91sam9260-shdwc.yaml b/Documentation/devicetree/bindings/power/reset/atmel,at91sam9260-shdwc.yaml
new file mode 100644
index 000000000000..3b3162677db3
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/reset/atmel,at91sam9260-shdwc.yaml
@@ -0,0 +1,81 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/reset/atmel,at91sam9260-shdwc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel SHDWC Shutdown Controller
+
+maintainers:
+  - Claudiu Beznea <claudiu.beznea@microchip.com>
+
+description: |
+  Atmel SHDWC shutdown controller controls the power supplies VDDIO and VDDCORE
+  and the wake-up detection on debounced input lines.
+
+properties:
+  compatible:
+    enum:
+      - atmel,at91sam9260-shdwc
+      - atmel,at91sam9rl-shdwc
+      - atmel,at91sam9x5-shdwc
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  atmel,wakeup-mode:
+    description: operation mode of the wakeup mode
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [ none, high, low, any ]
+
+  atmel,wakeup-counter:
+    description: counter on wake-up 0
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]
+
+required:
+  - compatible
+  - reg
+  - clocks
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - atmel,at91sam9260-shdwc
+              - atmel,at91sam9rl-shdwc
+    then:
+      properties:
+        atmel,wakeup-rtt-timer:
+          description: enable real-time timer wake-up
+          type: boolean
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - atmel,at91sam9rl-shdwc
+              - atmel,at91sam9x5-shdwc
+    then:
+      properties:
+        atmel,wakeup-rtc-timer:
+          description: enable real-time clock wake-up
+          type: boolean
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    shdwc: poweroff@fffffd10 {
+        compatible = "atmel,at91sam9260-shdwc";
+        reg = <0xfffffd10 0x10>;
+        clocks = <&clk32k>;
+    };
+
+...