1/*
2 * Copyright (c) 2014, 2015 FUKAUMI Naoki <naobsd@gmail.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#include "rk3288.dtsi"
44
45/ {
46	memory {
47		reg = <0 0x80000000>;
48	};
49
50	ext_gmac: external-gmac-clock {
51		compatible = "fixed-clock";
52		#clock-cells = <0>;
53		clock-frequency = <125000000>;
54		clock-output-names = "ext_gmac";
55	};
56
57	ir: ir-receiver {
58		compatible = "gpio-ir-receiver";
59		pinctrl-names = "default";
60		pinctrl-0 = <&ir_int>;
61	};
62
63	keys: gpio-keys {
64		compatible = "gpio-keys";
65		#address-cells = <1>;
66		#size-cells = <0>;
67
68		button@0 {
69			gpio-key,wakeup = <1>;
70			gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
71			label = "GPIO Power";
72			linux,code = <116>;
73			pinctrl-names = "default";
74			pinctrl-0 = <&pwr_key>;
75		};
76	};
77
78	leds {
79		compatible = "gpio-leds";
80
81		work {
82			gpios = <&gpio8 1 GPIO_ACTIVE_LOW>;
83			label = "firefly:blue:user";
84			linux,default-trigger = "rc-feedback";
85			pinctrl-names = "default";
86			pinctrl-0 = <&work_led>;
87		};
88
89		power {
90			gpios = <&gpio8 2 GPIO_ACTIVE_LOW>;
91			label = "firefly:green:power";
92			linux,default-trigger = "default-on";
93			pinctrl-names = "default";
94			pinctrl-0 = <&power_led>;
95		};
96	};
97
98	vcc_sys: vsys-regulator {
99		compatible = "regulator-fixed";
100		regulator-name = "vcc_sys";
101		regulator-min-microvolt = <5000000>;
102		regulator-max-microvolt = <5000000>;
103		regulator-always-on;
104		regulator-boot-on;
105	};
106
107	vcc_sd: sdmmc-regulator {
108		compatible = "regulator-fixed";
109		gpio = <&gpio7 11 GPIO_ACTIVE_LOW>;
110		pinctrl-names = "default";
111		pinctrl-0 = <&sdmmc_pwr>;
112		regulator-name = "vcc_sd";
113		regulator-min-microvolt = <3300000>;
114		regulator-max-microvolt = <3300000>;
115		startup-delay-us = <100000>;
116		vin-supply = <&vcc_io>;
117	};
118
119	vcc_flash: flash-regulator {
120		compatible = "regulator-fixed";
121		regulator-name = "vcc_flash";
122		regulator-min-microvolt = <1800000>;
123		regulator-max-microvolt = <1800000>;
124		vin-supply = <&vcc_io>;
125	};
126
127	vcc_5v: usb-regulator {
128		compatible = "regulator-fixed";
129		regulator-name = "vcc_5v";
130		regulator-min-microvolt = <5000000>;
131		regulator-max-microvolt = <5000000>;
132		regulator-always-on;
133		regulator-boot-on;
134		vin-supply = <&vcc_sys>;
135	};
136
137	vcc_host_5v: usb-host-regulator {
138		compatible = "regulator-fixed";
139		enable-active-high;
140		gpio = <&gpio0 14 GPIO_ACTIVE_HIGH>;
141		pinctrl-names = "default";
142		pinctrl-0 = <&host_vbus_drv>;
143		regulator-name = "vcc_host_5v";
144		regulator-min-microvolt = <5000000>;
145		regulator-max-microvolt = <5000000>;
146		regulator-always-on;
147		vin-supply = <&vcc_5v>;
148	};
149
150	vcc_otg_5v: usb-otg-regulator {
151		compatible = "regulator-fixed";
152		enable-active-high;
153		gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>;
154		pinctrl-names = "default";
155		pinctrl-0 = <&otg_vbus_drv>;
156		regulator-name = "vcc_otg_5v";
157		regulator-min-microvolt = <5000000>;
158		regulator-max-microvolt = <5000000>;
159		regulator-always-on;
160		vin-supply = <&vcc_5v>;
161	};
162};
163
164&cpu0 {
165	cpu0-supply = <&vdd_cpu>;
166};
167
168&emmc {
169	broken-cd;
170	bus-width = <8>;
171	cap-mmc-highspeed;
172	disable-wp;
173	non-removable;
174	num-slots = <1>;
175	pinctrl-names = "default";
176	pinctrl-0 = <&emmc_clk>, <&emmc_cmd>, <&emmc_pwr>, <&emmc_bus8>;
177	vmmc-supply = <&vcc_io>;
178	vqmmc-supply = <&vcc_flash>;
179	status = "okay";
180};
181
182&gmac {
183	assigned-clocks = <&cru SCLK_MAC>;
184	assigned-clock-parents = <&ext_gmac>;
185	clock_in_out = "input";
186	pinctrl-names = "default";
187	pinctrl-0 = <&rgmii_pins>, <&phy_rst>, <&phy_pmeb>, <&phy_int>;
188	phy-supply = <&vcc_lan>;
189	phy-mode = "rgmii";
190	snps,reset-active-low;
191	snps,reset-delays-us = <0 10000 1000000>;
192	snps,reset-gpio = <&gpio4 8 GPIO_ACTIVE_LOW>;
193	tx_delay = <0x30>;
194	rx_delay = <0x10>;
195	status = "ok";
196};
197
198&hdmi {
199	ddc-i2c-bus = <&i2c5>;
200	status = "okay";
201};
202
203&i2c0 {
204	clock-frequency = <400000>;
205	status = "okay";
206
207	vdd_cpu: syr827@40 {
208		compatible = "silergy,syr827";
209		fcs,suspend-voltage-selector = <1>;
210		reg = <0x40>;
211		regulator-name = "vdd_cpu";
212		regulator-min-microvolt = <850000>;
213		regulator-max-microvolt = <1350000>;
214		regulator-always-on;
215		regulator-boot-on;
216		vin-supply = <&vcc_sys>;
217	};
218
219	vdd_gpu: syr828@41 {
220		compatible = "silergy,syr828";
221		fcs,suspend-voltage-selector = <1>;
222		reg = <0x41>;
223		regulator-name = "vdd_gpu";
224		regulator-min-microvolt = <850000>;
225		regulator-max-microvolt = <1350000>;
226		regulator-always-on;
227		vin-supply = <&vcc_sys>;
228	};
229
230	hym8563: hym8563@51 {
231		compatible = "haoyu,hym8563";
232		reg = <0x51>;
233		#clock-cells = <0>;
234		clock-frequency = <32768>;
235		clock-output-names = "xin32k";
236		interrupt-parent = <&gpio7>;
237		interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
238		pinctrl-names = "default";
239		pinctrl-0 = <&rtc_int>;
240	};
241
242	act8846: act8846@5a {
243		compatible = "active-semi,act8846";
244		reg = <0x5a>;
245		pinctrl-names = "default";
246		pinctrl-0 = <&pmic_vsel>, <&pwr_hold>;
247		system-power-controller;
248
249		regulators {
250			vcc_ddr: REG1 {
251				regulator-name = "vcc_ddr";
252				regulator-min-microvolt = <1200000>;
253				regulator-max-microvolt = <1200000>;
254				regulator-always-on;
255			};
256
257			vcc_io: REG2 {
258				regulator-name = "vcc_io";
259				regulator-min-microvolt = <3300000>;
260				regulator-max-microvolt = <3300000>;
261				regulator-always-on;
262			};
263
264			vdd_log: REG3 {
265				regulator-name = "vdd_log";
266				regulator-min-microvolt = <1100000>;
267				regulator-max-microvolt = <1100000>;
268				regulator-always-on;
269			};
270
271			vcc_20: REG4 {
272				regulator-name = "vcc_20";
273				regulator-min-microvolt = <2000000>;
274				regulator-max-microvolt = <2000000>;
275				regulator-always-on;
276			};
277
278			vccio_sd: REG5 {
279				regulator-name = "vccio_sd";
280				regulator-min-microvolt = <3300000>;
281				regulator-max-microvolt = <3300000>;
282				regulator-always-on;
283			};
284
285			vdd10_lcd: REG6 {
286				regulator-name = "vdd10_lcd";
287				regulator-min-microvolt = <1000000>;
288				regulator-max-microvolt = <1000000>;
289				regulator-always-on;
290			};
291
292			vcca_18: REG7 {
293				regulator-name = "vcca_18";
294				regulator-min-microvolt = <1800000>;
295				regulator-max-microvolt = <1800000>;
296			};
297
298			vcca_33: REG8 {
299				regulator-name = "vcca_33";
300				regulator-min-microvolt = <3300000>;
301				regulator-max-microvolt = <3300000>;
302			};
303
304			vcc_lan: REG9 {
305				regulator-name = "vcc_lan";
306				regulator-min-microvolt = <3300000>;
307				regulator-max-microvolt = <3300000>;
308			};
309
310			vdd_10: REG10 {
311				regulator-name = "vdd_10";
312				regulator-min-microvolt = <1000000>;
313				regulator-max-microvolt = <1000000>;
314				regulator-always-on;
315			};
316
317			vcc_18: REG11 {
318				regulator-name = "vcc_18";
319				regulator-min-microvolt = <1800000>;
320				regulator-max-microvolt = <1800000>;
321				regulator-always-on;
322			};
323
324			vcc18_lcd: REG12 {
325				regulator-name = "vcc18_lcd";
326				regulator-min-microvolt = <1800000>;
327				regulator-max-microvolt = <1800000>;
328				regulator-always-on;
329			};
330		};
331	};
332};
333
334&i2c1 {
335	status = "okay";
336};
337
338&i2c2 {
339	status = "okay";
340};
341
342&i2c4 {
343	status = "okay";
344};
345
346&i2c5 {
347	status = "okay";
348};
349
350&pinctrl {
351	pcfg_output_high: pcfg-output-high {
352		output-high;
353	};
354
355	pcfg_output_low: pcfg-output-low {
356		output-low;
357	};
358
359	act8846 {
360		pwr_hold: pwr-hold {
361			rockchip,pins = <0 1 RK_FUNC_GPIO &pcfg_output_high>;
362		};
363	};
364
365	gmac {
366		phy_int: phy-int {
367			rockchip,pins = <0 9 RK_FUNC_GPIO &pcfg_pull_up>;
368		};
369
370		phy_pmeb: phy-pmeb {
371			rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_up>;
372		};
373
374		phy_rst: phy-rst {
375			rockchip,pins = <4 8 RK_FUNC_GPIO &pcfg_output_high>;
376		};
377	};
378
379	hym8563 {
380		rtc_int: rtc-int {
381			rockchip,pins = <7 4 RK_FUNC_GPIO &pcfg_pull_up>;
382		};
383	};
384
385	keys {
386		pwr_key: pwr-key {
387			rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
388		};
389	};
390
391	leds {
392		power_led: power-led {
393			rockchip,pins = <8 2 RK_FUNC_GPIO &pcfg_pull_none>;
394		};
395
396		work_led: work-led {
397			rockchip,pins = <8 1 RK_FUNC_GPIO &pcfg_pull_none>;
398		};
399	};
400
401	sdmmc {
402		sdmmc_pwr: sdmmc-pwr {
403			rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
404		};
405	};
406
407	usb_host {
408		host_vbus_drv: host-vbus-drv {
409			rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
410		};
411
412		usbhub_rst: usbhub-rst {
413			rockchip,pins = <8 3 RK_FUNC_GPIO &pcfg_output_high>;
414		};
415	};
416
417	usb_otg {
418		otg_vbus_drv: otg-vbus-drv {
419			rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>;
420		};
421	};
422};
423
424&saradc {
425	vref-supply = <&vcc_18>;
426	status = "okay";
427};
428
429&sdio0 {
430	broken-cd;
431	bus-width = <4>;
432	disable-wp;
433	non-removable;
434	num-slots = <1>;
435	pinctrl-names = "default";
436	pinctrl-0 = <&sdio0_bus4>, <&sdio0_cmd>, <&sdio0_clk>;
437	vmmc-supply = <&vcc_18>;
438	status = "okay";
439};
440
441&sdmmc {
442	bus-width = <4>;
443	cap-mmc-highspeed;
444	cap-sd-highspeed;
445	card-detect-delay = <200>;
446	disable-wp;
447	num-slots = <1>;
448	pinctrl-names = "default";
449	pinctrl-0 = <&sdmmc_clk>, <&sdmmc_cmd>, <&sdmmc_cd>, <&sdmmc_bus4>;
450	vmmc-supply = <&vcc_sd>;
451	status = "okay";
452};
453
454&spi0 {
455	pinctrl-names = "default";
456	pinctrl-0 = <&spi0_clk>, <&spi0_cs0>, <&spi0_tx>, <&spi0_rx>, <&spi0_cs1>;
457	status = "okay";
458};
459
460&uart0 {
461	pinctrl-names = "default";
462	pinctrl-0 = <&uart0_xfer>, <&uart0_cts>, <&uart0_rts>;
463	status = "okay";
464};
465
466&uart1 {
467	status = "okay";
468};
469
470&uart2 {
471	status = "okay";
472};
473
474&uart3 {
475	status = "okay";
476};
477
478&usbphy {
479	status = "okay";
480};
481
482&usb_host1 {
483	pinctrl-names = "default";
484	pinctrl-0 = <&usbhub_rst>;
485	status = "okay";
486};
487
488&usb_otg {
489	status = "okay";
490};
491
492&vopb {
493	status = "okay";
494};
495
496&vopb_mmu {
497	status = "okay";
498};
499
500&vopl {
501	status = "okay";
502};
503
504&vopl_mmu {
505	status = "okay";
506};
507
508&wdt {
509	status = "okay";
510};
511