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 <maxime.ripard@bootlin.com>
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
29  reg:
30    maxItems: 1
31
32  interrupts:
33    minItems: 1
34    maxItems: 2
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,sun8i-r40-rtc
100
101    then:
102      properties:
103        interrupts:
104          minItems: 1
105          maxItems: 1
106
107    else:
108      properties:
109        interrupts:
110          minItems: 2
111          maxItems: 2
112
113required:
114  - "#clock-cells"
115  - compatible
116  - reg
117  - interrupts
118  - clocks
119  - clock-output-names
120
121additionalProperties: false
122
123examples:
124  - |
125    rtc: rtc@1f00000 {
126        compatible = "allwinner,sun6i-a31-rtc";
127        reg = <0x01f00000 0x400>;
128        interrupts = <0 40 4>, <0 41 4>;
129        clock-output-names = "osc32k";
130        clocks = <&ext_osc32k>;
131        #clock-cells = <1>;
132    };
133
134...
135