1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2021 PHYTEC America, LLC - https://www.phytec.com
4 * Author: Matt McKee <mmckee@phytec.com>
5 *
6 * Copyright (C) 2022 PHYTEC Messtechnik GmbH
7 * Author: Wadim Egorov <w.egorov@phytec.de>
8 *
9 * Product homepage:
10 * https://www.phytec.com/product/phyboard-am64x
11 */
12
13/dts-v1/;
14
15#include <dt-bindings/gpio/gpio.h>
16#include <dt-bindings/input/input.h>
17#include <dt-bindings/leds/common.h>
18#include <dt-bindings/leds/leds-pca9532.h>
19#include <dt-bindings/phy/phy.h>
20#include "k3-am642.dtsi"
21#include "k3-am64-phycore-som.dtsi"
22
23#include "k3-serdes.h"
24
25/ {
26	compatible = "phytec,am642-phyboard-electra-rdk",
27		     "phytec,am64-phycore-som", "ti,am642";
28	model = "PHYTEC phyBOARD-Electra-AM64x RDK";
29
30	aliases {
31		mmc1 = &sdhci1;
32		serial2 = &main_uart0;
33		serial3 = &main_uart1;
34	};
35
36	chosen {
37		stdout-path = &main_uart0;
38	};
39
40	can_tc1: can-phy0 {
41		compatible = "ti,tcan1042";
42		pinctrl-names = "default";
43		pinctrl-0 = <&can_tc1_pins_default>;
44		#phy-cells = <0>;
45		max-bitrate = <5000000>;
46		standby-gpios = <&main_gpio0 32 GPIO_ACTIVE_HIGH>;
47	};
48
49	can_tc2: can-phy1 {
50		compatible = "ti,tcan1042";
51		pinctrl-names = "default";
52		pinctrl-0 = <&can_tc2_pins_default>;
53		#phy-cells = <0>;
54		max-bitrate = <5000000>;
55		standby-gpios = <&main_gpio0 35 GPIO_ACTIVE_HIGH>;
56	};
57
58	keys {
59		compatible = "gpio-keys";
60		autorepeat;
61		pinctrl-names = "default";
62		pinctrl-0 = <&gpio_keys_pins_default>;
63
64		key-home {
65			label = "home";
66			linux,code = <KEY_HOME>;
67			gpios = <&main_gpio0 17 GPIO_ACTIVE_HIGH>;
68		};
69
70		key-menu {
71			label = "menu";
72			linux,code = <KEY_MENU>;
73			gpios = <&main_gpio0 21 GPIO_ACTIVE_HIGH>;
74		};
75	};
76
77	leds {
78		compatible = "gpio-leds";
79		pinctrl-names = "default";
80		pinctrl-0 = <&leds_pins_default>, <&user_leds_pins_default>;
81
82		led-1 {
83			color = <LED_COLOR_ID_RED>;
84			gpios = <&main_gpio0 15 GPIO_ACTIVE_HIGH>;
85			linux,default-trigger = "mmc0";
86			function = LED_FUNCTION_DISK;
87		};
88
89		led-2 {
90			color = <LED_COLOR_ID_GREEN>;
91			gpios = <&main_gpio0 16 GPIO_ACTIVE_HIGH>;
92			linux,default-trigger = "mmc1";
93			function = LED_FUNCTION_DISK;
94		};
95	};
96
97	vcc_3v3_mmc: regulator-sd {
98		/* TPS22963C */
99		compatible = "regulator-fixed";
100		regulator-name = "VCC_3V3_MMC";
101		regulator-min-microvolt = <3300000>;
102		regulator-max-microvolt = <3300000>;
103		regulator-boot-on;
104		regulator-always-on;
105	};
106};
107
108&main_pmx0 {
109	can_tc1_pins_default: can-tc1-default-pins {
110		pinctrl-single,pins = <
111			AM64X_IOPAD(0x0084, PIN_OUTPUT, 7)	/* (P16) GPMC0_ADVn_ALE.GPIO0_32 */
112		>;
113	};
114
115	can_tc2_pins_default: can-tc2-default-pins {
116		pinctrl-single,pins = <
117			AM64X_IOPAD(0x0090, PIN_OUTPUT, 7)	/* (P17) GPMC0_BE0n_CLE.GPIO0_35 */
118		>;
119	};
120
121	gpio_keys_pins_default: gpio-keys-default-pins {
122		pinctrl-single,pins = <
123			AM64X_IOPAD(0x0044, PIN_INPUT, 7)	/* (T18) GPMC0_AD2.GPIO0_17 */
124			AM64X_IOPAD(0x0054, PIN_INPUT, 7)	/* (V20) GPMC0_AD6.GPIO0_21 */
125		>;
126	};
127
128	main_i2c1_pins_default: main-i2c1-default-pins {
129		pinctrl-single,pins = <
130			AM64X_IOPAD(0x0268, PIN_INPUT, 0)	/* (C18) I2C1_SCL */
131			AM64X_IOPAD(0x026c, PIN_INPUT, 0)	/* (B19) I2C1_SDA */
132		>;
133	};
134
135	main_mcan0_pins_default: main-mcan0-default-pins {
136		pinctrl-single,pins = <
137			AM64X_IOPAD(0x0250, PIN_OUTPUT, 0)	/* (A17) MCAN0_TX */
138			AM64X_IOPAD(0x0254, PIN_INPUT, 0)	/* (B17) MCAN0_RX */
139		>;
140	};
141
142	main_mcan1_pins_default: main-mcan1-default-pins {
143		pinctrl-single,pins = <
144			AM64X_IOPAD(0x0258, PIN_OUTPUT, 0)	/* (C17) MCAN1_TX */
145			AM64X_IOPAD(0x025c, PIN_INPUT, 0)	/* (D17) MCAN1_RX */
146		>;
147	};
148
149	main_mmc1_pins_default: main-mmc1-default-pins {
150		pinctrl-single,pins = <
151			AM64X_IOPAD(0x027c, PIN_INPUT_PULLUP, 0)	/* (K18) MMC1_DAT3 */
152			AM64X_IOPAD(0x0280, PIN_INPUT_PULLUP, 0)	/* (K19) MMC1_DAT2 */
153			AM64X_IOPAD(0x0284, PIN_INPUT_PULLUP, 0)	/* (L21) MMC1_DAT1 */
154			AM64X_IOPAD(0x0288, PIN_INPUT_PULLUP, 0)	/* (K21) MMC1_DAT0 */
155			AM64X_IOPAD(0x028c, PIN_INPUT_PULLDOWN, 0)	/* (L20) MMC1_CLK */
156			AM64X_IOPAD(0x0290, PIN_INPUT, 0)		/* MMC1_CLKLB */
157			AM64X_IOPAD(0x0294, PIN_INPUT_PULLUP, 0)	/* (J19) MMC1_CMD */
158			AM64X_IOPAD(0x0298, PIN_INPUT_PULLUP, 0)	/* (D19) MMC1_SDCD */
159		>;
160	};
161
162	main_uart0_pins_default: main-uart0-default-pins {
163		pinctrl-single,pins = <
164			AM64X_IOPAD(0x0230, PIN_INPUT, 0)	/* (D15) UART0_RXD */
165			AM64X_IOPAD(0x0234, PIN_OUTPUT, 0)	/* (C16) UART0_TXD */
166		>;
167	};
168
169	main_uart1_pins_default: main-uart1-default-pins {
170		pinctrl-single,pins = <
171			AM64X_IOPAD(0x0248, PIN_INPUT, 0)	/* (D16) UART1_CTSn */
172			AM64X_IOPAD(0x024C, PIN_OUTPUT, 0)	/* (E16) UART1_RTSn */
173			AM64X_IOPAD(0x0240, PIN_INPUT, 0)	/* (E15) UART1_RXD */
174			AM64X_IOPAD(0x0244, PIN_OUTPUT, 0)	/* (E14) UART1_TXD */
175		>;
176	};
177
178	main_usb0_pins_default: main-usb0-default-pins {
179		pinctrl-single,pins = <
180			AM64X_IOPAD(0x02a8, PIN_OUTPUT, 0)	/* (E19) USB0_DRVVBUS */
181		>;
182	};
183
184	pcie_usb_sel_pins_default: pcie-usb-sel-default-pins {
185		pinctrl-single,pins = <
186			AM64X_IOPAD(0x017c, PIN_OUTPUT, 7)	/* (T1) PRG0_PRU0_GPO7.GPIO1_7 */
187		>;
188	};
189
190	pcie0_pins_default: pcie0-default-pins {
191		pinctrl-single,pins = <
192			AM64X_IOPAD(0x0098, PIN_OUTPUT, 7)	/* (W19) GPMC0_WAIT0.GPIO0_37 */
193		>;
194	};
195
196	user_leds_pins_default: user-leds-default-pins {
197		pinctrl-single,pins = <
198			AM64X_IOPAD(0x003c, PIN_OUTPUT, 7)	/* (T20) GPMC0_AD0.GPIO0_15 */
199			AM64X_IOPAD(0x0040, PIN_OUTPUT, 7)	/* (U21) GPMC0_AD1.GPIO0_16 */
200		>;
201	};
202};
203
204&main_i2c1 {
205	status = "okay";
206	pinctrl-names = "default";
207	pinctrl-0 = <&main_i2c1_pins_default>;
208	clock-frequency = <400000>;
209
210	eeprom@51 {
211		compatible = "atmel,24c02";
212		pagesize = <16>;
213		reg = <0x51>;
214	};
215
216	led-controller@62 {
217		compatible = "nxp,pca9533";
218		reg = <0x62>;
219
220		led-3 {
221			label = "red:user";
222			type = <PCA9532_TYPE_LED>;
223		};
224
225		led-4 {
226			label = "green:user";
227			type = <PCA9532_TYPE_LED>;
228		};
229
230		led-5 {
231			label = "blue:user";
232			type = <PCA9532_TYPE_LED>;
233		};
234	};
235};
236
237&main_mcan0 {
238	status = "okay";
239	pinctrl-names = "default";
240	pinctrl-0 = <&main_mcan0_pins_default>;
241	phys = <&can_tc1>;
242};
243
244&main_mcan1 {
245	status = "okay";
246	pinctrl-names = "default";
247	pinctrl-0 = <&main_mcan1_pins_default>;
248	phys = <&can_tc2>;
249};
250
251&main_uart0 {
252	status = "okay";
253	pinctrl-names = "default";
254	pinctrl-0 = <&main_uart0_pins_default>;
255	current-speed = <115200>;
256};
257
258&main_uart1 {
259	status = "okay";
260	pinctrl-names = "default";
261	pinctrl-0 = <&main_uart1_pins_default>;
262	uart-has-rtscts;
263	current-speed = <115200>;
264};
265
266&sdhci1 {
267	status = "okay";
268	vmmc-supply = <&vcc_3v3_mmc>;
269	pinctrl-names = "default";
270	pinctrl-0 = <&main_mmc1_pins_default>;
271	bus-width = <4>;
272	ti,driver-strength-ohm = <50>;
273	disable-wp;
274	no-1-8-v;
275};
276
277&serdes0 {
278	serdes0_pcie_usb_link: phy@0 {
279		reg = <0>;
280		cdns,num-lanes = <1>;
281		#phy-cells = <0>;
282		cdns,phy-type = <PHY_TYPE_USB3>;
283		resets = <&serdes_wiz0 1>;
284	};
285};
286
287&serdes_ln_ctrl {
288	idle-states = <AM64_SERDES0_LANE0_USB>;
289};
290
291&usbss0 {
292	ti,vbus-divider;
293};
294
295&usb0 {
296	pinctrl-names = "default";
297	pinctrl-0 = <&main_usb0_pins_default>;
298	dr_mode = "host";
299	maximum-speed = "super-speed";
300	phys = <&serdes0_pcie_usb_link>;
301	phy-names = "cdns3,usb3-phy";
302};
303