[PATCH 2/2] dt-bindings: watchdog: mediatek: Convert binding to YAML

Allen-KH Cheng posted 2 patches 2 years, 5 months ago
There is a newer version of this series
[PATCH 2/2] dt-bindings: watchdog: mediatek: Convert binding to YAML
Posted by Allen-KH Cheng 2 years, 5 months ago
Convert Mediatek watchdog devicetree binding to YAML.

Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
---
 .../devicetree/bindings/watchdog/mtk-wdt.txt  | 42 ----------
 .../devicetree/bindings/watchdog/mtk-wdt.yaml | 76 +++++++++++++++++++
 2 files changed, 76 insertions(+), 42 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
 create mode 100644 Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml

diff --git a/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt b/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
deleted file mode 100644
index 762c62e428ef..000000000000
--- a/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-Mediatek SoCs Watchdog timer
-
-The watchdog supports a pre-timeout interrupt that fires timeout-sec/2
-before the expiry.
-
-Required properties:
-
-- compatible should contain:
-	"mediatek,mt2701-wdt", "mediatek,mt6589-wdt": for MT2701
-	"mediatek,mt2712-wdt": for MT2712
-	"mediatek,mt6582-wdt", "mediatek,mt6589-wdt": for MT6582
-	"mediatek,mt6589-wdt": for MT6589
-	"mediatek,mt6797-wdt", "mediatek,mt6589-wdt": for MT6797
-	"mediatek,mt7622-wdt", "mediatek,mt6589-wdt": for MT7622
-	"mediatek,mt7623-wdt", "mediatek,mt6589-wdt": for MT7623
-	"mediatek,mt7629-wdt", "mediatek,mt6589-wdt": for MT7629
-	"mediatek,mt7986-wdt", "mediatek,mt6589-wdt": for MT7986
-	"mediatek,mt8183-wdt": for MT8183
-	"mediatek,mt8186-wdt", "mediatek,mt6589-wdt": for MT8186
-	"mediatek,mt8516-wdt", "mediatek,mt6589-wdt": for MT8516
-	"mediatek,mt8192-wdt": for MT8192
-	"mediatek,mt8195-wdt", "mediatek,mt6589-wdt": for MT8195
-
-- reg : Specifies base physical address and size of the registers.
-
-Optional properties:
-- mediatek,disable-extrst: disable send output reset signal
-- interrupts: Watchdog pre-timeout (bark) interrupt.
-- timeout-sec: contains the watchdog timeout in seconds.
-- #reset-cells: Should be 1.
-
-Example:
-
-watchdog: watchdog@10007000 {
-	compatible = "mediatek,mt8183-wdt",
-		     "mediatek,mt6589-wdt";
-	mediatek,disable-extrst;
-	reg = <0 0x10007000 0 0x100>;
-	interrupts = <GIC_SPI 139 IRQ_TYPE_NONE>;
-	timeout-sec = <10>;
-	#reset-cells = <1>;
-};
diff --git a/Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml b/Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml
new file mode 100644
index 000000000000..5788617027c8
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/watchdog/mtk-wdt.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Mediatek SoCs Watchdog timer
+
+maintainers:
+  - Runyang Chen <runyang.chen@mediatek.com>
+  - Allen-KH Cheng <allen-kh.cheng@mediatek.com>
+
+description: |+
+  The watchdog supports a pre-timeout interrupt that fires timeout-sec/2
+  before the expiry.
+
+allOf:
+  - $ref: "watchdog.yaml#"
+
+properties:
+  compatible:
+    oneOf:
+      - const: mediatek,mt2712-wdt
+      - const: mediatek,mt6589-wdt
+      - const: mediatek,mt8183-wdt
+      - const: mediatek,mt8192-wdt
+
+      - items:
+          - enum:
+              - mediatek,mt2701-wdt
+              - mediatek,mt6582-wdt
+              - mediatek,mt6797-wdt
+              - mediatek,mt7622-wdt
+              - mediatek,mt7623-wdt
+              - mediatek,mt7629-wdt
+              - mediatek,mt7986-wdt
+              - mediatek,mt8173-wdt
+              - mediatek,mt8183-wdt
+              - mediatek,mt8186-wdt
+              - mediatek,mt8192-wdt
+              - mediatek,mt8195-wdt
+              - mediatek,mt8516-wdt
+          - const: mediatek,mt6589-wdt
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  '#reset-cells':
+    const: 1
+
+  timeout-sec: true
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    watchdog@10007000 {
+        compatible = "mediatek,mt8183-wdt",
+                     "mediatek,mt6589-wdt";
+        mediatek,disable-extrst;
+        reg = <0x10007000 0x100>;
+        interrupts = <GIC_SPI 139 IRQ_TYPE_NONE>;
+        timeout-sec = <10>;
+        #reset-cells = <1>;
+    };
+
+...
-- 
2.18.0
Re: [PATCH 2/2] dt-bindings: watchdog: mediatek: Convert binding to YAML
Posted by Krzysztof Kozlowski 2 years, 5 months ago
On 22/04/2022 14:10, Allen-KH Cheng wrote:
> Convert Mediatek watchdog devicetree binding to YAML.
> 
> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> ---
>  .../devicetree/bindings/watchdog/mtk-wdt.txt  | 42 ----------
>  .../devicetree/bindings/watchdog/mtk-wdt.yaml | 76 +++++++++++++++++++
>  2 files changed, 76 insertions(+), 42 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
>  create mode 100644 Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt b/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
> deleted file mode 100644
> index 762c62e428ef..000000000000
> --- a/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
> +++ /dev/null
> @@ -1,42 +0,0 @@
> -Mediatek SoCs Watchdog timer
> -
> -The watchdog supports a pre-timeout interrupt that fires timeout-sec/2
> -before the expiry.
> -
> -Required properties:
> -
> -- compatible should contain:
> -	"mediatek,mt2701-wdt", "mediatek,mt6589-wdt": for MT2701
> -	"mediatek,mt2712-wdt": for MT2712
> -	"mediatek,mt6582-wdt", "mediatek,mt6589-wdt": for MT6582
> -	"mediatek,mt6589-wdt": for MT6589
> -	"mediatek,mt6797-wdt", "mediatek,mt6589-wdt": for MT6797
> -	"mediatek,mt7622-wdt", "mediatek,mt6589-wdt": for MT7622
> -	"mediatek,mt7623-wdt", "mediatek,mt6589-wdt": for MT7623
> -	"mediatek,mt7629-wdt", "mediatek,mt6589-wdt": for MT7629
> -	"mediatek,mt7986-wdt", "mediatek,mt6589-wdt": for MT7986
> -	"mediatek,mt8183-wdt": for MT8183
> -	"mediatek,mt8186-wdt", "mediatek,mt6589-wdt": for MT8186
> -	"mediatek,mt8516-wdt", "mediatek,mt6589-wdt": for MT8516
> -	"mediatek,mt8192-wdt": for MT8192
> -	"mediatek,mt8195-wdt", "mediatek,mt6589-wdt": for MT8195
> -
> -- reg : Specifies base physical address and size of the registers.
> -
> -Optional properties:
> -- mediatek,disable-extrst: disable send output reset signal
> -- interrupts: Watchdog pre-timeout (bark) interrupt.
> -- timeout-sec: contains the watchdog timeout in seconds.
> -- #reset-cells: Should be 1.
> -
> -Example:
> -
> -watchdog: watchdog@10007000 {
> -	compatible = "mediatek,mt8183-wdt",
> -		     "mediatek,mt6589-wdt";
> -	mediatek,disable-extrst;
> -	reg = <0 0x10007000 0 0x100>;
> -	interrupts = <GIC_SPI 139 IRQ_TYPE_NONE>;
> -	timeout-sec = <10>;
> -	#reset-cells = <1>;
> -};
> diff --git a/Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml b/Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml
> new file mode 100644
> index 000000000000..5788617027c8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml
> @@ -0,0 +1,76 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/watchdog/mtk-wdt.yaml#

File name: mtk,wdt.yaml

I assume all future MediaTek watchdogs (even these unpublished and
developed in some years) will fit into this schema. :) If not, then
maybe better to name the file by the compatible... but it's not a must.

> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Mediatek SoCs Watchdog timer
> +
> +maintainers:
> +  - Runyang Chen <runyang.chen@mediatek.com>
> +  - Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> +
> +description: |+
> +  The watchdog supports a pre-timeout interrupt that fires timeout-sec/2
> +  before the expiry.
> +
> +allOf:
> +  - $ref: "watchdog.yaml#"
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - const: mediatek,mt2712-wdt
> +      - const: mediatek,mt6589-wdt
> +      - const: mediatek,mt8183-wdt
> +      - const: mediatek,mt8192-wdt

All these four entries should be an enum.

> +
> +      - items:
> +          - enum:
> +              - mediatek,mt2701-wdt
> +              - mediatek,mt6582-wdt
> +              - mediatek,mt6797-wdt
> +              - mediatek,mt7622-wdt
> +              - mediatek,mt7623-wdt
> +              - mediatek,mt7629-wdt
> +              - mediatek,mt7986-wdt
> +              - mediatek,mt8173-wdt
> +              - mediatek,mt8183-wdt
> +              - mediatek,mt8186-wdt
> +              - mediatek,mt8192-wdt
> +              - mediatek,mt8195-wdt
> +              - mediatek,mt8516-wdt
> +          - const: mediatek,mt6589-wdt
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  '#reset-cells':
> +    const: 1
> +
> +  timeout-sec: true

You do not need this, it's coming from watchdog schema.

> +
> +required:
> +  - compatible
> +  - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    watchdog@10007000 {
> +        compatible = "mediatek,mt8183-wdt",
> +                     "mediatek,mt6589-wdt";
> +        mediatek,disable-extrst;

Did you test your bindings? Does not look like. Please run
dt_binding_check (see writing-schema for instructions).

> +        reg = <0x10007000 0x100>;
> +        interrupts = <GIC_SPI 139 IRQ_TYPE_NONE>;

Wrong interrupt flag.

> +        timeout-sec = <10>;
> +        #reset-cells = <1>;
> +    };
> +
> +...


Best regards,
Krzysztof
Re: [PATCH 2/2] dt-bindings: watchdog: mediatek: Convert binding to YAML
Posted by Rob Herring 2 years, 5 months ago
On Fri, Apr 22, 2022 at 10:44 AM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 22/04/2022 14:10, Allen-KH Cheng wrote:
> > Convert Mediatek watchdog devicetree binding to YAML.
> >
> > Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> > ---
> >  .../devicetree/bindings/watchdog/mtk-wdt.txt  | 42 ----------
> >  .../devicetree/bindings/watchdog/mtk-wdt.yaml | 76 +++++++++++++++++++
> >  2 files changed, 76 insertions(+), 42 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
> >  create mode 100644 Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt b/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
> > deleted file mode 100644
> > index 762c62e428ef..000000000000
> > --- a/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
> > +++ /dev/null
> > @@ -1,42 +0,0 @@
> > -Mediatek SoCs Watchdog timer
> > -
> > -The watchdog supports a pre-timeout interrupt that fires timeout-sec/2
> > -before the expiry.
> > -
> > -Required properties:
> > -
> > -- compatible should contain:
> > -     "mediatek,mt2701-wdt", "mediatek,mt6589-wdt": for MT2701
> > -     "mediatek,mt2712-wdt": for MT2712
> > -     "mediatek,mt6582-wdt", "mediatek,mt6589-wdt": for MT6582
> > -     "mediatek,mt6589-wdt": for MT6589
> > -     "mediatek,mt6797-wdt", "mediatek,mt6589-wdt": for MT6797
> > -     "mediatek,mt7622-wdt", "mediatek,mt6589-wdt": for MT7622
> > -     "mediatek,mt7623-wdt", "mediatek,mt6589-wdt": for MT7623
> > -     "mediatek,mt7629-wdt", "mediatek,mt6589-wdt": for MT7629
> > -     "mediatek,mt7986-wdt", "mediatek,mt6589-wdt": for MT7986
> > -     "mediatek,mt8183-wdt": for MT8183
> > -     "mediatek,mt8186-wdt", "mediatek,mt6589-wdt": for MT8186
> > -     "mediatek,mt8516-wdt", "mediatek,mt6589-wdt": for MT8516
> > -     "mediatek,mt8192-wdt": for MT8192
> > -     "mediatek,mt8195-wdt", "mediatek,mt6589-wdt": for MT8195
> > -
> > -- reg : Specifies base physical address and size of the registers.
> > -
> > -Optional properties:
> > -- mediatek,disable-extrst: disable send output reset signal
> > -- interrupts: Watchdog pre-timeout (bark) interrupt.
> > -- timeout-sec: contains the watchdog timeout in seconds.
> > -- #reset-cells: Should be 1.
> > -
> > -Example:
> > -
> > -watchdog: watchdog@10007000 {
> > -     compatible = "mediatek,mt8183-wdt",
> > -                  "mediatek,mt6589-wdt";
> > -     mediatek,disable-extrst;
> > -     reg = <0 0x10007000 0 0x100>;
> > -     interrupts = <GIC_SPI 139 IRQ_TYPE_NONE>;
> > -     timeout-sec = <10>;
> > -     #reset-cells = <1>;
> > -};
> > diff --git a/Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml b/Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml
> > new file mode 100644
> > index 000000000000..5788617027c8
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/watchdog/mtk-wdt.yaml
> > @@ -0,0 +1,76 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/watchdog/mtk-wdt.yaml#
>
> File name: mtk,wdt.yaml

mediatek,wdt.yaml