1/*
2 * This file is dual-licensed: you can use it either under the terms
3 * of the GPL or the X11 license, at your option. Note that this dual
4 * licensing only applies to this file, and not this project as a
5 * whole.
6 *
7 *  a) This file is free software; you can redistribute it and/or
8 *     modify it under the terms of the GNU General Public License as
9 *     published by the Free Software Foundation; either version 2 of the
10 *     License, or (at your option) any later version.
11 *
12 *     This file is distributed in the hope that it will be useful,
13 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *     GNU General Public License for more details.
16 *
17 * Or, alternatively,
18 *
19 *  b) Permission is hereby granted, free of charge, to any person
20 *     obtaining a copy of this software and associated documentation
21 *     files (the "Software"), to deal in the Software without
22 *     restriction, including without limitation the rights to use,
23 *     copy, modify, merge, publish, distribute, sublicense, and/or
24 *     sell copies of the Software, and to permit persons to whom the
25 *     Software is furnished to do so, subject to the following
26 *     conditions:
27 *
28 *     The above copyright notice and this permission notice shall be
29 *     included in all copies or substantial portions of the Software.
30 *
31 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
33 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
35 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
36 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
37 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
38 *     OTHER DEALINGS IN THE SOFTWARE.
39 */
40
41#include "rk3288.dtsi"
42
43/ {
44	memory {
45		device_type = "memory";
46		reg = <0x0 0x80000000>;
47	};
48
49	ext_gmac: external-gmac-clock {
50		compatible = "fixed-clock";
51		clock-frequency = <125000000>;
52		clock-output-names = "ext_gmac";
53		#clock-cells = <0>;
54	};
55
56	gpio-keys {
57		compatible = "gpio-keys";
58		autorepeat;
59
60		pinctrl-names = "default";
61		pinctrl-0 = <&pwrbtn>;
62
63		button@0 {
64			gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
65			label = "GPIO Key Power";
66			linux,input-type = <1>;
67			gpio-key,wakeup = <1>;
68			debounce-interval = <100>;
69		};
70	};
71
72	gpio-leds {
73		compatible = "gpio-leds";
74
75		pwr-led {
76			gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
77			linux,default-trigger = "default-on";
78		};
79
80		act-led {
81			gpios=<&gpio2 3 GPIO_ACTIVE_LOW>;
82			linux,default-trigger="mmc0";
83		};
84	};
85
86	vcc_sys: vsys-regulator {
87		compatible = "regulator-fixed";
88		regulator-name = "vcc_sys";
89		regulator-min-microvolt = <5000000>;
90		regulator-max-microvolt = <5000000>;
91		regulator-always-on;
92		regulator-boot-on;
93	};
94
95	/*
96	 * NOTE: vcc_sd isn't hooked up on v1.0 boards where power comes from
97	 * vcc_io directly.  Those boards won't be able to power cycle SD cards
98	 * but it shouldn't hurt to toggle this pin there anyway.
99	 */
100	vcc_sd: sdmmc-regulator {
101		compatible = "regulator-fixed";
102		gpio = <&gpio7 11 GPIO_ACTIVE_LOW>;
103		pinctrl-names = "default";
104		pinctrl-0 = <&sdmmc_pwr>;
105		regulator-name = "vcc_sd";
106		regulator-min-microvolt = <3300000>;
107		regulator-max-microvolt = <3300000>;
108		startup-delay-us = <100000>;
109		vin-supply = <&vcc_io>;
110	};
111
112	vcc5v0_host: usb-host-regulator {
113		compatible = "regulator-fixed";
114		enable-active-high;
115		gpio = <&gpio0 14 GPIO_ACTIVE_HIGH>;
116		pinctrl-names = "default";
117		pinctrl-0 = <&host_vbus_drv>;
118		regulator-name = "vcc5v0_host";
119		regulator-min-microvolt = <5000000>;
120		regulator-max-microvolt = <5000000>;
121		regulator-always-on;
122	};
123};
124
125&cpu0 {
126	cpu0-supply = <&vdd_cpu>;
127};
128
129&sdmmc {
130	bus-width = <4>;
131	cap-mmc-highspeed;
132	cap-sd-highspeed;
133	card-detect-delay = <200>;
134	disable-wp;			/* wp not hooked up */
135	num-slots = <1>;
136	pinctrl-names = "default";
137	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
138	status = "okay";
139	supports-sd;
140	vmmc-supply = <&vcc_sd>;
141	vqmmc-supply = <&vccio_sd>;
142};
143
144&gpu {
145	mali-supply = <&vdd_gpu>;
146	status = "okay";
147};
148
149&gmac {
150	phy-supply = <&vcc33_lan>;
151	phy-mode = "rgmii";
152	clock_in_out = "input";
153	snps,reset-gpio = <&gpio4 7 0>;
154	snps,reset-active-low;
155	snps,reset-delays-us = <0 10000 1000000>;
156	assigned-clocks = <&cru SCLK_MAC>;
157	assigned-clock-parents = <&ext_gmac>;
158	pinctrl-names = "default";
159	pinctrl-0 = <&rgmii_pins>;
160	tx_delay = <0x30>;
161	rx_delay = <0x10>;
162	status = "okay";
163};
164
165&hdmi {
166	ddc-i2c-bus = <&i2c5>;
167	status = "okay";
168};
169
170&i2c0 {
171	status = "okay";
172	clock-frequency = <400000>;
173
174	rk808: pmic@1b {
175		compatible = "rockchip,rk808";
176		reg = <0x1b>;
177		interrupt-parent = <&gpio0>;
178		interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
179		pinctrl-names = "default";
180		pinctrl-0 = <&pmic_int &global_pwroff>;
181		rockchip,system-power-controller;
182		wakeup-source;
183		#clock-cells = <1>;
184		clock-output-names = "xin32k", "rk808-clkout2";
185
186		vcc1-supply = <&vcc_sys>;
187		vcc2-supply = <&vcc_sys>;
188		vcc3-supply = <&vcc_sys>;
189		vcc4-supply = <&vcc_sys>;
190		vcc6-supply = <&vcc_sys>;
191		vcc7-supply = <&vcc_sys>;
192		vcc8-supply = <&vcc_18>;
193		vcc9-supply = <&vcc_io>;
194		vcc10-supply = <&vcc_io>;
195		vcc11-supply = <&vcc_sys>;
196		vcc12-supply = <&vcc_io>;
197		vddio-supply = <&vcc18_ldo1>;
198
199		regulators {
200			vdd_cpu: DCDC_REG1 {
201				regulator-always-on;
202				regulator-boot-on;
203				regulator-min-microvolt = <750000>;
204				regulator-max-microvolt = <1350000>;
205				regulator-name = "vdd_arm";
206				regulator-state-mem {
207					regulator-off-in-suspend;
208				};
209			};
210
211			vdd_gpu: DCDC_REG2 {
212				regulator-always-on;
213				regulator-boot-on;
214				regulator-min-microvolt = <850000>;
215				regulator-max-microvolt = <1250000>;
216				regulator-name = "vdd_gpu";
217				regulator-state-mem {
218					regulator-on-in-suspend;
219					regulator-suspend-microvolt = <1000000>;
220				};
221			};
222
223			vcc_ddr: DCDC_REG3 {
224				regulator-always-on;
225				regulator-boot-on;
226				regulator-name = "vcc_ddr";
227				regulator-state-mem {
228					regulator-on-in-suspend;
229				};
230			};
231
232			vcc_io: DCDC_REG4 {
233				regulator-always-on;
234				regulator-boot-on;
235				regulator-min-microvolt = <3300000>;
236				regulator-max-microvolt = <3300000>;
237				regulator-name = "vcc_io";
238				regulator-state-mem {
239					regulator-on-in-suspend;
240					regulator-suspend-microvolt = <3300000>;
241				};
242			};
243
244			vcc18_ldo1: LDO_REG1 {
245				regulator-always-on;
246				regulator-boot-on;
247				regulator-min-microvolt = <1800000>;
248				regulator-max-microvolt = <1800000>;
249				regulator-name = "vcc18_ldo1";
250				regulator-state-mem {
251					regulator-on-in-suspend;
252					regulator-suspend-microvolt = <1800000>;
253				};
254			};
255
256			vcc33_mipi: LDO_REG2 {
257				regulator-always-on;
258				regulator-boot-on;
259				regulator-min-microvolt = <3300000>;
260				regulator-max-microvolt = <3300000>;
261				regulator-name = "vcc33_mipi";
262				regulator-state-mem {
263					regulator-off-in-suspend;
264				};
265			};
266
267			vdd_10: LDO_REG3 {
268				regulator-always-on;
269				regulator-boot-on;
270				regulator-min-microvolt = <1000000>;
271				regulator-max-microvolt = <1000000>;
272				regulator-name = "vdd_10";
273				regulator-state-mem {
274					regulator-on-in-suspend;
275					regulator-suspend-microvolt = <1000000>;
276				};
277			};
278
279			vcc18_codec: LDO_REG4 {
280				regulator-always-on;
281				regulator-boot-on;
282				regulator-min-microvolt = <1800000>;
283				regulator-max-microvolt = <1800000>;
284				regulator-name = "vcc18_codec";
285				regulator-state-mem {
286					regulator-on-in-suspend;
287					regulator-suspend-microvolt = <1800000>;
288				};
289			};
290
291			vccio_sd: LDO_REG5 {
292				regulator-always-on;
293				regulator-boot-on;
294				regulator-min-microvolt = <1800000>;
295				regulator-max-microvolt = <3300000>;
296				regulator-name = "vccio_sd";
297				regulator-state-mem {
298					regulator-on-in-suspend;
299					regulator-suspend-microvolt = <3300000>;
300				};
301			};
302
303			vdd10_lcd: LDO_REG6 {
304				regulator-always-on;
305				regulator-boot-on;
306				regulator-min-microvolt = <1000000>;
307				regulator-max-microvolt = <1000000>;
308				regulator-name = "vdd10_lcd";
309				regulator-state-mem {
310					regulator-on-in-suspend;
311					regulator-suspend-microvolt = <1000000>;
312				};
313			};
314
315			vcc_18: LDO_REG7 {
316				regulator-always-on;
317				regulator-boot-on;
318				regulator-min-microvolt = <1800000>;
319				regulator-max-microvolt = <1800000>;
320				regulator-name = "vcc_18";
321				regulator-state-mem {
322					regulator-on-in-suspend;
323					regulator-suspend-microvolt = <1800000>;
324				};
325			};
326
327			vcc18_lcd: LDO_REG8 {
328				regulator-always-on;
329				regulator-boot-on;
330				regulator-min-microvolt = <1800000>;
331				regulator-max-microvolt = <1800000>;
332				regulator-name = "vcc18_lcd";
333				regulator-state-mem {
334					regulator-on-in-suspend;
335					regulator-suspend-microvolt = <1800000>;
336				};
337			};
338
339			vcc33_sd: SWITCH_REG1 {
340				regulator-always-on;
341				regulator-boot-on;
342				regulator-name = "vcc33_sd";
343				regulator-state-mem {
344					regulator-on-in-suspend;
345				};
346			};
347
348			vcc33_lan: SWITCH_REG2 {
349				regulator-always-on;
350				regulator-boot-on;
351				regulator-name = "vcc33_lan";
352				regulator-state-mem {
353					regulator-on-in-suspend;
354				};
355			};
356		};
357	};
358};
359
360&i2c2 {
361	status = "okay";
362	headset: nau8825@1a {
363		compatible = "nuvoton,nau8825";
364		#sound-dai-cells = <0>;
365		reg = <0x1a>;
366		interrupt-parent = <&gpio6>;
367		interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
368		nuvoton,jkdet-enable = <1>;
369		nuvoton,jkdet-pull-enable = <1>;
370		nuvoton,jkdet-pull-up = <0>;
371		nuvoton,jkdet-polarity = <1>;
372		nuvoton,vref-impedance = <2>;
373		nuvoton,micbias-voltage = <6>;
374		nuvoton,sar-threshold-num = <4>;
375		nuvoton,sar-threshold = <0xa 0x14 0x26 0x73>;
376		nuvoton,sar-hysteresis = <0>;
377		nuvoton,sar-voltage = <6>;
378		nuvoton,sar-compare-time = <0>;
379		nuvoton,sar-sampling-time = <0>;
380		nuvoton,short-key-debounce = <3>;
381		nuvoton,jack-insert-debounce = <7>;
382		nuvoton,jack-eject-debounce = <7>;
383		clock-names = "mclk";
384		clocks = <&cru SCLK_I2S0_OUT>;
385	};
386};
387
388&i2c5 {
389	status = "okay";
390};
391
392&wdt {
393	status = "okay";
394};
395
396&pwm0 {
397	status = "okay";
398};
399
400&saradc {
401	vref-supply = <&vcc18_ldo1>;
402	status ="okay";
403};
404
405&uart0 {
406	status = "okay";
407};
408
409&uart1 {
410	status = "okay";
411};
412
413&uart2 {
414	status = "okay";
415};
416
417&uart3 {
418	status = "okay";
419};
420
421&uart4 {
422	status = "okay";
423};
424
425&tsadc {
426	rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
427	rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
428	status = "okay";
429};
430
431&usbphy {
432	status = "okay";
433};
434
435&usb_host0_ehci {
436	status = "okay";
437};
438
439&usb_host1 {
440	status = "okay";
441};
442
443&usb_otg {
444	status= "okay";
445};
446
447&vopb {
448	status = "okay";
449};
450
451&vopb_mmu {
452	status = "okay";
453};
454
455&vopl {
456	status = "okay";
457};
458
459&vopl_mmu {
460	status = "okay";
461};
462
463&pinctrl {
464	pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma {
465		drive-strength = <8>;
466	};
467
468	pcfg_pull_up_drv_8ma: pcfg-pull-up-drv-8ma {
469		bias-pull-up;
470		drive-strength = <8>;
471	};
472
473	backlight {
474		bl_en: bl-en {
475			rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>;
476		};
477	};
478
479	buttons {
480		pwrbtn: pwrbtn {
481			rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
482		};
483	};
484
485	eth_phy {
486		eth_phy_pwr: eth-phy-pwr {
487			rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_none>;
488		};
489	};
490
491	pmic {
492		pmic_int: pmic-int {
493			rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
494		};
495	};
496
497	sdmmc {
498		/*
499		 * Default drive strength isn't enough to achieve even
500		 * high-speed mode on EVB board so bump up to 8ma.
501		 */
502		sdmmc_bus4: sdmmc-bus4 {
503			rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
504					<6 17 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
505					<6 18 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
506					<6 19 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
507		};
508
509		sdmmc_clk: sdmmc-clk {
510			rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
511		};
512
513		sdmmc_cmd: sdmmc-cmd {
514			rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
515		};
516
517		sdmmc_pwr: sdmmc-pwr {
518			rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
519		};
520	};
521
522	usb {
523		host_vbus_drv: host-vbus-drv {
524			rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
525		};
526
527		pwr_3g: pwr-3g {
528			rockchip,pins = <7 8 RK_FUNC_GPIO &pcfg_pull_none>;
529		};
530	};
531};
532