Skip to contentSkip to conversation

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

PATCH Applied Rafał Miłecki 6 participants 8 messages Jan 22, 2024 – Feb 29, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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

From: Rafał Miłecki <[email protected]>

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

---
 .../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
Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml new file +39 -0
new file mode 100644
index 000000000000..75624ddf6d4d
@@ -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 <[email protected]>
+
+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>;
+    };
Documentation/devicetree/bindings/rtc/rtc-mt2712.txt deleted +0 -14
deleted file mode 100644
index c33d87e5e753..000000000000
@@ -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>;
-};
Signature · 1 line
2.35.3
maintainer
#1 lore raw

Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml

Quoted 16 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

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

---
  .../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

Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml +0 -0

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

Regards,
Matthias

Quoted 64 lines

new file mode 100644
index 000000000000..75624ddf6d4d

Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml new file +39 -0
@@ -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 <[email protected]>
+
+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>;
+    };
Documentation/devicetree/bindings/rtc/rtc-mt2712.txt deleted +0 -14
deleted file mode 100644
index c33d87e5e753..000000000000
@@ -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>;
-};
#2 lore raw
Quoted 16 lines · Matthias Brugger
Quoted 15 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

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

---
  .../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

Quoted 3 lines

Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml

Quoted 1 line
Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml +0 -0

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?

Signature · 1 line
Rafał Miłecki
#3 lore raw
Quoted 26 lines · Rafał Miłecki
Quoted 16 lines · Matthias Brugger
Quoted 15 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

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

---
  .../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

Quoted 3 lines

Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml

Quoted 1 line
Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml +0 -0

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.

Quoted 4 lines

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

#4 lore raw

Il 23/01/24 09:57, Krzysztof Kozlowski ha scritto:

Quoted 27 lines · Rafał Miłecki
Quoted 26 lines · Matthias Brugger
Quoted 16 lines · Rafał Miłecki
Quoted 15 lines

From: Rafał Miłecki <[email protected]>

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

---
   .../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

Quoted 3 lines

Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml

Quoted 1 line
Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml +0 -0

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.

Quoted 9 lines
Quoted 4 lines

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

maintainer Reviewed-by
#5 lore raw
Quoted 33 lines · AngeloGioacchino Del Regno

Il 23/01/24 09:57, Krzysztof Kozlowski ha scritto:

Quoted 32 lines · Rafał Miłecki
Quoted 30 lines · Matthias Brugger
Quoted 16 lines · Rafał Miłecki
Quoted 15 lines

From: Rafał Miłecki <[email protected]>

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

---
   .../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

Quoted 3 lines

Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml

Quoted 1 line
Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml +0 -0

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?

Quoted 8 lines
Quoted 4 lines

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:

maintainer Reviewed-by on v1 1/1
#6 lore raw
In reply to Rafał Miłecki
Quoted 7 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

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

Quoted 8 lines
---
 .../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
maintainer Applied
#7 lore raw
In reply to Rafał Miłecki
Quoted 6 lines · Rafał Miłecki

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,

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com