Skip to contentSkip to conversation

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

PATCH Superseded Teja Sai Charan B 3 participants 4 messages Jun 16 – Jun 17

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

---

Changes in v2:
- Allow intel,ce4100-rtc compatible used by existing DTS files

---
 .../devicetree/bindings/rtc/rtc-cmos.txt      | 27 ---------
 .../devicetree/bindings/rtc/rtc-cmos.yaml     | 60 +++++++++++++++++++
 result.txt                                    | 17 ++++++
 3 files changed, 77 insertions(+), 27 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-cmos.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-cmos.yaml
 create mode 100644 result.txt
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 +60 -0

60 lines not on this page · raw message

result.txt new file +17 -0
new file mode 100644
index 000000000000..5e90660b93ec
@@ -0,0 +1,17 @@
+arch/x86/kernel/x86_init.c:42:	{ .compatible = "motorola,mc146818" },
+arch/x86/platform/ce4100/falconfalls.dts:420:					compatible = "intel,ce4100-rtc", "motorola,mc146818";
+arch/mips/boot/dts/loongson/rs780e-pch.dtsi:31:				compatible = "motorola,mc146818";
+arch/mips/boot/dts/mti/malta.dts:110:			compatible = "motorola,mc146818";
+arch/alpha/kernel/rtc.c:25: * We don't want to use the rtc-cmos driver, because we don't want to support
+drivers/built-in.a:1031:rtc/rtc-cmos.o/
+drivers/rtc/built-in.a:11:rtc-cmos.o/
+drivers/rtc/.rtc-mc146818-lib.o.cmd:1:savedcmd_drivers/rtc/rtc-mc146818-lib.o := gcc -Wp,-MMD,drivers/rtc/.rtc-mc146818-lib.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-sse4a -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -march=x86-64 -mtune=generic -mno-red-zone -mcmodel=kernel -mstack-protector-guard-reg=gs -mstack-protector-guard-symbol=__ref_stack_chk_guard -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -O2 -fno-allow-store-data-races -fstack-protector-strong -fno-omit-frame-pointer -fno-optimize-sibling-calls -ftrivial-auto-var-init=zero -fno-stack-clash-protection -fzero-call-used-regs=used-gpr -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -falign-functions=16 -fstrict-flex-arrays=3 -fms-extensions -fno-strict-overflow -fno-stack-check -fconserve-stack -fno-builtin-wcslen -Wall -Wextra -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wmissing-declarations -Wmissing-prototypes -Wframe-larger-than=1024 -Wno-main -Wno-dangling-pointer -Wvla-larger-than=1 -Wno-pointer-sign -Wcast-function-type -Wno-array-bounds -Wno-stringop-overflow -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wenum-conversion -Wunused -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-packed-not-aligned -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-override-init -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-parameter -g -gdwarf-5  -fsanitize=bounds-strict -fsanitize=shift -fsanitize=bool -fsanitize=enum      -DKBUILD_MODFILE='"drivers/rtc/rtc-mc146818-lib"' -DKBUILD_BASENAME='"rtc_mc146818_lib"' -DKBUILD_MODNAME='"rtc_mc146818_lib"' -D__KBUILD_MODNAME=rtc_mc146818_lib -c -o drivers/rtc/rtc-mc146818-lib.o drivers/rtc/rtc-mc146818-lib.c  
+drivers/rtc/.built-in.a.cmd:1:savedcmd_drivers/rtc/built-in.a := rm -f drivers/rtc/built-in.a;  printf "drivers/rtc/%s " lib.o class.o interface.o nvmem.o dev.o proc.o sysfs.o rtc-mc146818-lib.o rtc-cmos.o | xargs ar cDPrST drivers/rtc/built-in.a
+drivers/rtc/Kconfig:1065:	  will be called rtc-cmos.
+drivers/rtc/Makefile:45:obj-$(CONFIG_RTC_DRV_CMOS)	+= rtc-cmos.o
+drivers/rtc/.rtc-cmos.o.cmd:1:savedcmd_drivers/rtc/rtc-cmos.o := gcc -Wp,-MMD,drivers/rtc/.rtc-cmos.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-sse4a -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -march=x86-64 -mtune=generic -mno-red-zone -mcmodel=kernel -mstack-protector-guard-reg=gs -mstack-protector-guard-symbol=__ref_stack_chk_guard -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -O2 -fno-allow-store-data-races -fstack-protector-strong -fno-omit-frame-pointer -fno-optimize-sibling-calls -ftrivial-auto-var-init=zero -fno-stack-clash-protection -fzero-call-used-regs=used-gpr -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -falign-functions=16 -fstrict-flex-arrays=3 -fms-extensions -fno-strict-overflow -fno-stack-check -fconserve-stack -fno-builtin-wcslen -Wall -Wextra -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wmissing-declarations -Wmissing-prototypes -Wframe-larger-than=1024 -Wno-main -Wno-dangling-pointer -Wvla-larger-than=1 -Wno-pointer-sign -Wcast-function-type -Wno-array-bounds -Wno-stringop-overflow -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wenum-conversion -Wunused -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-packed-not-aligned -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-override-init -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-parameter -g -gdwarf-5  -fsanitize=bounds-strict -fsanitize=shift -fsanitize=bool -fsanitize=enum      -DKBUILD_MODFILE='"drivers/rtc/rtc-cmos"' -DKBUILD_BASENAME='"rtc_cmos"' -DKBUILD_MODNAME='"rtc_cmos"' -D__KBUILD_MODNAME=rtc_cmos -c -o drivers/rtc/rtc-cmos.o drivers/rtc/rtc-cmos.c  
+drivers/rtc/.rtc-cmos.o.cmd:3:source_drivers/rtc/rtc-cmos.o := drivers/rtc/rtc-cmos.c
+drivers/rtc/.rtc-cmos.o.cmd:5:deps_drivers/rtc/rtc-cmos.o := \
+drivers/rtc/.rtc-cmos.o.cmd:1372:drivers/rtc/rtc-cmos.o: $(deps_drivers/rtc/rtc-cmos.o)
+drivers/rtc/.rtc-cmos.o.cmd:1374:$(deps_drivers/rtc/rtc-cmos.o):
+drivers/rtc/rtc-cmos.c:1382:		.compatible = "motorola,mc146818",
Signature · 1 line
2.43.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [Low] The node name in the YAML example uses a unit address that does not match its 'reg' property, which…

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Low] The node name in the YAML example uses a unit address that does not match its 'reg' property, which will cause a dtc warning and fail make dt_binding_check.
- [Low] A stray file result.txt containing intermediate search and build output was accidentally included in the patch.
- [Low] Important explanatory text about firmware initialization was dropped during the conversion to YAML.
--

commit 141cef115f7766092691376134d5e5d70aca938a
Author: Teja Sai Charan Bellamkonda <[email protected]>

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

Convert the rtc-cmos devicetree bindings to dt schema.

Quoted 5 lines
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +0 -0
new file mode 100644
index 0000000000000..ba4812778115c

[ ... ]

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

Quoted 11 lines
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +11 -0
+  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).

[Severity: Low]
The original text binding contained information explaining that Register A and B are usually initialized by firmware (e.g., BIOS), and if not, can be performed by the driver. Should this explanatory text be preserved in the descriptions here to retain the original context?

[ ... ]

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

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

[Severity: Low]
Since the bus has #address-cells = <2> and the reg property starts with 1, should the node name be formatted as rtc@1,70 instead of rtc@70? A mismatched unit address will result in dtc warnings and fail make dt_binding_check.

[ ... ]

result.txt line 2

Quoted 8 lines
result.txt new file +2 -0
new file mode 100644
index 0000000000000..5e90660b93ec2
@@ -0,0 +1,17 @@
+arch/x86/kernel/x86_init.c:42:	{ .compatible = "motorola,mc146818" },
+arch/x86/platform/ce4100/falconfalls.dts:420:					compatible = "intel,ce4100-rtc", "motorola,mc146818";

[Severity: Low]
Was this result.txt file intentionally included? It appears to be a local search and build log that accidentally made it into the patch.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
Quoted 4 lines · On Tue, Jun 16, 2026 at 09:04:03AM +0000, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Low] The node name in the YAML example uses a unit address that does not match its 'reg' property, which will cause a dtc warning and fail make dt_binding_check.
- [Low] A stray file result.txt containing intermediate search and build output was accidentally included in the patch.
- [Low] Important explanatory text about firmware initialization was dropped during the conversion to YAML.

Please address Sashiko reports as well.

Best regards,
Krzysztof

#3 lore raw
In reply to Teja Sai Charan B
Quoted 3 lines · Teja Sai Charan B

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

Convert the rtc-cmos devicetree bindings to dt schema.

Subject: s/YAML/DT schema/

Quoted 11 lines

---

Changes in v2:
- Allow intel,ce4100-rtc compatible used by existing DTS files

---
 .../devicetree/bindings/rtc/rtc-cmos.txt      | 27 ---------
 .../devicetree/bindings/rtc/rtc-cmos.yaml     | 60 +++++++++++++++++++
 result.txt                                    | 17 ++++++

Stale file, please drop.

Quoted 4 lines
 3 files changed, 77 insertions(+), 27 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-cmos.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-cmos.yaml
 create mode 100644 result.txt

...

Quoted 15 lines
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +9 -0
new file mode 100644
index 000000000000..ba4812778115
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/rtc-cmos.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Motorola mc146818 compatible RTC
+
+maintainers:

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

Quoted 10 lines
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +10 -0
+  - Alexandre Belloni <[email protected]>
+
+properties:
+  compatible:
+    oneOf:
+      - const: motorola,mc146818
+
+      - items:
+          - const: intel,ce4100-rtc
+          - const: motorola,mc146818

These were not in original binding, so you need to mention it in the commit msg and explain why.

I understand there is not 'rtc-cmos' compatible, so basically the filename should be set to this fallback compatible.

Quoted 13 lines
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +13 -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).
+

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

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

You should $ref the rtc.yaml schema and use "unevaluatedProperties:
false". Or explain in the commit msg why it is not applicable.

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

Quoted 1 line
Documentation/devicetree/bindings/rtc/rtc-cmos.yaml new file +1 -0
+additionalProperties: false

Best regards,
Krzysztof