Skip to contentSkip to conversation

dt-bindings: rtc: m41t80: Convert text schema to YAML one

PATCH Superseded Marek Vasut 2 participants 8 messages Nov 2, 2022 – Nov 3, 2022

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dt-bindings: rtc: m41t80: Convert text schema to YAML one

Convert the m41t80 text schema to YAML schema.
No functional change.

---
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: [email protected]
To: [email protected]

---
 .../devicetree/bindings/rtc/rtc-m41t80.txt    | 39 ----------
 .../devicetree/bindings/rtc/rtc-m41t80.yaml   | 75 +++++++++++++++++++
 2 files changed, 75 insertions(+), 39 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-m41t80.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml
Documentation/devicetree/bindings/rtc/rtc-m41t80.txt deleted +0 -39
deleted file mode 100644
index cdd196b1e9bdb..0000000000000
@@ -1,39 +0,0 @@
-ST M41T80 family of RTC and compatible
-
-Required properties:
-- compatible: should be one of:
-	"st,m41t62",
-	"st,m41t65",
-	"st,m41t80",
-	"st,m41t81",
-	"st,m41t81s",
-	"st,m41t82",
-	"st,m41t83",
-	"st,m41t84",
-	"st,m41t85",
-	"st,m41t87",
-	"microcrystal,rv4162",
-- reg: I2C bus address of the device
-
-Optional properties:
-- interrupts: rtc alarm interrupt.
-- clock-output-names: From common clock binding to override the default output
-                      clock name
-- wakeup-source: Enables wake up of host system on alarm
-
-Optional child node:
-- clock: Provide this if the square wave pin is used as boot-enabled fixed clock.
-
-Example:
-	rtc@68 {
-		compatible = "st,m41t80";
-		reg = <0x68>;
-		interrupt-parent = <&UIC0>;
-		interrupts = <0x9 0x8>;
-
-		clock {
-			compatible = "fixed-clock";
-			#clock-cells = <0>;
-			clock-frequency = <32768>;
-		};
-	};
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/2 dt-bindings: rtc: m41t80: Mark the clock: subnode as deprecated

The clock {} subnode seems like it is describing an always-on clock generated by the PMIC. This should rather be modeled by consumer of the clock taking phandle to the RTC node itself, since it already does have clock-cells and all. Since there are no users of the clock subnode in tree anyway, mark it as deprecated to avoid proliferation of this approach.

---
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: [email protected]
To: [email protected]

---
 Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml +1 -0
index 7f31a22caec9b..ffe1e09f2c56e 100644
@@ -42,6 +42,7 @@ properties:
   clock:
     type: object
     $ref: /schemas/clock/fixed-clock.yaml#
+    deprecated: true
     properties:
       clock-frequency:
         const: 32768
Signature · 1 line
2.35.1
#3 lore raw
In reply to Marek Vasut

Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml

Quoted 68 lines · Marek Vasut

Convert the m41t80 text schema to YAML schema.
No functional change.

---
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: [email protected]
To: [email protected]

---
 .../devicetree/bindings/rtc/rtc-m41t80.txt    | 39 ----------
 .../devicetree/bindings/rtc/rtc-m41t80.yaml   | 75 +++++++++++++++++++
 2 files changed, 75 insertions(+), 39 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-m41t80.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml
Documentation/devicetree/bindings/rtc/rtc-m41t80.txt deleted +0 -39
deleted file mode 100644
index cdd196b1e9bdb..0000000000000
@@ -1,39 +0,0 @@
-ST M41T80 family of RTC and compatible
-
-Required properties:
-- compatible: should be one of:
-	"st,m41t62",
-	"st,m41t65",
-	"st,m41t80",
-	"st,m41t81",
-	"st,m41t81s",
-	"st,m41t82",
-	"st,m41t83",
-	"st,m41t84",
-	"st,m41t85",
-	"st,m41t87",
-	"microcrystal,rv4162",
-- reg: I2C bus address of the device
-
-Optional properties:
-- interrupts: rtc alarm interrupt.
-- clock-output-names: From common clock binding to override the default output
-                      clock name
-- wakeup-source: Enables wake up of host system on alarm
-
-Optional child node:
-- clock: Provide this if the square wave pin is used as boot-enabled fixed clock.
-
-Example:
-	rtc@68 {
-		compatible = "st,m41t80";
-		reg = <0x68>;
-		interrupt-parent = <&UIC0>;
-		interrupts = <0x9 0x8>;
-
-		clock {
-			compatible = "fixed-clock";
-			#clock-cells = <0>;
-			clock-frequency = <32768>;
-		};
-	};
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +0 -0
new file mode 100644
index 0000000000000..7f31a22caec9b

Filename based on compatibles (more or less), so could be:
st,m41t80.yaml
or:
st,m41txx.yaml

The "rtc" name can be skipped as it is implied from subsystem folder, unless st,m41txx is a name of some SoC?

Quoted 25 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +24 -0
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/rtc-m41t80.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ST M41T80 family of RTC and compatible
+
+maintainers:
+  - Alexandre Belloni <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - st,m41t62
+      - st,m41t65
+      - st,m41t80
+      - st,m41t81
+      - st,m41t81s
+      - st,m41t82
+      - st,m41t83
+      - st,m41t84
+      - st,m41t85
+      - st,m41t87

Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml line 34

Quoted 10 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +10 -0
+      - microcrystal,rv4162
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  "#clock-cells":
+    const: 1

Hm, why do you have it?

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

Quoted 3 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +3 -0
+
+  clock-output-names:
+    description: From common clock binding to override the default output clock name.

You need maxItems

Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml line 40

Quoted 3 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +3 -0
+
+  wakeup-source:
+    description: Enables wake up of host system on alarm.

Skip the property - it comes from rtc.yaml.

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

Quoted 8 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +8 -0
+
+  clock:
+    type: object
+    $ref: /schemas/clock/fixed-clock.yaml#
+    properties:
+      clock-frequency:
+        const: 32768
+

Best regards,
Krzysztof

Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] dt-bindings: rtc: m41t80: Mark the clock: subnode as deprecated

In reply to Marek Vasut
Quoted 9 lines · Marek Vasut

The clock {} subnode seems like it is describing an always-on clock generated by the PMIC. This should rather be modeled by consumer of the clock taking phandle to the RTC node itself, since it already does have clock-cells and all. Since there are no users of the clock subnode in tree anyway, mark it as deprecated to avoid proliferation of this approach.

---

Best regards,
Krzysztof

#4 lore raw
In reply to Krzysztof Kozlowski

On 11/3/22 14:40, Krzysztof Kozlowski wrote:

[...]

Quoted 13 lines

Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml

Quoted 5 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +0 -0
new file mode 100644
index 0000000000000..7f31a22caec9b

Filename based on compatibles (more or less), so could be:
st,m41t80.yaml
or:
st,m41txx.yaml

The "rtc" name can be skipped as it is implied from subsystem folder, unless st,m41txx is a name of some SoC?

[...]

Quoted 10 lines

Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml line 34

Quoted 8 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +8 -0
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  "#clock-cells":
+    const: 1

Hm, why do you have it?

Because of the following warning:

$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml
  LINT    Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/rtc/rtc-m41t80.example.dts
  CHKDT   Documentation/devicetree/bindings/processed-schema.json
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml: properties: '#clock-cells' is a dependency of 'clock-output-names'
Quoted 5 lines

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

Quoted 3 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +3 -0
+
+  clock-output-names:
+    description: From common clock binding to override the default output clock name.

You need maxItems

Done

Quoted 5 lines

Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml line 40

Quoted 3 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +3 -0
+
+  wakeup-source:
+    description: Enables wake up of host system on alarm.

Skip the property - it comes from rtc.yaml.

Done

#6 lore raw
In reply to Krzysztof Kozlowski

On 11/3/22 14:40, Krzysztof Kozlowski wrote:

[...]

Quoted 11 lines

Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml

Quoted 5 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +0 -0
new file mode 100644
index 0000000000000..7f31a22caec9b

Filename based on compatibles (more or less), so could be:
st,m41t80.yaml
or:
st,m41txx.yaml

Quoted 2 lines

The "rtc" name can be skipped as it is implied from subsystem folder, unless st,m41txx is a name of some SoC?

It's dedicated I2C RTC, a discrete soic8 chip with optional coin cell battery.

We cannot really call it m41txx because there are other m41txx chips with different register layouts and thus different RTC drivers:

next$ ls -1 drivers/rtc/*m41t*
drivers/rtc/rtc-m41t80.c
drivers/rtc/rtc-m41t93.c
drivers/rtc/rtc-m41t94.c

The m41t80 is a sane choice, the m41t80 was the first supported, the other chips are just compatible to it.

Whether I should drop the rtc- prefix or not, I will defer that preference to Alexandre .

[...]

#5 lore raw
In reply to Marek Vasut
Quoted 33 lines · Marek Vasut

On 11/3/22 14:40, Krzysztof Kozlowski wrote:

[...]

Quoted 13 lines

Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml

Quoted 5 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +0 -0
new file mode 100644
index 0000000000000..7f31a22caec9b

Filename based on compatibles (more or less), so could be:
st,m41t80.yaml
or:
st,m41txx.yaml

The "rtc" name can be skipped as it is implied from subsystem folder, unless st,m41txx is a name of some SoC?

[...]

Quoted 10 lines

Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml line 34

Quoted 8 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +8 -0
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  "#clock-cells":
+    const: 1

Hm, why do you have it?

Because of the following warning:

Quoted 7 lines
$ make dt_binding_check 
DT_SCHEMA_FILES=Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml
   LINT    Documentation/devicetree/bindings
   DTEX    Documentation/devicetree/bindings/rtc/rtc-m41t80.example.dts
   CHKDT   Documentation/devicetree/bindings/processed-schema.json
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml: properties: 
'#clock-cells' is a dependency of 'clock-output-names'

So mention any changes from pure conversion in commit msg.

Best regards,
Krzysztof

#7 lore raw
In reply to Marek Vasut
Quoted 29 lines · Marek Vasut

On 11/3/22 14:40, Krzysztof Kozlowski wrote:

[...]

Quoted 11 lines

Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml

Quoted 5 lines
Documentation/devicetree/bindings/rtc/rtc-m41t80.yaml new file +0 -0
new file mode 100644
index 0000000000000..7f31a22caec9b

Filename based on compatibles (more or less), so could be:
st,m41t80.yaml
or:
st,m41txx.yaml

Quoted 2 lines

The "rtc" name can be skipped as it is implied from subsystem folder, unless st,m41txx is a name of some SoC?

It's dedicated I2C RTC, a discrete soic8 chip with optional coin cell battery.

We cannot really call it m41txx because there are other m41txx chips with different register layouts and thus different RTC drivers:

next$ ls -1 drivers/rtc/*m41t*
drivers/rtc/rtc-m41t80.c
drivers/rtc/rtc-m41t93.c
drivers/rtc/rtc-m41t94.c

Quoted 5 lines

The m41t80 is a sane choice, the m41t80 was the first supported, the other chips are just compatible to it.

Whether I should drop the rtc- prefix or not, I will defer that preference to Alexandre .

so st,m41t80.yaml

Best regards,
Krzysztof