2022-07-14 10:39:38

by Sergiu Moga

[permalink] [raw]
Subject: [PATCH] watchdog: dt-bindings: atmel,at91sam9-wdt: convert to json-schema

Convert at91sam9 WDT binding for Atmel/Microchip SoCs to Device Tree
Schema format.

Signed-off-by: Sergiu Moga <[email protected]>
---
.../bindings/watchdog/atmel,at91sam9-wdt.yaml | 127 ++++++++++++++++++
.../bindings/watchdog/atmel-wdt.txt | 51 -------
2 files changed, 127 insertions(+), 51 deletions(-)
create mode 100644 Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml
delete mode 100644 Documentation/devicetree/bindings/watchdog/atmel-wdt.txt

diff --git a/Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml b/Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml
new file mode 100644
index 000000000000..b3f7cbe913a5
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/watchdog/atmel,at91sam9-wdt.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel Watchdog Timers
+
+maintainers:
+ - Eugen Hristev <[email protected]>
+
+allOf:
+ - $ref: watchdog.yaml#
+ - if:
+ properties:
+ atmel,reset-type:
+ enum:
+ - all
+ - proc
+ then:
+ properties:
+ atmel,watchdog-type:
+ const: hardware
+
+properties:
+ compatible:
+ const: atmel,at91sam9260-wdt
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ atmel,max-heartbeat-sec:
+ description:
+ Should contain the maximum heartbeat value in seconds. This value
+ should be less or equal to 16. It is used to compute the WDV field.
+ maximum: 16
+
+ atmel,min-heartbeat-sec:
+ description:
+ Should contain the minimum heartbeat value in seconds. This value
+ must be smaller than the max-heartbeat-sec value. It is used to
+ compute the WDD field.
+ maximum: 16
+
+ atmel,watchdog-type:
+ $ref: /schemas/types.yaml#/definitions/string
+ description: |
+ Should be hardware or software.
+ oneOf:
+ - description:
+ Hardware watchdog uses the at91 watchdog reset.
+ const: hardware
+ - description: |
+ Software watchdog uses the watchdog interrupt
+ to trigger a software reset.
+ const: software
+ default: hardware
+
+ atmel,reset-type:
+ $ref: /schemas/types.yaml#/definitions/string
+ description: |
+ Should be proc or all. This is valid only when using hardware watchdog.
+ oneOf:
+ - description:
+ Assert peripherals and processor reset signals.
+ const: all
+ - description:
+ Assert the processor reset signal.
+ const: proc
+ default: all
+
+ atmel,disable:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description:
+ Should be present if you want to stop the watchdog.
+
+ atmel,idle-halt:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description: |
+ Should be present if you want to stop the watchdog when
+ entering idle state.
+ CAUTION: This property should be used with care, it actually makes the
+ watchdog not counting when the CPU is in idle state, therefore the
+ watchdog reset time depends on mean CPU usage and will not reset at all
+ if the CPU stops working while it is in idle state, which is probably
+ not what you want.
+
+ atmel,dbg-halt:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description: |
+ Should be present if you want to stop the watchdog when
+ entering debug state.
+
+required:
+ - compatible
+ - reg
+ - clocks
+
+dependencies:
+ atmel,reset-type: ['atmel,watchdog-type']
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ watchdog@fffffd40 {
+ compatible = "atmel,at91sam9260-wdt";
+ reg = <0xfffffd40 0x10>;
+ interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+ clocks = <&clk32k>;
+ timeout-sec = <15>;
+ atmel,watchdog-type = "hardware";
+ atmel,reset-type = "all";
+ atmel,dbg-halt;
+ atmel,idle-halt;
+ atmel,max-heartbeat-sec = <16>;
+ atmel,min-heartbeat-sec = <0>;
+ };
diff --git a/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt b/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
deleted file mode 100644
index 711a880b3d3b..000000000000
--- a/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-* Atmel Watchdog Timers
-
-** at91sam9-wdt
-
-Required properties:
-- compatible: must be "atmel,at91sam9260-wdt".
-- reg: physical base address of the controller and length of memory mapped
- region.
-- clocks: phandle to input clock.
-
-Optional properties:
-- timeout-sec: contains the watchdog timeout in seconds.
-- interrupts : Should contain WDT interrupt.
-- atmel,max-heartbeat-sec : Should contain the maximum heartbeat value in
- seconds. This value should be less or equal to 16. It is used to
- compute the WDV field.
-- atmel,min-heartbeat-sec : Should contain the minimum heartbeat value in
- seconds. This value must be smaller than the max-heartbeat-sec value.
- It is used to compute the WDD field.
-- atmel,watchdog-type : Should be "hardware" or "software". Hardware watchdog
- use the at91 watchdog reset. Software watchdog use the watchdog
- interrupt to trigger a software reset.
-- atmel,reset-type : Should be "proc" or "all".
- "all" : assert peripherals and processor reset signals
- "proc" : assert the processor reset signal
- This is valid only when using "hardware" watchdog.
-- atmel,disable : Should be present if you want to disable the watchdog.
-- atmel,idle-halt : Should be present if you want to stop the watchdog when
- entering idle state.
- CAUTION: This property should be used with care, it actually makes the
- watchdog not counting when the CPU is in idle state, therefore the
- watchdog reset time depends on mean CPU usage and will not reset at all
- if the CPU stop working while it is in idle state, which is probably
- not what you want.
-- atmel,dbg-halt : Should be present if you want to stop the watchdog when
- entering debug state.
-
-Example:
- watchdog@fffffd40 {
- compatible = "atmel,at91sam9260-wdt";
- reg = <0xfffffd40 0x10>;
- interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
- clocks = <&clk32k>;
- timeout-sec = <15>;
- atmel,watchdog-type = "hardware";
- atmel,reset-type = "all";
- atmel,dbg-halt;
- atmel,idle-halt;
- atmel,max-heartbeat-sec = <16>;
- atmel,min-heartbeat-sec = <0>;
- };
--
2.25.1


2022-07-14 10:53:30

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH] watchdog: dt-bindings: atmel,at91sam9-wdt: convert to json-schema

On 14/07/2022 12:12, Sergiu Moga wrote:
> Convert at91sam9 WDT binding for Atmel/Microchip SoCs to Device Tree
> Schema format.
>
> Signed-off-by: Sergiu Moga <[email protected]>
> ---
> .../bindings/watchdog/atmel,at91sam9-wdt.yaml | 127 ++++++++++++++++++
> .../bindings/watchdog/atmel-wdt.txt | 51 -------
> 2 files changed, 127 insertions(+), 51 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml
> delete mode 100644 Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
>
> diff --git a/Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml b/Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml
> new file mode 100644
> index 000000000000..b3f7cbe913a5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml
> @@ -0,0 +1,127 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/watchdog/atmel,at91sam9-wdt.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Atmel Watchdog Timers
> +
> +maintainers:
> + - Eugen Hristev <[email protected]>
> +
> +allOf:
> + - $ref: watchdog.yaml#
> + - if:
> + properties:
> + atmel,reset-type:
> + enum:
> + - all
> + - proc
> + then:
> + properties:
> + atmel,watchdog-type:
> + const: hardware

Entire allOf in such case goes after "required:".

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2022-07-14 12:09:54

by Sergiu Moga

[permalink] [raw]
Subject: Re: [PATCH] watchdog: dt-bindings: atmel,at91sam9-wdt: convert to json-schema

On 14.07.2022 13:41, Krzysztof Kozlowski wrote:
> On 14/07/2022 12:12, Sergiu Moga wrote:
>> Convert at91sam9 WDT binding for Atmel/Microchip SoCs to Device Tree
>> Schema format.
I somehow wrote "Device Tree Schema" here instead of "json-schema". Will
correct the commit message in the next version.
>>
>> Signed-off-by: Sergiu Moga <[email protected]>
>> ---
>> .../bindings/watchdog/atmel,at91sam9-wdt.yaml | 127 ++++++++++++++++++
>> .../bindings/watchdog/atmel-wdt.txt | 51 -------
>> 2 files changed, 127 insertions(+), 51 deletions(-)
>> create mode 100644 Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml
>> delete mode 100644 Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
>>
>> diff --git a/Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml b/Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml
>> new file mode 100644
>> index 000000000000..b3f7cbe913a5
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/watchdog/atmel,at91sam9-wdt.yaml
>> @@ -0,0 +1,127 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/watchdog/atmel,at91sam9-wdt.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Atmel Watchdog Timers
>> +
>> +maintainers:
>> + - Eugen Hristev <[email protected]>
>> +
>> +allOf:
>> + - $ref: watchdog.yaml#
>> + - if:
>> + properties:
>> + atmel,reset-type:
>> + enum:
>> + - all
>> + - proc
>> + then:
>> + properties:
>> + atmel,watchdog-type:
>> + const: hardware
> Entire allOf in such case goes after "required:".
Noted. Thank you.
> Reviewed-by: Krzysztof Kozlowski <[email protected]>
>
> Best regards,
> Krzysztof