diff mbox series

dt-bindings: rtc: convert MT2717 RTC to the json-schema

Message ID 20240122124949.29577-1-zajec5@gmail.com (mailing list archive)
State Not Applicable
Headers show
Series dt-bindings: rtc: convert MT2717 RTC to the json-schema | expand

Commit Message

Rafał Miłecki Jan. 22, 2024, 12:49 p.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

This helps validating DTS files. Introduced changes:
1. Reworded title
2. Dropper redundant properties descriptions
3. Added required #include and adjusted "reg" in example

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 .../bindings/rtc/mediatek,mt2712-rtc.yaml     | 39 +++++++++++++++++++
 .../devicetree/bindings/rtc/rtc-mt2712.txt    | 14 -------
 2 files changed, 39 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
 delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt2712.txt

Comments

Matthias Brugger Jan. 22, 2024, 1:19 p.m. UTC | #1
On 22/01/2024 13:49, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> This helps validating DTS files. Introduced changes:
> 1. Reworded title
> 2. Dropper redundant properties descriptions
> 3. Added required #include and adjusted "reg" in example
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>   .../bindings/rtc/mediatek,mt2712-rtc.yaml     | 39 +++++++++++++++++++
>   .../devicetree/bindings/rtc/rtc-mt2712.txt    | 14 -------
>   2 files changed, 39 insertions(+), 14 deletions(-)
>   create mode 100644 Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
>   delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
> 
> diff --git a/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml b/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml

In this schema can easily fit "mediatek,mt7622-rtc", so how about renaming it 
and add reference for that RTC as well?

Regards,
Matthias


> new file mode 100644
> index 000000000000..75624ddf6d4d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
> @@ -0,0 +1,39 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/rtc/mediatek,mt2712-rtc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MediaTek MT2712 on-SoC RTC
> +
> +allOf:
> +  - $ref: rtc.yaml#
> +
> +maintainers:
> +  - Ran Bi <ran.bi@mediatek.com>
> +
> +properties:
> +  compatible:
> +    const: mediatek,mt2712-rtc
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +required:
> +  - reg
> +  - interrupts
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    rtc@10011000 {
> +        compatible = "mediatek,mt2712-rtc";
> +        reg = <0x10011000 0x1000>;
> +        interrupts = <GIC_SPI 239 IRQ_TYPE_LEVEL_LOW>;
> +    };
> diff --git a/Documentation/devicetree/bindings/rtc/rtc-mt2712.txt b/Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
> deleted file mode 100644
> index c33d87e5e753..000000000000
> --- a/Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -Device-Tree bindings for MediaTek SoC based RTC
> -
> -Required properties:
> -- compatible	    : Should be "mediatek,mt2712-rtc" : for MT2712 SoC
> -- reg 		    : Specifies base physical address and size of the registers;
> -- interrupts	    : Should contain the interrupt for RTC alarm;
> -
> -Example:
> -
> -rtc: rtc@10011000 {
> -	compatible = "mediatek,mt2712-rtc";
> -	reg = <0 0x10011000 0 0x1000>;
> -	interrupts = <GIC_SPI 239 IRQ_TYPE_LEVEL_LOW>;
> -};
Rafał Miłecki Jan. 22, 2024, 5:40 p.m. UTC | #2
On 22.01.2024 14:19, Matthias Brugger wrote:
> On 22/01/2024 13:49, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> This helps validating DTS files. Introduced changes:
>> 1. Reworded title
>> 2. Dropper redundant properties descriptions
>> 3. Added required #include and adjusted "reg" in example
>>
>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>> ---
>>   .../bindings/rtc/mediatek,mt2712-rtc.yaml     | 39 +++++++++++++++++++
>>   .../devicetree/bindings/rtc/rtc-mt2712.txt    | 14 -------
>>   2 files changed, 39 insertions(+), 14 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
>>   delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
>>
>> diff --git a/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml b/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
> 
> In this schema can easily fit "mediatek,mt7622-rtc", so how about renaming it and add reference for that RTC as well?

I see your point but by looking at existing Linux drivers:
drivers/rtc/rtc-mt2712.c
drivers/rtc/rtc-mt7622.c
it seems like quite different hardware blocks.

Different registers, different programming, clk in MT7622.

Should they really share a YAML binding just because they use similar
properties?
Krzysztof Kozlowski Jan. 23, 2024, 8:57 a.m. UTC | #3
On 22/01/2024 18:40, Rafał Miłecki wrote:
> On 22.01.2024 14:19, Matthias Brugger wrote:
>> On 22/01/2024 13:49, Rafał Miłecki wrote:
>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>
>>> This helps validating DTS files. Introduced changes:
>>> 1. Reworded title
>>> 2. Dropper redundant properties descriptions
>>> 3. Added required #include and adjusted "reg" in example
>>>
>>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>>> ---
>>>   .../bindings/rtc/mediatek,mt2712-rtc.yaml     | 39 +++++++++++++++++++
>>>   .../devicetree/bindings/rtc/rtc-mt2712.txt    | 14 -------
>>>   2 files changed, 39 insertions(+), 14 deletions(-)
>>>   create mode 100644 Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
>>>   delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml b/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
>>
>> In this schema can easily fit "mediatek,mt7622-rtc", so how about renaming it and add reference for that RTC as well?
> 
> I see your point but by looking at existing Linux drivers:
> drivers/rtc/rtc-mt2712.c
> drivers/rtc/rtc-mt7622.c
> it seems like quite different hardware blocks.
> 
> Different registers, different programming, clk in MT7622.
> 
> Should they really share a YAML binding just because they use similar
> properties?

Hardware aspect matters more, including features not yet present in the
binding, like some power on/off control. Different clock inputs is also
an argument.

Best regards,
Krzysztof
AngeloGioacchino Del Regno Jan. 23, 2024, 10:40 a.m. UTC | #4
Il 23/01/24 09:57, Krzysztof Kozlowski ha scritto:
> On 22/01/2024 18:40, Rafał Miłecki wrote:
>> On 22.01.2024 14:19, Matthias Brugger wrote:
>>> On 22/01/2024 13:49, Rafał Miłecki wrote:
>>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>>
>>>> This helps validating DTS files. Introduced changes:
>>>> 1. Reworded title
>>>> 2. Dropper redundant properties descriptions
>>>> 3. Added required #include and adjusted "reg" in example
>>>>
>>>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>>>> ---
>>>>    .../bindings/rtc/mediatek,mt2712-rtc.yaml     | 39 +++++++++++++++++++
>>>>    .../devicetree/bindings/rtc/rtc-mt2712.txt    | 14 -------
>>>>    2 files changed, 39 insertions(+), 14 deletions(-)
>>>>    create mode 100644 Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
>>>>    delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml b/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
>>>
>>> In this schema can easily fit "mediatek,mt7622-rtc", so how about renaming it and add reference for that RTC as well?
>>
>> I see your point but by looking at existing Linux drivers:
>> drivers/rtc/rtc-mt2712.c
>> drivers/rtc/rtc-mt7622.c
>> it seems like quite different hardware blocks.
>>
>> Different registers, different programming, clk in MT7622.
>>
>> Should they really share a YAML binding just because they use similar
>> properties?
> 
> Hardware aspect matters more, including features not yet present in the
> binding, like some power on/off control. Different clock inputs is also
> an argument.
> 

I agree - those IPs are different, we should have two bindings for the two
(very) different IP versions.

Cheers,
Angelo
Matthias Brugger Jan. 24, 2024, 4:10 p.m. UTC | #5
On 23/01/2024 11:40, AngeloGioacchino Del Regno wrote:
> Il 23/01/24 09:57, Krzysztof Kozlowski ha scritto:
>> On 22/01/2024 18:40, Rafał Miłecki wrote:
>>> On 22.01.2024 14:19, Matthias Brugger wrote:
>>>> On 22/01/2024 13:49, Rafał Miłecki wrote:
>>>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>>>
>>>>> This helps validating DTS files. Introduced changes:
>>>>> 1. Reworded title
>>>>> 2. Dropper redundant properties descriptions
>>>>> 3. Added required #include and adjusted "reg" in example
>>>>>
>>>>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>>>>> ---
>>>>>    .../bindings/rtc/mediatek,mt2712-rtc.yaml     | 39 +++++++++++++++++++
>>>>>    .../devicetree/bindings/rtc/rtc-mt2712.txt    | 14 -------
>>>>>    2 files changed, 39 insertions(+), 14 deletions(-)
>>>>>    create mode 100644 
>>>>> Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
>>>>>    delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml 
>>>>> b/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
>>>>
>>>> In this schema can easily fit "mediatek,mt7622-rtc", so how about renaming 
>>>> it and add reference for that RTC as well?
>>>
>>> I see your point but by looking at existing Linux drivers:
>>> drivers/rtc/rtc-mt2712.c
>>> drivers/rtc/rtc-mt7622.c
>>> it seems like quite different hardware blocks.
>>>
>>> Different registers, different programming, clk in MT7622.
>>>
>>> Should they really share a YAML binding just because they use similar
>>> properties?
>>
>> Hardware aspect matters more, including features not yet present in the
>> binding, like some power on/off control. Different clock inputs is also
>> an argument.
>>
> 
> I agree - those IPs are different, we should have two bindings for the two
> (very) different IP versions.
> 

Makes sense. Then for this patch:
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Rob Herring (Arm) Jan. 30, 2024, 7:23 p.m. UTC | #6
On Mon, 22 Jan 2024 13:49:49 +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> This helps validating DTS files. Introduced changes:
> 1. Reworded title
> 2. Dropper redundant properties descriptions
> 3. Added required #include and adjusted "reg" in example
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>  .../bindings/rtc/mediatek,mt2712-rtc.yaml     | 39 +++++++++++++++++++
>  .../devicetree/bindings/rtc/rtc-mt2712.txt    | 14 -------
>  2 files changed, 39 insertions(+), 14 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
>  delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
> 

Reviewed-by: Rob Herring <robh@kernel.org>
Alexandre Belloni Feb. 29, 2024, 9:21 p.m. UTC | #7
On Mon, 22 Jan 2024 13:49:49 +0100, Rafał Miłecki wrote:
> This helps validating DTS files. Introduced changes:
> 1. Reworded title
> 2. Dropper redundant properties descriptions
> 3. Added required #include and adjusted "reg" in example
> 
> 

Applied, thanks!

[1/1] dt-bindings: rtc: convert MT2717 RTC to the json-schema
      https://git.kernel.org/abelloni/c/e8c0498505b0

Best regards,
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml b/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
new file mode 100644
index 000000000000..75624ddf6d4d
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml
@@ -0,0 +1,39 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/mediatek,mt2712-rtc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT2712 on-SoC RTC
+
+allOf:
+  - $ref: rtc.yaml#
+
+maintainers:
+  - Ran Bi <ran.bi@mediatek.com>
+
+properties:
+  compatible:
+    const: mediatek,mt2712-rtc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - reg
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    rtc@10011000 {
+        compatible = "mediatek,mt2712-rtc";
+        reg = <0x10011000 0x1000>;
+        interrupts = <GIC_SPI 239 IRQ_TYPE_LEVEL_LOW>;
+    };
diff --git a/Documentation/devicetree/bindings/rtc/rtc-mt2712.txt b/Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
deleted file mode 100644
index c33d87e5e753..000000000000
--- a/Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
+++ /dev/null
@@ -1,14 +0,0 @@ 
-Device-Tree bindings for MediaTek SoC based RTC
-
-Required properties:
-- compatible	    : Should be "mediatek,mt2712-rtc" : for MT2712 SoC
-- reg 		    : Specifies base physical address and size of the registers;
-- interrupts	    : Should contain the interrupt for RTC alarm;
-
-Example:
-
-rtc: rtc@10011000 {
-	compatible = "mediatek,mt2712-rtc";
-	reg = <0 0x10011000 0 0x1000>;
-	interrupts = <GIC_SPI 239 IRQ_TYPE_LEVEL_LOW>;
-};