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          description:
96            Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt
97
98  - if:
99      properties:
100        compatible:
101          contains:
102            enum:
103              - rockchip,rk3066-grf
104              - rockchip,rk3188-grf
105              - rockchip,rk3288-grf
106
107    then:
108      properties:
109        usbphy:
110          type: object
111
112          $ref: "/schemas/phy/rockchip-usb-phy.yaml#"
113
114          unevaluatedProperties: false
115
116  - if:
117      properties:
118        compatible:
119          contains:
120            const: rockchip,rk3328-grf
121
122    then:
123      properties:
124        gpio:
125          type: object
126
127          $ref: "/schemas/gpio/rockchip,rk3328-grf-gpio.yaml#"
128
129          unevaluatedProperties: false
130
131        power-controller:
132          type: object
133
134          $ref: "/schemas/power/rockchip,power-controller.yaml#"
135
136          unevaluatedProperties: false
137
138  - if:
139      properties:
140        compatible:
141          contains:
142            const: rockchip,rk3399-grf
143
144    then:
145      properties:
146        mipi-dphy-rx0:
147          type: object
148
149          $ref: "/schemas/phy/rockchip-mipi-dphy-rx0.yaml#"
150
151          unevaluatedProperties: false
152
153        pcie-phy:
154          description:
155            Documentation/devicetree/bindings/phy/rockchip-pcie-phy.txt
156
157      patternProperties:
158        "phy@[0-9a-f]+$":
159          description:
160            Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
161
162  - if:
163      properties:
164        compatible:
165          contains:
166            enum:
167              - rockchip,px30-pmugrf
168              - rockchip,rk3036-grf
169              - rockchip,rk3308-grf
170              - rockchip,rk3368-pmugrf
171
172    then:
173      properties:
174        reboot-mode:
175          type: object
176
177          $ref: "/schemas/power/reset/syscon-reboot-mode.yaml#"
178
179          unevaluatedProperties: false
180
181  - if:
182      properties:
183        compatible:
184          contains:
185            enum:
186              - rockchip,px30-usb2phy-grf
187              - rockchip,rk3128-grf
188              - rockchip,rk3228-grf
189              - rockchip,rk3308-usb2phy-grf
190              - rockchip,rk3328-usb2phy-grf
191              - rockchip,rk3399-grf
192              - rockchip,rv1108-grf
193
194    then:
195      required:
196        - "#address-cells"
197        - "#size-cells"
198
199      patternProperties:
200        "usb2phy@[0-9a-f]+$":
201          type: object
202
203          $ref: "/schemas/phy/phy-rockchip-inno-usb2.yaml#"
204
205          unevaluatedProperties: false
206
207  - if:
208      properties:
209        compatible:
210          contains:
211            enum:
212              - rockchip,px30-grf
213              - rockchip,px30-pmugrf
214              - rockchip,rk3188-grf
215              - rockchip,rk3228-grf
216              - rockchip,rk3288-grf
217              - rockchip,rk3328-grf
218              - rockchip,rk3368-grf
219              - rockchip,rk3368-pmugrf
220              - rockchip,rk3399-grf
221              - rockchip,rk3399-pmugrf
222              - rockchip,rk3568-pmugrf
223              - rockchip,rv1108-grf
224              - rockchip,rv1108-pmugrf
225
226    then:
227      properties:
228        io-domains:
229          type: object
230
231          $ref: "/schemas/power/rockchip-io-domain.yaml#"
232
233          unevaluatedProperties: false
234
235examples:
236  - |
237    #include <dt-bindings/clock/rk3399-cru.h>
238    #include <dt-bindings/interrupt-controller/arm-gic.h>
239    #include <dt-bindings/power/rk3399-power.h>
240    grf: syscon@ff770000 {
241      compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd";
242      reg = <0xff770000 0x10000>;
243      #address-cells = <1>;
244      #size-cells = <1>;
245
246      mipi_dphy_rx0: mipi-dphy-rx0 {
247        compatible = "rockchip,rk3399-mipi-dphy-rx0";
248        clocks = <&cru SCLK_MIPIDPHY_REF>,
249                 <&cru SCLK_DPHY_RX0_CFG>,
250                 <&cru PCLK_VIO_GRF>;
251        clock-names = "dphy-ref", "dphy-cfg", "grf";
252        power-domains = <&power RK3399_PD_VIO>;
253        #phy-cells = <0>;
254      };
255
256      u2phy0: usb2phy@e450 {
257        compatible = "rockchip,rk3399-usb2phy";
258        reg = <0xe450 0x10>;
259        clocks = <&cru SCLK_USB2PHY0_REF>;
260        clock-names = "phyclk";
261        #clock-cells = <0>;
262        clock-output-names = "clk_usbphy0_480m";
263
264        u2phy0_host: host-port {
265          #phy-cells = <0>;
266          interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH 0>;
267          interrupt-names = "linestate";
268         };
269
270        u2phy0_otg: otg-port {
271          #phy-cells = <0>;
272          interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH 0>,
273                       <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH 0>,
274                       <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH 0>;
275          interrupt-names = "otg-bvalid", "otg-id",
276                            "linestate";
277        };
278      };
279    };
280