1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
4 *
5 * Common Processor Board: https://www.ti.com/tool/J721EXCPXEVM
6 */
7
8/dts-v1/;
9
10#include "k3-j721s2-som-p0.dtsi"
11#include <dt-bindings/net/ti-dp83867.h>
12#include <dt-bindings/phy/phy-cadence.h>
13#include <dt-bindings/phy/phy.h>
14
15#include "k3-serdes.h"
16
17/ {
18	compatible = "ti,j721s2-evm", "ti,j721s2";
19	model = "Texas Instruments J721S2 EVM";
20
21	chosen {
22		stdout-path = "serial2:115200n8";
23	};
24
25	aliases {
26		serial1 = &mcu_uart0;
27		serial2 = &main_uart8;
28		mmc0 = &main_sdhci0;
29		mmc1 = &main_sdhci1;
30		can0 = &main_mcan16;
31		can1 = &mcu_mcan0;
32		can2 = &mcu_mcan1;
33		can3 = &main_mcan3;
34		can4 = &main_mcan5;
35	};
36
37	evm_12v0: fixedregulator-evm12v0 {
38		/* main supply */
39		compatible = "regulator-fixed";
40		regulator-name = "evm_12v0";
41		regulator-min-microvolt = <12000000>;
42		regulator-max-microvolt = <12000000>;
43		regulator-always-on;
44		regulator-boot-on;
45	};
46
47	vsys_3v3: fixedregulator-vsys3v3 {
48		/* Output of LM5140 */
49		compatible = "regulator-fixed";
50		regulator-name = "vsys_3v3";
51		regulator-min-microvolt = <3300000>;
52		regulator-max-microvolt = <3300000>;
53		vin-supply = <&evm_12v0>;
54		regulator-always-on;
55		regulator-boot-on;
56	};
57
58	vsys_5v0: fixedregulator-vsys5v0 {
59		/* Output of LM5140 */
60		compatible = "regulator-fixed";
61		regulator-name = "vsys_5v0";
62		regulator-min-microvolt = <5000000>;
63		regulator-max-microvolt = <5000000>;
64		vin-supply = <&evm_12v0>;
65		regulator-always-on;
66		regulator-boot-on;
67	};
68
69	vdd_mmc1: fixedregulator-sd {
70		/* Output of TPS22918 */
71		compatible = "regulator-fixed";
72		regulator-name = "vdd_mmc1";
73		regulator-min-microvolt = <3300000>;
74		regulator-max-microvolt = <3300000>;
75		regulator-boot-on;
76		enable-active-high;
77		vin-supply = <&vsys_3v3>;
78		gpio = <&exp2 2 GPIO_ACTIVE_HIGH>;
79	};
80
81	vdd_sd_dv: gpio-regulator-TLV71033 {
82		/* Output of TLV71033 */
83		compatible = "regulator-gpio";
84		regulator-name = "tlv71033";
85		pinctrl-names = "default";
86		pinctrl-0 = <&vdd_sd_dv_pins_default>;
87		regulator-min-microvolt = <1800000>;
88		regulator-max-microvolt = <3300000>;
89		regulator-boot-on;
90		vin-supply = <&vsys_5v0>;
91		gpios = <&main_gpio0 8 GPIO_ACTIVE_HIGH>;
92		states = <1800000 0x0>,
93			 <3300000 0x1>;
94	};
95
96	transceiver1: can-phy1 {
97		compatible = "ti,tcan1043";
98		#phy-cells = <0>;
99		max-bitrate = <5000000>;
100		pinctrl-names = "default";
101		pinctrl-0 = <&mcu_mcan0_gpio_pins_default>;
102		standby-gpios = <&wkup_gpio0 69 GPIO_ACTIVE_LOW>;
103		enable-gpios = <&wkup_gpio0 0 GPIO_ACTIVE_HIGH>;
104	};
105
106	transceiver2: can-phy2 {
107		compatible = "ti,tcan1042";
108		#phy-cells = <0>;
109		max-bitrate = <5000000>;
110		pinctrl-names = "default";
111		pinctrl-0 = <&mcu_mcan1_gpio_pins_default>;
112		standby-gpios = <&wkup_gpio0 2 GPIO_ACTIVE_HIGH>;
113	};
114
115	transceiver3: can-phy3 {
116		compatible = "ti,tcan1043";
117		#phy-cells = <0>;
118		max-bitrate = <5000000>;
119		standby-gpios = <&exp2 7 GPIO_ACTIVE_LOW>;
120		enable-gpios = <&exp2 6 GPIO_ACTIVE_HIGH>;
121		mux-states = <&mux0 1>;
122	};
123
124	transceiver4: can-phy4 {
125		compatible = "ti,tcan1042";
126		#phy-cells = <0>;
127		max-bitrate = <5000000>;
128		standby-gpios = <&exp_som 7 GPIO_ACTIVE_HIGH>;
129		mux-states = <&mux1 1>;
130	};
131};
132
133&main_pmx0 {
134	main_uart8_pins_default: main-uart8-default-pins {
135		pinctrl-single,pins = <
136			J721S2_IOPAD(0x040, PIN_INPUT, 14) /* (AC28) MCASP0_AXR0.UART8_CTSn */
137			J721S2_IOPAD(0x044, PIN_OUTPUT, 14) /* (Y26) MCASP0_AXR1.UART8_RTSn */
138			J721S2_IOPAD(0x0d0, PIN_INPUT, 11) /* (AF26) SPI0_CS1.UART8_RXD */
139			J721S2_IOPAD(0x0d4, PIN_OUTPUT, 11) /* (AH27) SPI0_CLK.UART8_TXD */
140		>;
141	};
142
143	main_i2c3_pins_default: main-i2c3-default-pins {
144		pinctrl-single,pins = <
145			J721S2_IOPAD(0x064, PIN_INPUT_PULLUP, 13) /* (W28) MCAN0_TX.I2C3_SCL */
146			J721S2_IOPAD(0x060, PIN_INPUT_PULLUP, 13) /* (AC27) MCASP2_AXR1.I2C3_SDA */
147		>;
148	};
149
150	main_mmc1_pins_default: main-mmc1-default-pins {
151		pinctrl-single,pins = <
152			J721S2_IOPAD(0x104, PIN_INPUT, 0) /* (P23) MMC1_CLK */
153			J721S2_IOPAD(0x108, PIN_INPUT, 0) /* (N24) MMC1_CMD */
154			J721S2_IOPAD(0x100, PIN_INPUT, 0) /* (###) MMC1_CLKLB */
155			J721S2_IOPAD(0x0fc, PIN_INPUT, 0) /* (M23) MMC1_DAT0 */
156			J721S2_IOPAD(0x0f8, PIN_INPUT, 0) /* (P24) MMC1_DAT1 */
157			J721S2_IOPAD(0x0f4, PIN_INPUT, 0) /* (R24) MMC1_DAT2 */
158			J721S2_IOPAD(0x0f0, PIN_INPUT, 0) /* (R22) MMC1_DAT3 */
159			J721S2_IOPAD(0x0e8, PIN_INPUT, 8) /* (AE25) TIMER_IO0.MMC1_SDCD */
160		>;
161	};
162
163	vdd_sd_dv_pins_default: vdd-sd-dv-default-pins {
164		pinctrl-single,pins = <
165			J721S2_IOPAD(0x020, PIN_INPUT, 7) /* (AA23) MCAN15_RX.GPIO0_8 */
166		>;
167	};
168
169	main_usbss0_pins_default: main-usbss0-default-pins {
170		pinctrl-single,pins = <
171			J721S2_IOPAD(0x0ec, PIN_OUTPUT, 6) /* (AG25) TIMER_IO1.USB0_DRVVBUS */
172		>;
173	};
174
175	main_mcan3_pins_default: main-mcan3-default-pins {
176		pinctrl-single,pins = <
177			J721S2_IOPAD(0x080, PIN_INPUT, 0) /* (U26) MCASP0_AXR4.MCAN3_RX */
178			J721S2_IOPAD(0x07c, PIN_OUTPUT, 0) /* (T27) MCASP0_AXR3.MCAN3_TX */
179		>;
180	};
181
182	main_mcan5_pins_default: main-mcan5-default-pins {
183		pinctrl-single,pins = <
184			J721S2_IOPAD(0x03c, PIN_INPUT, 0) /* (U27) MCASP0_AFSX.MCAN5_RX */
185			J721S2_IOPAD(0x038, PIN_OUTPUT, 0) /* (AB28) MCASP0_ACLKX.MCAN5_TX */
186		>;
187	};
188};
189
190&wkup_pmx2 {
191	wkup_uart0_pins_default: wkup-uart0-default-pins {
192		pinctrl-single,pins = <
193			J721S2_WKUP_IOPAD(0x048, PIN_INPUT, 0) /* (D28) WKUP_UART0_RXD */
194			J721S2_WKUP_IOPAD(0x04c, PIN_OUTPUT, 0) /* (D27) WKUP_UART0_TXD */
195		>;
196	};
197
198	mcu_uart0_pins_default: mcu-uart0-default-pins {
199		pinctrl-single,pins = <
200			J721S2_WKUP_IOPAD(0x090, PIN_INPUT, 0) /* (B24) WKUP_GPIO0_14.MCU_UART0_CTSn */
201			J721S2_WKUP_IOPAD(0x094, PIN_OUTPUT, 0) /* (D25) WKUP_GPIO0_15.MCU_UART0_RTSn */
202			J721S2_WKUP_IOPAD(0x08c, PIN_INPUT, 0) /* (C24) WKUP_GPIO0_13.MCU_UART0_RXD */
203			J721S2_WKUP_IOPAD(0x088, PIN_OUTPUT, 0) /* (C25) WKUP_GPIO0_12.MCU_UART0_TXD */
204		>;
205	};
206
207	mcu_cpsw_pins_default: mcu-cpsw-default-pins {
208		pinctrl-single,pins = <
209			J721S2_WKUP_IOPAD(0x02c, PIN_INPUT, 0) /* (B22) MCU_RGMII1_RD0 */
210			J721S2_WKUP_IOPAD(0x028, PIN_INPUT, 0) /* (B21) MCU_RGMII1_RD1 */
211			J721S2_WKUP_IOPAD(0x024, PIN_INPUT, 0) /* (C22) MCU_RGMII1_RD2 */
212			J721S2_WKUP_IOPAD(0x020, PIN_INPUT, 0) /* (D23) MCU_RGMII1_RD3 */
213			J721S2_WKUP_IOPAD(0x01c, PIN_INPUT, 0) /* (D22) MCU_RGMII1_RXC */
214			J721S2_WKUP_IOPAD(0x004, PIN_INPUT, 0) /* (E23) MCU_RGMII1_RX_CTL */
215			J721S2_WKUP_IOPAD(0x014, PIN_OUTPUT, 0) /* (F23) MCU_RGMII1_TD0 */
216			J721S2_WKUP_IOPAD(0x010, PIN_OUTPUT, 0) /* (G22) MCU_RGMII1_TD1 */
217			J721S2_WKUP_IOPAD(0x00c, PIN_OUTPUT, 0) /* (E21) MCU_RGMII1_TD2 */
218			J721S2_WKUP_IOPAD(0x008, PIN_OUTPUT, 0) /* (E22) MCU_RGMII1_TD3 */
219			J721S2_WKUP_IOPAD(0x018, PIN_OUTPUT, 0) /* (F21) MCU_RGMII1_TXC */
220			J721S2_WKUP_IOPAD(0x000, PIN_OUTPUT, 0) /* (F22) MCU_RGMII1_TX_CTL */
221		>;
222	};
223
224	mcu_mdio_pins_default: mcu-mdio-default-pins {
225		pinctrl-single,pins = <
226			J721S2_WKUP_IOPAD(0x034, PIN_OUTPUT, 0) /* (A21) MCU_MDIO0_MDC */
227			J721S2_WKUP_IOPAD(0x030, PIN_INPUT, 0) /* (A22) MCU_MDIO0_MDIO */
228		>;
229	};
230
231	mcu_mcan0_pins_default: mcu-mcan0-default-pins {
232		pinctrl-single,pins = <
233			J721S2_WKUP_IOPAD(0x054, PIN_INPUT, 0) /* (E28) MCU_MCAN0_RX */
234			J721S2_WKUP_IOPAD(0x050, PIN_OUTPUT, 0) /* (E27) MCU_MCAN0_TX */
235		>;
236	};
237
238	mcu_mcan1_pins_default: mcu-mcan1-default-pins {
239		pinctrl-single,pins = <
240			J721S2_WKUP_IOPAD(0x06c, PIN_INPUT, 0) /* (F26) WKUP_GPIO0_5.MCU_MCAN1_RX */
241			J721S2_WKUP_IOPAD(0x068, PIN_OUTPUT, 0) /*(C23) WKUP_GPIO0_4.MCU_MCAN1_TX */
242		>;
243	};
244
245	mcu_mcan0_gpio_pins_default: mcu-mcan0-gpio-default-pins {
246		pinctrl-single,pins = <
247			J721S2_WKUP_IOPAD(0x058, PIN_INPUT, 7) /* (D26) WKUP_GPIO0_0 */
248			J721S2_WKUP_IOPAD(0x040, PIN_INPUT, 7) /* (B25) MCU_SPI0_D1.WKUP_GPIO0_69 */
249		>;
250	};
251
252	mcu_mcan1_gpio_pins_default: mcu-mcan1-gpio-default-pins {
253		pinctrl-single,pins = <
254			J721S2_WKUP_IOPAD(0x060, PIN_INPUT, 7) /* (C28) WKUP_GPIO0_2 */
255		>;
256	};
257
258	mcu_adc0_pins_default: mcu-adc0-default-pins {
259		pinctrl-single,pins = <
260			J721S2_WKUP_IOPAD(0x0cc, PIN_INPUT, 0) /* (L25) MCU_ADC0_AIN0 */
261			J721S2_WKUP_IOPAD(0x0d0, PIN_INPUT, 0) /* (K25) MCU_ADC0_AIN1 */
262			J721S2_WKUP_IOPAD(0x0d4, PIN_INPUT, 0) /* (M24) MCU_ADC0_AIN2 */
263			J721S2_WKUP_IOPAD(0x0d8, PIN_INPUT, 0) /* (L24) MCU_ADC0_AIN3 */
264			J721S2_WKUP_IOPAD(0x0dc, PIN_INPUT, 0) /* (L27) MCU_ADC0_AIN4 */
265			J721S2_WKUP_IOPAD(0x0e0, PIN_INPUT, 0) /* (K24) MCU_ADC0_AIN5 */
266			J721S2_WKUP_IOPAD(0x0e4, PIN_INPUT, 0) /* (M27) MCU_ADC0_AIN6 */
267			J721S2_WKUP_IOPAD(0x0e8, PIN_INPUT, 0) /* (M26) MCU_ADC0_AIN7 */
268		>;
269	};
270
271	mcu_adc1_pins_default: mcu-adc1-default-pins {
272		pinctrl-single,pins = <
273			J721S2_WKUP_IOPAD(0x0ec, PIN_INPUT, 0) /* (P25) MCU_ADC1_AIN0 */
274			J721S2_WKUP_IOPAD(0x0f0, PIN_INPUT, 0) /* (R25) MCU_ADC1_AIN1 */
275			J721S2_WKUP_IOPAD(0x0f4, PIN_INPUT, 0) /* (P28) MCU_ADC1_AIN2 */
276			J721S2_WKUP_IOPAD(0x0f8, PIN_INPUT, 0) /* (P27) MCU_ADC1_AIN3 */
277			J721S2_WKUP_IOPAD(0x0fc, PIN_INPUT, 0) /* (N25) MCU_ADC1_AIN4 */
278			J721S2_WKUP_IOPAD(0x100, PIN_INPUT, 0) /* (P26) MCU_ADC1_AIN5 */
279			J721S2_WKUP_IOPAD(0x104, PIN_INPUT, 0) /* (N26) MCU_ADC1_AIN6 */
280			J721S2_WKUP_IOPAD(0x108, PIN_INPUT, 0) /* (N27) MCU_ADC1_AIN7 */
281		>;
282	};
283};
284
285&wkup_pmx1 {
286	mcu_fss0_ospi1_pins_default: mcu-fss0-ospi1-default-pins {
287		pinctrl-single,pins = <
288			J721S2_WKUP_IOPAD(0x008, PIN_OUTPUT, 0) /* (A19) MCU_OSPI1_CLK */
289			J721S2_WKUP_IOPAD(0x024, PIN_OUTPUT, 0) /* (D20) MCU_OSPI1_CSn0 */
290			J721S2_WKUP_IOPAD(0x014, PIN_INPUT, 0) /* (D21) MCU_OSPI1_D0 */
291			J721S2_WKUP_IOPAD(0x018, PIN_INPUT, 0) /* (G20) MCU_OSPI1_D1 */
292			J721S2_WKUP_IOPAD(0x01c, PIN_INPUT, 0) /* (C20) MCU_OSPI1_D2 */
293			J721S2_WKUP_IOPAD(0x020, PIN_INPUT, 0) /* (A20) MCU_OSPI1_D3 */
294			J721S2_WKUP_IOPAD(0x010, PIN_INPUT, 0) /* (B19) MCU_OSPI1_DQS */
295			J721S2_WKUP_IOPAD(0x00c, PIN_INPUT, 0) /* (B20) MCU_OSPI1_LBCLKO */
296		>;
297	};
298};
299
300&main_gpio0 {
301	status = "okay";
302};
303
304&wkup_gpio0 {
305	status = "okay";
306};
307
308&wkup_uart0 {
309	status = "reserved";
310	pinctrl-names = "default";
311	pinctrl-0 = <&wkup_uart0_pins_default>;
312};
313
314&mcu_uart0 {
315	status = "okay";
316	pinctrl-names = "default";
317	pinctrl-0 = <&mcu_uart0_pins_default>;
318};
319
320&main_uart8 {
321	status = "okay";
322	pinctrl-names = "default";
323	pinctrl-0 = <&main_uart8_pins_default>;
324	/* Shared with TFA on this platform */
325	power-domains = <&k3_pds 357 TI_SCI_PD_SHARED>;
326};
327
328&main_i2c0 {
329	clock-frequency = <400000>;
330
331	exp1: gpio@20 {
332		compatible = "ti,tca6416";
333		reg = <0x20>;
334		gpio-controller;
335		#gpio-cells = <2>;
336		gpio-line-names = "PCIE_2L_MODE_SEL", "PCIE_2L_PERSTZ", "PCIE_2L_RC_RSTZ",
337				  "PCIE_2L_EP_RST_EN", "PCIE_1L_MODE_SEL", "PCIE_1L_PERSTZ",
338				  "PCIE_1L_RC_RSTZ", "PCIE_1L_EP_RST_EN", "PCIE_2L_PRSNT#",
339				  "PCIE_1L_PRSNT#", "CDCI1_OE1/OE4", "CDCI1_OE2/OE3", "EXP_MUX1",
340				  "EXP_MUX2", "EXP_MUX3", "GESI_EXP_PHY_RSTz";
341	};
342
343	exp2: gpio@22 {
344		compatible = "ti,tca6424";
345		reg = <0x22>;
346		gpio-controller;
347		#gpio-cells = <2>;
348		gpio-line-names = "APPLE_AUTH_RSTZ", "MLB_RSTZ", "GPIO_USD_PWR_EN", "USBC_PWR_EN",
349				  "USBC_MODE_SEL1", "USBC_MODE_SEL0", "MCAN0_EN", "MCAN0_STB#",
350				  "MUX_SPAREMUX_SPARE", "MCASP/TRACE_MUX_S0", "MCASP/TRACE_MUX_S1",
351				  "MLB_MUX_SEL", "MCAN_MUX_SEL", "MCASP2/SPI3_MUX_SEL", "PCIe_CLKREQn_MUX_SEL",
352				  "CDCI2_RSTZ", "ENET_EXP_PWRDN", "ENET_EXP_RESETZ", "ENET_I2CMUX_SEL",
353				  "ENET_EXP_SPARE2", "M2PCIE_RTSZ", "USER_INPUT1", "USER_LED1", "USER_LED2";
354	};
355};
356
357&main_sdhci0 {
358	/* eMMC */
359	status = "okay";
360	non-removable;
361	ti,driver-strength-ohm = <50>;
362	disable-wp;
363};
364
365&main_sdhci1 {
366	/* SD card */
367	status = "okay";
368	pinctrl-0 = <&main_mmc1_pins_default>;
369	pinctrl-names = "default";
370	disable-wp;
371	vmmc-supply = <&vdd_mmc1>;
372	vqmmc-supply = <&vdd_sd_dv>;
373};
374
375&mcu_cpsw {
376	pinctrl-names = "default";
377	pinctrl-0 = <&mcu_cpsw_pins_default>, <&mcu_mdio_pins_default>;
378};
379
380&davinci_mdio {
381	phy0: ethernet-phy@0 {
382		reg = <0>;
383		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
384		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
385		ti,min-output-impedance;
386	};
387};
388
389&cpsw_port1 {
390	phy-mode = "rgmii-rxid";
391	phy-handle = <&phy0>;
392};
393
394&serdes_ln_ctrl {
395	idle-states = <J721S2_SERDES0_LANE0_PCIE1_LANE0>, <J721S2_SERDES0_LANE1_USB>,
396		      <J721S2_SERDES0_LANE2_EDP_LANE2>, <J721S2_SERDES0_LANE3_EDP_LANE3>;
397};
398
399&serdes_refclk {
400	clock-frequency = <100000000>;
401};
402
403&serdes0 {
404	status = "okay";
405	serdes0_pcie_link: phy@0 {
406		reg = <0>;
407		cdns,num-lanes = <1>;
408		#phy-cells = <0>;
409		cdns,phy-type = <PHY_TYPE_PCIE>;
410		resets = <&serdes_wiz0 1>;
411	};
412};
413
414&usb_serdes_mux {
415	idle-states = <1>; /* USB0 to SERDES lane 1 */
416};
417
418&usbss0 {
419	status = "okay";
420	pinctrl-0 = <&main_usbss0_pins_default>;
421	pinctrl-names = "default";
422	ti,vbus-divider;
423	ti,usb2-only;
424};
425
426&usb0 {
427	dr_mode = "otg";
428	maximum-speed = "high-speed";
429};
430
431&ospi1 {
432	status = "okay";
433	pinctrl-names = "default";
434	pinctrl-0 = <&mcu_fss0_ospi1_pins_default>;
435
436	flash@0 {
437		compatible = "jedec,spi-nor";
438		reg = <0x0>;
439		spi-tx-bus-width = <1>;
440		spi-rx-bus-width = <4>;
441		spi-max-frequency = <40000000>;
442		cdns,tshsl-ns = <60>;
443		cdns,tsd2d-ns = <60>;
444		cdns,tchsh-ns = <60>;
445		cdns,tslch-ns = <60>;
446		cdns,read-delay = <2>;
447	};
448};
449
450&pcie1_rc {
451	status = "okay";
452	reset-gpios = <&exp1 2 GPIO_ACTIVE_HIGH>;
453	phys = <&serdes0_pcie_link>;
454	phy-names = "pcie-phy";
455	num-lanes = <1>;
456};
457
458&mcu_mcan0 {
459	status = "okay";
460	pinctrl-names = "default";
461	pinctrl-0 = <&mcu_mcan0_pins_default>;
462	phys = <&transceiver1>;
463};
464
465&mcu_mcan1 {
466	status = "okay";
467	pinctrl-names = "default";
468	pinctrl-0 = <&mcu_mcan1_pins_default>;
469	phys = <&transceiver2>;
470};
471
472&tscadc0 {
473	pinctrl-0 = <&mcu_adc0_pins_default>;
474	pinctrl-names = "default";
475	status = "okay";
476	adc {
477		ti,adc-channels = <0 1 2 3 4 5 6 7>;
478	};
479};
480
481&tscadc1 {
482	pinctrl-0 = <&mcu_adc1_pins_default>;
483	pinctrl-names = "default";
484	status = "okay";
485	adc {
486		ti,adc-channels = <0 1 2 3 4 5 6 7>;
487	};
488};
489
490&main_mcan3 {
491	status = "okay";
492	pinctrl-names = "default";
493	pinctrl-0 = <&main_mcan3_pins_default>;
494	phys = <&transceiver3>;
495};
496
497&main_mcan5 {
498	status = "okay";
499	pinctrl-names = "default";
500	pinctrl-0 = <&main_mcan5_pins_default>;
501	phys = <&transceiver4>;
502};
503