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 Device Tree Bindings
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          - const: allwinner,sun20i-d1-rtc
34          - const: allwinner,sun50i-r329-rtc
35
36  reg:
37    maxItems: 1
38
39  interrupts:
40    minItems: 1
41    items:
42      - description: RTC Alarm 0
43      - description: RTC Alarm 1
44
45  clocks:
46    minItems: 1
47    maxItems: 4
48
49  clock-names:
50    minItems: 1
51    maxItems: 4
52
53  clock-output-names:
54    minItems: 1
55    maxItems: 3
56    description:
57      The RTC provides up to three clocks
58        - the Low Frequency Oscillator or LOSC, at index 0,
59        - the Low Frequency Oscillator External output (X32KFOUT in
60          the datasheet), at index 1,
61        - the Internal Oscillator, at index 2.
62
63allOf:
64  - $ref: "rtc.yaml#"
65  - if:
66      properties:
67        compatible:
68          contains:
69            const: allwinner,sun6i-a31-rtc
70
71    then:
72      properties:
73        clock-output-names:
74          minItems: 1
75          maxItems: 1
76
77  - if:
78      properties:
79        compatible:
80          contains:
81            enum:
82              - allwinner,sun8i-a23-rtc
83              - allwinner,sun8i-r40-rtc
84              - allwinner,sun8i-v3-rtc
85
86    then:
87      properties:
88        clock-output-names:
89          minItems: 2
90          maxItems: 2
91
92  - if:
93      properties:
94        compatible:
95          contains:
96            enum:
97              - allwinner,sun8i-h3-rtc
98              - allwinner,sun50i-h5-rtc
99              - allwinner,sun50i-h6-rtc
100
101    then:
102      properties:
103        clock-output-names:
104          minItems: 3
105          maxItems: 3
106
107  - if:
108      properties:
109        compatible:
110          contains:
111            const: allwinner,sun50i-h616-rtc
112
113    then:
114      properties:
115        clocks:
116          minItems: 3
117          maxItems: 3
118          items:
119            - description: Bus clock for register access
120            - description: 24 MHz oscillator
121            - description: 32 kHz clock from the CCU
122
123        clock-names:
124          minItems: 3
125          maxItems: 3
126          items:
127            - const: bus
128            - const: hosc
129            - const: pll-32k
130
131      required:
132        - clocks
133        - clock-names
134
135  - if:
136      properties:
137        compatible:
138          contains:
139            const: allwinner,sun50i-r329-rtc
140
141    then:
142      properties:
143        clocks:
144          minItems: 3
145          maxItems: 4
146          items:
147            - description: Bus clock for register access
148            - description: 24 MHz oscillator
149            - description: AHB parent for internal SPI clock
150            - description: External 32768 Hz oscillator
151
152        clock-names:
153          minItems: 3
154          maxItems: 4
155          items:
156            - const: bus
157            - const: hosc
158            - const: ahb
159            - const: ext-osc32k
160
161      required:
162        - clocks
163        - clock-names
164
165  - if:
166      properties:
167        compatible:
168          contains:
169            enum:
170              - allwinner,sun8i-r40-rtc
171              - allwinner,sun50i-h616-rtc
172              - allwinner,sun50i-r329-rtc
173
174    then:
175      properties:
176        interrupts:
177          minItems: 1
178          maxItems: 1
179
180    else:
181      properties:
182        interrupts:
183          minItems: 2
184          maxItems: 2
185
186required:
187  - "#clock-cells"
188  - compatible
189  - reg
190  - interrupts
191
192additionalProperties: false
193
194examples:
195  - |
196    rtc: rtc@1f00000 {
197        compatible = "allwinner,sun6i-a31-rtc";
198        reg = <0x01f00000 0x400>;
199        interrupts = <0 40 4>, <0 41 4>;
200        clock-output-names = "osc32k";
201        clocks = <&ext_osc32k>;
202        #clock-cells = <1>;
203    };
204
205...
206