All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: timer: Convert faraday,fttmr010 to yaml
@ 2021-05-28 18:53 Corentin Labbe
  2021-06-04 21:11 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Corentin Labbe @ 2021-05-28 18:53 UTC (permalink / raw)
  To: daniel.lezcano, robh+dt, tglx; +Cc: devicetree, linux-kernel, Corentin Labbe

Converts timer/faraday,fttmr010.txt to yaml.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 .../bindings/timer/faraday,fttmr010.txt       | 38 --------
 .../bindings/timer/faraday,fttmr010.yaml      | 86 +++++++++++++++++++
 2 files changed, 86 insertions(+), 38 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/timer/faraday,fttmr010.txt
 create mode 100644 Documentation/devicetree/bindings/timer/faraday,fttmr010.yaml

diff --git a/Documentation/devicetree/bindings/timer/faraday,fttmr010.txt b/Documentation/devicetree/bindings/timer/faraday,fttmr010.txt
deleted file mode 100644
index 3cb2f4c98d64..000000000000
--- a/Documentation/devicetree/bindings/timer/faraday,fttmr010.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-Faraday Technology timer
-
-This timer is a generic IP block from Faraday Technology, embedded in the
-Cortina Systems Gemini SoCs and other designs.
-
-Required properties:
-
-- compatible : Must be one of
-  "faraday,fttmr010"
-  "cortina,gemini-timer", "faraday,fttmr010"
-  "moxa,moxart-timer", "faraday,fttmr010"
-  "aspeed,ast2400-timer"
-  "aspeed,ast2500-timer"
-  "aspeed,ast2600-timer"
-
-- reg : Should contain registers location and length
-- interrupts : Should contain the three timer interrupts usually with
-  flags for falling edge
-
-Optionally required properties:
-
-- clocks : a clock to provide the tick rate for "faraday,fttmr010"
-- clock-names : should be "EXTCLK" and "PCLK" for the external tick timer
-  and peripheral clock respectively, for "faraday,fttmr010"
-- syscon : a phandle to the global Gemini system controller if the compatible
-  type is "cortina,gemini-timer"
-
-Example:
-
-timer@43000000 {
-	compatible = "faraday,fttmr010";
-	reg = <0x43000000 0x1000>;
-	interrupts = <14 IRQ_TYPE_EDGE_FALLING>, /* Timer 1 */
-		   <15 IRQ_TYPE_EDGE_FALLING>, /* Timer 2 */
-		   <16 IRQ_TYPE_EDGE_FALLING>; /* Timer 3 */
-	clocks = <&extclk>, <&pclk>;
-	clock-names = "EXTCLK", "PCLK";
-};
diff --git a/Documentation/devicetree/bindings/timer/faraday,fttmr010.yaml b/Documentation/devicetree/bindings/timer/faraday,fttmr010.yaml
new file mode 100644
index 000000000000..a495ea80c0fc
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/faraday,fttmr010.yaml
@@ -0,0 +1,86 @@
+# SPDX-License-Identifier: (GPL-2.0+)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/timer/faraday,fttmr010.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Faraday Technology timer
+
+maintainers:
+  - Linus Walleij <linus.walleij@linaro.org>
+
+description: |
+  This timer is a generic IP block from Faraday Technology, embedded in the
+  Cortina Systems Gemini SoCs and other designs.
+
+properties:
+  compatible:
+    oneOf:
+      - const: faraday,fttmr010
+      - items:
+          - const: cortina,gemini-timer
+          - const: faraday,fttmr010
+      - items:
+          - const: moxa,moxart-timer
+          - const: faraday,fttmr010
+      - const: aspeed,ast2400-timer
+      - const: aspeed,ast2500-timer
+      - const: aspeed,ast2600-timer
+
+  reg:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 3
+    description: Should contain the three timer interrupts usually with flags for falling edge
+
+  clocks:
+    minItems: 2
+
+  clock-names:
+    items:
+      - const: "PCLK"
+      - const: "EXTCLK"
+
+  syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    maxItems: 1
+
+if:
+  properties:
+    compatible:
+      contains:
+        items:
+          - const: cortina,gemini-timer
+          - const: faraday,fttmr010
+then:
+  required:
+    - syscon
+else:
+  properties:
+    syscon: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    timer@43000000 {
+      compatible = "faraday,fttmr010";
+      reg = <0x43000000 0x1000>;
+      interrupts = <14 IRQ_TYPE_EDGE_FALLING>, /* Timer 1 */
+                   <15 IRQ_TYPE_EDGE_FALLING>, /* Timer 2 */
+                   <16 IRQ_TYPE_EDGE_FALLING>; /* Timer 3 */
+      clocks = <&extclk>, <&pclk>;
+      clock-names = "PCLK", "EXTCLK";
+      syscon = <&syscon>;
+    };
+...
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dt-bindings: timer: Convert faraday,fttmr010 to yaml
  2021-05-28 18:53 [PATCH] dt-bindings: timer: Convert faraday,fttmr010 to yaml Corentin Labbe
@ 2021-06-04 21:11 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2021-06-04 21:11 UTC (permalink / raw)
  To: Corentin Labbe; +Cc: daniel.lezcano, tglx, devicetree, linux-kernel

On Fri, May 28, 2021 at 06:53:29PM +0000, Corentin Labbe wrote:
> Converts timer/faraday,fttmr010.txt to yaml.
> 
> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
>  .../bindings/timer/faraday,fttmr010.txt       | 38 --------
>  .../bindings/timer/faraday,fttmr010.yaml      | 86 +++++++++++++++++++
>  2 files changed, 86 insertions(+), 38 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/timer/faraday,fttmr010.txt
>  create mode 100644 Documentation/devicetree/bindings/timer/faraday,fttmr010.yaml
> 
> diff --git a/Documentation/devicetree/bindings/timer/faraday,fttmr010.txt b/Documentation/devicetree/bindings/timer/faraday,fttmr010.txt
> deleted file mode 100644
> index 3cb2f4c98d64..000000000000
> --- a/Documentation/devicetree/bindings/timer/faraday,fttmr010.txt
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -Faraday Technology timer
> -
> -This timer is a generic IP block from Faraday Technology, embedded in the
> -Cortina Systems Gemini SoCs and other designs.
> -
> -Required properties:
> -
> -- compatible : Must be one of
> -  "faraday,fttmr010"
> -  "cortina,gemini-timer", "faraday,fttmr010"
> -  "moxa,moxart-timer", "faraday,fttmr010"
> -  "aspeed,ast2400-timer"
> -  "aspeed,ast2500-timer"
> -  "aspeed,ast2600-timer"
> -
> -- reg : Should contain registers location and length
> -- interrupts : Should contain the three timer interrupts usually with
> -  flags for falling edge
> -
> -Optionally required properties:
> -
> -- clocks : a clock to provide the tick rate for "faraday,fttmr010"
> -- clock-names : should be "EXTCLK" and "PCLK" for the external tick timer
> -  and peripheral clock respectively, for "faraday,fttmr010"
> -- syscon : a phandle to the global Gemini system controller if the compatible
> -  type is "cortina,gemini-timer"
> -
> -Example:
> -
> -timer@43000000 {
> -	compatible = "faraday,fttmr010";
> -	reg = <0x43000000 0x1000>;
> -	interrupts = <14 IRQ_TYPE_EDGE_FALLING>, /* Timer 1 */
> -		   <15 IRQ_TYPE_EDGE_FALLING>, /* Timer 2 */
> -		   <16 IRQ_TYPE_EDGE_FALLING>; /* Timer 3 */
> -	clocks = <&extclk>, <&pclk>;
> -	clock-names = "EXTCLK", "PCLK";
> -};
> diff --git a/Documentation/devicetree/bindings/timer/faraday,fttmr010.yaml b/Documentation/devicetree/bindings/timer/faraday,fttmr010.yaml
> new file mode 100644
> index 000000000000..a495ea80c0fc
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/timer/faraday,fttmr010.yaml
> @@ -0,0 +1,86 @@
> +# SPDX-License-Identifier: (GPL-2.0+)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/timer/faraday,fttmr010.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Faraday Technology timer
> +
> +maintainers:
> +  - Linus Walleij <linus.walleij@linaro.org>
> +
> +description: |
> +  This timer is a generic IP block from Faraday Technology, embedded in the
> +  Cortina Systems Gemini SoCs and other designs.
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - const: faraday,fttmr010
> +      - items:
> +          - const: cortina,gemini-timer
> +          - const: faraday,fttmr010
> +      - items:
> +          - const: moxa,moxart-timer
> +          - const: faraday,fttmr010
> +      - const: aspeed,ast2400-timer
> +      - const: aspeed,ast2500-timer
> +      - const: aspeed,ast2600-timer
> +
> +  reg:
> +    maxItems: 1
> +
> +  resets:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 3
> +    description: Should contain the three timer interrupts usually with flags for falling edge
> +
> +  clocks:
> +    minItems: 2
> +
> +  clock-names:
> +    items:
> +      - const: "PCLK"
> +      - const: "EXTCLK"
> +
> +  syscon:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    maxItems: 1
> +
> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        items:

This is wrong because 'contains' should be a schema applying to a single 
item whereas 'items' applies to the whole array.

> +          - const: cortina,gemini-timer

Just this is enough.

> +          - const: faraday,fttmr010
> +then:
> +  required:
> +    - syscon
> +else:
> +  properties:
> +    syscon: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    timer@43000000 {
> +      compatible = "faraday,fttmr010";
> +      reg = <0x43000000 0x1000>;
> +      interrupts = <14 IRQ_TYPE_EDGE_FALLING>, /* Timer 1 */
> +                   <15 IRQ_TYPE_EDGE_FALLING>, /* Timer 2 */
> +                   <16 IRQ_TYPE_EDGE_FALLING>; /* Timer 3 */
> +      clocks = <&extclk>, <&pclk>;
> +      clock-names = "PCLK", "EXTCLK";
> +      syscon = <&syscon>;

This should fail based on my read of the .txt binding.

> +    };
> +...
> -- 
> 2.31.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-04 21:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28 18:53 [PATCH] dt-bindings: timer: Convert faraday,fttmr010 to yaml Corentin Labbe
2021-06-04 21:11 ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.