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
150&cpu0 {
151	cpu0-supply = <&vdd_cpu>;
152};
153
154&emmc {
155	bus-width = <8>;
156	cap-mmc-highspeed;
157	disable-wp;
158	non-removable;
159	num-slots = <1>;
160	pinctrl-names = "default";
161	pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>;
162	vmmc-supply = <&vcc_io>;
163	vqmmc-supply = <&vcc_flash>;
164	status = "okay";
165};
166
167&sdmmc {
168	bus-width = <4>;
169	cap-mmc-highspeed;
170	cap-sd-highspeed;
171	card-detect-delay = <200>;
172	disable-wp;
173	num-slots = <1>;
174	pinctrl-names = "default";
175	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
176	vmmc-supply = <&vcc_sd>;
177	vqmmc-supply = <&vccio_sd>;
178	status = "okay";
179};
180
181&gmac {
182	phy-supply = <&vcc_lan>;
183	phy-mode = "rgmii";
184	clock_in_out = "input";
185	snps,reset-gpio = <&gpio4 7 0>;
186	snps,reset-active-low;
187	snps,reset-delays-us = <0 10000 1000000>;
188	assigned-clocks = <&cru SCLK_MAC>;
189	assigned-clock-parents = <&ext_gmac>;
190	pinctrl-names = "default";
191	pinctrl-0 = <&rgmii_pins>;
192	tx_delay = <0x30>;
193	rx_delay = <0x10>;
194	status = "ok";
195};
196
197&hdmi {
198	ddc-i2c-bus = <&i2c5>;
199	status = "okay";
200};
201
202&i2c0 {
203	status = "okay";
204	clock-frequency = <400000>;
205
206	rk808: pmic@1b {
207		compatible = "rockchip,rk808";
208		reg = <0x1b>;
209		interrupt-parent = <&gpio0>;
210		interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
211		pinctrl-names = "default";
212		pinctrl-0 = <&pmic_int &global_pwroff>;
213		rockchip,system-power-controller;
214		wakeup-source;
215		#clock-cells = <1>;
216		clock-output-names = "xin32k", "rk808-clkout2";
217
218		vcc1-supply = <&vcc_sys>;
219		vcc2-supply = <&vcc_sys>;
220		vcc3-supply = <&vcc_sys>;
221		vcc4-supply = <&vcc_sys>;
222		vcc6-supply = <&vcc_sys>;
223		vcc7-supply = <&vcc_sys>;
224		vcc8-supply = <&vcc_18>;
225		vcc9-supply = <&vcc_io>;
226		vcc10-supply = <&vcc_io>;
227		vcc11-supply = <&vcc_sys>;
228		vcc12-supply = <&vcc_io>;
229		vddio-supply = <&vcc_io>;
230
231		regulators {
232			vdd_cpu: DCDC_REG1 {
233				regulator-always-on;
234				regulator-boot-on;
235				regulator-min-microvolt = <750000>;
236				regulator-max-microvolt = <1350000>;
237				regulator-name = "vdd_arm";
238				regulator-state-mem {
239					regulator-off-in-suspend;
240				};
241			};
242
243			vdd_gpu: DCDC_REG2 {
244				regulator-always-on;
245				regulator-boot-on;
246				regulator-min-microvolt = <850000>;
247				regulator-max-microvolt = <1250000>;
248				regulator-name = "vdd_gpu";
249				regulator-state-mem {
250					regulator-on-in-suspend;
251					regulator-suspend-microvolt = <1000000>;
252				};
253			};
254
255			vcc_ddr: DCDC_REG3 {
256				regulator-always-on;
257				regulator-boot-on;
258				regulator-name = "vcc_ddr";
259				regulator-state-mem {
260					regulator-on-in-suspend;
261				};
262			};
263
264			vcc_io: DCDC_REG4 {
265				regulator-always-on;
266				regulator-boot-on;
267				regulator-min-microvolt = <3300000>;
268				regulator-max-microvolt = <3300000>;
269				regulator-name = "vcc_io";
270				regulator-state-mem {
271					regulator-on-in-suspend;
272					regulator-suspend-microvolt = <3300000>;
273				};
274			};
275
276			vcc_lan: LDO_REG1 {
277				regulator-always-on;
278				regulator-boot-on;
279				regulator-min-microvolt = <3300000>;
280				regulator-max-microvolt = <3300000>;
281				regulator-name = "vcc_lan";
282				regulator-state-mem {
283					regulator-on-in-suspend;
284					regulator-suspend-microvolt = <3300000>;
285				};
286			};
287
288			vccio_sd: LDO_REG2 {
289				regulator-always-on;
290				regulator-boot-on;
291				regulator-min-microvolt = <3300000>;
292				regulator-max-microvolt = <3300000>;
293				regulator-name = "vccio_sd";
294				regulator-state-mem {
295					regulator-off-in-suspend;
296				};
297			};
298
299			vdd_10: LDO_REG3 {
300				regulator-always-on;
301				regulator-boot-on;
302				regulator-min-microvolt = <1000000>;
303				regulator-max-microvolt = <1000000>;
304				regulator-name = "vdd_10";
305				regulator-state-mem {
306					regulator-on-in-suspend;
307					regulator-suspend-microvolt = <1000000>;
308				};
309			};
310
311			vcc18_lcd: LDO_REG4 {
312				regulator-always-on;
313				regulator-boot-on;
314				regulator-min-microvolt = <1800000>;
315				regulator-max-microvolt = <1800000>;
316				regulator-name = "vcc18_lcd";
317				regulator-state-mem {
318					regulator-on-in-suspend;
319					regulator-suspend-microvolt = <1800000>;
320				};
321			};
322
323			ldo5: LDO_REG5 {
324				regulator-always-on;
325				regulator-min-microvolt = <1800000>;
326				regulator-max-microvolt = <3300000>;
327				regulator-name = "ldo5";
328			};
329
330			vdd10_lcd: LDO_REG6 {
331				regulator-always-on;
332				regulator-boot-on;
333				regulator-min-microvolt = <1000000>;
334				regulator-max-microvolt = <1000000>;
335				regulator-name = "vdd10_lcd";
336				regulator-state-mem {
337					regulator-on-in-suspend;
338					regulator-suspend-microvolt = <1000000>;
339				};
340			};
341
342			vcc_18: LDO_REG7 {
343				regulator-always-on;
344				regulator-boot-on;
345				regulator-min-microvolt = <1800000>;
346				regulator-max-microvolt = <1800000>;
347				regulator-name = "vcc_18";
348				regulator-state-mem {
349					regulator-on-in-suspend;
350					regulator-suspend-microvolt = <1800000>;
351				};
352			};
353
354			vcca_33: LDO_REG8 {
355				regulator-always-on;
356				regulator-boot-on;
357				regulator-min-microvolt = <3300000>;
358				regulator-max-microvolt = <3300000>;
359				regulator-name = "vcca_33";
360				regulator-state-mem {
361					regulator-on-in-suspend;
362					regulator-suspend-microvolt = <3300000>;
363				};
364			};
365
366			vccio_wl: SWITCH_REG1 {
367				regulator-always-on;
368				regulator-boot-on;
369				regulator-name = "vccio_wl";
370				regulator-state-mem {
371					regulator-on-in-suspend;
372				};
373			};
374
375			vcc_lcd: SWITCH_REG2 {
376				regulator-always-on;
377				regulator-boot-on;
378				regulator-name = "vcc_lcd";
379				regulator-state-mem {
380					regulator-on-in-suspend;
381				};
382			};
383		};
384	};
385};
386
387&i2c1 {
388	status = "okay";
389	clock-frequency = <400000>;
390
391	ak8963: ak8963@0d {
392		compatible = "asahi-kasei,ak8975";
393		reg = <0x0d>;
394		interrupt-parent = <&gpio8>;
395		interrupts = <1 IRQ_TYPE_EDGE_RISING>;
396		pinctrl-names = "default";
397		pinctrl-0 = <&comp_int>;
398	};
399
400	l3g4200d: l3g4200d@68 {
401		compatible = "st,l3g4200d-gyro";
402		st,drdy-int-pin = <2>;
403		reg = <0x6b>;
404	};
405
406	mma8452: mma8452@1d {
407		compatible = "fsl,mma8452";
408		reg = <0x1d>;
409		interrupt-parent = <&gpio8>;
410		interrupts = <0 IRQ_TYPE_EDGE_RISING>;
411		pinctrl-names = "default";
412		pinctrl-0 = <&gsensor_int>;
413	};
414};
415
416&i2c2 {
417	status = "okay";
418};
419
420&i2c3 {
421	status = "okay";
422};
423
424&i2c4 {
425	status = "okay";
426};
427
428&i2c5 {
429	status = "okay";
430};
431
432&pinctrl {
433	ak8963 {
434		comp_int: comp-int {
435			rockchip,pins = <8 1 RK_FUNC_GPIO &pcfg_pull_up>;
436		};
437	};
438
439	buttons {
440		pwrbtn: pwrbtn {
441			rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
442		};
443	};
444
445	dvp {
446		dvp_pwr: dvp-pwr {
447			rockchip,pins = <0 17 RK_FUNC_GPIO &pcfg_pull_none>;
448		};
449	};
450
451	ir {
452		ir_int: ir-int {
453			rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_up>;
454		};
455	};
456
457	mma8452 {
458		gsensor_int: gsensor-int {
459			rockchip,pins = <8 0 RK_FUNC_GPIO &pcfg_pull_up>;
460		};
461	};
462
463	pmic {
464		pmic_int: pmic-int {
465			rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
466		};
467	};
468
469	sdmmc {
470		sdmmc_pwr: sdmmc-pwr {
471			rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
472		};
473	};
474};
475
476&tsadc {
477	rockchip,hw-tshut-mode = <0>;
478	rockchip,hw-tshut-polarity = <0>;
479	status = "okay";
480};
481
482&vopb {
483	status = "okay";
484};
485
486&vopb_mmu {
487	status = "okay";
488};
489
490&vopl {
491	status = "okay";
492};
493
494&vopl_mmu {
495	status = "okay";
496};
497
498&uart0 {
499	status = "okay";
500};
501
502&uart1 {
503	status = "okay";
504};
505
506&uart2 {
507	status = "okay";
508};
509
510&uart3 {
511	status = "okay";
512};
513
514&uart4 {
515	status = "okay";
516};
517
518&usbphy {
519	status = "okay";
520};
521