1/*
2 * Copyright (c) 2016 Andreas Färber
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 "rk3368.dtsi"
45#include <dt-bindings/input/input.h>
46
47/ {
48	model = "GeekBox";
49	compatible = "geekbuying,geekbox", "rockchip,rk3368";
50
51	chosen {
52		stdout-path = "serial2:115200n8";
53	};
54
55	memory@0 {
56		device_type = "memory";
57		reg = <0x0 0x0 0x0 0x80000000>;
58	};
59
60	ext_gmac: gmac-clk {
61		compatible = "fixed-clock";
62		clock-frequency = <125000000>;
63		clock-output-names = "ext_gmac";
64		#clock-cells = <0>;
65	};
66
67	ir: ir-receiver {
68		compatible = "gpio-ir-receiver";
69		gpios = <&gpio3 RK_PD6 GPIO_ACTIVE_LOW>;
70		pinctrl-names = "default";
71		pinctrl-0 = <&ir_int>;
72	};
73
74	keys: gpio-keys {
75		compatible = "gpio-keys";
76		pinctrl-names = "default";
77		pinctrl-0 = <&pwr_key>;
78
79		power {
80			gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>;
81			label = "GPIO Power";
82			linux,code = <KEY_POWER>;
83			wakeup-source;
84		};
85	};
86
87	leds: gpio-leds {
88		compatible = "gpio-leds";
89
90		blue {
91			gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_HIGH>;
92			label = "geekbox:blue:led";
93			default-state = "on";
94		};
95
96		red {
97			gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_HIGH>;
98			label = "geekbox:red:led";
99			default-state = "off";
100		};
101	};
102
103	vcc_sys: vcc-sys-regulator {
104		compatible = "regulator-fixed";
105		regulator-name = "vcc_sys";
106		regulator-min-microvolt = <5000000>;
107		regulator-max-microvolt = <5000000>;
108		regulator-always-on;
109		regulator-boot-on;
110	};
111};
112
113&emmc {
114	status = "okay";
115	bus-width = <8>;
116	cap-mmc-highspeed;
117	clock-frequency = <150000000>;
118	disable-wp;
119	non-removable;
120	vmmc-supply = <&vcc_io>;
121	vqmmc-supply = <&vcc18_flash>;
122	pinctrl-names = "default";
123	pinctrl-0 = <&emmc_clk>, <&emmc_cmd>, <&emmc_bus8>;
124};
125
126&gmac {
127	status = "okay";
128	phy-supply = <&vcc_lan>;
129	phy-mode = "rgmii";
130	clock_in_out = "input";
131	assigned-clocks = <&cru SCLK_MAC>;
132	assigned-clock-parents = <&ext_gmac>;
133	pinctrl-names = "default";
134	pinctrl-0 = <&rgmii_pins>;
135	tx_delay = <0x30>;
136	rx_delay = <0x10>;
137};
138
139&i2c0 {
140	status = "okay";
141
142	rk808: pmic@1b {
143		compatible = "rockchip,rk808";
144		reg = <0x1b>;
145		pinctrl-names = "default";
146		pinctrl-0 = <&pmic_int>, <&pmic_sleep>;
147		interrupt-parent = <&gpio0>;
148		interrupts = <RK_PA5 IRQ_TYPE_LEVEL_LOW>;
149		rockchip,system-power-controller;
150		vcc1-supply = <&vcc_sys>;
151		vcc2-supply = <&vcc_sys>;
152		vcc3-supply = <&vcc_sys>;
153		vcc4-supply = <&vcc_sys>;
154		vcc6-supply = <&vcc_sys>;
155		vcc7-supply = <&vcc_sys>;
156		vcc8-supply = <&vcc_io>;
157		vcc9-supply = <&vcc_sys>;
158		vcc10-supply = <&vcc_sys>;
159		vcc11-supply = <&vcc_sys>;
160		vcc12-supply = <&vcc_io>;
161		clock-output-names = "xin32k", "rk808-clkout2";
162		#clock-cells = <1>;
163
164		regulators {
165			vdd_cpu: DCDC_REG1 {
166				regulator-always-on;
167				regulator-boot-on;
168				regulator-min-microvolt = <700000>;
169				regulator-max-microvolt = <1500000>;
170				regulator-name = "vdd_cpu";
171			};
172
173			vdd_log: DCDC_REG2 {
174				regulator-always-on;
175				regulator-boot-on;
176				regulator-min-microvolt = <700000>;
177				regulator-max-microvolt = <1500000>;
178				regulator-name = "vdd_log";
179			};
180
181			vcc_ddr: DCDC_REG3 {
182				regulator-always-on;
183				regulator-boot-on;
184				regulator-name = "vcc_ddr";
185			};
186
187			vcc_io: DCDC_REG4 {
188				regulator-always-on;
189				regulator-boot-on;
190				regulator-min-microvolt = <3300000>;
191				regulator-max-microvolt = <3300000>;
192				regulator-name = "vcc_io";
193			};
194
195			vcc18_flash: LDO_REG1 {
196				regulator-always-on;
197				regulator-boot-on;
198				regulator-min-microvolt = <1800000>;
199				regulator-max-microvolt = <1800000>;
200				regulator-name = "vcc18_flash";
201			};
202
203			vcc33_lcd: LDO_REG2 {
204				regulator-always-on;
205				regulator-boot-on;
206				regulator-min-microvolt = <3300000>;
207				regulator-max-microvolt = <3300000>;
208				regulator-name = "vcc33_lcd";
209			};
210
211			vdd_10: LDO_REG3 {
212				regulator-always-on;
213				regulator-boot-on;
214				regulator-min-microvolt = <1000000>;
215				regulator-max-microvolt = <1000000>;
216				regulator-name = "vdd_10";
217			};
218
219			vcca_18: LDO_REG4 {
220				regulator-boot-on;
221				regulator-min-microvolt = <1800000>;
222				regulator-max-microvolt = <1800000>;
223				regulator-name = "vcca_18";
224			};
225
226			vccio_sd: LDO_REG5 {
227				regulator-always-on;
228				regulator-boot-on;
229				regulator-min-microvolt = <1800000>;
230				regulator-max-microvolt = <3300000>;
231				regulator-name = "vccio_sd";
232			};
233
234			vdd10_lcd: LDO_REG6 {
235				regulator-always-on;
236				regulator-boot-on;
237				regulator-min-microvolt = <1000000>;
238				regulator-max-microvolt = <1000000>;
239				regulator-name = "vdd10_lcd";
240			};
241
242			vcc_18: LDO_REG7 {
243				regulator-always-on;
244				regulator-boot-on;
245				regulator-min-microvolt = <1800000>;
246				regulator-max-microvolt = <1800000>;
247				regulator-name = "vcc_18";
248			};
249
250			vcc18_lcd: LDO_REG8 {
251				regulator-always-on;
252				regulator-boot-on;
253				regulator-min-microvolt = <1800000>;
254				regulator-max-microvolt = <1800000>;
255				regulator-name = "vcc18_lcd";
256			};
257
258			vcc_sd: SWITCH_REG1 {
259				regulator-name = "vcc_sd";
260			};
261
262			vcc_lan: SWITCH_REG2 {
263				regulator-always-on;
264				regulator-boot-on;
265				regulator-name = "vcc_lan";
266			};
267		};
268	};
269};
270
271&pinctrl {
272	ir {
273		ir_int: ir-int {
274			rockchip,pins = <3 30 RK_FUNC_GPIO &pcfg_pull_none>;
275		};
276	};
277
278	keys {
279		pwr_key: pwr-key {
280			rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_none>;
281		};
282	};
283
284	pmic {
285		pmic_sleep: pmic-sleep {
286			rockchip,pins = <0 0 RK_FUNC_2 &pcfg_pull_none>;
287		};
288
289		pmic_int: pmic-int {
290			rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
291		};
292	};
293};
294
295&tsadc {
296	status = "okay";
297	rockchip,hw-tshut-mode = <0>; /* CRU */
298	rockchip,hw-tshut-polarity = <1>; /* high */
299};
300
301&uart2 {
302	status = "okay";
303};
304
305&usb_host0_ehci {
306	status = "okay";
307};
308
309&usb_otg {
310	status = "okay";
311};
312
313&wdt {
314	status = "okay";
315};
316