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_ext_audio_codec: clock-codec {
27		compatible = "fixed-clock";
28		#clock-cells = <0>;
29		clock-frequency = <24000000>;
30	};
31
32	clk_xtal25: clock-xtal25 {
33		compatible = "fixed-clock";
34		#clock-cells = <0>;
35		clock-frequency = <25000000>;
36	};
37
38	connector {
39		compatible = "usb-c-connector";
40		label = "USB-C";
41		data-role = "dual";
42
43		ports {
44			#address-cells = <1>;
45			#size-cells = <0>;
46
47			port@0 {
48				reg = <0>;
49
50				usb_c_0_hs_ep: endpoint {
51					remote-endpoint = <&dwc3_0_hs_ep>;
52				};
53			};
54
55			port@1 {
56				reg = <1>;
57
58				usb_c_0_ss_ep: endpoint {
59					remote-endpoint = <&ptn5150_in_ep>;
60				};
61			};
62		};
63	};
64
65	gpio-keys {
66		compatible = "gpio-keys";
67
68		button-0 {
69			gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; /* GPIO A */
70			label = "TA1-GPIO-A";
71			linux,code = <KEY_A>;
72			pinctrl-0 = <&pinctrl_dhcom_a>;
73			pinctrl-names = "default";
74			wakeup-source;
75		};
76
77		button-1 {
78			gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; /* GPIO B */
79			label = "TA2-GPIO-B";
80			linux,code = <KEY_B>;
81			pinctrl-0 = <&pinctrl_dhcom_b>;
82			pinctrl-names = "default";
83			wakeup-source;
84		};
85
86		button-2 {
87			gpios = <&gpio5 2 GPIO_ACTIVE_LOW>; /* GPIO C */
88			label = "TA3-GPIO-C";
89			linux,code = <KEY_C>;
90			pinctrl-0 = <&pinctrl_dhcom_c>;
91			pinctrl-names = "default";
92			wakeup-source;
93		};
94
95		button-3 {
96			gpios = <&gpio5 22 GPIO_ACTIVE_LOW>; /* GPIO E */
97			label = "TA4-GPIO-E";
98			linux,code = <KEY_E>;
99			pinctrl-0 = <&pinctrl_dhcom_e>;
100			pinctrl-names = "default";
101			wakeup-source;
102		};
103	};
104
105	led {
106		compatible = "gpio-leds";
107
108		led-0 {
109			color = <LED_COLOR_ID_GREEN>;
110			default-state = "off";
111			function = LED_FUNCTION_INDICATOR;
112			function-enumerator = <0>;
113			gpios = <&gpio4 27 GPIO_ACTIVE_HIGH>; /* GPIO D */
114			pinctrl-0 = <&pinctrl_dhcom_d>;
115			pinctrl-names = "default";
116		};
117
118		led-1 {
119			color = <LED_COLOR_ID_GREEN>;
120			default-state = "off";
121			function = LED_FUNCTION_INDICATOR;
122			function-enumerator = <1>;
123			gpios = <&gpio5 23 GPIO_ACTIVE_HIGH>; /* GPIO F */
124			pinctrl-0 = <&pinctrl_dhcom_f>;
125			pinctrl-names = "default";
126		};
127
128		led-2 {
129			color = <LED_COLOR_ID_GREEN>;
130			default-state = "off";
131			function = LED_FUNCTION_INDICATOR;
132			function-enumerator = <2>;
133			gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>; /* GPIO G */
134			pinctrl-0 = <&pinctrl_dhcom_g>;
135			pinctrl-names = "default";
136		};
137
138		led-3 {
139			color = <LED_COLOR_ID_GREEN>;
140			default-state = "off";
141			function = LED_FUNCTION_INDICATOR;
142			function-enumerator = <3>;
143			gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; /* GPIO I */
144			pinctrl-0 = <&pinctrl_dhcom_i>;
145			pinctrl-names = "default";
146		};
147	};
148
149	reg_3p3vdd: regulator-3p3vdd {	/* 3.3VDD */
150		compatible = "regulator-fixed";
151		regulator-always-on;
152		regulator-min-microvolt = <3300000>;
153		regulator-max-microvolt = <3300000>;
154		regulator-name = "3P3VDD";
155	};
156
157	sound {
158		compatible = "simple-audio-card";
159		simple-audio-card,name = "SGTL5000-Card";
160		simple-audio-card,format = "i2s";
161		simple-audio-card,bitclock-master = <&codec_dai>;
162		simple-audio-card,frame-master = <&codec_dai>;
163		simple-audio-card,widgets = "Headphone", "Headphone Jack";
164		simple-audio-card,routing = "Headphone Jack", "HP_OUT";
165
166		cpu_dai: simple-audio-card,cpu {
167			sound-dai = <&sai3>;
168		};
169
170		codec_dai: simple-audio-card,codec {
171			sound-dai = <&sgtl5000>;
172		};
173	};
174};
175
176&i2c5 {
177	i2c-mux@70 {
178		compatible = "nxp,pca9540";
179		reg = <0x70>;
180		#address-cells = <1>;
181		#size-cells = <0>;
182
183		i2cmuxed0: i2c@0 {
184			#address-cells = <1>;
185			#size-cells = <0>;
186			reg = <0>;
187
188			sgtl5000: codec@a {
189				compatible = "fsl,sgtl5000";
190				reg = <0x0a>;
191				#sound-dai-cells = <0>;
192				clocks = <&clk_ext_audio_codec>;
193				VDDA-supply = <&reg_3p3vdd>;
194				VDDIO-supply = <&reg_vdd_3p3v_awo>;
195			};
196
197			typec@3d {
198				compatible = "nxp,ptn5150";
199				reg = <0x3d>;
200				interrupt-parent = <&gpio4>;
201				interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
202				pinctrl-names = "default";
203				pinctrl-0 = <&pinctrl_ptn5150>;
204
205				ports {
206					#address-cells = <1>;
207					#size-cells = <0>;
208
209					port@0 {
210						reg = <0>;
211
212						ptn5150_in_ep: endpoint {
213							remote-endpoint = <&usb_c_0_ss_ep>;
214						};
215					};
216
217					port@1 {
218						reg = <1>;
219
220						ptn5150_out_ep: endpoint {
221							remote-endpoint = <&dwc3_0_ss_ep>;
222						};
223					};
224				};
225			};
226
227			power-sensor@40 {
228			    compatible = "ti,ina238";
229			    reg = <0x40>;
230			    shunt-resistor = <20000>;	/* 0.02 R */
231			    ti,shunt-gain = <1>;	/* Drop cca. 40mV */
232			};
233
234			eeprom_board: eeprom@54 {
235				compatible = "atmel,24c04";
236				pagesize = <16>;
237				reg = <0x54>;
238			};
239
240			pcieclk: clock@6b {
241				compatible = "skyworks,si52144";
242				reg = <0x6b>;
243				clocks = <&clk_xtal25>;
244				#clock-cells = <1>;
245			};
246		};
247
248		i2cmuxed1: i2c@1 {	/* HDMI DDC I2C */
249			#address-cells = <1>;
250			#size-cells = <0>;
251			reg = <1>;
252		};
253	};
254};
255
256&ethphy0g {
257	reg = <7>;
258};
259
260&fec {	/* Second ethernet */
261	pinctrl-0 = <&pinctrl_fec_rgmii>;
262	phy-handle = <&ethphypdk>;
263	phy-mode = "rgmii-id";
264
265	mdio {
266		ethphypdk: ethernet-phy@7 { /* Micrel KSZ9131RNXI */
267			compatible = "ethernet-phy-id0022.1642",
268				     "ethernet-phy-ieee802.3-c22";
269			interrupt-parent = <&gpio4>;
270			interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
271			pinctrl-0 = <&pinctrl_ethphy1>;
272			pinctrl-names = "default";
273			reg = <7>;
274			reset-assert-us = <1000>;
275			/* RESET_N signal rise time ~100ms */
276			reset-deassert-us = <120000>;
277			reset-gpios = <&gpio4 2 GPIO_ACTIVE_LOW>;
278		};
279	};
280};
281
282&flexcan1 {
283	status = "okay";
284};
285
286&pcie_phy {
287	clocks = <&pcieclk 1>;
288	clock-names = "ref";
289	fsl,refclk-pad-mode = <IMX8_PCIE_REFCLK_PAD_INPUT>;
290	status = "okay";
291};
292
293&pcie {
294	fsl,max-link-speed = <3>;
295	reset-gpio = <&gpio1 6 GPIO_ACTIVE_LOW>;
296	status = "okay";
297};
298
299&sai3 {
300	pinctrl-names = "default";
301	pinctrl-0 = <&pinctrl_sai3>;
302	assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
303	assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
304	assigned-clock-rates = <12288000>;
305	fsl,sai-mclk-direction-output;
306	status = "okay";
307};
308
309&usb_dwc3_0 {
310	usb-role-switch;
311
312	port {
313		#address-cells = <1>;
314		#size-cells = <0>;
315
316		dwc3_0_hs_ep: endpoint@0 {
317			reg = <0>;
318			remote-endpoint = <&usb_c_0_hs_ep>;
319		};
320
321		dwc3_0_ss_ep: endpoint@1 {
322			reg = <1>;
323			remote-endpoint = <&ptn5150_out_ep>;
324		};
325	};
326};
327
328&usb3_1 {
329	fsl,disable-port-power-control;
330	fsl,permanently-attached;
331};
332
333&usb_dwc3_1 {
334	/* This port has USB5734 Hub connected to it, PWR/OC pins are unused */
335	/delete-property/ pinctrl-names;
336	/delete-property/ pinctrl-0;
337};
338
339&iomuxc {
340	/*
341	 * GPIO_A,B,C,E are connected to buttons.
342	 * GPIO_D,F,G,I are connected to LEDs.
343	 * GPIO_H is connected to USB Hub RESET_N.
344	 * GPIO_M is connected to CLKOUT2.
345	 */
346	pinctrl-0 = <&pinctrl_hog_base
347		     &pinctrl_dhcom_h &pinctrl_dhcom_j &pinctrl_dhcom_k
348		     &pinctrl_dhcom_l
349		     &pinctrl_dhcom_int>;
350
351	pinctrl_ptn5150: ptn5150grp {
352		fsl,pins = <
353			MX8MP_IOMUXC_SAI2_TXC__GPIO4_IO25		0x40000000
354		>;
355	};
356};
357