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