1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2022 - 2023 PHYTEC Messtechnik GmbH
4 * Author: Wadim Egorov <w.egorov@phytec.de>
5 *
6 * Product homepage:
7 * https://www.phytec.com/product/phyboard-am62x
8 */
9
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/input/input.h>
12#include <dt-bindings/leds/common.h>
13#include <dt-bindings/net/ti-dp83867.h>
14#include "k3-am625.dtsi"
15#include "k3-am62-phycore-som.dtsi"
16
17/ {
18	compatible = "phytec,am625-phyboard-lyra-rdk",
19		     "phytec,am62-phycore-som", "ti,am625";
20	model = "PHYTEC phyBOARD-Lyra AM625";
21
22	aliases {
23		serial2 = &main_uart0;
24		serial3 = &main_uart1;
25		mmc1 = &sdhci1;
26		usb0 = &usb0;
27		usb1 = &usb1;
28		ethernet1 = &cpsw_port2;
29	};
30
31	can_tc1: can-phy0 {
32		compatible = "ti,tcan1042";
33		#phy-cells = <0>;
34		max-bitrate = <5000000>;
35		standby-gpios = <&gpio_exp 1 GPIO_ACTIVE_HIGH>;
36	};
37
38	keys {
39		compatible = "gpio-keys";
40		autorepeat;
41		pinctrl-names = "default";
42		pinctrl-0 = <&gpio_keys_pins_default>;
43
44		key-home {
45			label = "home";
46			linux,code = <KEY_HOME>;
47			gpios = <&main_gpio1 23 GPIO_ACTIVE_HIGH>;
48		};
49
50		key-menu {
51			label = "menu";
52			linux,code = <KEY_MENU>;
53			gpios = <&gpio_exp 4 GPIO_ACTIVE_HIGH>;
54		};
55	};
56
57	leds {
58		compatible = "gpio-leds";
59		pinctrl-names = "default";
60		pinctrl-0 = <&leds_pins_default>, <&user_leds_pins_default>;
61
62		led-1 {
63			gpios = <&main_gpio0 32 GPIO_ACTIVE_HIGH>;
64			linux,default-trigger = "mmc0";
65		};
66
67		led-2 {
68			gpios = <&gpio_exp 2 GPIO_ACTIVE_HIGH>;
69			linux,default-trigger = "mmc1";
70		};
71	};
72
73	vcc_3v3_mmc: regulator-vcc-3v3-mmc {
74		compatible = "regulator-fixed";
75		regulator-name = "VCC_3V3_MMC";
76		regulator-min-microvolt = <3300000>;
77		regulator-max-microvolt = <3300000>;
78		regulator-always-on;
79		regulator-boot-on;
80	};
81};
82
83&main_pmx0 {
84	gpio_keys_pins_default: gpio-keys-default-pins {
85		pinctrl-single,pins = <
86			AM62X_IOPAD(0x1d4, PIN_INPUT, 7) /* (B15) UART0_RTSn.GPIO1_23 */
87		>;
88	};
89
90	gpio_exp_int_pins_default: gpio-exp-int-default-pins {
91		pinctrl-single,pins = <
92			AM62X_IOPAD(0x244, PIN_INPUT, 7) /* (C17) MMC1_SDWP.GPIO1_49 */
93		>;
94	};
95
96	main_i2c1_pins_default: main-i2c1-default-pins {
97		pinctrl-single,pins = <
98			AM62X_IOPAD(0x1e8, PIN_INPUT_PULLUP, 0) /* (B17) I2C1_SCL */
99			AM62X_IOPAD(0x1ec, PIN_INPUT_PULLUP, 0) /* (A17) I2C1_SDA */
100		>;
101	};
102
103	main_mcan0_pins_default: main-mcan0-default-pins {
104		pinctrl-single,pins = <
105			AM62X_IOPAD(0x1dc, PIN_INPUT, 0) /* (E15) MCAN0_RX */
106			AM62X_IOPAD(0x1d8, PIN_OUTPUT, 0) /* (C15) MCAN0_TX */
107		>;
108	};
109
110	main_mmc1_pins_default: main-mmc1-default-pins {
111		pinctrl-single,pins = <
112			AM62X_IOPAD(0x23c, PIN_INPUT_PULLUP, 0) /* (A21) MMC1_CMD */
113			AM62X_IOPAD(0x234, PIN_INPUT_PULLDOWN, 0) /* (B22) MMC1_CLK */
114			AM62X_IOPAD(0x230, PIN_INPUT_PULLUP, 0) /* (A22) MMC1_DAT0 */
115			AM62X_IOPAD(0x22c, PIN_INPUT_PULLUP, 0) /* (B21) MMC1_DAT1 */
116			AM62X_IOPAD(0x228, PIN_INPUT_PULLUP, 0) /* (C21) MMC1_DAT2 */
117			AM62X_IOPAD(0x224, PIN_INPUT_PULLUP, 0) /* (D22) MMC1_DAT3 */
118			AM62X_IOPAD(0x240, PIN_INPUT_PULLUP, 0) /* (D17) MMC1_SDCD */
119		>;
120	};
121
122	main_rgmii2_pins_default: main-rgmii2-default-pins {
123		pinctrl-single,pins = <
124			AM62X_IOPAD(0x184, PIN_INPUT, 0) /* (AE23) RGMII2_RD0 */
125			AM62X_IOPAD(0x188, PIN_INPUT, 0) /* (AB20) RGMII2_RD1 */
126			AM62X_IOPAD(0x18c, PIN_INPUT, 0) /* (AC21) RGMII2_RD2 */
127			AM62X_IOPAD(0x190, PIN_INPUT, 0) /* (AE22) RGMII2_RD3 */
128			AM62X_IOPAD(0x180, PIN_INPUT, 0) /* (AD23) RGMII2_RXC */
129			AM62X_IOPAD(0x17c, PIN_INPUT, 0) /* (AD22) RGMII2_RX_CTL */
130			AM62X_IOPAD(0x16c, PIN_OUTPUT, 0) /* (Y18) RGMII2_TD0 */
131			AM62X_IOPAD(0x170, PIN_OUTPUT, 0) /* (AA18) RGMII2_TD1 */
132			AM62X_IOPAD(0x174, PIN_OUTPUT, 0) /* (AD21) RGMII2_TD2 */
133			AM62X_IOPAD(0x178, PIN_OUTPUT, 0) /* (AC20) RGMII2_TD3 */
134			AM62X_IOPAD(0x168, PIN_OUTPUT, 0) /* (AE21) RGMII2_TXC */
135			AM62X_IOPAD(0x164, PIN_OUTPUT, 0) /* (AA19) RGMII2_TX_CTL */
136		>;
137	};
138
139	main_uart0_pins_default: main-uart0-default-pins {
140		pinctrl-single,pins = <
141			AM62X_IOPAD(0x1c8, PIN_INPUT, 0) /* (D14) UART0_RXD */
142			AM62X_IOPAD(0x1cc, PIN_OUTPUT, 0) /* (E14) UART0_TXD */
143		>;
144	};
145
146	main_uart1_pins_default: main-uart1-default-pins {
147		pinctrl-single,pins = <
148			AM62X_IOPAD(0x194, PIN_INPUT, 2) /* (B19) MCASP0_AXR3.UART1_CTSn */
149			AM62X_IOPAD(0x198, PIN_OUTPUT, 2) /* (A19) MCASP0_AXR2.UART1_RTSn */
150			AM62X_IOPAD(0x1ac, PIN_INPUT, 2) /* (E19) MCASP0_AFSR.UART1_RXD */
151			AM62X_IOPAD(0x1b0, PIN_OUTPUT, 2) /* (A20) MCASP0_ACLKR.UART1_TXD */
152		>;
153	};
154
155	main_usb1_pins_default: main-usb1-default-pins {
156		pinctrl-single,pins = <
157			AM62X_IOPAD(0x258, PIN_OUTPUT, 0) /* (F18) USB1_DRVVBUS */
158		>;
159	};
160
161	user_leds_pins_default: user-leds-default-pins {
162		pinctrl-single,pins = <
163			AM62X_IOPAD(0x084, PIN_OUTPUT, 7) /* (L23) GPMC0_ADVn_ALE.GPIO0_32 */
164		>;
165	};
166};
167
168&cpsw3g {
169	pinctrl-names = "default";
170	pinctrl-0 = <&main_rgmii1_pins_default>, <&main_rgmii2_pins_default>;
171};
172
173&cpsw_port2 {
174	phy-mode = "rgmii-rxid";
175	phy-handle = <&cpsw3g_phy3>;
176};
177
178&cpsw3g_mdio {
179	cpsw3g_phy3: ethernet-phy@3 {
180		compatible = "ethernet-phy-id2000.a231", "ethernet-phy-ieee802.3-c22";
181		reg = <3>;
182		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
183		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
184	};
185};
186
187&main_i2c1 {
188	pinctrl-names = "default";
189	pinctrl-0 = <&main_i2c1_pins_default>;
190	clock-frequency = <400000>;
191	status = "okay";
192
193	gpio_exp: gpio-expander@21 {
194		pinctrl-names = "default";
195		pinctrl-0 = <&gpio_exp_int_pins_default>;
196		compatible = "nxp,pcf8574";
197		reg = <0x21>;
198		interrupt-parent = <&main_gpio1>;
199		interrupts = <49 0>;
200		#gpio-cells = <2>;
201		gpio-controller;
202		interrupt-controller;
203		#interrupt-cells = <2>;
204		gpio-line-names = "GPIO0_HDMI_RST", "GPIO1_CAN0_nEN",
205				  "GPIO2_LED2", "GPIO3_LVDS_GPIO",
206				  "GPIO4_BUT2", "GPIO5_LVDS_BKLT_EN",
207				  "GPIO6_ETH1_USER_RESET", "GPIO7_AUDIO_USER_RESET";
208	};
209
210	eeprom@51 {
211		compatible = "atmel,24c02";
212		pagesize = <16>;
213		reg = <0x51>;
214	};
215};
216
217&main_mcan0 {
218	pinctrl-names = "default";
219	pinctrl-0 = <&main_mcan0_pins_default>;
220	phys = <&can_tc1>;
221	status = "okay";
222};
223
224&main_uart0 {
225	pinctrl-names = "default";
226	pinctrl-0 = <&main_uart0_pins_default>;
227	status = "okay";
228};
229
230&main_uart1 {
231	pinctrl-names = "default";
232	pinctrl-0 = <&main_uart1_pins_default>;
233	/* Main UART1 may be used by TIFS firmware */
234	status = "okay";
235};
236
237&sdhci1 {
238	vmmc-supply = <&vcc_3v3_mmc>;
239	vqmmc-supply = <&vddshv5_sdio>;
240	pinctrl-names = "default";
241	pinctrl-0 = <&main_mmc1_pins_default>;
242	ti,driver-strength-ohm = <50>;
243	disable-wp;
244	no-1-8-v;
245	status = "okay";
246};
247
248&usbss0 {
249	ti,vbus-divider;
250	status = "okay";
251};
252
253&usbss1 {
254	ti,vbus-divider;
255	status = "okay";
256};
257
258&usb0 {
259	dr_mode = "peripheral";
260};
261
262&usb1 {
263	dr_mode = "host";
264	pinctrl-names = "default";
265	pinctrl-0 = <&main_usb1_pins_default>;
266};
267