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,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
140	snps,reset-active-low;
141	snps,reset-delays-us = <0 10000 50000>;
142	tx_delay = <0x26>;
143	rx_delay = <0x11>;
144	status = "okay";
145};
146
147&i2c1 {
148	status = "okay";
149
150	rk805: rk805@18 {
151		compatible = "rockchip,rk805";
152		reg = <0x18>;
153		interrupt-parent = <&gpio2>;
154		interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
155		#clock-cells = <1>;
156		clock-output-names = "xin32k", "rk805-clkout2";
157		pinctrl-names = "default";
158		pinctrl-0 = <&pmic_int_l>;
159		rockchip,system-power-controller;
160		wakeup-source;
161
162		vcc1-supply = <&vcc_sys>;
163		vcc2-supply = <&vcc_sys>;
164		vcc3-supply = <&vcc_sys>;
165		vcc4-supply = <&vcc_sys>;
166		vcc5-supply = <&vcc_io>;
167		vcc6-supply = <&vcc_sys>;
168
169		regulators {
170			vdd_logic: DCDC_REG1 {
171				regulator-name = "vdd_logic";
172				regulator-min-microvolt = <712500>;
173				regulator-max-microvolt = <1450000>;
174				regulator-ramp-delay = <12500>;
175				regulator-always-on;
176				regulator-boot-on;
177				regulator-state-mem {
178					regulator-on-in-suspend;
179					regulator-suspend-microvolt = <1000000>;
180				};
181			};
182
183			vdd_arm: DCDC_REG2 {
184				regulator-name = "vdd_arm";
185				regulator-min-microvolt = <712500>;
186				regulator-max-microvolt = <1450000>;
187				regulator-ramp-delay = <12500>;
188				regulator-always-on;
189				regulator-boot-on;
190				regulator-state-mem {
191					regulator-on-in-suspend;
192					regulator-suspend-microvolt = <950000>;
193				};
194			};
195
196			vcc_ddr: DCDC_REG3 {
197				regulator-name = "vcc_ddr";
198				regulator-always-on;
199				regulator-boot-on;
200				regulator-state-mem {
201					regulator-on-in-suspend;
202				};
203			};
204
205			vcc_io: DCDC_REG4 {
206				regulator-name = "vcc_io";
207				regulator-min-microvolt = <3300000>;
208				regulator-max-microvolt = <3300000>;
209				regulator-always-on;
210				regulator-boot-on;
211				regulator-state-mem {
212					regulator-on-in-suspend;
213					regulator-suspend-microvolt = <3300000>;
214				};
215			};
216
217			vcc_18: LDO_REG1 {
218				regulator-name = "vdd_18";
219				regulator-min-microvolt = <1800000>;
220				regulator-max-microvolt = <1800000>;
221				regulator-always-on;
222				regulator-boot-on;
223				regulator-state-mem {
224					regulator-on-in-suspend;
225					regulator-suspend-microvolt = <1800000>;
226				};
227			};
228
229			vcc18_emmc: LDO_REG2 {
230				regulator-name = "vcc_18emmc";
231				regulator-min-microvolt = <1800000>;
232				regulator-max-microvolt = <1800000>;
233				regulator-always-on;
234				regulator-boot-on;
235				regulator-state-mem {
236					regulator-on-in-suspend;
237					regulator-suspend-microvolt = <1800000>;
238				};
239			};
240
241			vdd_10: LDO_REG3 {
242				regulator-name = "vdd_10";
243				regulator-min-microvolt = <1000000>;
244				regulator-max-microvolt = <1000000>;
245				regulator-always-on;
246				regulator-boot-on;
247				regulator-state-mem {
248					regulator-on-in-suspend;
249					regulator-suspend-microvolt = <1000000>;
250				};
251			};
252		};
253	};
254};
255
256&io_domains {
257	status = "okay";
258
259	vccio1-supply = <&vcc_io>;
260	vccio2-supply = <&vcc18_emmc>;
261	vccio3-supply = <&vcc_io>;
262	vccio4-supply = <&vcc_18>;
263	vccio5-supply = <&vcc_io>;
264	vccio6-supply = <&vcc_io>;
265	pmuio-supply = <&vcc_io>;
266};
267
268&pinctrl {
269	pmic {
270		pmic_int_l: pmic-int-l {
271			rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
272		};
273	};
274
275	usb2 {
276		usb20_host_drv: usb20-host-drv {
277			rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
278		};
279	};
280
281	usb3 {
282		usb30_host_drv: usb30-host-drv {
283			rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
284		};
285	};
286};
287
288&sdmmc {
289	bus-width = <4>;
290	cap-mmc-highspeed;
291	cap-sd-highspeed;
292	disable-wp;
293	max-frequency = <150000000>;
294	pinctrl-names = "default";
295	pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>;
296	vmmc-supply = <&vcc_sd>;
297	status = "okay";
298};
299
300&tsadc {
301	rockchip,hw-tshut-mode = <0>;
302	rockchip,hw-tshut-polarity = <0>;
303	status = "okay";
304};
305
306&uart2 {
307	status = "okay";
308};
309
310&u2phy {
311	status = "okay";
312
313	u2phy_host: host-port {
314		status = "okay";
315	};
316
317	u2phy_otg: otg-port {
318		status = "okay";
319	};
320};
321
322&usb20_otg {
323	dr_mode = "host";
324	status = "okay";
325};
326
327&usb_host0_ehci {
328	status = "okay";
329};
330
331&usb_host0_ohci {
332	status = "okay";
333};
334