Commit 8fa8380a authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Wim Van Sebroeck
Browse files

dt-bindings: watchdog: samsung-wdt: Split if:then: and constrain more



Binding defined two if:then: blocks covering different conditions but
not fully constraining the properties per each variant:
1. "if:" to require samsung,syscon-phandle,
2. "if:" with "else:" to narrow number of clocks and require or disallow
   samsung,cluster-index.

This still did not cover following cases:
1. Disallow samsung,syscon-phandle when not applicable,
2. Narrow samsung,cluster-index to [0, 1], for SoCs with only two
   clusters.

Solving this in current format would lead to spaghetti code, so re-write
entire "if:then:" approach into mutually exclusive cases so each SoC
appears only in one "if:" block.  This allows to forbid
samsung,syscon-phandle for S3C6410, and narrow samsung,cluster-index
to [0, 1].

Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
Acked-by: default avatarRob Herring (Arm) <robh@kernel.org>
Reviewed-by: default avatarAlim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent 6a11dbf4
Loading
Loading
Loading
Loading
+43 −9
Original line number Diff line number Diff line
@@ -74,26 +74,31 @@ allOf:
          contains:
            enum:
              - google,gs101-wdt
              - samsung,exynos5250-wdt
              - samsung,exynos5420-wdt
              - samsung,exynos7-wdt
              - samsung,exynos850-wdt
              - samsung,exynos990-wdt
              - samsung,exynosautov9-wdt
              - samsung,exynosautov920-wdt
    then:
      properties:
        clocks:
          items:
            - description: Bus clock, used for register interface
            - description: Source clock (driving watchdog counter)
        clock-names:
          items:
            - const: watchdog
            - const: watchdog_src
        samsung,cluster-index:
          enum: [0, 1]
      required:
        - samsung,cluster-index
        - samsung,syscon-phandle

  - if:
      properties:
        compatible:
          contains:
            enum:
              - google,gs101-wdt
              - samsung,exynos850-wdt
              - samsung,exynos990-wdt
              - samsung,exynosautov9-wdt
              - samsung,exynosautov920-wdt
    then:
      properties:
        clocks:
@@ -106,7 +111,35 @@ allOf:
            - const: watchdog_src
      required:
        - samsung,cluster-index
    else:
        - samsung,syscon-phandle

  - if:
      properties:
        compatible:
          contains:
            enum:
              - samsung,exynos5250-wdt
              - samsung,exynos5420-wdt
              - samsung,exynos7-wdt
    then:
      properties:
        clocks:
          items:
            - description: Bus clock, which is also a source clock
        clock-names:
          items:
            - const: watchdog
        samsung,cluster-index: false
      required:
        - samsung,syscon-phandle

  - if:
      properties:
        compatible:
          contains:
            enum:
              - samsung,s3c6410-wdt
    then:
      properties:
        clocks:
          items:
@@ -115,6 +148,7 @@ allOf:
          items:
            - const: watchdog
        samsung,cluster-index: false
        samsung,syscon-phandle: false

unevaluatedProperties: false