1/* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-3-Clause) */
2/*
3 * Copyright (C) 2020 STMicroelectronics - All Rights Reserved
4 * Copyright (C) 2020 Ahmad Fatoum, Pengutronix
5 */
6
7/dts-v1/;
8
9#include "stm32mp157.dtsi"
10#include "stm32mp15xx-osd32.dtsi"
11#include "stm32mp15xxac-pinctrl.dtsi"
12
13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/pwm/pwm.h>
15
16/ {
17	model = "Linux Automation MC-1 board";
18	compatible = "lxa,stm32mp157c-mc1", "st,stm32mp157";
19
20	aliases {
21		ethernet0 = &ethernet0;
22		mmc0 = &sdmmc1;
23		mmc1 = &sdmmc2;
24		serial0 = &uart4;
25	};
26
27	backlight: backlight {
28		compatible = "pwm-backlight";
29		pwms = <&backlight_pwm 1 100000 PWM_POLARITY_INVERTED>;
30		brightness-levels = <0 31 63 95 127 159 191 223 255>;
31		default-brightness-level = <7>;
32		power-supply = <&reg_5v2>; /* 3V3_BACKLIGHT */
33	};
34
35	chosen {
36		stdout-path = &uart4;
37	};
38
39	led-act {
40		compatible = "gpio-leds";
41
42		led-green {
43			label = "mc1:green:act";
44			gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
45			linux,default-trigger = "heartbeat";
46		};
47	};
48
49	led-rgb {
50		compatible = "pwm-leds";
51
52		led-red {
53			label = "mc1:red:rgb";
54			pwms = <&leds_pwm 1 1000000 0>;
55			max-brightness = <255>;
56			active-low;
57		};
58
59		led-green {
60			label = "mc1:green:rgb";
61			pwms = <&leds_pwm 2 1000000 0>;
62			max-brightness = <255>;
63			active-low;
64		};
65
66		led-blue {
67			label = "mc1:blue:rgb";
68			pwms = <&leds_pwm 3 1000000 0>;
69			max-brightness = <255>;
70			active-low;
71		};
72	};
73
74	panel: panel {
75		compatible = "edt,etm0700g0edh6", "simple-panel";
76		backlight = <&backlight>;
77		enable-gpios = <&gpiod 4 GPIO_ACTIVE_HIGH>;
78		power-supply = <&reg_3v3>;
79
80		port {
81			panel_input: endpoint {
82				remote-endpoint = <&ltdc_ep0_out>;
83			};
84		};
85	};
86
87	reg_3v3: regulator_3v3 {
88		compatible = "regulator-fixed";
89		regulator-name = "3V3";
90		regulator-min-microvolt = <3300000>;
91		regulator-max-microvolt = <3300000>;
92		regulator-always-on;
93		vin-supply = <&v3v3>;
94	};
95
96	/* supplied by either debug board or PoE */
97	reg_5v2: regulator_5v2 {
98		compatible = "regulator-fixed";
99		regulator-name = "5V2";
100		regulator-min-microvolt = <5200000>;
101		regulator-max-microvolt = <5200000>;
102		regulator-always-on;
103	};
104};
105
106&ethernet0 {
107	pinctrl-names = "default", "sleep";
108	pinctrl-0 = <&ethernet0_rgmii_pins_b>;
109	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_b>;
110	phy-mode = "rgmii-id";
111	phy-handle = <&ethphy>;
112	status = "okay";
113
114	mdio0 {
115		compatible = "snps,dwmac-mdio";
116		#address-cells = <1>;
117		#size-cells = <0>;
118
119		ethphy: ethernet-phy@3 { /* KSZ9031RN */
120			reg = <3>;
121			reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>; /* ETH_RST# */
122			interrupt-parent = <&gpioa>;
123			interrupts = <6 IRQ_TYPE_EDGE_FALLING>; /* ETH_MDINT# */
124			rxc-skew-ps = <1860>;
125			txc-skew-ps = <1860>;
126			reset-assert-us = <10000>;
127			reset-deassert-us = <300>;
128			micrel,force-master;
129		};
130	};
131};
132
133&gpioz {
134	gpio-line-names = "HWID0", "HWID1", "HWID2", "HWID3", "", "",
135			  "HWID4", "HWID5";
136};
137
138&i2c5 {
139	pinctrl-names = "default", "sleep";
140	pinctrl-0 = <&i2c5_pins_b>;
141	pinctrl-1 = <&i2c5_sleep_pins_b>;
142	clock-frequency = <400000>;
143	status = "okay";
144
145	touchscreen@38 {
146		compatible = "edt,edt-ft5x06";
147		interrupt-parent = <&gpiod>;
148		interrupts = <11 IRQ_TYPE_EDGE_FALLING>; /* TOUCH_INT# */
149		vcc-supply = <&reg_3v3>;
150		reg = <0x38>;
151		reset-gpios = <&gpiof 8 GPIO_ACTIVE_LOW>; /* TOUCH_RESET# */
152		touchscreen-size-x = <1792>;
153		touchscreen-size-y = <1024>;
154		wakeup-source;
155	};
156};
157
158&ltdc {
159	pinctrl-names = "default", "sleep";
160	pinctrl-0 = <&ltdc_pins_c>;
161	pinctrl-1 = <&ltdc_sleep_pins_c>;
162	status = "okay";
163
164	port {
165		ltdc_ep0_out: endpoint@0 {
166			reg = <0>;
167			remote-endpoint = <&panel_input>;
168		};
169	};
170};
171
172&pmic {
173	regulators {
174		buck4-supply = <&reg_5v2>;	/* VIN */
175		ldo2-supply = <&reg_5v2>;	/* PMIC_LDO25IN */
176		ldo5-supply = <&reg_5v2>;	/* PMIC_LDO25IN */
177		boost-supply = <&reg_5v2>;	/* PMIC_BSTIN */
178		pwr_sw2-supply = <&bst_out>;    /* PMIC_SWIN */
179	};
180};
181
182&sdmmc1 {
183	pinctrl-names = "default", "opendrain", "sleep";
184	pinctrl-0 = <&sdmmc1_b4_pins_a>;
185	pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
186	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
187	bus-width = <4>;
188	cd-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
189	disable-wp;
190	no-1-8-v;
191	st,neg-edge;
192	vmmc-supply = <&reg_3v3>;
193	status = "okay";
194};
195
196&sdmmc1_b4_pins_a {
197	/*
198	 * board lacks external pull-ups on SDMMC lines. Class 10 SD refuses to
199	 * work, thus enable internal pull-ups.
200	 */
201	pins1 {
202		/delete-property/ bias-disable;
203		bias-pull-up;
204	};
205	pins2 {
206		/delete-property/ bias-disable;
207		bias-pull-up;
208	};
209};
210
211&sdmmc2 {
212	pinctrl-names = "default", "opendrain", "sleep";
213	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_b>;
214	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_b>;
215	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_b>;
216	bus-width = <8>;
217	no-1-8-v;
218	no-sd;
219	no-sdio;
220	non-removable;
221	st,neg-edge;
222	vmmc-supply = <&reg_3v3>;
223	status = "okay";
224};
225
226&timers3 {
227	status = "okay";
228
229	backlight_pwm: pwm {
230		pinctrl-names = "default", "sleep";
231		pinctrl-0 = <&pwm3_pins_b>;
232		pinctrl-1 = <&pwm3_sleep_pins_b>;
233		status = "okay";
234	};
235};
236
237&timers5 {
238	status = "okay";
239
240	leds_pwm: pwm {
241		pinctrl-names = "default", "sleep";
242		pinctrl-0 = <&pwm5_pins_b>;
243		pinctrl-1 = <&pwm5_sleep_pins_b>;
244		status = "okay";
245	};
246};
247
248&uart4 {
249	pinctrl-names = "default";
250	pinctrl-0 = <&uart4_pins_a>;
251	status = "okay";
252};
253