1/*
2 * Copyright (c) 2017 PINE64
3 *
4 * This file is dual-licensed: you can use it either under the terms
5 * of the GPL or the X11 license, at your option. Note that this dual
6 * licensing only applies to this file, and not this project as a
7 * whole.
8 *
9 *  a) This library is free software; you can redistribute it and/or
10 *     modify it under the terms of the GNU General Public License as
11 *     published by the Free Software Foundation; either version 2 of the
12 *     License, or (at your option) any later version.
13 *
14 *     This library is distributed in the hope that it will be useful,
15 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *     GNU General Public License for more details.
18 *
19 * Or, alternatively,
20 *
21 *  b) Permission is hereby granted, free of charge, to any person
22 *     obtaining a copy of this software and associated documentation
23 *     files (the "Software"), to deal in the Software without
24 *     restriction, including without limitation the rights to use,
25 *     copy, modify, merge, publish, distribute, sublicense, and/or
26 *     sell copies of the Software, and to permit persons to whom the
27 *     Software is furnished to do so, subject to the following
28 *     conditions:
29 *
30 *     The above copyright notice and this permission notice shall be
31 *     included in all copies or substantial portions of the Software.
32 *
33 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
35 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
37 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
40 *     OTHER DEALINGS IN THE SOFTWARE.
41 */
42
43/dts-v1/;
44#include "rk3328.dtsi"
45
46/ {
47	model = "Pine64 Rock64";
48	compatible = "pine64,rock64", "rockchip,rk3328";
49
50	chosen {
51		stdout-path = "serial2:1500000n8";
52	};
53
54	gmac_clkin: external-gmac-clock {
55		compatible = "fixed-clock";
56		clock-frequency = <125000000>;
57		clock-output-names = "gmac_clkin";
58		#clock-cells = <0>;
59	};
60
61	vcc_sd: sdmmc-regulator {
62		compatible = "regulator-fixed";
63		gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>;
64		pinctrl-names = "default";
65		pinctrl-0 = <&sdmmc0m1_gpio>;
66		regulator-name = "vcc_sd";
67		regulator-min-microvolt = <3300000>;
68		regulator-max-microvolt = <3300000>;
69		vin-supply = <&vcc_io>;
70	};
71
72	vcc_host_5v: vcc-host-5v-regulator {
73		compatible = "regulator-fixed";
74		enable-active-high;
75		gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
76		pinctrl-names = "default";
77		pinctrl-0 = <&usb30_host_drv>;
78		regulator-name = "vcc_host_5v";
79		regulator-always-on;
80		vin-supply = <&vcc_sys>;
81	};
82
83	vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator {
84		compatible = "regulator-fixed";
85		enable-active-high;
86		gpio = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>;
87		pinctrl-names = "default";
88		pinctrl-0 = <&usb20_host_drv>;
89		regulator-name = "vcc_host1_5v";
90		regulator-always-on;
91		vin-supply = <&vcc_sys>;
92	};
93
94	vcc_sys: vcc-sys {
95		compatible = "regulator-fixed";
96		regulator-name = "vcc_sys";
97		regulator-always-on;
98		regulator-boot-on;
99		regulator-min-microvolt = <5000000>;
100		regulator-max-microvolt = <5000000>;
101	};
102};
103
104&cpu0 {
105	cpu-supply = <&vdd_arm>;
106};
107
108&cpu1 {
109	cpu-supply = <&vdd_arm>;
110};
111
112&cpu2 {
113	cpu-supply = <&vdd_arm>;
114};
115
116&cpu3 {
117	cpu-supply = <&vdd_arm>;
118};
119
120&emmc {
121	bus-width = <8>;
122	cap-mmc-highspeed;
123	non-removable;
124	pinctrl-names = "default";
125	pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>;
126	vmmc-supply = <&vcc_io>;
127	vqmmc-supply = <&vcc18_emmc>;
128	status = "okay";
129};
130
131&gmac2io {
132	assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
133	assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>;
134	clock_in_out = "input";
135	phy-supply = <&vcc_io>;
136	phy-mode = "rgmii";
137	pinctrl-names = "default";
138	pinctrl-0 = <&rgmiim1_pins>;
139	snps,force_thresh_dma_mode;
140	snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
141	snps,reset-active-low;
142	snps,reset-delays-us = <0 10000 50000>;
143	tx_delay = <0x24>;
144	rx_delay = <0x18>;
145	status = "okay";
146};
147
148&i2c1 {
149	status = "okay";
150
151	rk805: rk805@18 {
152		compatible = "rockchip,rk805";
153		reg = <0x18>;
154		interrupt-parent = <&gpio2>;
155		interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
156		#clock-cells = <1>;
157		clock-output-names = "xin32k", "rk805-clkout2";
158		pinctrl-names = "default";
159		pinctrl-0 = <&pmic_int_l>;
160		rockchip,system-power-controller;
161		wakeup-source;
162
163		vcc1-supply = <&vcc_sys>;
164		vcc2-supply = <&vcc_sys>;
165		vcc3-supply = <&vcc_sys>;
166		vcc4-supply = <&vcc_sys>;
167		vcc5-supply = <&vcc_io>;
168		vcc6-supply = <&vcc_sys>;
169
170		regulators {
171			vdd_logic: DCDC_REG1 {
172				regulator-name = "vdd_logic";
173				regulator-min-microvolt = <712500>;
174				regulator-max-microvolt = <1450000>;
175				regulator-ramp-delay = <12500>;
176				regulator-always-on;
177				regulator-boot-on;
178				regulator-state-mem {
179					regulator-on-in-suspend;
180					regulator-suspend-microvolt = <1000000>;
181				};
182			};
183
184			vdd_arm: DCDC_REG2 {
185				regulator-name = "vdd_arm";
186				regulator-min-microvolt = <712500>;
187				regulator-max-microvolt = <1450000>;
188				regulator-ramp-delay = <12500>;
189				regulator-always-on;
190				regulator-boot-on;
191				regulator-state-mem {
192					regulator-on-in-suspend;
193					regulator-suspend-microvolt = <950000>;
194				};
195			};
196
197			vcc_ddr: DCDC_REG3 {
198				regulator-name = "vcc_ddr";
199				regulator-always-on;
200				regulator-boot-on;
201				regulator-state-mem {
202					regulator-on-in-suspend;
203				};
204			};
205
206			vcc_io: DCDC_REG4 {
207				regulator-name = "vcc_io";
208				regulator-min-microvolt = <3300000>;
209				regulator-max-microvolt = <3300000>;
210				regulator-always-on;
211				regulator-boot-on;
212				regulator-state-mem {
213					regulator-on-in-suspend;
214					regulator-suspend-microvolt = <3300000>;
215				};
216			};
217
218			vcc_18: LDO_REG1 {
219				regulator-name = "vdd_18";
220				regulator-min-microvolt = <1800000>;
221				regulator-max-microvolt = <1800000>;
222				regulator-always-on;
223				regulator-boot-on;
224				regulator-state-mem {
225					regulator-on-in-suspend;
226					regulator-suspend-microvolt = <1800000>;
227				};
228			};
229
230			vcc18_emmc: LDO_REG2 {
231				regulator-name = "vcc_18emmc";
232				regulator-min-microvolt = <1800000>;
233				regulator-max-microvolt = <1800000>;
234				regulator-always-on;
235				regulator-boot-on;
236				regulator-state-mem {
237					regulator-on-in-suspend;
238					regulator-suspend-microvolt = <1800000>;
239				};
240			};
241
242			vdd_10: LDO_REG3 {
243				regulator-name = "vdd_10";
244				regulator-min-microvolt = <1000000>;
245				regulator-max-microvolt = <1000000>;
246				regulator-always-on;
247				regulator-boot-on;
248				regulator-state-mem {
249					regulator-on-in-suspend;
250					regulator-suspend-microvolt = <1000000>;
251				};
252			};
253		};
254	};
255};
256
257&io_domains {
258	status = "okay";
259
260	vccio1-supply = <&vcc_io>;
261	vccio2-supply = <&vcc18_emmc>;
262	vccio3-supply = <&vcc_io>;
263	vccio4-supply = <&vcc_18>;
264	vccio5-supply = <&vcc_io>;
265	vccio6-supply = <&vcc_io>;
266	pmuio-supply = <&vcc_io>;
267};
268
269&pinctrl {
270	pmic {
271		pmic_int_l: pmic-int-l {
272			rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
273		};
274	};
275
276	usb2 {
277		usb20_host_drv: usb20-host-drv {
278			rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
279		};
280	};
281
282	usb3 {
283		usb30_host_drv: usb30-host-drv {
284			rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
285		};
286	};
287};
288
289&sdmmc {
290	bus-width = <4>;
291	cap-mmc-highspeed;
292	cap-sd-highspeed;
293	disable-wp;
294	max-frequency = <150000000>;
295	pinctrl-names = "default";
296	pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>;
297	vmmc-supply = <&vcc_sd>;
298	status = "okay";
299};
300
301&tsadc {
302	rockchip,hw-tshut-mode = <0>;
303	rockchip,hw-tshut-polarity = <0>;
304	status = "okay";
305};
306
307&uart2 {
308	status = "okay";
309};
310
311&u2phy {
312	status = "okay";
313
314	u2phy_host: host-port {
315		status = "okay";
316	};
317
318	u2phy_otg: otg-port {
319		status = "okay";
320	};
321};
322
323&usb20_otg {
324	dr_mode = "host";
325	status = "okay";
326};
327
328&usb_host0_ehci {
329	status = "okay";
330};
331
332&usb_host0_ohci {
333	status = "okay";
334};
335