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