Skip to contentSkip to conversation

dt-bindings: rtc: Convert rtc-cmos binding to YAML

PATCH Superseded Teja Sai Charan B 3 participants 3 messages May 19

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: rtc: Convert rtc-cmos binding to YAML

From: Teja Sai Charan Bellamkonda <[email protected]>

Convert the rtc-cmos devicetree bindings to dt schema.

---
 .../devicetree/bindings/rtc/rtc-cmos.txt      | 27 ---------
 .../devicetree/bindings/rtc/rtc-cmos.yaml     | 55 +++++++++++++++++++
 2 files changed, 55 insertions(+), 27 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-cmos.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-cmos.yaml
Documentation/devicetree/bindings/rtc/rtc-cmos.txt deleted +0 -27
deleted file mode 100644
index 7d7b5f6bda65..000000000000
@@ -1,27 +0,0 @@
- Motorola mc146818 compatible RTC
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Required properties:
-  - compatible : "motorola,mc146818"
-  - reg : should contain registers location and length.
-
-Optional properties:
-  - interrupts : should contain interrupt.
-  - ctrl-reg : Contains the initial value of the control register also
-    called "Register B".
-  - freq-reg : Contains the initial value of the frequency register also
-    called "Register A".
-
-"Register A" and "B" are usually initialized by the firmware (BIOS for
-instance). If this is not done, it can be performed by the driver.
-
-ISA Example:
-
-	rtc@70 {
-	         compatible = "motorola,mc146818";
-	         interrupts = <8 3>;
-	         interrupt-parent = <&ioapic1>;
-	         ctrl-reg = <2>;
-	         freq-reg = <0x26>;
-	         reg = <1 0x70 2>;
-	 };
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The schema restricts the `compatible` property to strictly `"motorola,mc146818"`, causing…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The schema restricts the compatible property to strictly "motorola,mc146818", causing dtbs_check validation failures for existing in-tree device trees. --

commit 2e9837eab33637d478720ff763bc9b81afee1cf3
Author: Teja Sai Charan Bellamkonda <[email protected]>

dt-bindings: rtc: Convert rtc-cmos binding to YAML

This commit converts the rtc-cmos devicetree bindings from plain text to the dt schema format.

Quoted 4 lines
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +0 -0
new file mode 100644

[ ... ]

Documentation/devicetree/bindings/rtc/rtc-cmos.yaml line 16

Quoted 5 lines
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +5 -0
+properties:
+  compatible:
+    const: motorola,mc146818
+
+  reg:

Will this strict constraint cause dtbs_check validation failures for existing in-tree device trees?

Looking at arch/x86/platform/ce4100/falconfalls.dts, the RTC node defines a fallback compatible array:

	rtc@70 {
		compatible = "intel,ce4100-rtc", "motorola,mc146818";
		...
	};

Since the schema uses const instead of allowing an array, it appears this might reject configurations containing the intel,ce4100-rtc variant. Should the compatible property use a oneOf block to permit both the exact string and the fallback array?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Teja Sai Charan B
Quoted 55 lines · Teja Sai Charan B

From: Teja Sai Charan Bellamkonda <[email protected]>

Convert the rtc-cmos devicetree bindings to dt schema.

---
 .../devicetree/bindings/rtc/rtc-cmos.txt      | 27 ---------
 .../devicetree/bindings/rtc/rtc-cmos.yaml     | 55 +++++++++++++++++++
 2 files changed, 55 insertions(+), 27 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-cmos.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-cmos.yaml
Documentation/devicetree/bindings/rtc/rtc-cmos.txt deleted +0 -27
deleted file mode 100644
index 7d7b5f6bda65..000000000000
@@ -1,27 +0,0 @@
- Motorola mc146818 compatible RTC
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Required properties:
-  - compatible : "motorola,mc146818"
-  - reg : should contain registers location and length.
-
-Optional properties:
-  - interrupts : should contain interrupt.
-  - ctrl-reg : Contains the initial value of the control register also
-    called "Register B".
-  - freq-reg : Contains the initial value of the frequency register also
-    called "Register A".
-
-"Register A" and "B" are usually initialized by the firmware (BIOS for
-instance). If this is not done, it can be performed by the driver.
-
-ISA Example:
-
-	rtc@70 {
-	         compatible = "motorola,mc146818";
-	         interrupts = <8 3>;
-	         interrupt-parent = <&ioapic1>;
-	         ctrl-reg = <2>;
-	         freq-reg = <0x26>;
-	         reg = <1 0x70 2>;
-	 };
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +4 -0
new file mode 100644
index 000000000000..e368264ac483
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/rtc-cmos.yaml#

Documentation/devicetree/bindings/rtc/rtc-cmos.yaml line 14

Quoted 10 lines
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +10 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Motorola mc146818 compatible RTC
+
+maintainers:
+  - Alexandre Belloni <[email protected]>
+
+properties:
+  compatible:
+    const: motorola,mc146818

It's not a problem with the conversion per se, but as sashiko pointed out, there's an intel device with a soc-specific compatible.
Could you document that here, with a fallback to this motorola one please?

pw-bot: changes-requested

Thanks,
Conor.

Quoted 24 lines
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +24 -0
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  ctrl-reg:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Initial value of the control register
+      (also known as Register B).
+
+  freq-reg:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Initial value of the frequency register
+      (also known as Register A).
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false

Documentation/devicetree/bindings/rtc/rtc-cmos.yaml line 48

Quoted 10 lines
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +10 -0
+
+examples:
+  - |
+    bus {
+        #address-cells = <2>;
+        #size-cells = <1>;
+
+        rtc@70 {
+            compatible = "motorola,mc146818";
+            reg = <1 0x70 2>;

Please be consistent here about using only hex, even if the text file didn't do that.

Quoted 10 lines
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +7 -0
+
+            interrupts = <8 3>;
+
+            ctrl-reg = <2>;
+            freq-reg = <0x26>;
+        };
+    };
Signature · 1 line
2.43.0