1// SPDX-License-Identifier: GPL-2.0
2/*
3 * AM62A SK: https://www.ti.com/lit/zip/sprr459
4 *
5 * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
6 */
7
8/dts-v1/;
9
10#include <dt-bindings/leds/common.h>
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/net/ti-dp83867.h>
13#include "k3-am62a7.dtsi"
14
15/ {
16	compatible = "ti,am62a7-sk", "ti,am62a7";
17	model = "Texas Instruments AM62A7 SK";
18
19	aliases {
20		serial0 = &wkup_uart0;
21		serial2 = &main_uart0;
22		serial3 = &main_uart1;
23		mmc1 = &sdhci1;
24	};
25
26	chosen {
27		stdout-path = "serial2:115200n8";
28	};
29
30	memory@80000000 {
31		device_type = "memory";
32		/* 4G RAM */
33		reg = <0x00000000 0x80000000 0x00000000 0x80000000>,
34		      <0x00000008 0x80000000 0x00000000 0x80000000>;
35	};
36
37	reserved-memory {
38		#address-cells = <2>;
39		#size-cells = <2>;
40		ranges;
41
42		secure_tfa_ddr: tfa@9e780000 {
43			reg = <0x00 0x9e780000 0x00 0x80000>;
44			alignment = <0x1000>;
45			no-map;
46		};
47
48		secure_ddr: optee@9e800000 {
49			reg = <0x00 0x9e800000 0x00 0x01800000>; /* for OP-TEE */
50			alignment = <0x1000>;
51			no-map;
52		};
53
54		wkup_r5fss0_core0_memory_region: r5f-dma-memory@9c900000 {
55			compatible = "shared-dma-pool";
56			reg = <0x00 0x9c900000 0x00 0x01e00000>;
57			no-map;
58		};
59	};
60
61	vmain_pd: regulator-0 {
62		/* TPS25750 PD CONTROLLER OUTPUT */
63		compatible = "regulator-fixed";
64		regulator-name = "vmain_pd";
65		regulator-min-microvolt = <5000000>;
66		regulator-max-microvolt = <5000000>;
67		regulator-always-on;
68		regulator-boot-on;
69	};
70
71	vcc_5v0: regulator-1 {
72		/* Output of TPS63070 */
73		compatible = "regulator-fixed";
74		regulator-name = "vcc_5v0";
75		regulator-min-microvolt = <5000000>;
76		regulator-max-microvolt = <5000000>;
77		vin-supply = <&vmain_pd>;
78		regulator-always-on;
79		regulator-boot-on;
80	};
81
82	vcc_3v3_sys: regulator-2 {
83		/* output of LM5141-Q1 */
84		compatible = "regulator-fixed";
85		regulator-name = "vcc_3v3_sys";
86		regulator-min-microvolt = <3300000>;
87		regulator-max-microvolt = <3300000>;
88		vin-supply = <&vmain_pd>;
89		regulator-always-on;
90		regulator-boot-on;
91	};
92
93	vdd_mmc1: regulator-3 {
94		/* TPS22918DBVR */
95		compatible = "regulator-fixed";
96		regulator-name = "vdd_mmc1";
97		regulator-min-microvolt = <3300000>;
98		regulator-max-microvolt = <3300000>;
99		regulator-boot-on;
100		enable-active-high;
101		gpio = <&exp1 3 GPIO_ACTIVE_HIGH>;
102	};
103
104	leds {
105		compatible = "gpio-leds";
106		pinctrl-names = "default";
107		pinctrl-0 = <&usr_led_pins_default>;
108
109		led-0 {
110			label = "am62a-sk:green:heartbeat";
111			gpios = <&main_gpio1 49 GPIO_ACTIVE_HIGH>;
112			linux,default-trigger = "heartbeat";
113			function = LED_FUNCTION_HEARTBEAT;
114			default-state = "off";
115		};
116	};
117};
118
119&mcu_pmx0 {
120	wkup_uart0_pins_default: wkup-uart0-default-pins {
121		pinctrl-single,pins = <
122			AM62AX_MCU_IOPAD(0x0024, PIN_INPUT, 0) /* (C9) WKUP_UART0_RXD */
123			AM62AX_MCU_IOPAD(0x0028, PIN_OUTPUT, 0) /* (E9) WKUP_UART0_TXD */
124			AM62AX_MCU_IOPAD(0x002c, PIN_INPUT, 0) /* (C10) WKUP_UART0_CTSn */
125			AM62AX_MCU_IOPAD(0x0030, PIN_OUTPUT, 0) /* (C8) WKUP_UART0_RTSn */
126		>;
127	};
128};
129
130/* WKUP UART0 is used for DM firmware logs */
131&wkup_uart0 {
132	pinctrl-names = "default";
133	pinctrl-0 = <&wkup_uart0_pins_default>;
134	status = "reserved";
135};
136
137&main_pmx0 {
138	main_uart0_pins_default: main-uart0-default-pins {
139		pinctrl-single,pins = <
140			AM62AX_IOPAD(0x1c8, PIN_INPUT, 0) /* (E14) UART0_RXD */
141			AM62AX_IOPAD(0x1cc, PIN_OUTPUT, 0) /* (D15) UART0_TXD */
142		>;
143	};
144
145	main_uart1_pins_default: main-uart1-default-pins {
146		pinctrl-single,pins = <
147			AM62AX_IOPAD(0x01e8, PIN_INPUT, 1) /* (C17) I2C1_SCL.UART1_RXD */
148			AM62AX_IOPAD(0x01ec, PIN_OUTPUT, 1) /* (E17) I2C1_SDA.UART1_TXD */
149			AM62AX_IOPAD(0x0194, PIN_INPUT, 2) /* (C19) MCASP0_AXR3.UART1_CTSn */
150			AM62AX_IOPAD(0x0198, PIN_OUTPUT, 2) /* (B19) MCASP0_AXR2.UART1_RTSn */
151		>;
152	};
153
154	main_i2c0_pins_default: main-i2c0-default-pins {
155		pinctrl-single,pins = <
156			AM62AX_IOPAD(0x1e0, PIN_INPUT_PULLUP, 0) /* (B16) I2C0_SCL */
157			AM62AX_IOPAD(0x1e4, PIN_INPUT_PULLUP, 0) /* (A16) I2C0_SDA */
158		>;
159	};
160
161	main_i2c1_pins_default: main-i2c1-default-pins {
162		pinctrl-single,pins = <
163			AM62AX_IOPAD(0x1e8, PIN_INPUT_PULLUP, 0) /* (B17) I2C1_SCL */
164			AM62AX_IOPAD(0x1ec, PIN_INPUT_PULLUP, 0) /* (A17) I2C1_SDA */
165		>;
166	};
167
168	main_i2c2_pins_default: main-i2c2-default-pins {
169		pinctrl-single,pins = <
170			AM62AX_IOPAD(0x0b0, PIN_INPUT_PULLUP, 1) /* (K22) GPMC0_CSn2.I2C2_SCL */
171			AM62AX_IOPAD(0x0b4, PIN_INPUT_PULLUP, 1) /* (K24) GPMC0_CSn3.I2C2_SDA */
172		>;
173	};
174
175	main_mmc1_pins_default: main-mmc1-default-pins {
176		pinctrl-single,pins = <
177			AM62AX_IOPAD(0x23c, PIN_INPUT, 0) /* (A21) MMC1_CMD */
178			AM62AX_IOPAD(0x234, PIN_INPUT, 0) /* (B22) MMC1_CLK */
179			AM62AX_IOPAD(0x230, PIN_INPUT, 0) /* (A22) MMC1_DAT0 */
180			AM62AX_IOPAD(0x22c, PIN_INPUT, 0) /* (B21) MMC1_DAT1 */
181			AM62AX_IOPAD(0x228, PIN_INPUT, 0) /* (C21) MMC1_DAT2 */
182			AM62AX_IOPAD(0x224, PIN_INPUT, 0) /* (D22) MMC1_DAT3 */
183			AM62AX_IOPAD(0x240, PIN_INPUT, 0) /* (D17) MMC1_SDCD */
184		>;
185	};
186
187	usr_led_pins_default: usr-led-default-pins {
188		pinctrl-single,pins = <
189			AM62AX_IOPAD(0x244, PIN_OUTPUT, 7) /* (D18) MMC1_SDWP.GPIO1_49 */
190		>;
191	};
192
193	main_usb1_pins_default: main-usb1-default-pins {
194		pinctrl-single,pins = <
195			AM62AX_IOPAD(0x0258, PIN_OUTPUT, 0) /* (F18) USB1_DRVVBUS */
196		>;
197	};
198
199	main_mdio1_pins_default: main-mdio1-default-pins {
200		pinctrl-single,pins = <
201			AM62AX_IOPAD(0x160, PIN_OUTPUT, 0) /* (V12) MDIO0_MDC */
202			AM62AX_IOPAD(0x15c, PIN_INPUT, 0) /* (V13) MDIO0_MDIO */
203		>;
204	};
205
206	main_rgmii1_pins_default: main-rgmii1-default-pins {
207		pinctrl-single,pins = <
208			AM62AX_IOPAD(0x14c, PIN_INPUT, 0) /* (AB16) RGMII1_RD0 */
209			AM62AX_IOPAD(0x150, PIN_INPUT, 0) /* (V15) RGMII1_RD1 */
210			AM62AX_IOPAD(0x154, PIN_INPUT, 0) /* (W15) RGMII1_RD2 */
211			AM62AX_IOPAD(0x158, PIN_INPUT, 0) /* (V14) RGMII1_RD3 */
212			AM62AX_IOPAD(0x148, PIN_INPUT, 0) /* (AA16) RGMII1_RXC */
213			AM62AX_IOPAD(0x144, PIN_INPUT, 0) /* (AA15) RGMII1_RX_CTL */
214			AM62AX_IOPAD(0x134, PIN_INPUT, 0) /* (Y17) RGMII1_TD0 */
215			AM62AX_IOPAD(0x138, PIN_INPUT, 0) /* (V16) RGMII1_TD1 */
216			AM62AX_IOPAD(0x13c, PIN_INPUT, 0) /* (Y16) RGMII1_TD2 */
217			AM62AX_IOPAD(0x140, PIN_INPUT, 0) /* (AA17) RGMII1_TD3 */
218			AM62AX_IOPAD(0x130, PIN_INPUT, 0) /* (AB17) RGMII1_TXC */
219			AM62AX_IOPAD(0x12c, PIN_INPUT, 0) /* (W16) RGMII1_TX_CTL */
220		>;
221	};
222};
223
224&main_i2c0 {
225	status = "okay";
226	pinctrl-names = "default";
227	pinctrl-0 = <&main_i2c0_pins_default>;
228	clock-frequency = <400000>;
229
230	typec_pd0: usb-power-controller@3f {
231		compatible = "ti,tps6598x";
232		reg = <0x3f>;
233
234		connector {
235			compatible = "usb-c-connector";
236			label = "USB-C";
237			self-powered;
238			data-role = "dual";
239			power-role = "sink";
240			port {
241				usb_con_hs: endpoint {
242					remote-endpoint = <&usb0_hs_ep>;
243				};
244			};
245		};
246	};
247};
248
249&main_i2c1 {
250	status = "okay";
251	pinctrl-names = "default";
252	pinctrl-0 = <&main_i2c1_pins_default>;
253	clock-frequency = <100000>;
254
255	exp1: gpio@22 {
256		compatible = "ti,tca6424";
257		reg = <0x22>;
258		gpio-controller;
259		#gpio-cells = <2>;
260
261		gpio-line-names = "GPIO_CPSW2_RST", "GPIO_CPSW1_RST",
262				   "BT_EN_SOC", "MMC1_SD_EN",
263				   "VPP_EN", "EXP_PS_3V3_En",
264				   "EXP_PS_5V0_En", "EXP_HAT_DETECT",
265				   "GPIO_AUD_RSTn", "GPIO_eMMC_RSTn",
266				   "UART1_FET_BUF_EN", "BT_UART_WAKE_SOC",
267				   "GPIO_HDMI_RSTn", "CSI_GPIO0",
268				   "CSI_GPIO1", "WLAN_ALERTn",
269				   "HDMI_INTn", "TEST_GPIO2",
270				   "MCASP1_FET_EN", "MCASP1_BUF_BT_EN",
271				   "MCASP1_FET_SEL", "UART1_FET_SEL",
272				   "PD_I2C_IRQ", "IO_EXP_TEST_LED";
273	};
274};
275
276&sdhci1 {
277	/* SD/MMC */
278	status = "okay";
279	vmmc-supply = <&vdd_mmc1>;
280	pinctrl-names = "default";
281	pinctrl-0 = <&main_mmc1_pins_default>;
282	ti,driver-strength-ohm = <50>;
283	disable-wp;
284};
285
286&main_gpio0 {
287	status = "okay";
288};
289
290&main_gpio1 {
291	status = "okay";
292};
293
294&main_gpio_intr {
295	status = "okay";
296};
297
298&main_uart0 {
299	status = "okay";
300	pinctrl-names = "default";
301	pinctrl-0 = <&main_uart0_pins_default>;
302};
303
304/* Main UART1 is used for TIFS firmware logs */
305&main_uart1 {
306	pinctrl-names = "default";
307	pinctrl-0 = <&main_uart1_pins_default>;
308	status = "reserved";
309};
310
311&usbss0 {
312	status = "okay";
313	ti,vbus-divider;
314};
315
316&usb0 {
317	usb-role-switch;
318
319	port {
320		usb0_hs_ep: endpoint {
321			remote-endpoint = <&usb_con_hs>;
322		};
323	};
324};
325
326&usbss1 {
327	status = "okay";
328};
329
330&usb1 {
331	dr_mode = "host";
332	pinctrl-names = "default";
333	pinctrl-0 = <&main_usb1_pins_default>;
334};
335
336&cpsw3g {
337	status = "okay";
338	pinctrl-names = "default";
339	pinctrl-0 = <&main_rgmii1_pins_default>;
340};
341
342&cpsw_port1 {
343	status = "okay";
344	phy-mode = "rgmii-rxid";
345	phy-handle = <&cpsw3g_phy0>;
346};
347
348&cpsw_port2 {
349	status = "disabled";
350};
351
352&cpsw3g_mdio {
353	status = "okay";
354	pinctrl-names = "default";
355	pinctrl-0 = <&main_mdio1_pins_default>;
356
357	cpsw3g_phy0: ethernet-phy@0 {
358		reg = <0>;
359		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
360		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
361		ti,min-output-impedance;
362	};
363};
364