[v3,1/1] dt-bindings: watchdog: starfive,jh7100-wdt: Add compatible for JH8100

Message ID 20231214033056.3953143-2-jisheng.teoh@starfivetech.com
State New
Headers
Series Add StarFive JH8100 watchdog |

Commit Message

JiSheng Teoh Dec. 14, 2023, 3:30 a.m. UTC
  Add "starfive,jh8100-wdt" compatible string for StarFive's JH8100
watchdog.
Since JH8100 watchdog only has 1 reset signal, update binding
document to support one reset for "starfive,jh8100-wdt" compatible.

Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
---
 .../watchdog/starfive,jh7100-wdt.yaml         | 48 ++++++++++++++++---
 1 file changed, 42 insertions(+), 6 deletions(-)
  

Comments

Krzysztof Kozlowski Dec. 14, 2023, 7:39 a.m. UTC | #1
On 14/12/2023 04:30, Ji Sheng Teoh wrote:
> Add "starfive,jh8100-wdt" compatible string for StarFive's JH8100
> watchdog.
> Since JH8100 watchdog only has 1 reset signal, update binding
> document to support one reset for "starfive,jh8100-wdt" compatible.
> 
> Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
> Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
> ---
>  .../watchdog/starfive,jh7100-wdt.yaml         | 48 ++++++++++++++++---
>  1 file changed, 42 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> index 68f3f6fd08a6..79082c5f9971 100644
> --- a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> +++ b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> @@ -19,14 +19,17 @@ description:
>    isn't cleared, the watchdog will reset the system unless the watchdog
>    reset is disabled.
>  
> -allOf:
> -  - $ref: watchdog.yaml#
> -
>  properties:
>    compatible:
> -    enum:
> -      - starfive,jh7100-wdt
> -      - starfive,jh7110-wdt
> +    oneOf:
> +      - items:

Drop items, it wasn't here in the first place.

> +          - enum:
> +              - starfive,jh7100-wdt
> +              - starfive,jh7110-wdt
> +      - items:
> +          - enum:
> +              - starfive,jh8100-wdt
> +          - const: starfive,jh7110-wdt
>  
>    reg:
>      maxItems: 1
> @@ -45,10 +48,33 @@ properties:
>        - const: core
>  
>    resets:
> +    minItems: 1
>      items:
>        - description: APB reset
>        - description: Core reset

This is not valid for jh8100. Move it to else: part. Here maxItems: 2.

>  
> +allOf:

allOf goes after required:, see example-schema

> +  - $ref: watchdog.yaml#
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - starfive,jh8100-wdt
> +    then:
> +      properties:
> +        resets:
> +          description: |
> +            Must contain Core reset entry.
> +          maxItems: 1

Instead of both, items: with description.

> +    else:
> +      properties:
> +        resets:
> +          description: |
> +            Must contain APB reset and Core reset entry.
> +          minItems: 2
> +
>  required:
>    - compatible
>    - reg
> @@ -69,3 +95,13 @@ examples:
>          resets = <&rst 99>,
>                   <&rst 100>;
>      };
> +
> +  - |
> +    watchdog@12270000 {
> +        compatible = "starfive,jh8100-wdt", "starfive,jh7110-wdt";
> +        reg = <0x12270000 0x10000>;
> +        clocks = <&clk 78>,
> +                 <&clk 79>;

No need for new example with difference in one property.

Best regards,
Krzysztof
  
JiSheng Teoh Dec. 15, 2023, 7:25 a.m. UTC | #2
On Thu, 14 Dec 2023 08:39:46 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> On 14/12/2023 04:30, Ji Sheng Teoh wrote:
> > Add "starfive,jh8100-wdt" compatible string for StarFive's JH8100
> > watchdog.
> > Since JH8100 watchdog only has 1 reset signal, update binding
> > document to support one reset for "starfive,jh8100-wdt" compatible.
> > 
> > Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
> > Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
> > ---
> >  .../watchdog/starfive,jh7100-wdt.yaml         | 48
> > ++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-)
> > 
> > diff --git
> > a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> > b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> > index 68f3f6fd08a6..79082c5f9971 100644 ---
> > a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> > +++
> > b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> > @@ -19,14 +19,17 @@ description: isn't cleared, the watchdog will
> > reset the system unless the watchdog reset is disabled. -allOf:
> > -  - $ref: watchdog.yaml#
> > -
> >  properties:
> >    compatible:
> > -    enum:
> > -      - starfive,jh7100-wdt
> > -      - starfive,jh7110-wdt
> > +    oneOf:
> > +      - items:  
> 
> Drop items, it wasn't here in the first place.

Ok, will drop.
> 
> > +          - enum:
> > +              - starfive,jh7100-wdt
> > +              - starfive,jh7110-wdt
> > +      - items:
> > +          - enum:
> > +              - starfive,jh8100-wdt
> > +          - const: starfive,jh7110-wdt
> >  
> >    reg:
> >      maxItems: 1
> > @@ -45,10 +48,33 @@ properties:
> >        - const: core
> >  
> >    resets:
> > +    minItems: 1
> >      items:
> >        - description: APB reset
> >        - description: Core reset  
> 
> This is not valid for jh8100. Move it to else: part. Here maxItems: 2.
>
Sure, will replace with maxItems.
 
> >  
> > +allOf:  
> 
> allOf goes after required:, see example-schema
> 
Ok, will move it after required.

> > +  - $ref: watchdog.yaml#
> > +
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            enum:
> > +              - starfive,jh8100-wdt
> > +    then:
> > +      properties:
> > +        resets:
> > +          description: |
> > +            Must contain Core reset entry.
> > +          maxItems: 1  
> 
> Instead of both, items: with description.
> 
Sure, will use items instead.

> > +    else:
> > +      properties:
> > +        resets:
> > +          description: |
> > +            Must contain APB reset and Core reset entry.
> > +          minItems: 2
> > +
> >  required:
> >    - compatible
> >    - reg
> > @@ -69,3 +95,13 @@ examples:
> >          resets = <&rst 99>,
> >                   <&rst 100>;
> >      };
> > +
> > +  - |
> > +    watchdog@12270000 {
> > +        compatible = "starfive,jh8100-wdt", "starfive,jh7110-wdt";
> > +        reg = <0x12270000 0x10000>;
> > +        clocks = <&clk 78>,
> > +                 <&clk 79>;  
> 
> No need for new example with difference in one property.

Ok, will drop the new example. Thanks
> 
> Best regards,
> Krzysztof
>
  

Patch

diff --git a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
index 68f3f6fd08a6..79082c5f9971 100644
--- a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
+++ b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
@@ -19,14 +19,17 @@  description:
   isn't cleared, the watchdog will reset the system unless the watchdog
   reset is disabled.
 
-allOf:
-  - $ref: watchdog.yaml#
-
 properties:
   compatible:
-    enum:
-      - starfive,jh7100-wdt
-      - starfive,jh7110-wdt
+    oneOf:
+      - items:
+          - enum:
+              - starfive,jh7100-wdt
+              - starfive,jh7110-wdt
+      - items:
+          - enum:
+              - starfive,jh8100-wdt
+          - const: starfive,jh7110-wdt
 
   reg:
     maxItems: 1
@@ -45,10 +48,33 @@  properties:
       - const: core
 
   resets:
+    minItems: 1
     items:
       - description: APB reset
       - description: Core reset
 
+allOf:
+  - $ref: watchdog.yaml#
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - starfive,jh8100-wdt
+    then:
+      properties:
+        resets:
+          description: |
+            Must contain Core reset entry.
+          maxItems: 1
+    else:
+      properties:
+        resets:
+          description: |
+            Must contain APB reset and Core reset entry.
+          minItems: 2
+
 required:
   - compatible
   - reg
@@ -69,3 +95,13 @@  examples:
         resets = <&rst 99>,
                  <&rst 100>;
     };
+
+  - |
+    watchdog@12270000 {
+        compatible = "starfive,jh8100-wdt", "starfive,jh7110-wdt";
+        reg = <0x12270000 0x10000>;
+        clocks = <&clk 78>,
+                 <&clk 79>;
+        clock-names = "apb", "core";
+        resets = <&rst 15>;
+    };