Re: [PATCH] dt-bindings: rtc: mcp795: convert to YAML

From: Krzysztof Kozlowski
Date: Wed Sep 06 2023 - 06:42:53 EST


On 06/09/2023 12:23, Javier Carrasco wrote:
> Convert the MCP795 bindings from text to YAML format to support bindings
> validation.
>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx>
> ---
> YAML is the preferred format for dt-bindings, which allows validation.
> ---
> .../devicetree/bindings/rtc/maxim,mcp795.txt | 11 -------
> .../devicetree/bindings/rtc/maxim,mcp795.yaml | 35 ++++++++++++++++++++++
> 2 files changed, 35 insertions(+), 11 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/rtc/maxim,mcp795.txt b/Documentation/devicetree/bindings/rtc/maxim,mcp795.txt
> deleted file mode 100644
> index a59fdd8c236d..000000000000
> --- a/Documentation/devicetree/bindings/rtc/maxim,mcp795.txt
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -* Maxim MCP795 SPI Serial Real-Time Clock
> -
> -Required properties:
> -- compatible: Should contain "maxim,mcp795".
> -- reg: SPI address for chip
> -
> -Example:
> - mcp795: rtc@0 {
> - compatible = "maxim,mcp795";
> - reg = <0>;
> - };
> diff --git a/Documentation/devicetree/bindings/rtc/maxim,mcp795.yaml b/Documentation/devicetree/bindings/rtc/maxim,mcp795.yaml
> new file mode 100644
> index 000000000000..77e465747d43
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/maxim,mcp795.yaml
> @@ -0,0 +1,35 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/rtc/maxim,mcp795.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Maxim MCP795 SPI Serial Real Time Clock
> +
> +allOf:
> + - $ref: rtc.yaml#

Nit: By convention, this goes after maintainers/description.

> +
> +maintainers:
> + - Josef Gajdusek <atx@xxxxxxxx>
> +
> +properties:
> + compatible:
> + enum:
> + - maxim,mcp795
> +
> + reg:
> + maxItems: 1
> +
> +required:
> + - compatible
> + - reg
> +
> +additionalProperties: false

This should be unevaluatedProperties:false, so you allow other common
RTC properties. But then, it is even smaller than trivial RTC devices, so:
1. What about interrupts? No interrupt line?
2. If there is interrupt line, just add it to trivial-rtc. Otherwise,
it's fine here with changes above.

Best regards,
Krzysztof