linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Benjamin Gaignard <benjamin.gaignard@st.com>
Cc: a.zummo@towertech.it, alexandre.belloni@bootlin.com,
	mark.rutland@arm.com, alexandre.torgue@st.com,
	linux-rtc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dt-bindings: rtc: Convert stm32 rtc bindings to json-schema
Date: Fri, 13 Dec 2019 17:25:21 -0600	[thread overview]
Message-ID: <20191213232521.GA20953@bogus> (raw)
In-Reply-To: <20191202145740.29123-1-benjamin.gaignard@st.com>

On Mon, Dec 02, 2019 at 03:57:40PM +0100, Benjamin Gaignard wrote:
> Convert the STM32 RTC binding to DT schema format using json-schema
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> ---
>  .../devicetree/bindings/rtc/st,stm32-rtc.txt       |  61 ---------
>  .../devicetree/bindings/rtc/st,stm32-rtc.yaml      | 152 +++++++++++++++++++++
>  2 files changed, 152 insertions(+), 61 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/rtc/st,stm32-rtc.txt
>  create mode 100644 Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml


> diff --git a/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml
> new file mode 100644
> index 000000000000..80c445005bfb
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml
> @@ -0,0 +1,152 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/rtc/st,stm32-rtc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: STMicroelectronics STM32 Real Time Clock Bindings
> +
> +maintainers:
> +  - Gabriel Fernandez <gabriel.fernandez@st.com>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - st,stm32-rtc
> +      - st,stm32h7-rtc
> +      - st,stm32mp1-rtc
> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    minItems: 1
> +    maxItems: 2
> +
> +  clock-names:
> +    items:
> +      - const: pclk
> +      - const: rtc_ck
> +
> +  interrupts:
> +    maxItems: 1
> +
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - st,stm32-rtc
> +              - st,stm32h7-rtc
> +    then:
> +      properties:
> +        st,syscfg:
> +          allOf:
> +            - $ref: "/schemas/types.yaml#/definitions/phandle-array"
> +            - items:
> +                minItems: 3
> +                maxItems: 3
> +          description: |
> +            Phandle/offset/mask triplet. The phandle to pwrcfg used to
> +            access control register at offset, and change the dbp (Disable Backup
> +            Protection) bit represented by the mask, mandatory to disable/enable backup
> +            domain (RTC registers) write protection.
> +
> +        assigned-clocks:
> +          allOf:
> +            - $ref: "/schemas/types.yaml#/definitions/phandle-array"

Already has a type, so drop this.

> +          description: |
> +            override default rtc_ck parent clock reference to the rtc_ck clock entry
> +          maxItems: 1
> +
> +        assigned-clock-parents:
> +          allOf:
> +           - $ref: "/schemas/types.yaml#/definitions/phandle-array"

Same here.

Since you have the false schema below, I think these can go in base 
schema rather than under the if.

> +          description: |
> +            override default rtc_ck parent clock phandle of the new parent clock of rtc_ck
> +          maxItems: 1
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: st,stm32-rtc
> +
> +    then:
> +      properties:
> +        clocks:
> +          minItems: 1
> +          maxItems: 1
> +
> +        clock-names: false
> +
> +      required:
> +        - st,syscfg
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: st,stm32h7-rtc
> +
> +    then:
> +       properties:
> +         clocks:
> +           minItems: 2
> +           maxItems: 2
> +
> +       required:
> +         - clock-names
> +         - st,syscfg
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: st,stm32mp1-rtc
> +
> +    then:
> +       properties:
> +         clocks:
> +           minItems: 2
> +           maxItems: 2
> +
> +         assigned-clocks: false
> +         assigned-clock-parents: false
> +
> +       required:
> +         - clock-names
> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - interrupts
> +
> +examples:
> +  - |
> +    #include <dt-bindings/mfd/stm32f4-rcc.h>
> +    #include <dt-bindings/clock/stm32fx-clock.h>
> +    rtc@40002800 {
> +      compatible = "st,stm32-rtc";
> +      reg = <0x40002800 0x400>;
> +      clocks = <&rcc 1 CLK_RTC>;
> +      assigned-clocks = <&rcc 1 CLK_RTC>;
> +      assigned-clock-parents = <&rcc 1 CLK_LSE>;
> +      interrupt-parent = <&exti>;
> +      interrupts = <17 1>;
> +      st,syscfg = <&pwrcfg 0x00 0x100>;
> +    };
> +
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/clock/stm32mp1-clks.h>
> +    rtc@5c004000 {
> +      compatible = "st,stm32mp1-rtc";
> +      reg = <0x5c004000 0x400>;
> +      clocks = <&rcc RTCAPB>, <&rcc RTC>;
> +      clock-names = "pclk", "rtc_ck";
> +      interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
> +    };
> +
> +...
> -- 
> 2.15.0
> 

      reply	other threads:[~2019-12-13 23:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-02 14:57 [PATCH] dt-bindings: rtc: Convert stm32 rtc bindings to json-schema Benjamin Gaignard
2019-12-13 23:25 ` Rob Herring [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191213232521.GA20953@bogus \
    --to=robh@kernel.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandre.torgue@st.com \
    --cc=benjamin.gaignard@st.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mark.rutland@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).