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