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