1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Eddie Huang <eddie.huang@mediatek.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 */
14
15/dts-v1/;
16#include <dt-bindings/gpio/gpio.h>
17#include "mt8173.dtsi"
18
19/ {
20	model = "MediaTek MT8173 evaluation board";
21	compatible = "mediatek,mt8173-evb", "mediatek,mt8173";
22
23	aliases {
24		serial0 = &uart0;
25		serial1 = &uart1;
26		serial2 = &uart2;
27		serial3 = &uart3;
28	};
29
30	memory@40000000 {
31		device_type = "memory";
32		reg = <0 0x40000000 0 0x80000000>;
33	};
34
35	chosen { };
36
37	connector {
38		compatible = "hdmi-connector";
39		label = "hdmi";
40		type = "d";
41
42		port {
43			hdmi_connector_in: endpoint {
44				remote-endpoint = <&hdmi0_out>;
45			};
46		};
47	};
48
49	extcon_usb: extcon_iddig {
50		compatible = "linux,extcon-usb-gpio";
51		id-gpio = <&pio 16 GPIO_ACTIVE_HIGH>;
52	};
53
54	usb_p1_vbus: regulator@0 {
55		compatible = "regulator-fixed";
56		regulator-name = "usb_vbus";
57		regulator-min-microvolt = <5000000>;
58		regulator-max-microvolt = <5000000>;
59		gpio = <&pio 130 GPIO_ACTIVE_HIGH>;
60		enable-active-high;
61	};
62
63	usb_p0_vbus: regulator@1 {
64		compatible = "regulator-fixed";
65		regulator-name = "vbus";
66		regulator-min-microvolt = <5000000>;
67		regulator-max-microvolt = <5000000>;
68		gpio = <&pio 9 GPIO_ACTIVE_HIGH>;
69		enable-active-high;
70	};
71};
72
73&cec {
74	status = "okay";
75};
76
77&cpu0 {
78	proc-supply = <&mt6397_vpca15_reg>;
79};
80
81&cpu1 {
82	proc-supply = <&mt6397_vpca15_reg>;
83};
84
85&cpu2 {
86	proc-supply = <&da9211_vcpu_reg>;
87	sram-supply = <&mt6397_vsramca7_reg>;
88};
89
90&cpu3 {
91	proc-supply = <&da9211_vcpu_reg>;
92	sram-supply = <&mt6397_vsramca7_reg>;
93};
94
95&dpi0 {
96	status = "okay";
97};
98
99&hdmi_phy {
100	status = "okay";
101};
102
103&hdmi0 {
104	status = "okay";
105
106	ports {
107		port@1 {
108			reg = <1>;
109
110			hdmi0_out: endpoint {
111				remote-endpoint = <&hdmi_connector_in>;
112			};
113		};
114	};
115};
116
117&i2c1 {
118	status = "okay";
119
120	buck: da9211@68 {
121		compatible = "dlg,da9211";
122		reg = <0x68>;
123
124		regulators {
125			da9211_vcpu_reg: BUCKA {
126				regulator-name = "VBUCKA";
127				regulator-min-microvolt = < 700000>;
128				regulator-max-microvolt = <1310000>;
129				regulator-min-microamp	= <2000000>;
130				regulator-max-microamp	= <4400000>;
131				regulator-ramp-delay = <10000>;
132				regulator-always-on;
133			};
134
135			da9211_vgpu_reg: BUCKB {
136				regulator-name = "VBUCKB";
137				regulator-min-microvolt = < 700000>;
138				regulator-max-microvolt = <1310000>;
139				regulator-min-microamp	= <2000000>;
140				regulator-max-microamp	= <3000000>;
141				regulator-ramp-delay = <10000>;
142			};
143		};
144	};
145};
146
147&mmc0 {
148	status = "okay";
149	pinctrl-names = "default", "state_uhs";
150	pinctrl-0 = <&mmc0_pins_default>;
151	pinctrl-1 = <&mmc0_pins_uhs>;
152	bus-width = <8>;
153	max-frequency = <50000000>;
154	cap-mmc-highspeed;
155	mediatek,hs200-cmd-int-delay=<26>;
156	mediatek,hs400-cmd-int-delay=<14>;
157	mediatek,hs400-cmd-resp-sel-rising;
158	vmmc-supply = <&mt6397_vemc_3v3_reg>;
159	vqmmc-supply = <&mt6397_vio18_reg>;
160	non-removable;
161};
162
163&mmc1 {
164	status = "okay";
165	pinctrl-names = "default", "state_uhs";
166	pinctrl-0 = <&mmc1_pins_default>;
167	pinctrl-1 = <&mmc1_pins_uhs>;
168	bus-width = <4>;
169	max-frequency = <50000000>;
170	cap-sd-highspeed;
171	sd-uhs-sdr25;
172	cd-gpios = <&pio 132 0>;
173	vmmc-supply = <&mt6397_vmch_reg>;
174	vqmmc-supply = <&mt6397_vmc_reg>;
175};
176
177&pio {
178	disp_pwm0_pins: disp_pwm0_pins {
179		pins1 {
180			pinmux = <MT8173_PIN_87_DISP_PWM0__FUNC_DISP_PWM0>;
181			output-low;
182		};
183	};
184
185	mmc0_pins_default: mmc0default {
186		pins_cmd_dat {
187			pinmux = <MT8173_PIN_57_MSDC0_DAT0__FUNC_MSDC0_DAT0>,
188				 <MT8173_PIN_58_MSDC0_DAT1__FUNC_MSDC0_DAT1>,
189				 <MT8173_PIN_59_MSDC0_DAT2__FUNC_MSDC0_DAT2>,
190				 <MT8173_PIN_60_MSDC0_DAT3__FUNC_MSDC0_DAT3>,
191				 <MT8173_PIN_61_MSDC0_DAT4__FUNC_MSDC0_DAT4>,
192				 <MT8173_PIN_62_MSDC0_DAT5__FUNC_MSDC0_DAT5>,
193				 <MT8173_PIN_63_MSDC0_DAT6__FUNC_MSDC0_DAT6>,
194				 <MT8173_PIN_64_MSDC0_DAT7__FUNC_MSDC0_DAT7>,
195				 <MT8173_PIN_66_MSDC0_CMD__FUNC_MSDC0_CMD>;
196			input-enable;
197			bias-pull-up;
198		};
199
200		pins_clk {
201			pinmux = <MT8173_PIN_65_MSDC0_CLK__FUNC_MSDC0_CLK>;
202			bias-pull-down;
203		};
204
205		pins_rst {
206			pinmux = <MT8173_PIN_68_MSDC0_RST___FUNC_MSDC0_RSTB>;
207			bias-pull-up;
208		};
209	};
210
211	mmc1_pins_default: mmc1default {
212		pins_cmd_dat {
213			pinmux = <MT8173_PIN_73_MSDC1_DAT0__FUNC_MSDC1_DAT0>,
214				 <MT8173_PIN_74_MSDC1_DAT1__FUNC_MSDC1_DAT1>,
215				 <MT8173_PIN_75_MSDC1_DAT2__FUNC_MSDC1_DAT2>,
216				 <MT8173_PIN_76_MSDC1_DAT3__FUNC_MSDC1_DAT3>,
217				 <MT8173_PIN_78_MSDC1_CMD__FUNC_MSDC1_CMD>;
218			input-enable;
219			drive-strength = <MTK_DRIVE_4mA>;
220			bias-pull-up = <MTK_PUPD_SET_R1R0_10>;
221		};
222
223		pins_clk {
224			pinmux = <MT8173_PIN_77_MSDC1_CLK__FUNC_MSDC1_CLK>;
225			bias-pull-down;
226			drive-strength = <MTK_DRIVE_4mA>;
227		};
228
229		pins_insert {
230			pinmux = <MT8173_PIN_132_I2S0_DATA1__FUNC_GPIO132>;
231			bias-pull-up;
232		};
233	};
234
235	mmc0_pins_uhs: mmc0 {
236		pins_cmd_dat {
237			pinmux = <MT8173_PIN_57_MSDC0_DAT0__FUNC_MSDC0_DAT0>,
238				 <MT8173_PIN_58_MSDC0_DAT1__FUNC_MSDC0_DAT1>,
239				 <MT8173_PIN_59_MSDC0_DAT2__FUNC_MSDC0_DAT2>,
240				 <MT8173_PIN_60_MSDC0_DAT3__FUNC_MSDC0_DAT3>,
241				 <MT8173_PIN_61_MSDC0_DAT4__FUNC_MSDC0_DAT4>,
242				 <MT8173_PIN_62_MSDC0_DAT5__FUNC_MSDC0_DAT5>,
243				 <MT8173_PIN_63_MSDC0_DAT6__FUNC_MSDC0_DAT6>,
244				 <MT8173_PIN_64_MSDC0_DAT7__FUNC_MSDC0_DAT7>,
245				 <MT8173_PIN_66_MSDC0_CMD__FUNC_MSDC0_CMD>;
246			input-enable;
247			drive-strength = <MTK_DRIVE_2mA>;
248			bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
249		};
250
251		pins_clk {
252			pinmux = <MT8173_PIN_65_MSDC0_CLK__FUNC_MSDC0_CLK>;
253			drive-strength = <MTK_DRIVE_2mA>;
254			bias-pull-down = <MTK_PUPD_SET_R1R0_01>;
255		};
256
257		pins_rst {
258			pinmux = <MT8173_PIN_68_MSDC0_RST___FUNC_MSDC0_RSTB>;
259			bias-pull-up;
260		};
261	};
262
263	mmc1_pins_uhs: mmc1 {
264		pins_cmd_dat {
265			pinmux = <MT8173_PIN_73_MSDC1_DAT0__FUNC_MSDC1_DAT0>,
266				 <MT8173_PIN_74_MSDC1_DAT1__FUNC_MSDC1_DAT1>,
267				 <MT8173_PIN_75_MSDC1_DAT2__FUNC_MSDC1_DAT2>,
268				 <MT8173_PIN_76_MSDC1_DAT3__FUNC_MSDC1_DAT3>,
269				 <MT8173_PIN_78_MSDC1_CMD__FUNC_MSDC1_CMD>;
270			input-enable;
271			drive-strength = <MTK_DRIVE_4mA>;
272			bias-pull-up = <MTK_PUPD_SET_R1R0_10>;
273		};
274
275		pins_clk {
276			pinmux = <MT8173_PIN_77_MSDC1_CLK__FUNC_MSDC1_CLK>;
277			drive-strength = <MTK_DRIVE_4mA>;
278			bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
279		};
280	};
281
282	usb_id_pins_float: usb_iddig_pull_up {
283		pins_iddig {
284			pinmux = <MT8173_PIN_16_IDDIG__FUNC_IDDIG>;
285			bias-pull-up;
286		};
287	};
288
289	usb_id_pins_ground: usb_iddig_pull_down {
290		pins_iddig {
291			pinmux = <MT8173_PIN_16_IDDIG__FUNC_IDDIG>;
292			bias-pull-down;
293		};
294	};
295};
296
297&pwm0 {
298	pinctrl-names = "default";
299	pinctrl-0 = <&disp_pwm0_pins>;
300	status = "okay";
301};
302
303&pwrap {
304	/* Only MT8173 E1 needs USB power domain */
305	power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
306
307	pmic: mt6397 {
308		compatible = "mediatek,mt6397";
309		interrupt-parent = <&pio>;
310		interrupts = <11 IRQ_TYPE_LEVEL_HIGH>;
311		interrupt-controller;
312		#interrupt-cells = <2>;
313
314		mt6397regulator: mt6397regulator {
315			compatible = "mediatek,mt6397-regulator";
316
317			mt6397_vpca15_reg: buck_vpca15 {
318				regulator-compatible = "buck_vpca15";
319				regulator-name = "vpca15";
320				regulator-min-microvolt = < 700000>;
321				regulator-max-microvolt = <1350000>;
322				regulator-ramp-delay = <12500>;
323				regulator-always-on;
324			};
325
326			mt6397_vpca7_reg: buck_vpca7 {
327				regulator-compatible = "buck_vpca7";
328				regulator-name = "vpca7";
329				regulator-min-microvolt = < 700000>;
330				regulator-max-microvolt = <1350000>;
331				regulator-ramp-delay = <12500>;
332				regulator-enable-ramp-delay = <115>;
333			};
334
335			mt6397_vsramca15_reg: buck_vsramca15 {
336				regulator-compatible = "buck_vsramca15";
337				regulator-name = "vsramca15";
338				regulator-min-microvolt = < 700000>;
339				regulator-max-microvolt = <1350000>;
340				regulator-ramp-delay = <12500>;
341				regulator-always-on;
342			};
343
344			mt6397_vsramca7_reg: buck_vsramca7 {
345				regulator-compatible = "buck_vsramca7";
346				regulator-name = "vsramca7";
347				regulator-min-microvolt = < 700000>;
348				regulator-max-microvolt = <1350000>;
349				regulator-ramp-delay = <12500>;
350				regulator-always-on;
351			};
352
353			mt6397_vcore_reg: buck_vcore {
354				regulator-compatible = "buck_vcore";
355				regulator-name = "vcore";
356				regulator-min-microvolt = < 700000>;
357				regulator-max-microvolt = <1350000>;
358				regulator-ramp-delay = <12500>;
359				regulator-always-on;
360			};
361
362			mt6397_vgpu_reg: buck_vgpu {
363				regulator-compatible = "buck_vgpu";
364				regulator-name = "vgpu";
365				regulator-min-microvolt = < 700000>;
366				regulator-max-microvolt = <1350000>;
367				regulator-ramp-delay = <12500>;
368				regulator-enable-ramp-delay = <115>;
369			};
370
371			mt6397_vdrm_reg: buck_vdrm {
372				regulator-compatible = "buck_vdrm";
373				regulator-name = "vdrm";
374				regulator-min-microvolt = <1200000>;
375				regulator-max-microvolt = <1400000>;
376				regulator-ramp-delay = <12500>;
377				regulator-always-on;
378			};
379
380			mt6397_vio18_reg: buck_vio18 {
381				regulator-compatible = "buck_vio18";
382				regulator-name = "vio18";
383				regulator-min-microvolt = <1620000>;
384				regulator-max-microvolt = <1980000>;
385				regulator-ramp-delay = <12500>;
386				regulator-always-on;
387			};
388
389			mt6397_vtcxo_reg: ldo_vtcxo {
390				regulator-compatible = "ldo_vtcxo";
391				regulator-name = "vtcxo";
392				regulator-always-on;
393			};
394
395			mt6397_va28_reg: ldo_va28 {
396				regulator-compatible = "ldo_va28";
397				regulator-name = "va28";
398				regulator-always-on;
399			};
400
401			mt6397_vcama_reg: ldo_vcama {
402				regulator-compatible = "ldo_vcama";
403				regulator-name = "vcama";
404				regulator-min-microvolt = <1500000>;
405				regulator-max-microvolt = <2800000>;
406				regulator-enable-ramp-delay = <218>;
407			};
408
409			mt6397_vio28_reg: ldo_vio28 {
410				regulator-compatible = "ldo_vio28";
411				regulator-name = "vio28";
412				regulator-always-on;
413			};
414
415			mt6397_vusb_reg: ldo_vusb {
416				regulator-compatible = "ldo_vusb";
417				regulator-name = "vusb";
418			};
419
420			mt6397_vmc_reg: ldo_vmc {
421				regulator-compatible = "ldo_vmc";
422				regulator-name = "vmc";
423				regulator-min-microvolt = <1800000>;
424				regulator-max-microvolt = <3300000>;
425				regulator-enable-ramp-delay = <218>;
426			};
427
428			mt6397_vmch_reg: ldo_vmch {
429				regulator-compatible = "ldo_vmch";
430				regulator-name = "vmch";
431				regulator-min-microvolt = <3000000>;
432				regulator-max-microvolt = <3300000>;
433				regulator-enable-ramp-delay = <218>;
434			};
435
436			mt6397_vemc_3v3_reg: ldo_vemc3v3 {
437				regulator-compatible = "ldo_vemc3v3";
438				regulator-name = "vemc_3v3";
439				regulator-min-microvolt = <3000000>;
440				regulator-max-microvolt = <3300000>;
441				regulator-enable-ramp-delay = <218>;
442			};
443
444			mt6397_vgp1_reg: ldo_vgp1 {
445				regulator-compatible = "ldo_vgp1";
446				regulator-name = "vcamd";
447				regulator-min-microvolt = <1220000>;
448				regulator-max-microvolt = <3300000>;
449				regulator-enable-ramp-delay = <240>;
450			};
451
452			mt6397_vgp2_reg: ldo_vgp2 {
453				regulator-compatible = "ldo_vgp2";
454				regulator-name = "vcamio";
455				regulator-min-microvolt = <1000000>;
456				regulator-max-microvolt = <3300000>;
457				regulator-enable-ramp-delay = <218>;
458			};
459
460			mt6397_vgp3_reg: ldo_vgp3 {
461				regulator-compatible = "ldo_vgp3";
462				regulator-name = "vcamaf";
463				regulator-min-microvolt = <1200000>;
464				regulator-max-microvolt = <3300000>;
465				regulator-enable-ramp-delay = <218>;
466			};
467
468			mt6397_vgp4_reg: ldo_vgp4 {
469				regulator-compatible = "ldo_vgp4";
470				regulator-name = "vgp4";
471				regulator-min-microvolt = <1200000>;
472				regulator-max-microvolt = <3300000>;
473				regulator-enable-ramp-delay = <218>;
474			};
475
476			mt6397_vgp5_reg: ldo_vgp5 {
477				regulator-compatible = "ldo_vgp5";
478				regulator-name = "vgp5";
479				regulator-min-microvolt = <1200000>;
480				regulator-max-microvolt = <3000000>;
481				regulator-enable-ramp-delay = <218>;
482			};
483
484			mt6397_vgp6_reg: ldo_vgp6 {
485				regulator-compatible = "ldo_vgp6";
486				regulator-name = "vgp6";
487				regulator-min-microvolt = <1200000>;
488				regulator-max-microvolt = <3300000>;
489				regulator-enable-ramp-delay = <218>;
490			};
491
492			mt6397_vibr_reg: ldo_vibr {
493				regulator-compatible = "ldo_vibr";
494				regulator-name = "vibr";
495				regulator-min-microvolt = <1300000>;
496				regulator-max-microvolt = <3300000>;
497				regulator-enable-ramp-delay = <218>;
498			};
499		};
500	};
501};
502
503&pio {
504	spi_pins_a: spi0 {
505		pins_spi {
506			pinmux = <MT8173_PIN_69_SPI_CK__FUNC_SPI_CK_0_>,
507				<MT8173_PIN_70_SPI_MI__FUNC_SPI_MI_0_>,
508				<MT8173_PIN_71_SPI_MO__FUNC_SPI_MO_0_>,
509				<MT8173_PIN_72_SPI_CS__FUNC_SPI_CS_0_>;
510		};
511	};
512};
513
514&spi {
515	pinctrl-names = "default";
516	pinctrl-0 = <&spi_pins_a>;
517	mediatek,pad-select = <0>;
518	status = "okay";
519};
520
521&ssusb {
522	vusb33-supply = <&mt6397_vusb_reg>;
523	vbus-supply = <&usb_p0_vbus>;
524	extcon = <&extcon_usb>;
525	dr_mode = "otg";
526	wakeup-source;
527	pinctrl-names = "default", "id_float", "id_ground";
528	pinctrl-0 = <&usb_id_pins_float>;
529	pinctrl-1 = <&usb_id_pins_float>;
530	pinctrl-2 = <&usb_id_pins_ground>;
531	status = "okay";
532};
533
534&uart0 {
535	status = "okay";
536};
537
538&usb_host {
539	vusb33-supply = <&mt6397_vusb_reg>;
540	vbus-supply = <&usb_p1_vbus>;
541	status = "okay";
542};
543