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