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