1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Common dtsi for AM62x SK and derivatives
4 *
5 * Copyright (C) 2021-2023 Texas Instruments Incorporated - https://www.ti.com/
6 */
7
8#include <dt-bindings/leds/common.h>
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/net/ti-dp83867.h>
11#include "k3-am625.dtsi"
12
13/ {
14	aliases {
15		serial2 = &main_uart0;
16		mmc0 = &sdhci0;
17		mmc1 = &sdhci1;
18		mmc2 = &sdhci2;
19		spi0 = &ospi0;
20		ethernet0 = &cpsw_port1;
21		ethernet1 = &cpsw_port2;
22		usb0 = &usb0;
23		usb1 = &usb1;
24	};
25
26	chosen {
27		stdout-path = "serial2:115200n8";
28	};
29
30	memory@80000000 {
31		device_type = "memory";
32		/* 2G RAM */
33		reg = <0x00000000 0x80000000 0x00000000 0x80000000>;
34	};
35
36	reserved-memory {
37		#address-cells = <2>;
38		#size-cells = <2>;
39		ranges;
40
41		ramoops@9ca00000 {
42			compatible = "ramoops";
43			reg = <0x00 0x9ca00000 0x00 0x00100000>;
44			record-size = <0x8000>;
45			console-size = <0x8000>;
46			ftrace-size = <0x00>;
47			pmsg-size = <0x8000>;
48		};
49
50		secure_tfa_ddr: tfa@9e780000 {
51			reg = <0x00 0x9e780000 0x00 0x80000>;
52			alignment = <0x1000>;
53			no-map;
54		};
55
56		secure_ddr: optee@9e800000 {
57			reg = <0x00 0x9e800000 0x00 0x01800000>; /* for OP-TEE */
58			alignment = <0x1000>;
59			no-map;
60		};
61
62		wkup_r5fss0_core0_dma_memory_region: r5f-dma-memory@9db00000 {
63			compatible = "shared-dma-pool";
64			reg = <0x00 0x9db00000 0x00 0xc00000>;
65			no-map;
66		};
67	};
68
69	leds {
70		compatible = "gpio-leds";
71		pinctrl-names = "default";
72		pinctrl-0 = <&usr_led_pins_default>;
73
74		led-0 {
75			label = "am62-sk:green:heartbeat";
76			gpios = <&main_gpio1 49 GPIO_ACTIVE_HIGH>;
77			linux,default-trigger = "heartbeat";
78			function = LED_FUNCTION_HEARTBEAT;
79			default-state = "off";
80		};
81	};
82
83	tlv320_mclk: clk-0 {
84		#clock-cells = <0>;
85		compatible = "fixed-clock";
86		clock-frequency = <12288000>;
87	};
88
89	codec_audio: sound {
90		compatible = "simple-audio-card";
91		simple-audio-card,name = "AM62x-SKEVM";
92		simple-audio-card,widgets =
93			"Headphone",	"Headphone Jack",
94			"Line",		"Line In",
95			"Microphone",	"Microphone Jack";
96		simple-audio-card,routing =
97			"Headphone Jack",	"HPLOUT",
98			"Headphone Jack",	"HPROUT",
99			"LINE1L",		"Line In",
100			"LINE1R",		"Line In",
101			"MIC3R",		"Microphone Jack",
102			"Microphone Jack",	"Mic Bias";
103		simple-audio-card,format = "dsp_b";
104		simple-audio-card,bitclock-master = <&sound_master>;
105		simple-audio-card,frame-master = <&sound_master>;
106		simple-audio-card,bitclock-inversion;
107
108		simple-audio-card,cpu {
109			sound-dai = <&mcasp1>;
110		};
111
112		sound_master: simple-audio-card,codec {
113			sound-dai = <&tlv320aic3106>;
114			clocks = <&tlv320_mclk>;
115		};
116	};
117};
118
119&main_pmx0 {
120	/* First pad number is ALW package and second is AMC package */
121	main_uart0_pins_default: main-uart0-pins-default {
122		pinctrl-single,pins = <
123			AM62X_IOPAD(0x1c8, PIN_INPUT, 0) /* (D14/A13) UART0_RXD */
124			AM62X_IOPAD(0x1cc, PIN_OUTPUT, 0) /* (E14/E11) UART0_TXD */
125		>;
126	};
127
128	main_i2c0_pins_default: main-i2c0-pins-default {
129		pinctrl-single,pins = <
130			AM62X_IOPAD(0x1e0, PIN_INPUT_PULLUP, 0) /* (B16/E12) I2C0_SCL */
131			AM62X_IOPAD(0x1e4, PIN_INPUT_PULLUP, 0) /* (A16/D14) I2C0_SDA */
132		>;
133	};
134
135	main_i2c1_pins_default: main-i2c1-pins-default {
136		pinctrl-single,pins = <
137			AM62X_IOPAD(0x1e8, PIN_INPUT_PULLUP, 0) /* (B17/A17) I2C1_SCL */
138			AM62X_IOPAD(0x1ec, PIN_INPUT_PULLUP, 0) /* (A17/A16) I2C1_SDA */
139		>;
140	};
141
142	main_i2c2_pins_default: main-i2c2-pins-default {
143		pinctrl-single,pins = <
144			AM62X_IOPAD(0x0b0, PIN_INPUT_PULLUP, 1) /* (K22/H18) GPMC0_CSn2.I2C2_SCL */
145			AM62X_IOPAD(0x0b4, PIN_INPUT_PULLUP, 1) /* (K24/H19) GPMC0_CSn3.I2C2_SDA */
146		>;
147	};
148
149	main_mmc0_pins_default: main-mmc0-pins-default {
150		pinctrl-single,pins = <
151			AM62X_IOPAD(0x220, PIN_INPUT, 0) /* (Y3/V3) MMC0_CMD */
152			AM62X_IOPAD(0x218, PIN_INPUT, 0) /* (AB1/Y1) MMC0_CLK */
153			AM62X_IOPAD(0x214, PIN_INPUT, 0) /* (AA2/V2) MMC0_DAT0 */
154			AM62X_IOPAD(0x210, PIN_INPUT, 0) /* (AA1/V1) MMC0_DAT1 */
155			AM62X_IOPAD(0x20c, PIN_INPUT, 0) /* (AA3/W2) MMC0_DAT2 */
156			AM62X_IOPAD(0x208, PIN_INPUT, 0) /* (Y4/W1) MMC0_DAT3 */
157			AM62X_IOPAD(0x204, PIN_INPUT, 0) /* (AB2/Y2) MMC0_DAT4 */
158			AM62X_IOPAD(0x200, PIN_INPUT, 0) /* (AC1/W3) MMC0_DAT5 */
159			AM62X_IOPAD(0x1fc, PIN_INPUT, 0) /* (AD2/W4) MMC0_DAT6 */
160			AM62X_IOPAD(0x1f8, PIN_INPUT, 0) /* (AC2/V4) MMC0_DAT7 */
161		>;
162	};
163
164	main_mmc1_pins_default: main-mmc1-pins-default {
165		pinctrl-single,pins = <
166			AM62X_IOPAD(0x23c, PIN_INPUT, 0) /* (A21/C18) MMC1_CMD */
167			AM62X_IOPAD(0x234, PIN_INPUT, 0) /* (B22/A20) MMC1_CLK */
168			AM62X_IOPAD(0x230, PIN_INPUT, 0) /* (A22/A19) MMC1_DAT0 */
169			AM62X_IOPAD(0x22c, PIN_INPUT, 0) /* (B21/B19) MMC1_DAT1 */
170			AM62X_IOPAD(0x228, PIN_INPUT, 0) /* (C21/B20) MMC1_DAT2 */
171			AM62X_IOPAD(0x224, PIN_INPUT, 0) /* (D22/C19) MMC1_DAT3 */
172			AM62X_IOPAD(0x240, PIN_INPUT, 0) /* (D17/C15) MMC1_SDCD */
173		>;
174	};
175
176	usr_led_pins_default: usr-led-pins-default {
177		pinctrl-single,pins = <
178			AM62X_IOPAD(0x244, PIN_OUTPUT, 7) /* (C17/B15) MMC1_SDWP.GPIO1_49 */
179		>;
180	};
181
182	main_mdio1_pins_default: main-mdio1-pins-default {
183		pinctrl-single,pins = <
184			AM62X_IOPAD(0x160, PIN_OUTPUT, 0) /* (AD24/V17) MDIO0_MDC */
185			AM62X_IOPAD(0x15c, PIN_INPUT, 0) /* (AB22/U16) MDIO0_MDIO */
186		>;
187	};
188
189	main_rgmii1_pins_default: main-rgmii1-pins-default {
190		pinctrl-single,pins = <
191			AM62X_IOPAD(0x14c, PIN_INPUT, 0) /* (AB17/W15) RGMII1_RD0 */
192			AM62X_IOPAD(0x150, PIN_INPUT, 0) /* (AC17/Y16) RGMII1_RD1 */
193			AM62X_IOPAD(0x154, PIN_INPUT, 0) /* (AB16/AA17) RGMII1_RD2 */
194			AM62X_IOPAD(0x158, PIN_INPUT, 0) /* (AA15/Y15) RGMII1_RD3 */
195			AM62X_IOPAD(0x148, PIN_INPUT, 0) /* (AD17/AA16) RGMII1_RXC */
196			AM62X_IOPAD(0x144, PIN_INPUT, 0) /* (AE17/W14) RGMII1_RX_CTL */
197			AM62X_IOPAD(0x134, PIN_OUTPUT, 0) /* (AE20/U14) RGMII1_TD0 */
198			AM62X_IOPAD(0x138, PIN_OUTPUT, 0) /* (AD20/AA19) RGMII1_TD1 */
199			AM62X_IOPAD(0x13c, PIN_OUTPUT, 0) /* (AE18/Y17) RGMII1_TD2 */
200			AM62X_IOPAD(0x140, PIN_OUTPUT, 0) /* (AD18/AA18) RGMII1_TD3 */
201			AM62X_IOPAD(0x130, PIN_OUTPUT, 0) /* (AE19/W16) RGMII1_TXC */
202			AM62X_IOPAD(0x12c, PIN_OUTPUT, 0) /* (AD19/V15) RGMII1_TX_CTL */
203		>;
204	};
205
206	main_usb1_pins_default: main-usb1-pins-default {
207		pinctrl-single,pins = <
208			AM62X_IOPAD(0x0258, PIN_OUTPUT, 0) /* (F18/E16) USB1_DRVVBUS */
209		>;
210	};
211
212	main_mcasp1_pins_default: main-mcasp1-pins-default {
213		pinctrl-single,pins = <
214			AM62X_IOPAD(0x090, PIN_INPUT, 2) /* (M24) GPMC0_BE0N_CLE.MCASP1_ACLKX */
215			AM62X_IOPAD(0x098, PIN_INPUT, 2) /* (U23) GPMC0_WAIT0.MCASP1_AFSX */
216			AM62X_IOPAD(0x08c, PIN_OUTPUT, 2) /* (L25) GPMC0_WEN.MCASP1_AXR0 */
217			AM62X_IOPAD(0x084, PIN_INPUT, 2) /* (L23) GPMC0_ADVN_ALE.MCASP1_AXR2 */
218		>;
219	};
220};
221
222&wkup_uart0 {
223	/* WKUP UART0 is used by DM firmware */
224	status = "reserved";
225};
226
227&main_uart0 {
228	status = "okay";
229	pinctrl-names = "default";
230	pinctrl-0 = <&main_uart0_pins_default>;
231};
232
233&main_uart1 {
234	/* Main UART1 is used by TIFS firmware */
235	status = "reserved";
236};
237
238&main_i2c0 {
239	status = "okay";
240	pinctrl-names = "default";
241	pinctrl-0 = <&main_i2c0_pins_default>;
242	clock-frequency = <400000>;
243
244	typec_pd0: tps6598x@3f {
245		compatible = "ti,tps6598x";
246		reg = <0x3f>;
247
248		connector {
249			compatible = "usb-c-connector";
250			label = "USB-C";
251			self-powered;
252			data-role = "dual";
253			power-role = "sink";
254			ports {
255				#address-cells = <1>;
256				#size-cells = <0>;
257
258				port@0 {
259					reg = <0>;
260					usb_con_hs: endpoint {
261						remote-endpoint = <&usb0_hs_ep>;
262					};
263				};
264			};
265		};
266	};
267};
268
269&main_i2c1 {
270	status = "okay";
271	pinctrl-names = "default";
272	pinctrl-0 = <&main_i2c1_pins_default>;
273	clock-frequency = <400000>;
274
275	tlv320aic3106: audio-codec@1b {
276		#sound-dai-cells = <0>;
277		compatible = "ti,tlv320aic3106";
278		reg = <0x1b>;
279		ai3x-micbias-vg = <1>;	/* 2.0V */
280
281		/* Regulators */
282		AVDD-supply = <&vcc_3v3_sys>;
283		IOVDD-supply = <&vcc_3v3_sys>;
284		DRVDD-supply = <&vcc_3v3_sys>;
285	};
286};
287
288&sdhci0 {
289	status = "okay";
290	pinctrl-names = "default";
291	pinctrl-0 = <&main_mmc0_pins_default>;
292	ti,driver-strength-ohm = <50>;
293	disable-wp;
294};
295
296&sdhci1 {
297	/* SD/MMC */
298	status = "okay";
299	pinctrl-names = "default";
300	pinctrl-0 = <&main_mmc1_pins_default>;
301	ti,driver-strength-ohm = <50>;
302	disable-wp;
303};
304
305&cpsw3g {
306	pinctrl-names = "default";
307	pinctrl-0 = <&main_rgmii1_pins_default>;
308};
309
310&cpsw_port1 {
311	phy-mode = "rgmii-rxid";
312	phy-handle = <&cpsw3g_phy0>;
313};
314
315&cpsw3g_mdio {
316	status = "okay";
317	pinctrl-names = "default";
318	pinctrl-0 = <&main_mdio1_pins_default>;
319
320	cpsw3g_phy0: ethernet-phy@0 {
321		reg = <0>;
322		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
323		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
324		ti,min-output-impedance;
325	};
326};
327
328&mailbox0_cluster0 {
329	mbox_m4_0: mbox-m4-0 {
330		ti,mbox-rx = <0 0 0>;
331		ti,mbox-tx = <1 0 0>;
332	};
333};
334
335&usbss0 {
336	status = "okay";
337	ti,vbus-divider;
338};
339
340&usbss1 {
341	status = "okay";
342	ti,vbus-divider;
343};
344
345&usb0 {
346	#address-cells = <1>;
347	#size-cells = <0>;
348	usb-role-switch;
349
350	port@0 {
351		reg = <0>;
352		usb0_hs_ep: endpoint {
353		    remote-endpoint = <&usb_con_hs>;
354	       };
355	};
356};
357
358&usb1 {
359	dr_mode = "host";
360	pinctrl-names = "default";
361	pinctrl-0 = <&main_usb1_pins_default>;
362};
363
364&mcasp1 {
365	status = "okay";
366	#sound-dai-cells = <0>;
367
368	pinctrl-names = "default";
369	pinctrl-0 = <&main_mcasp1_pins_default>;
370
371	op-mode = <0>;          /* MCASP_IIS_MODE */
372	tdm-slots = <2>;
373
374	serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
375	       1 0 2 0
376	       0 0 0 0
377	       0 0 0 0
378	       0 0 0 0
379	>;
380	tx-num-evt = <32>;
381	rx-num-evt = <32>;
382};
383