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&dpi0 {
78	status = "okay";
79};
80
81&hdmi_phy {
82	status = "okay";
83};
84
85&hdmi0 {
86	status = "okay";
87
88	ports {
89		port@1 {
90			reg = <1>;
91
92			hdmi0_out: endpoint {
93				remote-endpoint = <&hdmi_connector_in>;
94			};
95		};
96	};
97};
98
99&i2c1 {
100	status = "okay";
101
102	buck: da9211@68 {
103		compatible = "dlg,da9211";
104		reg = <0x68>;
105
106		regulators {
107			da9211_vcpu_reg: BUCKA {
108				regulator-name = "VBUCKA";
109				regulator-min-microvolt = < 700000>;
110				regulator-max-microvolt = <1310000>;
111				regulator-min-microamp	= <2000000>;
112				regulator-max-microamp	= <4400000>;
113				regulator-ramp-delay = <10000>;
114				regulator-always-on;
115			};
116
117			da9211_vgpu_reg: BUCKB {
118				regulator-name = "VBUCKB";
119				regulator-min-microvolt = < 700000>;
120				regulator-max-microvolt = <1310000>;
121				regulator-min-microamp	= <2000000>;
122				regulator-max-microamp	= <3000000>;
123				regulator-ramp-delay = <10000>;
124			};
125		};
126	};
127};
128
129&mmc0 {
130	status = "okay";
131	pinctrl-names = "default", "state_uhs";
132	pinctrl-0 = <&mmc0_pins_default>;
133	pinctrl-1 = <&mmc0_pins_uhs>;
134	bus-width = <8>;
135	max-frequency = <50000000>;
136	cap-mmc-highspeed;
137	vmmc-supply = <&mt6397_vemc_3v3_reg>;
138	vqmmc-supply = <&mt6397_vio18_reg>;
139	non-removable;
140};
141
142&mmc1 {
143	status = "okay";
144	pinctrl-names = "default", "state_uhs";
145	pinctrl-0 = <&mmc1_pins_default>;
146	pinctrl-1 = <&mmc1_pins_uhs>;
147	bus-width = <4>;
148	max-frequency = <50000000>;
149	cap-sd-highspeed;
150	sd-uhs-sdr25;
151	cd-gpios = <&pio 132 0>;
152	vmmc-supply = <&mt6397_vmch_reg>;
153	vqmmc-supply = <&mt6397_vmc_reg>;
154};
155
156&pio {
157	disp_pwm0_pins: disp_pwm0_pins {
158		pins1 {
159			pinmux = <MT8173_PIN_87_DISP_PWM0__FUNC_DISP_PWM0>;
160			output-low;
161		};
162	};
163
164	mmc0_pins_default: mmc0default {
165		pins_cmd_dat {
166			pinmux = <MT8173_PIN_57_MSDC0_DAT0__FUNC_MSDC0_DAT0>,
167				 <MT8173_PIN_58_MSDC0_DAT1__FUNC_MSDC0_DAT1>,
168				 <MT8173_PIN_59_MSDC0_DAT2__FUNC_MSDC0_DAT2>,
169				 <MT8173_PIN_60_MSDC0_DAT3__FUNC_MSDC0_DAT3>,
170				 <MT8173_PIN_61_MSDC0_DAT4__FUNC_MSDC0_DAT4>,
171				 <MT8173_PIN_62_MSDC0_DAT5__FUNC_MSDC0_DAT5>,
172				 <MT8173_PIN_63_MSDC0_DAT6__FUNC_MSDC0_DAT6>,
173				 <MT8173_PIN_64_MSDC0_DAT7__FUNC_MSDC0_DAT7>,
174				 <MT8173_PIN_66_MSDC0_CMD__FUNC_MSDC0_CMD>;
175			input-enable;
176			bias-pull-up;
177		};
178
179		pins_clk {
180			pinmux = <MT8173_PIN_65_MSDC0_CLK__FUNC_MSDC0_CLK>;
181			bias-pull-down;
182		};
183
184		pins_rst {
185			pinmux = <MT8173_PIN_68_MSDC0_RST___FUNC_MSDC0_RSTB>;
186			bias-pull-up;
187		};
188	};
189
190	mmc1_pins_default: mmc1default {
191		pins_cmd_dat {
192			pinmux = <MT8173_PIN_73_MSDC1_DAT0__FUNC_MSDC1_DAT0>,
193				 <MT8173_PIN_74_MSDC1_DAT1__FUNC_MSDC1_DAT1>,
194				 <MT8173_PIN_75_MSDC1_DAT2__FUNC_MSDC1_DAT2>,
195				 <MT8173_PIN_76_MSDC1_DAT3__FUNC_MSDC1_DAT3>,
196				 <MT8173_PIN_78_MSDC1_CMD__FUNC_MSDC1_CMD>;
197			input-enable;
198			drive-strength = <MTK_DRIVE_4mA>;
199			bias-pull-up = <MTK_PUPD_SET_R1R0_10>;
200		};
201
202		pins_clk {
203			pinmux = <MT8173_PIN_77_MSDC1_CLK__FUNC_MSDC1_CLK>;
204			bias-pull-down;
205			drive-strength = <MTK_DRIVE_4mA>;
206		};
207
208		pins_insert {
209			pinmux = <MT8173_PIN_132_I2S0_DATA1__FUNC_GPIO132>;
210			bias-pull-up;
211		};
212	};
213
214	mmc0_pins_uhs: mmc0 {
215		pins_cmd_dat {
216			pinmux = <MT8173_PIN_57_MSDC0_DAT0__FUNC_MSDC0_DAT0>,
217				 <MT8173_PIN_58_MSDC0_DAT1__FUNC_MSDC0_DAT1>,
218				 <MT8173_PIN_59_MSDC0_DAT2__FUNC_MSDC0_DAT2>,
219				 <MT8173_PIN_60_MSDC0_DAT3__FUNC_MSDC0_DAT3>,
220				 <MT8173_PIN_61_MSDC0_DAT4__FUNC_MSDC0_DAT4>,
221				 <MT8173_PIN_62_MSDC0_DAT5__FUNC_MSDC0_DAT5>,
222				 <MT8173_PIN_63_MSDC0_DAT6__FUNC_MSDC0_DAT6>,
223				 <MT8173_PIN_64_MSDC0_DAT7__FUNC_MSDC0_DAT7>,
224				 <MT8173_PIN_66_MSDC0_CMD__FUNC_MSDC0_CMD>;
225			input-enable;
226			drive-strength = <MTK_DRIVE_2mA>;
227			bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
228		};
229
230		pins_clk {
231			pinmux = <MT8173_PIN_65_MSDC0_CLK__FUNC_MSDC0_CLK>;
232			drive-strength = <MTK_DRIVE_2mA>;
233			bias-pull-down = <MTK_PUPD_SET_R1R0_01>;
234		};
235
236		pins_rst {
237			pinmux = <MT8173_PIN_68_MSDC0_RST___FUNC_MSDC0_RSTB>;
238			bias-pull-up;
239		};
240	};
241
242	mmc1_pins_uhs: mmc1 {
243		pins_cmd_dat {
244			pinmux = <MT8173_PIN_73_MSDC1_DAT0__FUNC_MSDC1_DAT0>,
245				 <MT8173_PIN_74_MSDC1_DAT1__FUNC_MSDC1_DAT1>,
246				 <MT8173_PIN_75_MSDC1_DAT2__FUNC_MSDC1_DAT2>,
247				 <MT8173_PIN_76_MSDC1_DAT3__FUNC_MSDC1_DAT3>,
248				 <MT8173_PIN_78_MSDC1_CMD__FUNC_MSDC1_CMD>;
249			input-enable;
250			drive-strength = <MTK_DRIVE_4mA>;
251			bias-pull-up = <MTK_PUPD_SET_R1R0_10>;
252		};
253
254		pins_clk {
255			pinmux = <MT8173_PIN_77_MSDC1_CLK__FUNC_MSDC1_CLK>;
256			drive-strength = <MTK_DRIVE_4mA>;
257			bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
258		};
259	};
260
261	usb_id_pins_float: usb_iddig_pull_up {
262		pins_iddig {
263			pinmux = <MT8173_PIN_16_IDDIG__FUNC_IDDIG>;
264			bias-pull-up;
265		};
266	};
267
268	usb_id_pins_ground: usb_iddig_pull_down {
269		pins_iddig {
270			pinmux = <MT8173_PIN_16_IDDIG__FUNC_IDDIG>;
271			bias-pull-down;
272		};
273	};
274};
275
276&pwm0 {
277	pinctrl-names = "default";
278	pinctrl-0 = <&disp_pwm0_pins>;
279	status = "okay";
280};
281
282&pwrap {
283	/* Only MT8173 E1 needs USB power domain */
284	power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
285
286	pmic: mt6397 {
287		compatible = "mediatek,mt6397";
288		interrupt-parent = <&pio>;
289		interrupts = <11 IRQ_TYPE_LEVEL_HIGH>;
290		interrupt-controller;
291		#interrupt-cells = <2>;
292
293		mt6397regulator: mt6397regulator {
294			compatible = "mediatek,mt6397-regulator";
295
296			mt6397_vpca15_reg: buck_vpca15 {
297				regulator-compatible = "buck_vpca15";
298				regulator-name = "vpca15";
299				regulator-min-microvolt = < 700000>;
300				regulator-max-microvolt = <1350000>;
301				regulator-ramp-delay = <12500>;
302				regulator-always-on;
303			};
304
305			mt6397_vpca7_reg: buck_vpca7 {
306				regulator-compatible = "buck_vpca7";
307				regulator-name = "vpca7";
308				regulator-min-microvolt = < 700000>;
309				regulator-max-microvolt = <1350000>;
310				regulator-ramp-delay = <12500>;
311				regulator-enable-ramp-delay = <115>;
312			};
313
314			mt6397_vsramca15_reg: buck_vsramca15 {
315				regulator-compatible = "buck_vsramca15";
316				regulator-name = "vsramca15";
317				regulator-min-microvolt = < 700000>;
318				regulator-max-microvolt = <1350000>;
319				regulator-ramp-delay = <12500>;
320				regulator-always-on;
321			};
322
323			mt6397_vsramca7_reg: buck_vsramca7 {
324				regulator-compatible = "buck_vsramca7";
325				regulator-name = "vsramca7";
326				regulator-min-microvolt = < 700000>;
327				regulator-max-microvolt = <1350000>;
328				regulator-ramp-delay = <12500>;
329				regulator-always-on;
330			};
331
332			mt6397_vcore_reg: buck_vcore {
333				regulator-compatible = "buck_vcore";
334				regulator-name = "vcore";
335				regulator-min-microvolt = < 700000>;
336				regulator-max-microvolt = <1350000>;
337				regulator-ramp-delay = <12500>;
338				regulator-always-on;
339			};
340
341			mt6397_vgpu_reg: buck_vgpu {
342				regulator-compatible = "buck_vgpu";
343				regulator-name = "vgpu";
344				regulator-min-microvolt = < 700000>;
345				regulator-max-microvolt = <1350000>;
346				regulator-ramp-delay = <12500>;
347				regulator-enable-ramp-delay = <115>;
348			};
349
350			mt6397_vdrm_reg: buck_vdrm {
351				regulator-compatible = "buck_vdrm";
352				regulator-name = "vdrm";
353				regulator-min-microvolt = <1200000>;
354				regulator-max-microvolt = <1400000>;
355				regulator-ramp-delay = <12500>;
356				regulator-always-on;
357			};
358
359			mt6397_vio18_reg: buck_vio18 {
360				regulator-compatible = "buck_vio18";
361				regulator-name = "vio18";
362				regulator-min-microvolt = <1620000>;
363				regulator-max-microvolt = <1980000>;
364				regulator-ramp-delay = <12500>;
365				regulator-always-on;
366			};
367
368			mt6397_vtcxo_reg: ldo_vtcxo {
369				regulator-compatible = "ldo_vtcxo";
370				regulator-name = "vtcxo";
371				regulator-always-on;
372			};
373
374			mt6397_va28_reg: ldo_va28 {
375				regulator-compatible = "ldo_va28";
376				regulator-name = "va28";
377				regulator-always-on;
378			};
379
380			mt6397_vcama_reg: ldo_vcama {
381				regulator-compatible = "ldo_vcama";
382				regulator-name = "vcama";
383				regulator-min-microvolt = <1500000>;
384				regulator-max-microvolt = <2800000>;
385				regulator-enable-ramp-delay = <218>;
386			};
387
388			mt6397_vio28_reg: ldo_vio28 {
389				regulator-compatible = "ldo_vio28";
390				regulator-name = "vio28";
391				regulator-always-on;
392			};
393
394			mt6397_vusb_reg: ldo_vusb {
395				regulator-compatible = "ldo_vusb";
396				regulator-name = "vusb";
397			};
398
399			mt6397_vmc_reg: ldo_vmc {
400				regulator-compatible = "ldo_vmc";
401				regulator-name = "vmc";
402				regulator-min-microvolt = <1800000>;
403				regulator-max-microvolt = <3300000>;
404				regulator-enable-ramp-delay = <218>;
405			};
406
407			mt6397_vmch_reg: ldo_vmch {
408				regulator-compatible = "ldo_vmch";
409				regulator-name = "vmch";
410				regulator-min-microvolt = <3000000>;
411				regulator-max-microvolt = <3300000>;
412				regulator-enable-ramp-delay = <218>;
413			};
414
415			mt6397_vemc_3v3_reg: ldo_vemc3v3 {
416				regulator-compatible = "ldo_vemc3v3";
417				regulator-name = "vemc_3v3";
418				regulator-min-microvolt = <3000000>;
419				regulator-max-microvolt = <3300000>;
420				regulator-enable-ramp-delay = <218>;
421			};
422
423			mt6397_vgp1_reg: ldo_vgp1 {
424				regulator-compatible = "ldo_vgp1";
425				regulator-name = "vcamd";
426				regulator-min-microvolt = <1220000>;
427				regulator-max-microvolt = <3300000>;
428				regulator-enable-ramp-delay = <240>;
429			};
430
431			mt6397_vgp2_reg: ldo_vgp2 {
432				regulator-compatible = "ldo_vgp2";
433				regulator-name = "vcamio";
434				regulator-min-microvolt = <1000000>;
435				regulator-max-microvolt = <3300000>;
436				regulator-enable-ramp-delay = <218>;
437			};
438
439			mt6397_vgp3_reg: ldo_vgp3 {
440				regulator-compatible = "ldo_vgp3";
441				regulator-name = "vcamaf";
442				regulator-min-microvolt = <1200000>;
443				regulator-max-microvolt = <3300000>;
444				regulator-enable-ramp-delay = <218>;
445			};
446
447			mt6397_vgp4_reg: ldo_vgp4 {
448				regulator-compatible = "ldo_vgp4";
449				regulator-name = "vgp4";
450				regulator-min-microvolt = <1200000>;
451				regulator-max-microvolt = <3300000>;
452				regulator-enable-ramp-delay = <218>;
453			};
454
455			mt6397_vgp5_reg: ldo_vgp5 {
456				regulator-compatible = "ldo_vgp5";
457				regulator-name = "vgp5";
458				regulator-min-microvolt = <1200000>;
459				regulator-max-microvolt = <3000000>;
460				regulator-enable-ramp-delay = <218>;
461			};
462
463			mt6397_vgp6_reg: ldo_vgp6 {
464				regulator-compatible = "ldo_vgp6";
465				regulator-name = "vgp6";
466				regulator-min-microvolt = <1200000>;
467				regulator-max-microvolt = <3300000>;
468				regulator-enable-ramp-delay = <218>;
469			};
470
471			mt6397_vibr_reg: ldo_vibr {
472				regulator-compatible = "ldo_vibr";
473				regulator-name = "vibr";
474				regulator-min-microvolt = <1300000>;
475				regulator-max-microvolt = <3300000>;
476				regulator-enable-ramp-delay = <218>;
477			};
478		};
479	};
480};
481
482&pio {
483	spi_pins_a: spi0 {
484		pins_spi {
485			pinmux = <MT8173_PIN_69_SPI_CK__FUNC_SPI_CK_0_>,
486				<MT8173_PIN_70_SPI_MI__FUNC_SPI_MI_0_>,
487				<MT8173_PIN_71_SPI_MO__FUNC_SPI_MO_0_>,
488				<MT8173_PIN_72_SPI_CS__FUNC_SPI_CS_0_>;
489		};
490	};
491};
492
493&spi {
494	pinctrl-names = "default";
495	pinctrl-0 = <&spi_pins_a>;
496	mediatek,pad-select = <0>;
497	status = "okay";
498};
499
500&ssusb {
501	vusb33-supply = <&mt6397_vusb_reg>;
502	vbus-supply = <&usb_p0_vbus>;
503	extcon = <&extcon_usb>;
504	dr_mode = "otg";
505	mediatek,enable-wakeup;
506	pinctrl-names = "default", "id_float", "id_ground";
507	pinctrl-0 = <&usb_id_pins_float>;
508	pinctrl-1 = <&usb_id_pins_float>;
509	pinctrl-2 = <&usb_id_pins_ground>;
510	status = "okay";
511};
512
513&uart0 {
514	status = "okay";
515};
516
517&usb_host {
518	vusb33-supply = <&mt6397_vusb_reg>;
519	vbus-supply = <&usb_p1_vbus>;
520	status = "okay";
521};
522