1/*
2 * Copyright (c) 2016 Matthias Brugger <mbrugger@suse.com>
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 file 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 file 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 <dt-bindings/input/input.h>
45#include "rk3368.dtsi"
46
47/ {
48	model = "Rockchip Orion R68";
49	compatible = "tronsmart,orion-r68-meta", "rockchip,rk3368";
50
51	chosen {
52		stdout-path = "serial2:115200n8";
53	};
54
55	memory {
56		device_type = "memory";
57		reg = <0x0 0x0 0x0 0x80000000>;
58	};
59
60	emmc_pwrseq: emmc-pwrseq {
61		compatible = "mmc-pwrseq-emmc";
62		pinctrl-0 = <&emmc_reset>;
63		pinctrl-names = "default";
64		reset-gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
65	};
66
67	ext_gmac: external-gmac-clock {
68		compatible = "fixed-clock";
69		#clock-cells = <0>;
70		clock-frequency = <125000000>;
71		clock-output-names = "ext_gmac";
72	};
73
74	keys: gpio-keys {
75		compatible = "gpio-keys";
76		pinctrl-names = "default";
77		pinctrl-0 = <&pwr_key>;
78
79		power {
80			wakeup-source;
81			gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>;
82			label = "GPIO Power";
83			linux,code = <KEY_POWER>;
84		};
85	};
86
87	leds: gpio-leds {
88		compatible = "gpio-leds";
89
90		red {
91			gpios = <&gpio3 29 GPIO_ACTIVE_HIGH>;
92			label = "orion:red:led";
93			pinctrl-names = "default";
94			pinctrl-0 = <&led_ctl>;
95			default-state = "on";
96		};
97
98		blue {
99			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
100			label = "orion:blue:led";
101			pinctrl-names = "default";
102			pinctrl-0 = <&stby_pwren>;
103			default-state = "off";
104		};
105	};
106
107	vcc_18: vcc18-regulator {
108		compatible = "regulator-fixed";
109		regulator-name = "vcc_18";
110		regulator-min-microvolt = <1800000>;
111		regulator-max-microvolt = <1800000>;
112		regulator-always-on;
113		regulator-boot-on;
114		vin-supply = <&vcc_sys>;
115	};
116
117	/* supplies both host and otg */
118	vcc_host: vcc-host-regulator {
119		compatible = "regulator-fixed";
120		gpio = <&gpio0 4 GPIO_ACTIVE_LOW>;
121		pinctrl-names = "default";
122		pinctrl-0 = <&host_vbus_drv>;
123		regulator-name = "vcc_host";
124		regulator-always-on;
125		regulator-boot-on;
126		vin-supply = <&vcc_sys>;
127	};
128
129	vcc_io: vcc-io-regulator {
130		compatible = "regulator-fixed";
131		regulator-name = "vcc_io";
132		regulator-min-microvolt = <3300000>;
133		regulator-max-microvolt = <3300000>;
134		regulator-always-on;
135		regulator-boot-on;
136		vin-supply = <&vcc_sys>;
137	};
138
139	vcc_lan: vcc-lan-regulator {
140		compatible = "regulator-fixed";
141		regulator-name = "vcc_lan";
142		regulator-min-microvolt = <3300000>;
143		regulator-max-microvolt = <3300000>;
144		regulator-always-on;
145		regulator-boot-on;
146		vin-supply = <&vcc_io>;
147	};
148
149	vcc_sd: vcc-sd-regulator {
150		compatible = "regulator-fixed";
151		regulator-name = "vcc_sd";
152		gpio = <&gpio3 11 GPIO_ACTIVE_LOW>;
153		regulator-min-microvolt = <1800000>;
154		regulator-max-microvolt = <3300000>;
155		regulator-always-on;
156		regulator-boot-on;
157		vin-supply = <&vcc_io>;
158	};
159
160	vcc_sys: vcc-sys-regulator {
161		compatible = "regulator-fixed";
162		regulator-name = "vcc_sys";
163		regulator-min-microvolt = <5000000>;
164		regulator-max-microvolt = <5000000>;
165		regulator-always-on;
166		regulator-boot-on;
167	};
168
169	vccio_sd: vcc-io-sd-regulator {
170		compatible = "regulator-fixed";
171		regulator-name= "vccio_sd";
172		regulator-min-microvolt = <1800000>;
173		regulator-max-microvolt = <3300000>;
174		regulator-always-on;
175		regulator-boot-on;
176		vin-supply = <&vcc_io>;
177	};
178
179	vccio_wl: vccio-wl-regulator {
180		compatible = "regulator-fixed";
181		regulator-name = "vccio_wl";
182		regulator-min-microvolt = <3300000>;
183		regulator-max-microvolt = <3300000>;
184		regulator-always-on;
185		regulator-boot-on;
186		vin-supply = <&vcc_io>;
187	};
188
189	vdd_10: vdd-10-regulator {
190		compatible = "regulator-fixed";
191		regulator-name = "vdd_10";
192		regulator-min-microvolt = <1000000>;
193		regulator-max-microvolt = <1000000>;
194		regulator-always-on;
195		regulator-boot-on;
196		vin-supply = <&vcc_sys>;
197	};
198};
199
200&emmc {
201	bus-width = <8>;
202	cap-mmc-highspeed;
203	disable-wp;
204	keep-power-in-suspend;
205	mmc-pwrseq = <&emmc_pwrseq>;
206	mmc-hs200-1_2v;
207	mmc-hs200-1_8v;
208	non-removable;
209	num-slots = <1>;
210	pinctrl-names = "default";
211	pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>;
212	status = "okay";
213};
214
215&gmac {
216	assigned-clocks = <&cru SCLK_MAC>;
217	assigned-clock-parents = <&ext_gmac>;
218	clock_in_out = "input";
219	phy-supply = <&vcc_lan>;
220	phy-mode = "rgmii";
221	pinctrl-names = "default";
222	pinctrl-0 = <&rgmii_pins>;
223	snps,reset-gpio = <&gpio3 12 0>;
224	snps,reset-active-low;
225	snps,reset-delays-us = <0 10000 1000000>;
226	tx_delay = <0x30>;
227	rx_delay = <0x10>;
228	status = "ok";
229};
230
231&i2c0 {
232	status = "okay";
233
234	vdd_cpu: syr827@40 {
235		compatible = "silergy,syr827";
236		reg = <0x40>;
237		fcs,suspend-voltage-selector = <1>;
238		regulator-name = "vdd_cpu";
239		regulator-enable-ramp-delay = <300>;
240		regulator-min-microvolt = <712500>;
241		regulator-max-microvolt = <1500000>;
242		regulator-ramp-delay = <8000>;
243		regulator-always-on;
244		regulator-boot-on;
245		vin-supply = <&vcc_sys>;
246	};
247
248	hym8563: hym8563@51 {
249		compatible = "haoyu,hym8563";
250		reg = <0x51>;
251		#clock-cells = <0>;
252		clock-frequency = <32768>;
253		clock-output-names = "xin32k";
254		/* rtc_int is not connected */
255	};
256};
257
258&pinctrl {
259	pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma {
260		bias-disable;
261		drive-strength = <8>;
262	};
263
264	pcfg_pull_up_drv_8ma: pcfg-pull-up-drv-8ma {
265		bias-pull-up;
266		drive-strength = <8>;
267	};
268
269	emmc {
270		emmc_bus8: emmc-bus8 {
271			rockchip,pins = <1 18 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
272					<1 19 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
273					<1 20 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
274					<1 21 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
275					<1 22 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
276					<1 23 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
277					<1 24 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
278					<1 25 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
279		};
280
281		emmc-clk {
282			rockchip,pins = <2 4 RK_FUNC_2 &pcfg_pull_none_drv_8ma>;
283		};
284
285		emmc-cmd {
286			rockchip,pins = <1 26 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
287		};
288
289		emmc_reset: emmc-reset {
290			rockchip,pins = <2 3 RK_FUNC_GPIO &pcfg_pull_none>;
291		};
292	};
293
294	keys {
295		pwr_key: pwr-key {
296			rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_down>;
297		};
298	};
299
300	leds {
301		stby_pwren: stby-pwren {
302			rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>;
303		};
304
305		led_ctl: led-ctl {
306			rockchip,pins = <3 29 RK_FUNC_GPIO &pcfg_pull_none>;
307		};
308	};
309
310	sdmmc {
311		sdmmc_clk: sdmmc-clk {
312			rockchip,pins = <2 9 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
313		};
314
315		sdmmc_cmd: sdmmc-cmd {
316			rockchip,pins = <2 10 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
317		};
318
319		sdmmc_cd: sdmmc-cd {
320			rockchip,pins = <2 11 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
321		};
322
323		sdmmc_bus1: sdmmc-bus1 {
324			rockchip,pins = <2 5 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
325		};
326
327		sdmmc_bus4: sdmmc-bus4 {
328			rockchip,pins = <2 5 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
329					<2 6 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
330					<2 7 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
331					<2 8 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
332		};
333	};
334
335	usb {
336		host_vbus_drv: host-vbus-drv {
337			rockchip,pins = <0 4 RK_FUNC_GPIO &pcfg_pull_none>;
338		};
339	};
340};
341
342&saradc {
343	vref-supply = <&vcc_18>;
344	status = "okay";
345};
346
347&sdmmc {
348	bus-width = <4>;
349	clock-frequency = <50000000>;
350	clock-freq-min-max = <400000 50000000>;
351	cap-sd-highspeed;
352	card-detect-delay = <200>;
353	keep-power-in-suspend;
354	num-slots = <1>;
355	pinctrl-names = "default";
356	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
357	vmmc-supply = <&vcc_sd>;
358	vqmmc-supply = <&vccio_sd>;
359	status = "okay";
360};
361
362&uart2 {
363	status = "okay";
364};
365
366&uart4 {
367	pinctrl-names = "default";
368	pinctrl-0 = <&uart4_xfer>;
369	status = "okay";
370};
371
372&usb_host0_ehci {
373	status = "okay";
374};
375
376&usb_otg {
377	status = "okay";
378};
379
380&wdt {
381	status = "okay";
382};
383