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
86&main_pmx0 {
87	/* First pad number is ALW package and second is AMC package */
88	main_uart0_pins_default: main-uart0-pins-default {
89		pinctrl-single,pins = <
90			AM62X_IOPAD(0x1c8, PIN_INPUT, 0) /* (D14/A13) UART0_RXD */
91			AM62X_IOPAD(0x1cc, PIN_OUTPUT, 0) /* (E14/E11) UART0_TXD */
92		>;
93	};
94
95	main_i2c0_pins_default: main-i2c0-pins-default {
96		pinctrl-single,pins = <
97			AM62X_IOPAD(0x1e0, PIN_INPUT_PULLUP, 0) /* (B16/E12) I2C0_SCL */
98			AM62X_IOPAD(0x1e4, PIN_INPUT_PULLUP, 0) /* (A16/D14) I2C0_SDA */
99		>;
100	};
101
102	main_i2c1_pins_default: main-i2c1-pins-default {
103		pinctrl-single,pins = <
104			AM62X_IOPAD(0x1e8, PIN_INPUT_PULLUP, 0) /* (B17/A17) I2C1_SCL */
105			AM62X_IOPAD(0x1ec, PIN_INPUT_PULLUP, 0) /* (A17/A16) I2C1_SDA */
106		>;
107	};
108
109	main_i2c2_pins_default: main-i2c2-pins-default {
110		pinctrl-single,pins = <
111			AM62X_IOPAD(0x0b0, PIN_INPUT_PULLUP, 1) /* (K22/H18) GPMC0_CSn2.I2C2_SCL */
112			AM62X_IOPAD(0x0b4, PIN_INPUT_PULLUP, 1) /* (K24/H19) GPMC0_CSn3.I2C2_SDA */
113		>;
114	};
115
116	main_mmc0_pins_default: main-mmc0-pins-default {
117		pinctrl-single,pins = <
118			AM62X_IOPAD(0x220, PIN_INPUT, 0) /* (Y3/V3) MMC0_CMD */
119			AM62X_IOPAD(0x218, PIN_INPUT, 0) /* (AB1/Y1) MMC0_CLK */
120			AM62X_IOPAD(0x214, PIN_INPUT, 0) /* (AA2/V2) MMC0_DAT0 */
121			AM62X_IOPAD(0x210, PIN_INPUT, 0) /* (AA1/V1) MMC0_DAT1 */
122			AM62X_IOPAD(0x20c, PIN_INPUT, 0) /* (AA3/W2) MMC0_DAT2 */
123			AM62X_IOPAD(0x208, PIN_INPUT, 0) /* (Y4/W1) MMC0_DAT3 */
124			AM62X_IOPAD(0x204, PIN_INPUT, 0) /* (AB2/Y2) MMC0_DAT4 */
125			AM62X_IOPAD(0x200, PIN_INPUT, 0) /* (AC1/W3) MMC0_DAT5 */
126			AM62X_IOPAD(0x1fc, PIN_INPUT, 0) /* (AD2/W4) MMC0_DAT6 */
127			AM62X_IOPAD(0x1f8, PIN_INPUT, 0) /* (AC2/V4) MMC0_DAT7 */
128		>;
129	};
130
131	main_mmc1_pins_default: main-mmc1-pins-default {
132		pinctrl-single,pins = <
133			AM62X_IOPAD(0x23c, PIN_INPUT, 0) /* (A21/C18) MMC1_CMD */
134			AM62X_IOPAD(0x234, PIN_INPUT, 0) /* (B22/A20) MMC1_CLK */
135			AM62X_IOPAD(0x230, PIN_INPUT, 0) /* (A22/A19) MMC1_DAT0 */
136			AM62X_IOPAD(0x22c, PIN_INPUT, 0) /* (B21/B19) MMC1_DAT1 */
137			AM62X_IOPAD(0x228, PIN_INPUT, 0) /* (C21/B20) MMC1_DAT2 */
138			AM62X_IOPAD(0x224, PIN_INPUT, 0) /* (D22/C19) MMC1_DAT3 */
139			AM62X_IOPAD(0x240, PIN_INPUT, 0) /* (D17/C15) MMC1_SDCD */
140		>;
141	};
142
143	usr_led_pins_default: usr-led-pins-default {
144		pinctrl-single,pins = <
145			AM62X_IOPAD(0x244, PIN_OUTPUT, 7) /* (C17/B15) MMC1_SDWP.GPIO1_49 */
146		>;
147	};
148
149	main_mdio1_pins_default: main-mdio1-pins-default {
150		pinctrl-single,pins = <
151			AM62X_IOPAD(0x160, PIN_OUTPUT, 0) /* (AD24/V17) MDIO0_MDC */
152			AM62X_IOPAD(0x15c, PIN_INPUT, 0) /* (AB22/U16) MDIO0_MDIO */
153		>;
154	};
155
156	main_rgmii1_pins_default: main-rgmii1-pins-default {
157		pinctrl-single,pins = <
158			AM62X_IOPAD(0x14c, PIN_INPUT, 0) /* (AB17/W15) RGMII1_RD0 */
159			AM62X_IOPAD(0x150, PIN_INPUT, 0) /* (AC17/Y16) RGMII1_RD1 */
160			AM62X_IOPAD(0x154, PIN_INPUT, 0) /* (AB16/AA17) RGMII1_RD2 */
161			AM62X_IOPAD(0x158, PIN_INPUT, 0) /* (AA15/Y15) RGMII1_RD3 */
162			AM62X_IOPAD(0x148, PIN_INPUT, 0) /* (AD17/AA16) RGMII1_RXC */
163			AM62X_IOPAD(0x144, PIN_INPUT, 0) /* (AE17/W14) RGMII1_RX_CTL */
164			AM62X_IOPAD(0x134, PIN_OUTPUT, 0) /* (AE20/U14) RGMII1_TD0 */
165			AM62X_IOPAD(0x138, PIN_OUTPUT, 0) /* (AD20/AA19) RGMII1_TD1 */
166			AM62X_IOPAD(0x13c, PIN_OUTPUT, 0) /* (AE18/Y17) RGMII1_TD2 */
167			AM62X_IOPAD(0x140, PIN_OUTPUT, 0) /* (AD18/AA18) RGMII1_TD3 */
168			AM62X_IOPAD(0x130, PIN_OUTPUT, 0) /* (AE19/W16) RGMII1_TXC */
169			AM62X_IOPAD(0x12c, PIN_OUTPUT, 0) /* (AD19/V15) RGMII1_TX_CTL */
170		>;
171	};
172
173	main_usb1_pins_default: main-usb1-pins-default {
174		pinctrl-single,pins = <
175			AM62X_IOPAD(0x0258, PIN_OUTPUT, 0) /* (F18/E16) USB1_DRVVBUS */
176		>;
177	};
178};
179
180&wkup_uart0 {
181	/* WKUP UART0 is used by DM firmware */
182	status = "reserved";
183};
184
185&main_uart0 {
186	status = "okay";
187	pinctrl-names = "default";
188	pinctrl-0 = <&main_uart0_pins_default>;
189};
190
191&main_uart1 {
192	/* Main UART1 is used by TIFS firmware */
193	status = "reserved";
194};
195
196&main_i2c0 {
197	status = "okay";
198	pinctrl-names = "default";
199	pinctrl-0 = <&main_i2c0_pins_default>;
200	clock-frequency = <400000>;
201};
202
203&main_i2c1 {
204	status = "okay";
205	pinctrl-names = "default";
206	pinctrl-0 = <&main_i2c1_pins_default>;
207	clock-frequency = <400000>;
208};
209
210&sdhci0 {
211	status = "okay";
212	pinctrl-names = "default";
213	pinctrl-0 = <&main_mmc0_pins_default>;
214	ti,driver-strength-ohm = <50>;
215	disable-wp;
216};
217
218&sdhci1 {
219	/* SD/MMC */
220	status = "okay";
221	pinctrl-names = "default";
222	pinctrl-0 = <&main_mmc1_pins_default>;
223	ti,driver-strength-ohm = <50>;
224	disable-wp;
225};
226
227&cpsw3g {
228	pinctrl-names = "default";
229	pinctrl-0 = <&main_rgmii1_pins_default>;
230};
231
232&cpsw_port1 {
233	phy-mode = "rgmii-rxid";
234	phy-handle = <&cpsw3g_phy0>;
235};
236
237&cpsw3g_mdio {
238	status = "okay";
239	pinctrl-names = "default";
240	pinctrl-0 = <&main_mdio1_pins_default>;
241
242	cpsw3g_phy0: ethernet-phy@0 {
243		reg = <0>;
244		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
245		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
246		ti,min-output-impedance;
247	};
248};
249
250&mailbox0_cluster0 {
251	mbox_m4_0: mbox-m4-0 {
252		ti,mbox-rx = <0 0 0>;
253		ti,mbox-tx = <1 0 0>;
254	};
255};
256
257&usbss0 {
258	status = "okay";
259	ti,vbus-divider;
260};
261
262&usbss1 {
263	status = "okay";
264	ti,vbus-divider;
265};
266
267&usb0 {
268	dr_mode = "peripheral";
269};
270
271&usb1 {
272	dr_mode = "host";
273	pinctrl-names = "default";
274	pinctrl-0 = <&main_usb1_pins_default>;
275};
276