1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/soc/rockchip/grf.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Rockchip General Register Files (GRF)
8
9maintainers:
10  - Heiko Stuebner <heiko@sntech.de>
11
12properties:
13  compatible:
14    oneOf:
15      - items:
16          - enum:
17              - rockchip,rk3288-sgrf
18              - rockchip,rv1108-usbgrf
19          - const: syscon
20      - items:
21          - enum:
22              - rockchip,px30-grf
23              - rockchip,px30-pmugrf
24              - rockchip,px30-usb2phy-grf
25              - rockchip,rk3036-grf
26              - rockchip,rk3066-grf
27              - rockchip,rk3188-grf
28              - rockchip,rk3228-grf
29              - rockchip,rk3288-grf
30              - rockchip,rk3308-core-grf
31              - rockchip,rk3308-detect-grf
32              - rockchip,rk3308-grf
33              - rockchip,rk3308-usb2phy-grf
34              - rockchip,rk3328-grf
35              - rockchip,rk3328-usb2phy-grf
36              - rockchip,rk3368-grf
37              - rockchip,rk3368-pmugrf
38              - rockchip,rk3399-grf
39              - rockchip,rk3399-pmugrf
40              - rockchip,rk3568-grf
41              - rockchip,rk3568-pipe-grf
42              - rockchip,rk3568-pipe-phy-grf
43              - rockchip,rk3568-pmugrf
44              - rockchip,rv1108-grf
45              - rockchip,rv1108-pmugrf
46          - const: syscon
47          - const: simple-mfd
48
49  reg:
50    maxItems: 1
51
52  "#address-cells":
53    const: 1
54
55  "#size-cells":
56    const: 1
57
58required:
59  - compatible
60  - reg
61
62additionalProperties:
63  type: object
64
65allOf:
66  - if:
67      properties:
68        compatible:
69          contains:
70            const: rockchip,px30-grf
71
72    then:
73      properties:
74        lvds:
75          description:
76            Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt
77
78  - if:
79      properties:
80        compatible:
81          contains:
82            const: rockchip,rk3288-grf
83
84    then:
85      properties:
86        edp-phy:
87          description:
88            Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt
89
90  - if:
91      properties:
92        compatible:
93          contains:
94            enum:
95              - rockchip,rk3066-grf
96              - rockchip,rk3188-grf
97              - rockchip,rk3288-grf
98
99    then:
100      properties:
101        usbphy:
102          type: object
103
104          $ref: "/schemas/phy/rockchip-usb-phy.yaml#"
105
106          unevaluatedProperties: false
107
108  - if:
109      properties:
110        compatible:
111          contains:
112            const: rockchip,rk3328-grf
113
114    then:
115      properties:
116        gpio:
117          type: object
118
119          $ref: "/schemas/gpio/rockchip,rk3328-grf-gpio.yaml#"
120
121          unevaluatedProperties: false
122
123        power-controller:
124          type: object
125
126          $ref: "/schemas/power/rockchip,power-controller.yaml#"
127
128          unevaluatedProperties: false
129
130  - if:
131      properties:
132        compatible:
133          contains:
134            const: rockchip,rk3399-grf
135
136    then:
137      properties:
138        mipi-dphy-rx0:
139          type: object
140
141          $ref: "/schemas/phy/rockchip-mipi-dphy-rx0.yaml#"
142
143          unevaluatedProperties: false
144
145        pcie-phy:
146          description:
147            Documentation/devicetree/bindings/phy/rockchip-pcie-phy.txt
148
149      patternProperties:
150        "phy@[0-9a-f]+$":
151          description:
152            Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
153
154  - if:
155      properties:
156        compatible:
157          contains:
158            enum:
159              - rockchip,px30-pmugrf
160              - rockchip,rk3036-grf
161              - rockchip,rk3308-grf
162              - rockchip,rk3368-pmugrf
163
164    then:
165      properties:
166        reboot-mode:
167          type: object
168
169          $ref: "/schemas/power/reset/syscon-reboot-mode.yaml#"
170
171          unevaluatedProperties: false
172
173  - if:
174      properties:
175        compatible:
176          contains:
177            enum:
178              - rockchip,px30-usb2phy-grf
179              - rockchip,rk3228-grf
180              - rockchip,rk3308-usb2phy-grf
181              - rockchip,rk3328-usb2phy-grf
182              - rockchip,rk3399-grf
183              - rockchip,rv1108-grf
184
185    then:
186      required:
187        - "#address-cells"
188        - "#size-cells"
189
190      patternProperties:
191        "usb2phy@[0-9a-f]+$":
192          type: object
193
194          $ref: "/schemas/phy/phy-rockchip-inno-usb2.yaml#"
195
196          unevaluatedProperties: false
197
198  - if:
199      properties:
200        compatible:
201          contains:
202            enum:
203              - rockchip,px30-grf
204              - rockchip,px30-pmugrf
205              - rockchip,rk3188-grf
206              - rockchip,rk3228-grf
207              - rockchip,rk3288-grf
208              - rockchip,rk3328-grf
209              - rockchip,rk3368-grf
210              - rockchip,rk3368-pmugrf
211              - rockchip,rk3399-grf
212              - rockchip,rk3399-pmugrf
213              - rockchip,rk3568-pmugrf
214              - rockchip,rv1108-grf
215              - rockchip,rv1108-pmugrf
216
217    then:
218      properties:
219        io-domains:
220          type: object
221
222          $ref: "/schemas/power/rockchip-io-domain.yaml#"
223
224          unevaluatedProperties: false
225
226examples:
227  - |
228    #include <dt-bindings/clock/rk3399-cru.h>
229    #include <dt-bindings/interrupt-controller/arm-gic.h>
230    #include <dt-bindings/power/rk3399-power.h>
231    grf: syscon@ff770000 {
232      compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd";
233      reg = <0xff770000 0x10000>;
234      #address-cells = <1>;
235      #size-cells = <1>;
236
237      mipi_dphy_rx0: mipi-dphy-rx0 {
238        compatible = "rockchip,rk3399-mipi-dphy-rx0";
239        clocks = <&cru SCLK_MIPIDPHY_REF>,
240                 <&cru SCLK_DPHY_RX0_CFG>,
241                 <&cru PCLK_VIO_GRF>;
242        clock-names = "dphy-ref", "dphy-cfg", "grf";
243        power-domains = <&power RK3399_PD_VIO>;
244        #phy-cells = <0>;
245      };
246
247      u2phy0: usb2phy@e450 {
248        compatible = "rockchip,rk3399-usb2phy";
249        reg = <0xe450 0x10>;
250        clocks = <&cru SCLK_USB2PHY0_REF>;
251        clock-names = "phyclk";
252        #clock-cells = <0>;
253        clock-output-names = "clk_usbphy0_480m";
254
255        u2phy0_host: host-port {
256          #phy-cells = <0>;
257          interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH 0>;
258          interrupt-names = "linestate";
259         };
260
261        u2phy0_otg: otg-port {
262          #phy-cells = <0>;
263          interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH 0>,
264                       <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH 0>,
265                       <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH 0>;
266          interrupt-names = "otg-bvalid", "otg-id",
267                            "linestate";
268        };
269      };
270    };
271