Skip to contentSkip to conversation

dt-bindings: rtc: convert at91sam9 bindings to

PATCH Superseded Sergiu Moga 3 participants 12 messages Mar 4, 2022

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover dt-bindings: rtc: convert at91sam9 bindings to

This patch series addresses the conversion of the RTC binding for Atmel/Microchip SoCs to Device Tree Schema format. It also changes the node names from some of the "dtsi" files from "rtt" to the more generic "rtc", while adding the atmel,rtt-rtc-time-reg required property to the board files that were missing it.

Changes since v2:
- Removed patch that would move the atmel,rtt-rtc-time-reg property from the board file to the SoC file.
- Modified the patch that adds the atmel,rtt-rtc-time-reg property to add it in the board file instead of the SoC file.
- Replaced start-year and additionalProperties from the DT binding with unevaluatedProperties.
- Modified the atmel,rtt-rtc-time-reg property described in the DT binding to use items with description.
- Used macro for the IRQ type of the example node's interrupt property of the DT binding.

Sergiu Moga (5):
ARM: dts: at91: Add the required atmel,rtt-rtc-time-reg property
ARM: dts: at91: Use the generic "rtc" node name for the rtt IPs
dt-bindings: rtc: convert at91sam9 bindings to json-schema
dt-bindings: rtc: at91: Use macros for the IRQ type
dt-bindings: rtc: at91: Add SAMA7G5 compatible strings list

 .../bindings/rtc/atmel,at91sam9-rtc.txt       | 25 -------
 .../bindings/rtc/atmel,at91sam9-rtc.yaml      | 69 +++++++++++++++++++
 arch/arm/boot/dts/at91sam9261ek.dts           |  4 ++
 arch/arm/boot/dts/at91sam9263ek.dts           |  8 +++
 arch/arm/boot/dts/at91sam9rlek.dts            |  4 ++
 arch/arm/boot/dts/sam9x60.dtsi                |  2 +-
 arch/arm/boot/dts/sama7g5.dtsi                |  2 +-
 7 files changed, 87 insertions(+), 27 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml
Signature · 1 line
2.25.1
#1 lore raw

PATCH v3 1/5 ARM: dts: at91: Add the required `atmel,rtt-rtc-time-reg` property

Add the required atmel,rtt-rtc-time-reg property to the rtt nodes of the board files that were missing it.

---
 arch/arm/boot/dts/at91sam9261ek.dts | 4 ++++
 arch/arm/boot/dts/at91sam9263ek.dts | 8 ++++++++
 arch/arm/boot/dts/at91sam9rlek.dts  | 4 ++++
 3 files changed, 16 insertions(+)
arch/arm/boot/dts/at91sam9261ek.dts +4 -0
index beed819609e8..3c1f40b4a13e 100644
@@ -178,6 +178,10 @@ dbgu: serial@fffff200 {
 				status = "okay";
 			};
 
+			rtc@fffffd20 {
+				atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
+			};
+
 			watchdog@fffffd40 {
 				status = "okay";
 			};
arch/arm/boot/dts/at91sam9263ek.dts +8 -0
index 71f60576761a..1208bb580d14 100644
@@ -102,6 +102,14 @@ mtd_dataflash@0 {
 				};
 			};
 
+			rtc@fffffd20 {
+				atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
+			};
+
+			rtc@fffffd50 {
+				atmel,rtt-rtc-time-reg = <&gpbr 0x4>;
+			};
+
 			watchdog@fffffd40 {
 				status = "okay";
 			};
arch/arm/boot/dts/at91sam9rlek.dts +4 -0
index 62981b39c815..a26f9f70b6b2 100644
@@ -212,6 +212,10 @@ watchdog@fffffd40 {
 				status = "okay";
 			};
 
+			rtc@fffffd20 {
+				atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
+			};
+
 			rtc@fffffe00 {
 				status = "okay";
 			};
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v3 1/5] ARM: dts: at91: Add the required `atmel,rtt-rtc-time-reg` property

Quoted 30 lines · Sergiu Moga

Add the required atmel,rtt-rtc-time-reg property to the rtt nodes of the board files that were missing it.

---
 arch/arm/boot/dts/at91sam9261ek.dts | 4 ++++
 arch/arm/boot/dts/at91sam9263ek.dts | 8 ++++++++
 arch/arm/boot/dts/at91sam9rlek.dts  | 4 ++++
 3 files changed, 16 insertions(+)
arch/arm/boot/dts/at91sam9261ek.dts +4 -0
index beed819609e8..3c1f40b4a13e 100644
@@ -178,6 +178,10 @@ dbgu: serial@fffff200 {
 				status = "okay";
 			};
 
+			rtc@fffffd20 {
+				atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
+			};
+
 			watchdog@fffffd40 {
 				status = "okay";
 			};
arch/arm/boot/dts/at91sam9263ek.dts +0 -0
index 71f60576761a..1208bb580d14 100644

arch/arm/boot/dts/at91sam9263ek.dts mtd_dataflash@0 { · line 111

Quoted 10 lines
arch/arm/boot/dts/at91sam9263ek.dts +7 -0
@@ -102,6 +102,14 @@ mtd_dataflash@0 {
 				};
 			};
 
+			rtc@fffffd20 {
+				atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
+			};
+
+			rtc@fffffd50 {
+				atmel,rtt-rtc-time-reg = <&gpbr 0x4>;
+			};

Do we really need two RTCs with the exact same features on that board? Is there a check failure hen the property is not there and the node is disabled?

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

Re: [PATCH v3 1/5] ARM: dts: at91: Add the required `atmel,rtt-rtc-time-reg` property

Quoted 34 lines · Alexandre Belloni
Quoted 33 lines · Sergiu Moga

Add the required atmel,rtt-rtc-time-reg property to the rtt nodes of the board files that were missing it.

---
  arch/arm/boot/dts/at91sam9261ek.dts | 4 ++++
  arch/arm/boot/dts/at91sam9263ek.dts | 8 ++++++++
  arch/arm/boot/dts/at91sam9rlek.dts  | 4 ++++
  3 files changed, 16 insertions(+)
arch/arm/boot/dts/at91sam9261ek.dts +4 -0
index beed819609e8..3c1f40b4a13e 100644
@@ -178,6 +178,10 @@ dbgu: serial@fffff200 {
                               status = "okay";
                       };
 
+                     rtc@fffffd20 {
+                             atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
+                     };
+
                       watchdog@fffffd40 {
                               status = "okay";
                       };
arch/arm/boot/dts/at91sam9263ek.dts +0 -0
index 71f60576761a..1208bb580d14 100644
@@ -102,6 +102,14 @@ mtd_dataflash@0 {
                               };
                       };
 
Quoted 11 lines

arch/arm/boot/dts/at91sam9263ek.dts mtd_dataflash@0 { · line 111

Quoted 7 lines
arch/arm/boot/dts/at91sam9263ek.dts +7 -0
+                     rtc@fffffd20 {
+                             atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
+                     };
+
+                     rtc@fffffd50 {
+                             atmel,rtt-rtc-time-reg = <&gpbr 0x4>;
+                     };

Do we really need two RTCs with the exact same features on that board? Is there a check failure hen the property is not there and the node is disabled?

I can understand your point here. No, it is indeed not really needed since, from what I can see, they are both disabled in the SoC file. The reason why I added both was that I thought it would have been more consistent. Do you think I should remove both in this file and keep the changes in the other 2 files only?

Quoted 4 lines

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

Thank you for the feedback.

Sergiu

#4 lore raw

Re: [PATCH v3 1/5] ARM: dts: at91: Add the required `atmel,rtt-rtc-time-reg` property

Quoted 46 lines · On 04/03/2022 15:29:45+0000, [email protected] wrote:
Quoted 34 lines · Alexandre Belloni
Quoted 33 lines · Sergiu Moga

Add the required atmel,rtt-rtc-time-reg property to the rtt nodes of the board files that were missing it.

---
  arch/arm/boot/dts/at91sam9261ek.dts | 4 ++++
  arch/arm/boot/dts/at91sam9263ek.dts | 8 ++++++++
  arch/arm/boot/dts/at91sam9rlek.dts  | 4 ++++
  3 files changed, 16 insertions(+)
arch/arm/boot/dts/at91sam9261ek.dts +4 -0
index beed819609e8..3c1f40b4a13e 100644
@@ -178,6 +178,10 @@ dbgu: serial@fffff200 {
                               status = "okay";
                       };
 
+                     rtc@fffffd20 {
+                             atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
+                     };
+
                       watchdog@fffffd40 {
                               status = "okay";
                       };
arch/arm/boot/dts/at91sam9263ek.dts +0 -0
index 71f60576761a..1208bb580d14 100644
@@ -102,6 +102,14 @@ mtd_dataflash@0 {
                               };
                       };
 
Quoted 11 lines

arch/arm/boot/dts/at91sam9263ek.dts mtd_dataflash@0 { · line 111

Quoted 7 lines
arch/arm/boot/dts/at91sam9263ek.dts +7 -0
+                     rtc@fffffd20 {
+                             atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
+                     };
+
+                     rtc@fffffd50 {
+                             atmel,rtt-rtc-time-reg = <&gpbr 0x4>;
+                     };

Do we really need two RTCs with the exact same features on that board? Is there a check failure hen the property is not there and the node is disabled?

Quoted 6 lines

I can understand your point here. No, it is indeed not really needed since, from what I can see, they are both disabled in the SoC file. The reason why I added both was that I thought it would have been more consistent. Do you think I should remove both in this file and keep the changes in the other 2 files only?

Well, I would keep the first node but not the second so that you have a good example, ready to be enabled.

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

PATCH v3 2/5 ARM: dts: at91: Use the generic "rtc" node name for the rtt IPs

In reply to Sergiu Moga

As the DT specification recommends, the node names should be of a generic nature. Thus, the most appropriate generic node name for the at91 rtt IPs is the "rtc" node name.

---
 arch/arm/boot/dts/sam9x60.dtsi | 2 +-
 arch/arm/boot/dts/sama7g5.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sam9x60.dtsi +1 -1
index 998629a3c34f..c328b67bea0c 100644
@@ -684,7 +684,7 @@ shutdown_controller: shdwc@fffffe10 {
 				status = "disabled";
 			};
 
-			rtt: rtt@fffffe20 {
+			rtt: rtc@fffffe20 {
 				compatible = "microchip,sam9x60-rtt", "atmel,at91sam9260-rtt";
 				reg = <0xfffffe20 0x20>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
arch/arm/boot/dts/sama7g5.dtsi +1 -1
index e6d0c90cf710..5d8841d0831a 100644
@@ -170,7 +170,7 @@ shdwc: shdwc@e001d010 {
 			status = "disabled";
 		};
 
-		rtt: rtt@e001d020 {
+		rtt: rtc@e001d020 {
 			compatible = "microchip,sama7g5-rtt", "microchip,sam9x60-rtt", "atmel,at91sam9260-rtt";
 			reg = <0xe001d020 0x30>;
 			interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.25.1
#6 lore raw

PATCH v3 3/5 dt-bindings: rtc: convert at91sam9 bindings to json-schema

In reply to Sergiu Moga

Convert RTC binding for Atmel/Microchip SoCs to Device Tree Schema format.

---
 .../bindings/rtc/atmel,at91sam9-rtc.txt       | 25 --------
 .../bindings/rtc/atmel,at91sam9-rtc.yaml      | 63 +++++++++++++++++++
 2 files changed, 63 insertions(+), 25 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.txt deleted +0 -25
deleted file mode 100644
index 3f0e2a5950eb..000000000000
@@ -1,25 +0,0 @@
-Atmel AT91SAM9260 Real Time Timer
-
-Required properties:
-- compatible: should be one of the following:
-	- "atmel,at91sam9260-rtt"
-	- "microchip,sam9x60-rtt", "atmel,at91sam9260-rtt"
-- reg: should encode the memory region of the RTT controller
-- interrupts: rtt alarm/event interrupt
-- clocks: should contain the 32 KHz slow clk that will drive the RTT block.
-- atmel,rtt-rtc-time-reg: should encode the GPBR register used to store
-	the time base when the RTT is used as an RTC.
-	The first cell should point to the GPBR node and the second one
-	encode the offset within the GPBR block (or in other words, the
-	GPBR register used to store the time base).
-
-
-Example:
-
-rtt@fffffd20 {
-	compatible = "atmel,at91sam9260-rtt";
-	reg = <0xfffffd20 0x10>;
-	interrupts = <1 4 7>;
-	clocks = <&clk32k>;
-	atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
-};
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.25.1
#7 lore raw

Re: [PATCH v3 3/5] dt-bindings: rtc: convert at91sam9 bindings to json-schema

Quoted 82 lines · Sergiu Moga

Convert RTC binding for Atmel/Microchip SoCs to Device Tree Schema format.

---
 .../bindings/rtc/atmel,at91sam9-rtc.txt       | 25 --------
 .../bindings/rtc/atmel,at91sam9-rtc.yaml      | 63 +++++++++++++++++++
 2 files changed, 63 insertions(+), 25 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.txt deleted +0 -25
deleted file mode 100644
index 3f0e2a5950eb..000000000000
@@ -1,25 +0,0 @@
-Atmel AT91SAM9260 Real Time Timer
-
-Required properties:
-- compatible: should be one of the following:
-	- "atmel,at91sam9260-rtt"
-	- "microchip,sam9x60-rtt", "atmel,at91sam9260-rtt"
-- reg: should encode the memory region of the RTT controller
-- interrupts: rtt alarm/event interrupt
-- clocks: should contain the 32 KHz slow clk that will drive the RTT block.
-- atmel,rtt-rtc-time-reg: should encode the GPBR register used to store
-	the time base when the RTT is used as an RTC.
-	The first cell should point to the GPBR node and the second one
-	encode the offset within the GPBR block (or in other words, the
-	GPBR register used to store the time base).
-
-
-Example:
-
-rtt@fffffd20 {
-	compatible = "atmel,at91sam9260-rtt";
-	reg = <0xfffffd20 0x10>;
-	interrupts = <1 4 7>;
-	clocks = <&clk32k>;
-	atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
-};
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml new file +34 -0
new file mode 100644
index 000000000000..af25cc275356
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/atmel,at91sam9-rtc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel AT91 RTT Device Tree Bindings
+
+allOf:
+  - $ref: "rtc.yaml#"
+
+maintainers:
+  - Alexandre Belloni <[email protected]>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: atmel,at91sam9260-rtt
+      - items:
+          - const: microchip,sam9x60-rtt
+          - const: atmel,at91sam9260-rtt
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  atmel,rtt-rtc-time-reg:

Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml line 44

Quoted 10 lines
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml new file +10 -0
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      - items:
+          - description: Phandle to the GPBR node.
+          - description: Offset within the GPBR block.
+    description:
+      Should encode the GPBR register used to store the time base when the
+      RTT is used as an RTC. The first cell should point to the GPBR node
+      and the second one encodes the offset within the GPBR block (or in
+      other words, the GPBR register used to store the time base).

Don't duplicate in description what is already before, so entire part from "The first cell" is not needed. I mentioned it last time - Instead of describing cells here, use items. You have items, good, but you still have description.

Quoted 6 lines
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml new file +6 -0
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks

Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml line 60

Quoted 10 lines
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml new file +10 -0
+  - atmel,rtt-rtc-time-reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    rtc@fffffd20 {
+        compatible = "atmel,at91sam9260-rtt";
+        reg = <0xfffffd20 0x10>;
+        interrupts = <1 4 7>;

Could you start acknowledging comments instead of ignoring them?

Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml line 63

Quoted 3 lines
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml new file +3 -0
+        clocks = <&clk32k>;
+        atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
+    };

Best regards,
Krzysztof

#8 lore raw

PATCH v3 4/5 dt-bindings: rtc: at91: Use macros for the IRQ type

In reply to Sergiu Moga

Prefer using macros for the IRQ type of the example node's interrupt property.

---
 Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml +3 -1
index af25cc275356..d2452067bfe4 100644
@@ -54,10 +54,12 @@ unevaluatedProperties: false
 
 examples:
   - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
     rtc@fffffd20 {
         compatible = "atmel,at91sam9260-rtt";
         reg = <0xfffffd20 0x10>;
-        interrupts = <1 4 7>;
+        interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
         clocks = <&clk32k>;
         atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
     };
Signature · 1 line
2.25.1
#9 lore raw

Re: [PATCH v3 4/5] dt-bindings: rtc: at91: Use macros for the IRQ type

Quoted 13 lines · Sergiu Moga

Prefer using macros for the IRQ type of the example node's interrupt property.

---
 Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml +0 -0
index af25cc275356..d2452067bfe4 100644

Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml unevaluatedProperties: false · line 62

Quoted 10 lines
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml +3 -1
@@ -54,10 +54,12 @@ unevaluatedProperties: false
 
 examples:
   - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
     rtc@fffffd20 {
         compatible = "atmel,at91sam9260-rtt";
         reg = <0xfffffd20 0x10>;
-        interrupts = <1 4 7>;
+        interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;

Ah, I see the change now. This should be squashed with previous patch. There is no point to add imperfect DTS code which is being changed a commit later. Example is not bindings.

Best regards,
Krzysztof

#10 lore raw

Re: [PATCH v3 4/5] dt-bindings: rtc: at91: Use macros for the IRQ type

Quoted 28 lines · Krzysztof Kozlowski
Quoted 13 lines · Sergiu Moga

Prefer using macros for the IRQ type of the example node's interrupt property.

---
  Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml +0 -0
index af25cc275356..d2452067bfe4 100644

Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml unevaluatedProperties: false · line 62

Quoted 10 lines
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml +3 -1
@@ -54,10 +54,12 @@ unevaluatedProperties: false
 
  examples:
    - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
      rtc@fffffd20 {
          compatible = "atmel,at91sam9260-rtt";
          reg = <0xfffffd20 0x10>;
-        interrupts = <1 4 7>;
+        interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;

Ah, I see the change now. This should be squashed with previous patch. There is no point to add imperfect DTS code which is being changed a commit later. Example is not bindings.

Quoted 2 lines

Best regards,
Krzysztof

Understood, I will make the squash for the next version. Thank you very much for the feedback.

Sergiu

#11 lore raw

PATCH v3 5/5 dt-bindings: rtc: at91: Add SAMA7G5 compatible strings list

In reply to Sergiu Moga

Add compatible strings list for SAMA7G5.

---
 Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.yaml +4 -0
index d2452067bfe4..e5c3c384e172 100644
@@ -21,6 +21,10 @@ properties:
       - items:
           - const: microchip,sam9x60-rtt
           - const: atmel,at91sam9260-rtt
+      - items:
+          - const: microchip,sama7g5-rtt
+          - const: microchip,sam9x60-rtt
+          - const: atmel,at91sam9260-rtt
 
   reg:
     maxItems: 1
Signature · 1 line
2.25.1