xref: /linux/Documentation/devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/rtc/allwinner,sun6i-a31-rtc.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Allwinner A31 RTC
8
9maintainers:
10  - Chen-Yu Tsai <wens@csie.org>
11  - Maxime Ripard <mripard@kernel.org>
12
13properties:
14  "#clock-cells":
15    const: 1
16
17  compatible:
18    oneOf:
19      - enum:
20          - allwinner,sun6i-a31-rtc
21          - allwinner,sun8i-a23-rtc
22          - allwinner,sun8i-h3-rtc
23          - allwinner,sun8i-r40-rtc
24          - allwinner,sun8i-v3-rtc
25          - allwinner,sun50i-h5-rtc
26          - allwinner,sun50i-h6-rtc
27          - allwinner,sun50i-h616-rtc
28          - allwinner,sun50i-r329-rtc
29      - items:
30          - const: allwinner,sun50i-a64-rtc
31          - const: allwinner,sun8i-h3-rtc
32      - items:
33          - enum:
34              - allwinner,sun20i-d1-rtc
35              - allwinner,sun55i-a523-rtc
36          - const: allwinner,sun50i-r329-rtc
37
38  reg:
39    maxItems: 1
40
41  interrupts:
42    minItems: 1
43    items:
44      - description: RTC Alarm 0
45      - description: RTC Alarm 1
46
47  clocks:
48    minItems: 1
49    maxItems: 4
50
51  clock-names:
52    minItems: 1
53    maxItems: 4
54
55  clock-output-names:
56    minItems: 1
57    maxItems: 3
58    description:
59      The RTC provides up to three clocks
60        - the Low Frequency Oscillator or LOSC, at index 0,
61        - the Low Frequency Oscillator External output (X32KFOUT in
62          the datasheet), at index 1,
63        - the Internal Oscillator, at index 2.
64
65allOf:
66  - $ref: rtc.yaml#
67  - if:
68      properties:
69        compatible:
70          contains:
71            const: allwinner,sun6i-a31-rtc
72
73    then:
74      properties:
75        clock-output-names:
76          maxItems: 1
77
78  - if:
79      properties:
80        compatible:
81          contains:
82            enum:
83              - allwinner,sun8i-a23-rtc
84              - allwinner,sun8i-r40-rtc
85              - allwinner,sun8i-v3-rtc
86
87    then:
88      properties:
89        clock-output-names:
90          minItems: 2
91          maxItems: 2
92
93  - if:
94      properties:
95        compatible:
96          contains:
97            enum:
98              - allwinner,sun8i-h3-rtc
99              - allwinner,sun50i-h5-rtc
100              - allwinner,sun50i-h6-rtc
101
102    then:
103      properties:
104        clock-output-names:
105          minItems: 3
106
107  - if:
108      properties:
109        compatible:
110          contains:
111            const: allwinner,sun50i-h616-rtc
112
113    then:
114      properties:
115        clocks:
116          items:
117            - description: Bus clock for register access
118            - description: 24 MHz oscillator
119            - description: 32 kHz clock from the CCU
120
121        clock-names:
122          items:
123            - const: bus
124            - const: hosc
125            - const: pll-32k
126
127      required:
128        - clocks
129        - clock-names
130
131  - if:
132      properties:
133        compatible:
134          contains:
135            const: allwinner,sun50i-r329-rtc
136
137    then:
138      properties:
139        clocks:
140          minItems: 3
141          items:
142            - description: Bus clock for register access
143            - description: 24 MHz oscillator
144            - description: AHB parent for internal SPI clock
145            - description: External 32768 Hz oscillator
146
147        clock-names:
148          minItems: 3
149          items:
150            - const: bus
151            - const: hosc
152            - const: ahb
153            - const: ext-osc32k
154
155      required:
156        - clocks
157        - clock-names
158
159  - if:
160      properties:
161        compatible:
162          contains:
163            enum:
164              - allwinner,sun8i-r40-rtc
165              - allwinner,sun50i-h616-rtc
166              - allwinner,sun50i-r329-rtc
167
168    then:
169      properties:
170        interrupts:
171          maxItems: 1
172
173    else:
174      properties:
175        interrupts:
176          minItems: 2
177
178required:
179  - "#clock-cells"
180  - compatible
181  - reg
182  - interrupts
183
184additionalProperties: false
185
186examples:
187  - |
188    rtc: rtc@1f00000 {
189        compatible = "allwinner,sun6i-a31-rtc";
190        reg = <0x01f00000 0x400>;
191        interrupts = <0 40 4>, <0 41 4>;
192        clock-output-names = "osc32k";
193        clocks = <&ext_osc32k>;
194        #clock-cells = <1>;
195    };
196
197...
198