1// SPDX-License-Identifier: GPL-2.0-only OR MIT
2/*
3 * Copyright (C) 2022-2024 PHYTEC Messtechnik GmbH
4 * Author: Wadim Egorov <[email protected]>
5 *
6 */
7
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/leds/common.h>
11#include <dt-bindings/net/ti-dp83867.h>
12
13/ {
14	aliases {
15		serial2 = &main_uart0;
16		serial3 = &main_uart1;
17		mmc1 = &sdhci1;
18		usb0 = &usb0;
19		usb1 = &usb1;
20		ethernet1 = &cpsw_port2;
21	};
22
23	can_tc1: can-phy0 {
24		compatible = "ti,tcan1042";
25		#phy-cells = <0>;
26		max-bitrate = <8000000>;
27		standby-gpios = <&gpio_exp 1 GPIO_ACTIVE_HIGH>;
28	};
29
30	hdmi0: connector-hdmi {
31		compatible = "hdmi-connector";
32		label = "hdmi";
33		type = "a";
34
35		port {
36			hdmi_connector_in: endpoint {
37				remote-endpoint = <&sii9022_out>;
38			};
39		};
40	};
41
42	keys {
43		compatible = "gpio-keys";
44		autorepeat;
45		pinctrl-names = "default";
46		pinctrl-0 = <&gpio_keys_pins_default>;
47
48		key-home {
49			label = "home";
50			linux,code = <KEY_HOME>;
51			gpios = <&main_gpio1 23 GPIO_ACTIVE_HIGH>;
52		};
53
54		key-menu {
55			label = "menu";
56			linux,code = <KEY_MENU>;
57			gpios = <&gpio_exp 4 GPIO_ACTIVE_HIGH>;
58		};
59	};
60
61	sound {
62		compatible = "simple-audio-card";
63		simple-audio-card,name = "phyBOARD-Lyra";
64		simple-audio-card,widgets =
65			"Microphone",           "Mic Jack",
66			"Headphone",            "Headphone Jack",
67			"Speaker",              "External Speaker";
68		simple-audio-card,routing =
69			"MIC3R",                "Mic Jack",
70			"Mic Jack",             "Mic Bias",
71			"Headphone Jack",       "HPLOUT",
72			"Headphone Jack",       "HPROUT",
73			"External Speaker",     "SPOP",
74			"External Speaker",     "SPOM";
75		simple-audio-card,format = "dsp_b";
76		simple-audio-card,bitclock-master = <&sound_master>;
77		simple-audio-card,frame-master = <&sound_master>;
78		simple-audio-card,bitclock-inversion;
79
80		simple-audio-card,cpu {
81			sound-dai = <&mcasp2>;
82		};
83
84		sound_master: simple-audio-card,codec {
85			sound-dai = <&audio_codec>;
86			clocks = <&audio_refclk1>;
87		};
88	};
89
90	leds {
91		compatible = "gpio-leds";
92		pinctrl-names = "default";
93		pinctrl-0 = <&leds_pins_default>, <&user_leds_pins_default>;
94
95		led-1 {
96			gpios = <&main_gpio0 32 GPIO_ACTIVE_HIGH>;
97			linux,default-trigger = "mmc0";
98		};
99
100		led-2 {
101			gpios = <&gpio_exp 2 GPIO_ACTIVE_HIGH>;
102			linux,default-trigger = "mmc1";
103		};
104	};
105
106	vcc_1v8: regulator-vcc-1v8 {
107		compatible = "regulator-fixed";
108		regulator-name = "VCC_1V8";
109		regulator-min-microvolt = <1800000>;
110		regulator-max-microvolt = <1800000>;
111		regulator-always-on;
112		regulator-boot-on;
113	};
114
115	vcc_3v3_hdmi: regulator-vcc-3v3-hdmi {
116		compatible = "regulator-fixed";
117		regulator-name = "VCC_3V3_HDMI";
118		regulator-min-microvolt = <3300000>;
119		regulator-max-microvolt = <3300000>;
120		vin-supply = <&vcc_3v3_sw>;
121		regulator-always-on;
122		regulator-boot-on;
123	};
124
125	vcc_1v2_hdmi: regulator-vcc-1v2-hdmi {
126		compatible = "regulator-fixed";
127		regulator-name = "HDMI_CVCC";
128		regulator-min-microvolt = <1200000>;
129		regulator-max-microvolt = <1200000>;
130		regulator-always-on;
131		regulator-boot-on;
132	};
133
134	vcc_3v3_mmc: regulator-vcc-3v3-mmc {
135		compatible = "regulator-fixed";
136		regulator-name = "VCC_3V3_MMC";
137		regulator-min-microvolt = <3300000>;
138		regulator-max-microvolt = <3300000>;
139		regulator-always-on;
140		regulator-boot-on;
141	};
142
143	vcc_3v3_sw: regulator-vcc-3v3-sw {
144		compatible = "regulator-fixed";
145		regulator-name = "VCC_3V3_SW";
146		regulator-min-microvolt = <3300000>;
147		regulator-max-microvolt = <3300000>;
148		regulator-always-on;
149		regulator-boot-on;
150	};
151};
152
153&main_pmx0 {
154	audio_ext_refclk1_pins_default: audio-ext-refclk1-default-pins {
155		pinctrl-single,pins = <
156			AM62X_IOPAD(0x0a0, PIN_OUTPUT, 1) /* (K25) GPMC0_WPn.AUDIO_EXT_REFCLK1 */
157		>;
158	};
159
160	gpio_keys_pins_default: gpio-keys-default-pins {
161		pinctrl-single,pins = <
162			AM62X_IOPAD(0x1d4, PIN_INPUT, 7) /* (B15) UART0_RTSn.GPIO1_23 */
163		>;
164	};
165
166	gpio_exp_int_pins_default: gpio-exp-int-default-pins {
167		pinctrl-single,pins = <
168			AM62X_IOPAD(0x244, PIN_INPUT, 7) /* (C17) MMC1_SDWP.GPIO1_49 */
169		>;
170	};
171
172	hdmi_int_pins_default: hdmi-int-default-pins {
173		pinctrl-single,pins = <
174			AM62X_IOPAD(0x040, PIN_INPUT, 7) /* (N23) GPMC0_AD1.GPIO0_16 */
175		>;
176	};
177
178	main_dss0_pins_default: main-dss0-default-pins {
179		pinctrl-single,pins = <
180			AM62X_IOPAD(0x0b8, PIN_OUTPUT, 0) /* (U22) VOUT0_DATA0 */
181			AM62X_IOPAD(0x0bc, PIN_OUTPUT, 0) /* (V24) VOUT0_DATA1 */
182			AM62X_IOPAD(0x0e0, PIN_OUTPUT, 0) /* (V20) VOUT0_DATA10 */
183			AM62X_IOPAD(0x0e4, PIN_OUTPUT, 0) /* (AA23) VOUT0_DATA11 */
184			AM62X_IOPAD(0x0e8, PIN_OUTPUT, 0) /* (AB25) VOUT0_DATA12 */
185			AM62X_IOPAD(0x0ec, PIN_OUTPUT, 0) /* (AA24) VOUT0_DATA13 */
186			AM62X_IOPAD(0x0f0, PIN_OUTPUT, 0) /* (Y22) VOUT0_DATA14 */
187			AM62X_IOPAD(0x0f4, PIN_OUTPUT, 0) /* (AA21) VOUT0_DATA15 */
188			AM62X_IOPAD(0x0c0, PIN_OUTPUT, 0) /* (W25) VOUT0_DATA2 */
189			AM62X_IOPAD(0x0c4, PIN_OUTPUT, 0) /* (W24) VOUT0_DATA3 */
190			AM62X_IOPAD(0x0c8, PIN_OUTPUT, 0) /* (Y25) VOUT0_DATA4 */
191			AM62X_IOPAD(0x0cc, PIN_OUTPUT, 0) /* (Y24) VOUT0_DATA5 */
192			AM62X_IOPAD(0x0d0, PIN_OUTPUT, 0) /* (Y23) VOUT0_DATA6 */
193			AM62X_IOPAD(0x0d4, PIN_OUTPUT, 0) /* (AA25) VOUT0_DATA7 */
194			AM62X_IOPAD(0x0d8, PIN_OUTPUT, 0) /* (V21) VOUT0_DATA8 */
195			AM62X_IOPAD(0x0dc, PIN_OUTPUT, 0) /* (W21) VOUT0_DATA9 */
196			AM62X_IOPAD(0x0fc, PIN_OUTPUT, 0) /* (Y20) VOUT0_DE */
197			AM62X_IOPAD(0x0f8, PIN_OUTPUT, 0) /* (AB24) VOUT0_HSYNC */
198			AM62X_IOPAD(0x104, PIN_OUTPUT, 0) /* (AC24) VOUT0_PCLK */
199			AM62X_IOPAD(0x100, PIN_OUTPUT, 0) /* (AC25) VOUT0_VSYNC */
200		>;
201	};
202
203	main_i2c1_pins_default: main-i2c1-default-pins {
204		pinctrl-single,pins = <
205			AM62X_IOPAD(0x1e8, PIN_INPUT_PULLUP, 0) /* (B17) I2C1_SCL */
206			AM62X_IOPAD(0x1ec, PIN_INPUT_PULLUP, 0) /* (A17) I2C1_SDA */
207		>;
208	};
209
210	main_mcan0_pins_default: main-mcan0-default-pins {
211		pinctrl-single,pins = <
212			AM62X_IOPAD(0x1dc, PIN_INPUT, 0) /* (E15) MCAN0_RX */
213			AM62X_IOPAD(0x1d8, PIN_OUTPUT, 0) /* (C15) MCAN0_TX */
214		>;
215	};
216
217	main_mcasp2_pins_default: main-mcasp2-default-pins {
218		pinctrl-single,pins = <
219			AM62X_IOPAD(0x070, PIN_INPUT, 3) /* (T24) GPMC0_AD13.MCASP2_ACLKX */
220			AM62X_IOPAD(0x06c, PIN_INPUT, 3) /* (T22) GPMC0_AD12.MCASP2_AFSX */
221			AM62X_IOPAD(0x064, PIN_OUTPUT, 3) /* (T25) GPMC0_AD10.MCASP2_AXR2 */
222			AM62X_IOPAD(0x068, PIN_INPUT, 3) /* (R21) GPMC0_AD11.MCASP2_AXR3 */
223		>;
224	};
225
226	main_mmc1_pins_default: main-mmc1-default-pins {
227		pinctrl-single,pins = <
228			AM62X_IOPAD(0x23c, PIN_INPUT_PULLUP, 0) /* (A21) MMC1_CMD */
229			AM62X_IOPAD(0x234, PIN_INPUT_PULLDOWN, 0) /* (B22) MMC1_CLK */
230			AM62X_IOPAD(0x230, PIN_INPUT_PULLUP, 0) /* (A22) MMC1_DAT0 */
231			AM62X_IOPAD(0x22c, PIN_INPUT_PULLUP, 0) /* (B21) MMC1_DAT1 */
232			AM62X_IOPAD(0x228, PIN_INPUT_PULLUP, 0) /* (C21) MMC1_DAT2 */
233			AM62X_IOPAD(0x224, PIN_INPUT_PULLUP, 0) /* (D22) MMC1_DAT3 */
234			AM62X_IOPAD(0x240, PIN_INPUT_PULLUP, 0) /* (D17) MMC1_SDCD */
235		>;
236	};
237
238	main_rgmii2_pins_default: main-rgmii2-default-pins {
239		pinctrl-single,pins = <
240			AM62X_IOPAD(0x184, PIN_INPUT, 0) /* (AE23) RGMII2_RD0 */
241			AM62X_IOPAD(0x188, PIN_INPUT, 0) /* (AB20) RGMII2_RD1 */
242			AM62X_IOPAD(0x18c, PIN_INPUT, 0) /* (AC21) RGMII2_RD2 */
243			AM62X_IOPAD(0x190, PIN_INPUT, 0) /* (AE22) RGMII2_RD3 */
244			AM62X_IOPAD(0x180, PIN_INPUT, 0) /* (AD23) RGMII2_RXC */
245			AM62X_IOPAD(0x17c, PIN_INPUT, 0) /* (AD22) RGMII2_RX_CTL */
246			AM62X_IOPAD(0x16c, PIN_OUTPUT, 0) /* (Y18) RGMII2_TD0 */
247			AM62X_IOPAD(0x170, PIN_OUTPUT, 0) /* (AA18) RGMII2_TD1 */
248			AM62X_IOPAD(0x174, PIN_OUTPUT, 0) /* (AD21) RGMII2_TD2 */
249			AM62X_IOPAD(0x178, PIN_OUTPUT, 0) /* (AC20) RGMII2_TD3 */
250			AM62X_IOPAD(0x168, PIN_OUTPUT, 0) /* (AE21) RGMII2_TXC */
251			AM62X_IOPAD(0x164, PIN_OUTPUT, 0) /* (AA19) RGMII2_TX_CTL */
252		>;
253	};
254
255	main_uart0_pins_default: main-uart0-default-pins {
256		pinctrl-single,pins = <
257			AM62X_IOPAD(0x1c8, PIN_INPUT, 0) /* (D14) UART0_RXD */
258			AM62X_IOPAD(0x1cc, PIN_OUTPUT, 0) /* (E14) UART0_TXD */
259		>;
260	};
261
262	main_uart1_pins_default: main-uart1-default-pins {
263		pinctrl-single,pins = <
264			AM62X_IOPAD(0x194, PIN_INPUT, 2) /* (B19) MCASP0_AXR3.UART1_CTSn */
265			AM62X_IOPAD(0x198, PIN_OUTPUT, 2) /* (A19) MCASP0_AXR2.UART1_RTSn */
266			AM62X_IOPAD(0x1ac, PIN_INPUT, 2) /* (E19) MCASP0_AFSR.UART1_RXD */
267			AM62X_IOPAD(0x1b0, PIN_OUTPUT, 2) /* (A20) MCASP0_ACLKR.UART1_TXD */
268		>;
269	};
270
271	main_usb1_pins_default: main-usb1-default-pins {
272		pinctrl-single,pins = <
273			AM62X_IOPAD(0x258, PIN_OUTPUT, 0) /* (F18) USB1_DRVVBUS */
274		>;
275	};
276
277	user_leds_pins_default: user-leds-default-pins {
278		pinctrl-single,pins = <
279			AM62X_IOPAD(0x084, PIN_OUTPUT, 7) /* (L23) GPMC0_ADVn_ALE.GPIO0_32 */
280		>;
281	};
282};
283
284&cpsw3g {
285	pinctrl-names = "default";
286	pinctrl-0 = <&main_rgmii1_pins_default>, <&main_rgmii2_pins_default>;
287};
288
289&cpsw_port2 {
290	phy-mode = "rgmii-rxid";
291	phy-handle = <&cpsw3g_phy3>;
292};
293
294&cpsw3g_mdio {
295	cpsw3g_phy3: ethernet-phy@3 {
296		compatible = "ethernet-phy-id2000.a231", "ethernet-phy-ieee802.3-c22";
297		reg = <3>;
298		ti,clk-output-sel = <DP83867_CLK_O_SEL_OFF>;
299		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
300		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
301	};
302};
303
304&dss {
305	pinctrl-names = "default";
306	pinctrl-0 = <&main_dss0_pins_default>;
307	status = "okay";
308};
309
310&dss_ports {
311	#address-cells = <1>;
312	#size-cells = <0>;
313
314	/* VP2: DPI/HDMI Output */
315	port@1 {
316		reg = <1>;
317
318		dpi1_out: endpoint {
319			remote-endpoint = <&sii9022_in>;
320		};
321	};
322};
323
324&main_i2c1 {
325	pinctrl-names = "default";
326	pinctrl-0 = <&main_i2c1_pins_default>;
327	clock-frequency = <100000>;
328	status = "okay";
329
330	audio_codec: audio-codec@18 {
331		pinctrl-names = "default";
332		pinctrl-0 = <&audio_ext_refclk1_pins_default>;
333
334		#sound-dai-cells = <0>;
335		compatible = "ti,tlv320aic3007";
336		reg = <0x18>;
337		ai3x-micbias-vg = <2>;
338
339		AVDD-supply = <&vcc_3v3_sw>;
340		IOVDD-supply = <&vcc_3v3_sw>;
341		DRVDD-supply = <&vcc_3v3_sw>;
342		DVDD-supply = <&vcc_1v8>;
343	};
344
345	gpio_exp: gpio-expander@21 {
346		pinctrl-names = "default";
347		pinctrl-0 = <&gpio_exp_int_pins_default>;
348		compatible = "nxp,pcf8574";
349		reg = <0x21>;
350		interrupt-parent = <&main_gpio1>;
351		interrupts = <49 0>;
352		#gpio-cells = <2>;
353		gpio-controller;
354		interrupt-controller;
355		#interrupt-cells = <2>;
356		gpio-line-names = "", "GPIO1_CAN0_nEN",
357				  "GPIO2_LED2", "GPIO3_LVDS_GPIO",
358				  "GPIO4_BUT2", "GPIO5_LVDS_BKLT_EN",
359				  "GPIO6_ETH1_USER_RESET", "GPIO7_AUDIO_USER_RESET";
360	};
361
362	usb-pd@22 {
363		compatible = "ti,tps6598x";
364		reg = <0x22>;
365
366		connector {
367			compatible = "usb-c-connector";
368			label = "USB-C";
369			self-powered;
370			data-role = "dual";
371			power-role = "sink";
372			port {
373				usb_con_hs: endpoint {
374					remote-endpoint = <&typec_hs>;
375				};
376			};
377		};
378	};
379
380	sii9022: bridge-hdmi@39 {
381		compatible = "sil,sii9022";
382		reg = <0x39>;
383
384		interrupt-parent = <&main_gpio0>;
385		interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
386		pinctrl-names = "default";
387		pinctrl-0 = <&hdmi_int_pins_default>;
388
389		iovcc-supply = <&vcc_3v3_hdmi>;
390		cvcc12-supply = <&vcc_1v2_hdmi>;
391
392		ports {
393			#address-cells = <1>;
394			#size-cells = <0>;
395
396			port@0 {
397				reg = <0>;
398
399				sii9022_in: endpoint {
400					remote-endpoint = <&dpi1_out>;
401					bus-width = <16>;
402				};
403			};
404
405			port@1 {
406				reg = <1>;
407
408				sii9022_out: endpoint {
409					remote-endpoint = <&hdmi_connector_in>;
410				};
411			};
412		};
413	};
414
415	eeprom@51 {
416		compatible = "atmel,24c02";
417		pagesize = <16>;
418		reg = <0x51>;
419		vcc-supply = <&vcc_3v3_mmc>;
420	};
421};
422
423&main_mcan0 {
424	pinctrl-names = "default";
425	pinctrl-0 = <&main_mcan0_pins_default>;
426	phys = <&can_tc1>;
427	status = "okay";
428};
429
430&main_uart0 {
431	pinctrl-names = "default";
432	pinctrl-0 = <&main_uart0_pins_default>;
433	status = "okay";
434};
435
436&main_uart1 {
437	pinctrl-names = "default";
438	pinctrl-0 = <&main_uart1_pins_default>;
439	/* Main UART1 may be used by TIFS firmware */
440	status = "okay";
441};
442
443&mcasp2 {
444	#sound-dai-cells = <0>;
445
446	pinctrl-names = "default";
447	pinctrl-0 = <&main_mcasp2_pins_default>;
448
449	/* MCASP_IIS_MODE */
450	op-mode = <0>;
451	tdm-slots = <2>;
452
453	/* 0: INACTIVE, 1: TX, 2: RX */
454	serial-dir = <
455			0 0 1 2
456			0 0 0 0
457			0 0 0 0
458			0 0 0 0
459	>;
460	status = "okay";
461};
462
463&sdhci1 {
464	vmmc-supply = <&vcc_3v3_mmc>;
465	vqmmc-supply = <&vddshv5_sdio>;
466	pinctrl-names = "default";
467	pinctrl-0 = <&main_mmc1_pins_default>;
468	disable-wp;
469	no-1-8-v;
470	status = "okay";
471};
472
473&usbss0 {
474	ti,vbus-divider;
475	status = "okay";
476};
477
478&usbss1 {
479	ti,vbus-divider;
480	status = "okay";
481};
482
483&usb0 {
484	usb-role-switch;
485
486	port {
487		typec_hs: endpoint {
488			remote-endpoint = <&usb_con_hs>;
489		};
490	};
491};
492
493&usb1 {
494	dr_mode = "host";
495	pinctrl-names = "default";
496	pinctrl-0 = <&main_usb1_pins_default>;
497};
498