1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (C) 2023 Marek Vasut <marex@denx.de>
4 *
5 * DHCOM iMX8MP variant:
6 * DHCM-iMX8ML8-C160-R409-F1638-SPI16-GE-CAN2-SD-RTC-WBTA-ADC-T-RGB-CSI2-HS-I-01D2
7 * DHCOM PCB number: 660-100 or newer
8 * PDK3 PCB number: 669-100 or newer
9 */
10
11/dts-v1/;
12
13#include <dt-bindings/leds/common.h>
14#include <dt-bindings/phy/phy-imx8-pcie.h>
15#include "imx8mp-dhcom-som.dtsi"
16
17/ {
18	model = "DH electronics i.MX8M Plus DHCOM Premium Developer Kit (3)";
19	compatible = "dh,imx8mp-dhcom-pdk3", "dh,imx8mp-dhcom-som",
20		     "fsl,imx8mp";
21
22	chosen {
23		stdout-path = &uart1;
24	};
25
26	clk_pcie: clock-pcie {
27		compatible = "fixed-clock";
28		#clock-cells = <0>;
29		clock-frequency = <100000000>;
30	};
31
32	connector {
33		compatible = "usb-c-connector";
34		label = "USB-C";
35		data-role = "dual";
36
37		ports {
38			#address-cells = <1>;
39			#size-cells = <0>;
40
41			port@0 {
42				reg = <0>;
43
44				usb_c_0_hs_ep: endpoint {
45					remote-endpoint = <&dwc3_0_hs_ep>;
46				};
47			};
48
49			port@1 {
50				reg = <1>;
51
52				usb_c_0_ss_ep: endpoint {
53					remote-endpoint = <&ptn5150_in_ep>;
54				};
55			};
56		};
57	};
58
59	gpio-keys {
60		compatible = "gpio-keys";
61
62		button-0 {
63			gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; /* GPIO A */
64			label = "TA1-GPIO-A";
65			linux,code = <KEY_A>;
66			pinctrl-0 = <&pinctrl_dhcom_a>;
67			pinctrl-names = "default";
68			wakeup-source;
69		};
70
71		button-1 {
72			gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; /* GPIO B */
73			label = "TA2-GPIO-B";
74			linux,code = <KEY_B>;
75			pinctrl-0 = <&pinctrl_dhcom_b>;
76			pinctrl-names = "default";
77			wakeup-source;
78		};
79
80		button-2 {
81			gpios = <&gpio5 2 GPIO_ACTIVE_LOW>; /* GPIO C */
82			label = "TA3-GPIO-C";
83			linux,code = <KEY_C>;
84			pinctrl-0 = <&pinctrl_dhcom_c>;
85			pinctrl-names = "default";
86			wakeup-source;
87		};
88
89		button-3 {
90			gpios = <&gpio5 22 GPIO_ACTIVE_LOW>; /* GPIO E */
91			label = "TA4-GPIO-E";
92			linux,code = <KEY_E>;
93			pinctrl-0 = <&pinctrl_dhcom_e>;
94			pinctrl-names = "default";
95			wakeup-source;
96		};
97	};
98
99	led {
100		compatible = "gpio-leds";
101
102		led-0 {
103			color = <LED_COLOR_ID_GREEN>;
104			default-state = "off";
105			function = LED_FUNCTION_INDICATOR;
106			function-enumerator = <0>;
107			gpios = <&gpio4 27 GPIO_ACTIVE_HIGH>; /* GPIO D */
108			pinctrl-0 = <&pinctrl_dhcom_d>;
109			pinctrl-names = "default";
110		};
111
112		led-1 {
113			color = <LED_COLOR_ID_GREEN>;
114			default-state = "off";
115			function = LED_FUNCTION_INDICATOR;
116			function-enumerator = <1>;
117			gpios = <&gpio5 23 GPIO_ACTIVE_HIGH>; /* GPIO F */
118			pinctrl-0 = <&pinctrl_dhcom_f>;
119			pinctrl-names = "default";
120		};
121
122		led-2 {
123			color = <LED_COLOR_ID_GREEN>;
124			default-state = "off";
125			function = LED_FUNCTION_INDICATOR;
126			function-enumerator = <2>;
127			gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>; /* GPIO G */
128			pinctrl-0 = <&pinctrl_dhcom_g>;
129			pinctrl-names = "default";
130		};
131
132		led-3 {
133			color = <LED_COLOR_ID_GREEN>;
134			default-state = "off";
135			function = LED_FUNCTION_INDICATOR;
136			function-enumerator = <3>;
137			gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; /* GPIO I */
138			pinctrl-0 = <&pinctrl_dhcom_i>;
139			pinctrl-names = "default";
140		};
141	};
142
143	reg_avdd: regulator-avdd {	/* AUDIO_VDD */
144		compatible = "regulator-fixed";
145		regulator-always-on;
146		regulator-min-microvolt = <3300000>;
147		regulator-max-microvolt = <3300000>;
148		regulator-name = "AUDIO_VDD";
149	};
150};
151
152&i2c5 {
153	i2c-mux@70 {
154		compatible = "nxp,pca9540";
155		reg = <0x70>;
156		#address-cells = <1>;
157		#size-cells = <0>;
158
159		i2cmuxed0: i2c@0 {
160			#address-cells = <1>;
161			#size-cells = <0>;
162			reg = <0>;
163
164			typec@3d {
165				compatible = "nxp,ptn5150";
166				reg = <0x3d>;
167				interrupt-parent = <&gpio4>;
168				interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
169				pinctrl-names = "default";
170				pinctrl-0 = <&pinctrl_ptn5150>;
171
172				ports {
173					#address-cells = <1>;
174					#size-cells = <0>;
175
176					port@0 {
177						reg = <0>;
178
179						ptn5150_in_ep: endpoint {
180							remote-endpoint = <&usb_c_0_ss_ep>;
181						};
182					};
183
184					port@1 {
185						reg = <1>;
186
187						ptn5150_out_ep: endpoint {
188							remote-endpoint = <&dwc3_0_ss_ep>;
189						};
190					};
191				};
192			};
193
194			power-sensor@40 {
195			    compatible = "ti,ina238";
196			    reg = <0x40>;
197			    shunt-resistor = <20000>;	/* 0.02 R */
198			    ti,shunt-gain = <1>;	/* Drop cca. 40mV */
199			};
200
201			eeprom_board: eeprom@54 {
202				compatible = "atmel,24c04";
203				pagesize = <16>;
204				reg = <0x54>;
205			};
206		};
207
208		i2cmuxed1: i2c@1 {	/* HDMI DDC I2C */
209			#address-cells = <1>;
210			#size-cells = <0>;
211			reg = <1>;
212		};
213	};
214};
215
216&ethphy0g {
217	reg = <7>;
218};
219
220&fec {	/* Second ethernet */
221	pinctrl-0 = <&pinctrl_fec_rgmii>;
222	phy-handle = <&ethphypdk>;
223	phy-mode = "rgmii-id";
224
225	mdio {
226		ethphypdk: ethernet-phy@7 { /* Micrel KSZ9131RNXI */
227			compatible = "ethernet-phy-id0022.1642",
228				     "ethernet-phy-ieee802.3-c22";
229			interrupt-parent = <&gpio4>;
230			interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
231			pinctrl-0 = <&pinctrl_ethphy1>;
232			pinctrl-names = "default";
233			reg = <7>;
234			reset-assert-us = <1000>;
235			/* RESET_N signal rise time ~100ms */
236			reset-deassert-us = <120000>;
237			reset-gpios = <&gpio4 2 GPIO_ACTIVE_LOW>;
238		};
239	};
240};
241
242&flexcan1 {
243	status = "okay";
244};
245
246&pcie_phy {
247	clocks = <&clk_pcie>;
248	clock-names = "ref";
249	fsl,refclk-pad-mode = <IMX8_PCIE_REFCLK_PAD_INPUT>;
250	status = "okay";
251};
252
253&pcie {
254	fsl,max-link-speed = <3>;
255	reset-gpio = <&gpio1 6 GPIO_ACTIVE_LOW>;
256	status = "okay";
257};
258
259&usb_dwc3_0 {
260	usb-role-switch;
261
262	port {
263		#address-cells = <1>;
264		#size-cells = <0>;
265
266		dwc3_0_hs_ep: endpoint@0 {
267			reg = <0>;
268			remote-endpoint = <&usb_c_0_hs_ep>;
269		};
270
271		dwc3_0_ss_ep: endpoint@1 {
272			reg = <1>;
273			remote-endpoint = <&ptn5150_out_ep>;
274		};
275	};
276};
277
278&usb3_1 {
279	fsl,disable-port-power-control;
280	fsl,permanently-attached;
281};
282
283&usb_dwc3_1 {
284	/* This port has USB5734 Hub connected to it, PWR/OC pins are unused */
285	/delete-property/ pinctrl-names;
286	/delete-property/ pinctrl-0;
287};
288
289&iomuxc {
290	/*
291	 * GPIO_A,B,C,E are connected to buttons.
292	 * GPIO_D,F,G,I are connected to LEDs.
293	 * GPIO_H is connected to USB Hub RESET_N.
294	 * GPIO_M is connected to CLKOUT2.
295	 */
296	pinctrl-0 = <&pinctrl_hog_base
297		     &pinctrl_dhcom_h &pinctrl_dhcom_j &pinctrl_dhcom_k
298		     &pinctrl_dhcom_l
299		     &pinctrl_dhcom_int>;
300
301	pinctrl_ptn5150: ptn5150grp {
302		fsl,pins = <
303			MX8MP_IOMUXC_SAI2_TXC__GPIO4_IO25		0x40000000
304		>;
305	};
306};
307