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