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
231&main_i2c1 {
232	status = "okay";
233	pinctrl-names = "default";
234	pinctrl-0 = <&main_i2c1_pins_default>;
235	clock-frequency = <400000>;
236
237	exp1: gpio@22 {
238		compatible = "ti,tca6424";
239		reg = <0x22>;
240		gpio-controller;
241		#gpio-cells = <2>;
242
243		gpio-line-names = "GPIO_CPSW2_RST", "GPIO_CPSW1_RST",
244				   "BT_EN_SOC", "MMC1_SD_EN",
245				   "VPP_EN", "EXP_PS_3V3_En",
246				   "EXP_PS_5V0_En", "EXP_HAT_DETECT",
247				   "GPIO_AUD_RSTn", "GPIO_eMMC_RSTn",
248				   "UART1_FET_BUF_EN", "BT_UART_WAKE_SOC",
249				   "GPIO_HDMI_RSTn", "CSI_GPIO0",
250				   "CSI_GPIO1", "WLAN_ALERTn",
251				   "HDMI_INTn", "TEST_GPIO2",
252				   "MCASP1_FET_EN", "MCASP1_BUF_BT_EN",
253				   "MCASP1_FET_SEL", "UART1_FET_SEL",
254				   "PD_I2C_IRQ", "IO_EXP_TEST_LED";
255	};
256};
257
258&sdhci1 {
259	/* SD/MMC */
260	status = "okay";
261	vmmc-supply = <&vdd_mmc1>;
262	pinctrl-names = "default";
263	pinctrl-0 = <&main_mmc1_pins_default>;
264	ti,driver-strength-ohm = <50>;
265	disable-wp;
266};
267
268&main_gpio0 {
269	status = "okay";
270};
271
272&main_gpio1 {
273	status = "okay";
274};
275
276&main_gpio_intr {
277	status = "okay";
278};
279
280&main_uart0 {
281	status = "okay";
282	pinctrl-names = "default";
283	pinctrl-0 = <&main_uart0_pins_default>;
284};
285
286/* Main UART1 is used for TIFS firmware logs */
287&main_uart1 {
288	pinctrl-names = "default";
289	pinctrl-0 = <&main_uart1_pins_default>;
290	status = "reserved";
291};
292
293&usbss1 {
294	status = "okay";
295};
296
297&usb1 {
298	dr_mode = "host";
299	pinctrl-names = "default";
300	pinctrl-0 = <&main_usb1_pins_default>;
301};
302
303&cpsw3g {
304	status = "okay";
305	pinctrl-names = "default";
306	pinctrl-0 = <&main_rgmii1_pins_default>;
307};
308
309&cpsw_port1 {
310	status = "okay";
311	phy-mode = "rgmii-rxid";
312	phy-handle = <&cpsw3g_phy0>;
313};
314
315&cpsw_port2 {
316	status = "disabled";
317};
318
319&cpsw3g_mdio {
320	status = "okay";
321	pinctrl-names = "default";
322	pinctrl-0 = <&main_mdio1_pins_default>;
323
324	cpsw3g_phy0: ethernet-phy@0 {
325		reg = <0>;
326		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
327		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
328		ti,min-output-impedance;
329	};
330};
331