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      - const: allwinner,sun6i-a31-rtc
20      - const: allwinner,sun8i-a23-rtc
21      - const: allwinner,sun8i-h3-rtc
22      - const: allwinner,sun8i-r40-rtc
23      - const: allwinner,sun8i-v3-rtc
24      - const: allwinner,sun50i-h5-rtc
25      - items:
26          - const: allwinner,sun50i-a64-rtc
27          - const: allwinner,sun8i-h3-rtc
28      - const: allwinner,sun50i-h6-rtc
29
30  reg:
31    maxItems: 1
32
33  interrupts:
34    minItems: 1
35    items:
36      - description: RTC Alarm 0
37      - description: RTC Alarm 1
38
39  clocks:
40    maxItems: 1
41
42  clock-output-names:
43    minItems: 1
44    maxItems: 3
45    description:
46      The RTC provides up to three clocks
47        - the Low Frequency Oscillator or LOSC, at index 0,
48        - the Low Frequency Oscillator External output (X32KFOUT in
49          the datasheet), at index 1,
50        - the Internal Oscillator, at index 2.
51
52allOf:
53  - $ref: "rtc.yaml#"
54  - if:
55      properties:
56        compatible:
57          contains:
58            const: allwinner,sun6i-a31-rtc
59
60    then:
61      properties:
62        clock-output-names:
63          minItems: 1
64          maxItems: 1
65
66  - if:
67      properties:
68        compatible:
69          contains:
70            enum:
71              - allwinner,sun8i-a23-rtc
72              - allwinner,sun8i-r40-rtc
73              - allwinner,sun8i-v3-rtc
74
75    then:
76      properties:
77        clock-output-names:
78          minItems: 2
79          maxItems: 2
80
81  - if:
82      properties:
83        compatible:
84          contains:
85            enum:
86              - allwinner,sun8i-h3-rtc
87              - allwinner,sun50i-h5-rtc
88
89    then:
90      properties:
91        clock-output-names:
92          minItems: 3
93          maxItems: 3
94
95  - if:
96      properties:
97        compatible:
98          contains:
99            const: 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,sun8i-r40-rtc
112
113    then:
114      properties:
115        interrupts:
116          minItems: 1
117          maxItems: 1
118
119    else:
120      properties:
121        interrupts:
122          minItems: 2
123          maxItems: 2
124
125required:
126  - "#clock-cells"
127  - compatible
128  - reg
129  - interrupts
130  - clock-output-names
131
132additionalProperties: false
133
134examples:
135  - |
136    rtc: rtc@1f00000 {
137        compatible = "allwinner,sun6i-a31-rtc";
138        reg = <0x01f00000 0x400>;
139        interrupts = <0 40 4>, <0 41 4>;
140        clock-output-names = "osc32k";
141        clocks = <&ext_osc32k>;
142        #clock-cells = <1>;
143    };
144
145...
146