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