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