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 = <0 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		power {
64			gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
65			label = "GPIO Key Power";
66			linux,input-type = <1>;
67			wakeup-source;
68			debounce-interval = <100>;
69		};
70	};
71
72	io_domains: io-domains {
73		compatible = "rockchip,rk3288-io-voltage-domain";
74		rockchip,grf = <&grf>;
75
76		audio-supply = <&vcca_33>;
77		bb-supply = <&vcc_io>;
78		dvp-supply = <&vcc18_dvp>;
79		flash0-supply = <&vcc_flash>;
80		flash1-supply = <&vcc_lan>;
81		gpio30-supply = <&vcc_io>;
82		gpio1830-supply = <&vcc_io>;
83		lcdc-supply = <&vcc_io>;
84		sdcard-supply = <&vccio_sd>;
85		wifi-supply = <&vccio_wl>;
86	};
87
88	ir: ir-receiver {
89		compatible = "gpio-ir-receiver";
90		gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
91		pinctrl-names = "default";
92		pinctrl-0 = <&ir_int>;
93	};
94
95	vcc_flash: flash-regulator {
96		compatible = "regulator-fixed";
97		regulator-name = "vcc_flash";
98		regulator-min-microvolt = <1800000>;
99		regulator-max-microvolt = <1800000>;
100		vin-supply = <&vcc_io>;
101	};
102
103	vcc_sd: sdmmc-regulator {
104		compatible = "regulator-fixed";
105		gpio = <&gpio7 11 GPIO_ACTIVE_LOW>;
106		pinctrl-names = "default";
107		pinctrl-0 = <&sdmmc_pwr>;
108		regulator-name = "vcc_sd";
109		regulator-min-microvolt = <3300000>;
110		regulator-max-microvolt = <3300000>;
111		startup-delay-us = <100000>;
112		vin-supply = <&vcc_io>;
113	};
114
115	vcc_sys: vsys-regulator {
116		compatible = "regulator-fixed";
117		regulator-name = "vcc_sys";
118		regulator-min-microvolt = <5000000>;
119		regulator-max-microvolt = <5000000>;
120		regulator-always-on;
121		regulator-boot-on;
122	};
123
124	/*
125	 * A PT5128 creates both dovdd_1v8 and vcc28_dvp, controlled
126	 * by the dvp_pwr pin.
127	 */
128	vcc18_dvp: vcc18-dvp-regulator {
129		compatible = "regulator-fixed";
130		regulator-name = "vcc18-dvp";
131		regulator-min-microvolt = <1800000>;
132		regulator-max-microvolt = <1800000>;
133		vin-supply = <&vcc28_dvp>;
134	};
135
136	vcc28_dvp: vcc28-dvp-regulator {
137		compatible = "regulator-fixed";
138		enable-active-high;
139		gpio = <&gpio0 17 GPIO_ACTIVE_HIGH>;
140		pinctrl-names = "default";
141		pinctrl-0 = <&dvp_pwr>;
142		regulator-name = "vcc28_dvp";
143		regulator-min-microvolt = <2800000>;
144		regulator-max-microvolt = <2800000>;
145		regulator-always-on;
146		vin-supply = <&vcc_io>;
147	};
148
149	vcc5v0_host: usb-host-regulator {
150		compatible = "regulator-fixed";
151		enable-active-high;
152		gpio = <&gpio0 14 GPIO_ACTIVE_HIGH>;
153		pinctrl-names = "default";
154		pinctrl-0 = <&host_vbus_drv>;
155		regulator-name = "vcc5v0_host";
156		regulator-min-microvolt = <5000000>;
157		regulator-max-microvolt = <5000000>;
158		regulator-always-on;
159	};
160};
161
162&cpu0 {
163	cpu0-supply = <&vdd_cpu>;
164};
165
166&emmc {
167	bus-width = <8>;
168	cap-mmc-highspeed;
169	disable-wp;
170	non-removable;
171	num-slots = <1>;
172	pinctrl-names = "default";
173	pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>;
174	vmmc-supply = <&vcc_io>;
175	vqmmc-supply = <&vcc_flash>;
176	status = "okay";
177};
178
179&sdmmc {
180	bus-width = <4>;
181	cap-mmc-highspeed;
182	cap-sd-highspeed;
183	card-detect-delay = <200>;
184	disable-wp;
185	num-slots = <1>;
186	pinctrl-names = "default";
187	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
188	vmmc-supply = <&vcc_sd>;
189	vqmmc-supply = <&vccio_sd>;
190	status = "okay";
191};
192
193&gmac {
194	phy-supply = <&vcc_lan>;
195	phy-mode = "rgmii";
196	clock_in_out = "input";
197	snps,reset-gpio = <&gpio4 7 0>;
198	snps,reset-active-low;
199	snps,reset-delays-us = <0 10000 1000000>;
200	assigned-clocks = <&cru SCLK_MAC>;
201	assigned-clock-parents = <&ext_gmac>;
202	pinctrl-names = "default";
203	pinctrl-0 = <&rgmii_pins>;
204	tx_delay = <0x30>;
205	rx_delay = <0x10>;
206	status = "ok";
207};
208
209&hdmi {
210	ddc-i2c-bus = <&i2c5>;
211	status = "okay";
212};
213
214&i2c0 {
215	status = "okay";
216	clock-frequency = <400000>;
217
218	rk808: pmic@1b {
219		compatible = "rockchip,rk808";
220		reg = <0x1b>;
221		interrupt-parent = <&gpio0>;
222		interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
223		pinctrl-names = "default";
224		pinctrl-0 = <&pmic_int &global_pwroff>;
225		rockchip,system-power-controller;
226		wakeup-source;
227		#clock-cells = <1>;
228		clock-output-names = "xin32k", "rk808-clkout2";
229
230		vcc1-supply = <&vcc_sys>;
231		vcc2-supply = <&vcc_sys>;
232		vcc3-supply = <&vcc_sys>;
233		vcc4-supply = <&vcc_sys>;
234		vcc6-supply = <&vcc_sys>;
235		vcc7-supply = <&vcc_sys>;
236		vcc8-supply = <&vcc_18>;
237		vcc9-supply = <&vcc_io>;
238		vcc10-supply = <&vcc_io>;
239		vcc11-supply = <&vcc_sys>;
240		vcc12-supply = <&vcc_io>;
241		vddio-supply = <&vcc_io>;
242
243		regulators {
244			vdd_cpu: DCDC_REG1 {
245				regulator-always-on;
246				regulator-boot-on;
247				regulator-min-microvolt = <750000>;
248				regulator-max-microvolt = <1350000>;
249				regulator-name = "vdd_arm";
250				regulator-state-mem {
251					regulator-off-in-suspend;
252				};
253			};
254
255			vdd_gpu: DCDC_REG2 {
256				regulator-always-on;
257				regulator-boot-on;
258				regulator-min-microvolt = <850000>;
259				regulator-max-microvolt = <1250000>;
260				regulator-name = "vdd_gpu";
261				regulator-state-mem {
262					regulator-on-in-suspend;
263					regulator-suspend-microvolt = <1000000>;
264				};
265			};
266
267			vcc_ddr: DCDC_REG3 {
268				regulator-always-on;
269				regulator-boot-on;
270				regulator-name = "vcc_ddr";
271				regulator-state-mem {
272					regulator-on-in-suspend;
273				};
274			};
275
276			vcc_io: DCDC_REG4 {
277				regulator-always-on;
278				regulator-boot-on;
279				regulator-min-microvolt = <3300000>;
280				regulator-max-microvolt = <3300000>;
281				regulator-name = "vcc_io";
282				regulator-state-mem {
283					regulator-on-in-suspend;
284					regulator-suspend-microvolt = <3300000>;
285				};
286			};
287
288			vcc_lan: LDO_REG1 {
289				regulator-always-on;
290				regulator-boot-on;
291				regulator-min-microvolt = <3300000>;
292				regulator-max-microvolt = <3300000>;
293				regulator-name = "vcc_lan";
294				regulator-state-mem {
295					regulator-on-in-suspend;
296					regulator-suspend-microvolt = <3300000>;
297				};
298			};
299
300			vccio_sd: LDO_REG2 {
301				regulator-always-on;
302				regulator-boot-on;
303				regulator-min-microvolt = <3300000>;
304				regulator-max-microvolt = <3300000>;
305				regulator-name = "vccio_sd";
306				regulator-state-mem {
307					regulator-off-in-suspend;
308				};
309			};
310
311			vdd_10: LDO_REG3 {
312				regulator-always-on;
313				regulator-boot-on;
314				regulator-min-microvolt = <1000000>;
315				regulator-max-microvolt = <1000000>;
316				regulator-name = "vdd_10";
317				regulator-state-mem {
318					regulator-on-in-suspend;
319					regulator-suspend-microvolt = <1000000>;
320				};
321			};
322
323			vcc18_lcd: LDO_REG4 {
324				regulator-always-on;
325				regulator-boot-on;
326				regulator-min-microvolt = <1800000>;
327				regulator-max-microvolt = <1800000>;
328				regulator-name = "vcc18_lcd";
329				regulator-state-mem {
330					regulator-on-in-suspend;
331					regulator-suspend-microvolt = <1800000>;
332				};
333			};
334
335			ldo5: LDO_REG5 {
336				regulator-always-on;
337				regulator-min-microvolt = <1800000>;
338				regulator-max-microvolt = <3300000>;
339				regulator-name = "ldo5";
340			};
341
342			vdd10_lcd: LDO_REG6 {
343				regulator-always-on;
344				regulator-boot-on;
345				regulator-min-microvolt = <1000000>;
346				regulator-max-microvolt = <1000000>;
347				regulator-name = "vdd10_lcd";
348				regulator-state-mem {
349					regulator-on-in-suspend;
350					regulator-suspend-microvolt = <1000000>;
351				};
352			};
353
354			vcc_18: LDO_REG7 {
355				regulator-always-on;
356				regulator-boot-on;
357				regulator-min-microvolt = <1800000>;
358				regulator-max-microvolt = <1800000>;
359				regulator-name = "vcc_18";
360				regulator-state-mem {
361					regulator-on-in-suspend;
362					regulator-suspend-microvolt = <1800000>;
363				};
364			};
365
366			vcca_33: LDO_REG8 {
367				regulator-always-on;
368				regulator-boot-on;
369				regulator-min-microvolt = <3300000>;
370				regulator-max-microvolt = <3300000>;
371				regulator-name = "vcca_33";
372				regulator-state-mem {
373					regulator-on-in-suspend;
374					regulator-suspend-microvolt = <3300000>;
375				};
376			};
377
378			vccio_wl: SWITCH_REG1 {
379				regulator-always-on;
380				regulator-boot-on;
381				regulator-name = "vccio_wl";
382				regulator-state-mem {
383					regulator-on-in-suspend;
384				};
385			};
386
387			vcc_lcd: SWITCH_REG2 {
388				regulator-always-on;
389				regulator-boot-on;
390				regulator-name = "vcc_lcd";
391				regulator-state-mem {
392					regulator-on-in-suspend;
393				};
394			};
395		};
396	};
397};
398
399&i2c1 {
400	status = "okay";
401	clock-frequency = <400000>;
402
403	ak8963: ak8963@0d {
404		compatible = "asahi-kasei,ak8975";
405		reg = <0x0d>;
406		interrupt-parent = <&gpio8>;
407		interrupts = <1 IRQ_TYPE_EDGE_RISING>;
408		pinctrl-names = "default";
409		pinctrl-0 = <&comp_int>;
410	};
411
412	l3g4200d: l3g4200d@68 {
413		compatible = "st,l3g4200d-gyro";
414		st,drdy-int-pin = <2>;
415		reg = <0x6b>;
416	};
417
418	mma8452: mma8452@1d {
419		compatible = "fsl,mma8452";
420		reg = <0x1d>;
421		interrupt-parent = <&gpio8>;
422		interrupts = <0 IRQ_TYPE_EDGE_RISING>;
423		pinctrl-names = "default";
424		pinctrl-0 = <&gsensor_int>;
425	};
426};
427
428&i2c2 {
429	status = "okay";
430};
431
432&i2c3 {
433	status = "okay";
434};
435
436&i2c4 {
437	status = "okay";
438};
439
440&i2c5 {
441	status = "okay";
442};
443
444&pinctrl {
445	ak8963 {
446		comp_int: comp-int {
447			rockchip,pins = <8 1 RK_FUNC_GPIO &pcfg_pull_up>;
448		};
449	};
450
451	buttons {
452		pwrbtn: pwrbtn {
453			rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
454		};
455	};
456
457	dvp {
458		dvp_pwr: dvp-pwr {
459			rockchip,pins = <0 17 RK_FUNC_GPIO &pcfg_pull_none>;
460		};
461	};
462
463	ir {
464		ir_int: ir-int {
465			rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_up>;
466		};
467	};
468
469	mma8452 {
470		gsensor_int: gsensor-int {
471			rockchip,pins = <8 0 RK_FUNC_GPIO &pcfg_pull_up>;
472		};
473	};
474
475	pmic {
476		pmic_int: pmic-int {
477			rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
478		};
479	};
480
481	sdmmc {
482		sdmmc_pwr: sdmmc-pwr {
483			rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
484		};
485	};
486
487	usb_host {
488		host_vbus_drv: host-vbus-drv {
489			rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
490		};
491	};
492};
493
494&tsadc {
495	rockchip,hw-tshut-mode = <0>;
496	rockchip,hw-tshut-polarity = <0>;
497	status = "okay";
498};
499
500&vopb {
501	status = "okay";
502};
503
504&vopb_mmu {
505	status = "okay";
506};
507
508&vopl {
509	status = "okay";
510};
511
512&vopl_mmu {
513	status = "okay";
514};
515
516&uart0 {
517	status = "okay";
518};
519
520&uart1 {
521	status = "okay";
522};
523
524&uart2 {
525	status = "okay";
526};
527
528&uart3 {
529	status = "okay";
530};
531
532&uart4 {
533	status = "okay";
534};
535
536&usb_host1 {
537	vbus-supply = <&vcc5v0_host>;
538	status = "okay";
539};
540
541&usbphy {
542	status = "okay";
543};
544