1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2018 MundoReader S.L.
4 * Author:  Heiko Stuebner <heiko.stuebner@bq.com>
5 */
6
7/dts-v1/;
8#include <dt-bindings/i2c/i2c.h>
9#include <dt-bindings/input/input.h>
10#include "rk3188.dtsi"
11
12/ {
13	model = "BQ Edison2 Quad-Core";
14	compatible = "mundoreader,bq-edison2qc", "rockchip,rk3188";
15
16	memory@60000000 {
17		device_type = "memory";
18		reg = <0x60000000 0x80000000>;
19	};
20
21	backlight: backlight {
22		compatible = "pwm-backlight";
23		power-supply = <&vsys>;
24		pwms = <&pwm1 0 25000>;
25	};
26
27	gpio-keys {
28		compatible = "gpio-keys";
29		autorepeat;
30		pinctrl-names = "default";
31		pinctrl-0 = <&pwr_key &usb_int>;
32
33		power {
34			gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
35			linux,code = <KEY_POWER>;
36			label = "GPIO Key Power";
37			linux,input-type = <1>;
38			debounce-interval = <100>;
39			wakeup-source;
40		};
41
42		wake_on_usb: wake-on-usb {
43			label = "Wake-on-USB";
44			gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
45			linux,code = <KEY_WAKEUP>;
46			wakeup-source;
47		};
48	};
49
50	gpio-poweroff {
51		compatible = "gpio-poweroff";
52		gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>;
53		pinctrl-names = "default";
54		pinctrl-0 = <&pwr_hold>;
55		/* only drive the pin low until device is off */
56		active-delay-ms = <3000>;
57	};
58
59	lvds-encoder {
60		compatible = "ti,sn75lvds83", "lvds-encoder";
61
62		ports {
63			#address-cells = <1>;
64			#size-cells = <0>;
65
66			port@0 {
67				reg = <0>;
68
69				lvds_in_vop0: endpoint {
70					remote-endpoint = <&vop0_out_lvds>;
71				};
72			};
73
74			port@1 {
75				reg = <1>;
76
77				lvds_out_panel: endpoint {
78					remote-endpoint = <&panel_in_lvds>;
79				};
80			};
81		};
82	};
83
84	panel {
85		compatible = "innolux,ee101ia-01d", "panel-lvds";
86		backlight = <&backlight>;
87
88		/* pin LCD_CS, Nshtdn input of lvds-encoder */
89		enable-gpios = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>;
90		pinctrl-names = "default";
91		pinctrl-0 = <&lcd_cs>;
92		power-supply = <&vcc_lcd>;
93
94		data-mapping = "vesa-24";
95		height-mm = <163>;
96		width-mm = <261>;
97
98		panel-timing {
99			clock-frequency = <72000000>;
100			hactive = <1280>;
101			vactive = <800>;
102			hback-porch = <160>;
103			hfront-porch = <16>;
104			hsync-len = <10>;
105			vback-porch = <23>;
106			vfront-porch = <12>;
107			vsync-len = <3>;
108		};
109
110		port {
111			panel_in_lvds: endpoint {
112				remote-endpoint = <&lvds_out_panel>;
113			};
114		};
115	};
116
117	sdio_pwrseq: sdio-pwrseq {
118		compatible = "mmc-pwrseq-simple";
119		clocks = <&hym8563>;
120		clock-names = "ext_clock";
121		pinctrl-names = "default";
122		pinctrl-0 = <&wifi_reg_on>;
123		reset-gpios = <&gpio3 RK_PD0 GPIO_ACTIVE_LOW>;
124	};
125
126	avdd_cif: cif-avdd-regulator {
127		compatible = "regulator-fixed";
128		regulator-name = "avdd-cif";
129		regulator-min-microvolt = <2800000>;
130		regulator-max-microvolt = <2800000>;
131		gpio = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>;
132		pinctrl-names = "default";
133		pinctrl-0 = <&cif_avdd_en>;
134		startup-delay-us = <100000>;
135		vin-supply = <&vcc28_cif>;
136	};
137
138	vcc_5v: vcc-5v-regulator {
139		compatible = "regulator-fixed";
140		regulator-name = "vcc-5v";
141		regulator-min-microvolt = <5000000>;
142		regulator-max-microvolt = <5000000>;
143		enable-active-high;
144		gpio = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>;
145		pinctrl-names = "default";
146		pinctrl-0 = <&v5_drv>;
147		vin-supply = <&vsys>;
148	};
149
150	vcc_lcd: lcd-regulator {
151		compatible = "regulator-fixed";
152		regulator-name = "vcc-lcd";
153		gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_LOW>;
154		pinctrl-names = "default";
155		pinctrl-0 = <&lcd_en>;
156		startup-delay-us = <50000>;
157		vin-supply = <&vcc_io>;
158	};
159
160	vcc_otg: usb-otg-regulator {
161		compatible = "regulator-fixed";
162		regulator-name = "vcc-otg";
163		regulator-min-microvolt = <5000000>;
164		regulator-max-microvolt = <5000000>;
165		enable-active-high;
166		gpio = <&gpio3 RK_PB1 GPIO_ACTIVE_HIGH>;
167		pinctrl-names = "default";
168		pinctrl-0 = <&otg_drv>;
169		startup-delay-us = <100000>;
170		vin-supply = <&vcc_5v>;
171	};
172
173	vcc_sd: sdmmc-regulator {
174		compatible = "regulator-fixed";
175		regulator-name = "vcc-sd";
176		regulator-min-microvolt = <3300000>;
177		regulator-max-microvolt = <3300000>;
178		gpio = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>;
179		pinctrl-names = "default";
180		pinctrl-0 = <&sdmmc_pwr>;
181		startup-delay-us = <100000>;
182		vin-supply = <&vcc_io>;
183	};
184
185	vccq_emmc: emmc-vccq-regulator {
186		compatible = "regulator-fixed";
187		regulator-name = "vccq-emmc";
188		regulator-min-microvolt = <2800000>;
189		regulator-max-microvolt = <2800000>;
190		vin-supply = <&vcc_io>;
191	};
192
193	/* supplied from the bq24196 */
194	vsys: vsys-regulator {
195		compatible = "regulator-fixed";
196		regulator-name = "vsys";
197		regulator-min-microvolt = <5000000>;
198		regulator-max-microvolt = <5000000>;
199		regulator-boot-on;
200	};
201};
202
203&cpu0 {
204	cpu-supply = <&vdd_arm>;
205};
206
207&cpu1 {
208	cpu-supply = <&vdd_arm>;
209};
210
211&cpu2 {
212	cpu-supply = <&vdd_arm>;
213};
214
215&cpu3 {
216	cpu-supply = <&vdd_arm>;
217};
218
219&cru {
220	assigned-clocks = <&cru PLL_GPLL>, <&cru PLL_CPLL>,
221			  <&cru ACLK_CPU>,
222			  <&cru HCLK_CPU>, <&cru PCLK_CPU>,
223			  <&cru ACLK_PERI>, <&cru HCLK_PERI>,
224			  <&cru PCLK_PERI>;
225	assigned-clock-rates = <594000000>, <504000000>,
226			       <300000000>,
227			       <150000000>, <75000000>,
228			       <300000000>, <150000000>,
229			       <75000000>;
230};
231
232&emmc {
233	bus-width = <8>;
234	cap-mmc-highspeed;
235	non-removable;
236	pinctrl-names = "default";
237	pinctrl-0 = <&emmc_clk &emmc_cmd>;
238	vmmc-supply = <&vcc_io>;
239	vqmmc-supply = <&vccq_emmc>;
240	status = "okay";
241};
242
243&gpu {
244	status = "okay";
245};
246
247&i2c0 {
248	clock-frequency = <400000>;
249	status = "okay";
250
251	lis3de: accelerometer@29 {
252		compatible = "st,lis3de";
253		reg = <0x29>;
254		interrupt-parent = <&gpio0>;
255		interrupts = <RK_PB7 IRQ_TYPE_EDGE_RISING>;
256		pinctrl-names = "default";
257		pinctrl-0 = <&gsensor_int>;
258		rotation-matrix = "1", "0", "0",
259				  "0", "-1", "0",
260				  "0", "0", "1";
261		vdd-supply = <&vcc_io>;
262	};
263};
264
265&i2c1 {
266	clock-frequency = <400000>;
267	status = "okay";
268
269	tmp108@48 {
270		compatible = "ti,tmp108";
271		reg = <0x48>;
272		interrupt-parent = <&gpio1>;
273		interrupts = <RK_PA7 IRQ_TYPE_LEVEL_LOW>;
274		pinctrl-names = "default";
275		pinctrl-0 = <&tmp_alrt>;
276		#thermal-sensor-cells = <0>;
277	};
278
279	hym8563: rtc@51 {
280		compatible = "haoyu,hym8563";
281		reg = <0x51>;
282		interrupt-parent = <&gpio0>;
283		interrupts = <RK_PB5 IRQ_TYPE_EDGE_FALLING>;
284		pinctrl-names = "default";
285		pinctrl-0 = <&rtc_int>;
286		#clock-cells = <0>;
287		clock-output-names = "xin32k";
288	};
289
290	bat: battery@55 {
291		compatible = "ti,bq27541";
292		reg = <0x55>;
293		power-supplies = <&bq24196>;
294	};
295
296	act8846: pmic@5a {
297		compatible = "active-semi,act8846";
298		reg = <0x5a>;
299		pinctrl-names = "default";
300		pinctrl-0 = <&dvs0_ctl &pmic_int>;
301
302		vp1-supply = <&vsys>;
303		vp2-supply = <&vsys>;
304		vp3-supply = <&vsys>;
305		vp4-supply = <&vsys>;
306		inl1-supply = <&vcc_io>;
307		inl2-supply = <&vsys>;
308		inl3-supply = <&vsys>;
309
310		regulators {
311			vcc_ddr: REG1 {
312				regulator-name = "VCC_DDR";
313				regulator-min-microvolt = <1200000>;
314				regulator-max-microvolt = <1200000>;
315				regulator-always-on;
316			};
317
318			vdd_log: REG2 {
319				regulator-name = "VDD_LOG";
320				regulator-min-microvolt = <1000000>;
321				regulator-max-microvolt = <1200000>;
322				regulator-always-on;
323			};
324
325			vdd_arm: REG3 {
326				regulator-name = "VDD_ARM";
327				regulator-min-microvolt = <875000>;
328				regulator-max-microvolt = <1350000>;
329				regulator-always-on;
330			};
331
332			vcc_io: vcc_hdmi: REG4 {
333				regulator-name = "VCC_IO";
334				regulator-min-microvolt = <3000000>;
335				regulator-max-microvolt = <3000000>;
336				regulator-always-on;
337			};
338
339			vdd_10: REG5 {
340				regulator-name = "VDD_10";
341				regulator-min-microvolt = <1000000>;
342				regulator-max-microvolt = <1000000>;
343				regulator-always-on;
344			};
345
346			vdd_12: REG6 {
347				regulator-name = "VDD_12";
348				regulator-min-microvolt = <1200000>;
349				regulator-max-microvolt = <1200000>;
350				regulator-always-on;
351			};
352
353			vcc18_cif: REG7 {
354				regulator-name = "VCC18_CIF";
355				regulator-min-microvolt = <1800000>;
356				regulator-max-microvolt = <1800000>;
357				regulator-always-on;
358			};
359
360			vcca_33: REG8 {
361				regulator-name = "VCCA_33";
362				regulator-min-microvolt = <3300000>;
363				regulator-max-microvolt = <3300000>;
364				regulator-always-on;
365			};
366
367			vcc_tp: REG9 {
368				regulator-name = "VCC_TP";
369				regulator-min-microvolt = <3300000>;
370				regulator-max-microvolt = <3300000>;
371				regulator-always-on;
372			};
373
374			vccio_wl: REG10 {
375				regulator-name = "VCCIO_WL";
376				regulator-min-microvolt = <2800000>;
377				regulator-max-microvolt = <2800000>;
378				regulator-always-on;
379			};
380
381			vcc_18: REG11 {
382				regulator-name = "VCC_18";
383				regulator-min-microvolt = <1800000>;
384				regulator-max-microvolt = <1800000>;
385				regulator-always-on;
386			};
387
388			vcc28_cif: REG12 {
389				regulator-name = "VCC28_CIF";
390				regulator-min-microvolt = <2800000>;
391				regulator-max-microvolt = <2800000>;
392				regulator-always-on;
393			};
394		};
395	};
396
397	bq24196: charger@6b {
398		compatible = "ti,bq24196";
399		reg = <0x6b>;
400		interrupt-parent = <&gpio0>;
401		interrupts = <RK_PD7 IRQ_TYPE_EDGE_FALLING>;
402		pinctrl-names = "default";
403		pinctrl-0 = <&charger_int &chg_ctl &otg_en>;
404		ti,system-minimum-microvolt = <3200000>;
405		monitored-battery = <&bat>;
406		omit-battery-class;
407
408		usb_otg_vbus: usb-otg-vbus { };
409	};
410};
411
412&i2c2 {
413	clock-frequency = <400000>;
414	status = "okay";
415
416	ft5606: touchscreen@3e {
417		compatible = "edt,edt-ft5506";
418		reg = <0x3e>;
419		interrupt-parent = <&gpio1>;
420		interrupts = <RK_PB7 IRQ_TYPE_EDGE_FALLING>;
421		pinctrl-names = "default";
422		pinctrl-0 = <&tp_int &tp_rst>;
423		reset-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
424		touchscreen-inverted-y;
425		/* hw ts resolution does not match display */
426		touchscreen-size-y = <1024>;
427		touchscreen-size-x = <768>;
428		touchscreen-swapped-x-y;
429	};
430};
431
432&i2c3 {
433	clock-frequency = <400000>;
434	status = "okay";
435};
436
437&i2c4 {
438	clock-frequency = <400000>;
439	status = "okay";
440
441	rt5616: codec@1b {
442		compatible = "realtek,rt5616";
443		reg = <0x1b>;
444		clocks = <&cru SCLK_I2S0>;
445		clock-names = "mclk";
446		#sound-dai-cells = <0>;
447	};
448};
449
450&i2s0 {
451	status = "okay";
452};
453
454&mmc0 {
455	bus-width = <4>;
456	cap-mmc-highspeed;
457	cap-sd-highspeed;
458	disable-wp;
459	pinctrl-names = "default";
460	pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>;
461	vmmc-supply = <&vcc_sd>;
462	status = "okay";
463};
464
465&mmc1 {
466	bus-width = <4>;
467	cap-sd-highspeed;
468	keep-power-in-suspend;
469	mmc-pwrseq = <&sdio_pwrseq>;
470	non-removable;
471	pinctrl-names = "default";
472	pinctrl-0 = <&sd1_clk>, <&sd1_cmd>, <&sd1_bus4>;
473	vqmmc-supply = <&vccio_wl>;
474	#address-cells = <1>;
475	#size-cells = <0>;
476	status = "okay";
477
478	brcmf: wifi@1 {
479		reg = <1>;
480		compatible = "brcm,bcm4329-fmac";
481		interrupt-parent = <&gpio3>;
482		interrupts = <RK_PD2 GPIO_ACTIVE_HIGH>;
483		interrupt-names = "host-wake";
484		brcm,drive-strength = <5>;
485		pinctrl-names = "default";
486		pinctrl-0 = <&wifi_host_wake>;
487	};
488};
489
490&pwm1 {
491	status = "okay";
492};
493
494&pinctrl {
495	pcfg_output_high: pcfg-output-high {
496		output-high;
497	};
498
499	pcfg_output_low: pcfg-output-low {
500		output-low;
501	};
502
503	act8846 {
504		dvs0_ctl: dvs0-ctl {
505			rockchip,pins = <3 RK_PD3 RK_FUNC_GPIO &pcfg_output_low>;
506		};
507
508		pmic_int: pmic-int {
509			rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>;
510		};
511	};
512
513	bq24196 {
514		charger_int: charger-int {
515			rockchip,pins = <0 RK_PD7 RK_FUNC_GPIO &pcfg_pull_up>;
516		};
517
518		/* pin hog to make it select usb profile */
519		chg_ctl: chg-ctl {
520			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_output_high>;
521		};
522
523		/* low: charging, high: complete, fault: blinking */
524		chg_det: chg-det {
525			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
526		};
527
528		/* charging enabled when pin low and register set */
529		chg_en: chg-en {
530			rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_output_low>;
531		};
532
533		/* bq29196 powergood (when low) signal */
534		dc_det: dc-det {
535			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
536		};
537
538		/* wire bq24196 otg pin to high, to enable 500mA charging */
539		otg_en: otg-en {
540			rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_output_high>;
541		};
542	};
543
544	camera {
545		cif0_pdn: cif0-pdn {
546			rockchip,pins = <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
547		};
548
549		cif1_pdn: cif1-pdn {
550			rockchip,pins = <3 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
551		};
552
553		cif_avdd_en: cif-avdd-en {
554			rockchip,pins = <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
555		};
556	};
557
558	display {
559		lcd_cs: lcd-cs {
560			rockchip,pins = <3 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
561		};
562
563		lcd_en: lcd-en {
564			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
565		};
566	};
567
568	ft5606 {
569		tp_int: tp-int {
570			rockchip,pins = <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>;
571		};
572
573		tp_rst: tp-rst {
574			rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
575		};
576	};
577
578	hdmi {
579		hdmi_int: hdmi-int {
580			rockchip,pins = <2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>;
581		};
582
583		hdmi_rst: hdmi-rst {
584			rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
585		};
586	};
587
588	hym8563 {
589		rtc_int: rtc-int {
590			rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>;
591		};
592	};
593
594	keys {
595		pwr_hold: pwr-hold {
596			rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
597		};
598
599		pwr_key: pwr-key {
600			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
601		};
602	};
603
604	lis3de {
605		gsensor_int: gsensor-int {
606			rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
607		};
608	};
609
610	mmc {
611		sdmmc_pwr: sdmmc-pwr {
612			rockchip,pins = <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
613		};
614	};
615
616	tmp108 {
617		tmp_alrt: tmp-alrt {
618			rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
619		};
620	};
621
622	usb {
623		v5_drv: v5-drv {
624			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
625		};
626
627		otg_drv: otg-drv {
628			rockchip,pins = <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
629		};
630
631		usb_int: usb-int {
632			rockchip,pins = <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>;
633		};
634	};
635
636	rk903 {
637		bt_host_wake: bt-host-wake {
638			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
639		};
640
641		bt_reg_on: bt-reg-on {
642			rockchip,pins = <3 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>;
643		};
644
645		/* pin hog to pull the reset high */
646		bt_rst: bt-rst {
647			rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_output_high>;
648		};
649
650		bt_wake: bt-wake {
651			rockchip,pins = <3 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
652		};
653
654		wifi_host_wake: wifi-host-wake {
655			rockchip,pins = <3 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>;
656		};
657
658		wifi_reg_on: wifi-reg-on {
659			rockchip,pins = <3 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
660		};
661	};
662};
663
664&saradc {
665	vref-supply = <&vcc_18>;
666	status = "okay";
667};
668
669&spdif {
670	status = "okay";
671};
672
673&uart0 {
674	pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
675	status = "okay";
676
677	bluetooth {
678		compatible = "brcm,bcm43438-bt";
679		max-speed = <2000000>;
680		device-wakeup-gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>;
681		host-wakeup-gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
682		shutdown-gpios = <&gpio3 RK_PC7 GPIO_ACTIVE_HIGH>;
683		pinctrl-names = "default";
684		pinctrl-0 = <&bt_host_wake &bt_reg_on &bt_rst &bt_wake>;
685	};
686};
687
688&uart1 {
689	status = "okay";
690};
691
692&uart2 {
693	status = "okay";
694};
695
696&uart3 {
697	pinctrl-0 = <&uart3_xfer &uart3_cts &uart3_rts>;
698	status = "okay";
699};
700
701&usbphy {
702	status = "okay";
703};
704
705&usb_host {
706	status = "okay";
707};
708
709&usb_otg {
710	status = "okay";
711};
712
713&vop0 {
714	status = "okay";
715};
716
717&vop0_out {
718	vop0_out_lvds: endpoint {
719		remote-endpoint = <&lvds_in_vop0>;
720	};
721};
722
723&vop1 {
724	pinctrl-names = "default";
725	pinctrl-0 = <&lcdc1_dclk &lcdc1_den &lcdc1_hsync
726		     &lcdc1_vsync &lcdc1_rgb24>;
727	status = "okay";
728};
729
730&wdt {
731	status = "okay";
732};
733