1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (C) 2022 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 * PDK2 PCB number: 516-400 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 (2)";
19	compatible = "dh,imx8mp-dhcom-pdk2", "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	gpio-keys {
33		compatible = "gpio-keys";
34
35		button-0 {
36			gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; /* GPIO A */
37			label = "TA1-GPIO-A";
38			linux,code = <KEY_A>;
39			pinctrl-0 = <&pinctrl_dhcom_a>;
40			pinctrl-names = "default";
41			wakeup-source;
42		};
43
44		button-1 {
45			gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; /* GPIO B */
46			label = "TA2-GPIO-B";
47			linux,code = <KEY_B>;
48			pinctrl-0 = <&pinctrl_dhcom_b>;
49			pinctrl-names = "default";
50			wakeup-source;
51		};
52
53		button-2 {
54			gpios = <&gpio5 2 GPIO_ACTIVE_LOW>; /* GPIO C */
55			label = "TA3-GPIO-C";
56			linux,code = <KEY_C>;
57			pinctrl-0 = <&pinctrl_dhcom_c>;
58			pinctrl-names = "default";
59			wakeup-source;
60		};
61
62		button-3 {
63			gpios = <&gpio4 27 GPIO_ACTIVE_LOW>; /* GPIO D */
64			label = "TA4-GPIO-D";
65			linux,code = <KEY_D>;
66			pinctrl-0 = <&pinctrl_dhcom_d>;
67			pinctrl-names = "default";
68			wakeup-source;
69		};
70	};
71
72	led {
73		compatible = "gpio-leds";
74
75		led-0 {
76			color = <LED_COLOR_ID_GREEN>;
77			default-state = "off";
78			function = LED_FUNCTION_INDICATOR;
79			gpios = <&gpio5 22 GPIO_ACTIVE_HIGH>; /* GPIO E */
80			pinctrl-0 = <&pinctrl_dhcom_e>;
81			pinctrl-names = "default";
82		};
83
84		led-1 {
85			color = <LED_COLOR_ID_GREEN>;
86			default-state = "off";
87			function = LED_FUNCTION_INDICATOR;
88			gpios = <&gpio5 23 GPIO_ACTIVE_HIGH>; /* GPIO F */
89			pinctrl-0 = <&pinctrl_dhcom_f>;
90			pinctrl-names = "default";
91		};
92
93		led-2 {
94			color = <LED_COLOR_ID_GREEN>;
95			default-state = "off";
96			function = LED_FUNCTION_INDICATOR;
97			gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; /* GPIO H */
98			pinctrl-0 = <&pinctrl_dhcom_h>;
99			pinctrl-names = "default";
100		};
101
102		led-3 {
103			color = <LED_COLOR_ID_GREEN>;
104			default-state = "off";
105			function = LED_FUNCTION_INDICATOR;
106			gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; /* GPIO I */
107			pinctrl-0 = <&pinctrl_dhcom_i>;
108			pinctrl-names = "default";
109		};
110	};
111
112	reg_3p3vdd: regulator-3p3vdd {	/* 3.3VDD */
113		compatible = "regulator-fixed";
114		regulator-always-on;
115		regulator-min-microvolt = <3300000>;
116		regulator-max-microvolt = <3300000>;
117		regulator-name = "3P3VDD";
118	};
119
120	sound {
121		compatible = "simple-audio-card";
122		simple-audio-card,name = "SGTL5000-Card";
123		simple-audio-card,format = "i2s";
124		simple-audio-card,bitclock-master = <&codec_dai>;
125		simple-audio-card,frame-master = <&codec_dai>;
126		simple-audio-card,widgets = "Headphone", "Headphone Jack";
127		simple-audio-card,routing = "Headphone Jack", "HP_OUT";
128
129		cpu_dai: simple-audio-card,cpu {
130			sound-dai = <&sai3>;
131		};
132
133		codec_dai: simple-audio-card,codec {
134			sound-dai = <&sgtl5000>;
135		};
136	};
137};
138
139&i2c5 {
140	sgtl5000: codec@a {
141		compatible = "fsl,sgtl5000";
142		reg = <0x0a>;
143		#sound-dai-cells = <0>;
144		clocks = <&clk_ext_audio_codec>;
145		VDDA-supply = <&reg_3p3vdd>;
146		VDDIO-supply = <&reg_vdd_3p3v_awo>;
147	};
148};
149
150&fec {	/* Second ethernet */
151	pinctrl-0 = <&pinctrl_fec_rgmii>;
152	phy-handle = <&ethphypdk>;
153	phy-mode = "rgmii";
154
155	mdio {
156		ethphypdk: ethernet-phy@7 { /* KSZ 9021 */
157			compatible = "ethernet-phy-ieee802.3-c22";
158			pinctrl-0 = <&pinctrl_ethphy1>;
159			pinctrl-names = "default";
160			interrupt-parent = <&gpio4>;
161			interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
162			max-speed = <100>;
163			reg = <7>;
164			reset-assert-us = <1000>;
165			reset-deassert-us = <1000>;
166			reset-gpios = <&gpio4 2 GPIO_ACTIVE_LOW>;
167			rxc-skew-ps = <3000>;
168			rxd0-skew-ps = <0>;
169			rxd1-skew-ps = <0>;
170			rxd2-skew-ps = <0>;
171			rxd3-skew-ps = <0>;
172			rxdv-skew-ps = <0>;
173			txc-skew-ps = <3000>;
174			txd0-skew-ps = <0>;
175			txd1-skew-ps = <0>;
176			txd2-skew-ps = <0>;
177			txd3-skew-ps = <0>;
178			txen-skew-ps = <0>;
179		};
180	};
181};
182
183&flexcan1 {
184	status = "okay";
185};
186
187&pcie_phy {
188	clock-names = "ref";
189	clocks = <&clk IMX8MP_SYS_PLL2_100M>;
190	fsl,clkreq-unsupported;
191	fsl,refclk-pad-mode = <IMX8_PCIE_REFCLK_PAD_UNUSED>;
192	status = "okay";
193};
194
195&pcie {
196	fsl,max-link-speed = <1>;
197	reset-gpio = <&gpio1 6 GPIO_ACTIVE_LOW>;	/* GPIO J */
198	status = "okay";
199};
200
201&sai3 {
202	#sound-dai-cells = <0>;
203	pinctrl-names = "default";
204	pinctrl-0 = <&pinctrl_sai3>;
205	assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
206	assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
207	assigned-clock-rates = <12288000>;
208	fsl,sai-mclk-direction-output;
209	status = "okay";
210};
211
212&usb3_1 {
213	fsl,over-current-active-low;
214};
215
216&iomuxc {
217	/*
218	 * GPIO_A,B,C,D are connected to buttons.
219	 * GPIO_E,F,H,I are connected to LEDs.
220	 * GPIO_M is connected to CLKOUT1.
221	 */
222	pinctrl-0 = <&pinctrl_hog_base
223		     &pinctrl_dhcom_g &pinctrl_dhcom_j
224		     &pinctrl_dhcom_k &pinctrl_dhcom_l
225		     &pinctrl_dhcom_int>;
226};
227