1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2/*
3 * Copyright (C) STMicroelectronics 2021 - All Rights Reserved
4 * Author: Alexandre Torgue <alexandre.torgue@foss.st.com> for STMicroelectronics.
5 */
6
7/dts-v1/;
8
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/input/input.h>
11#include <dt-bindings/leds/common.h>
12#include "stm32mp135.dtsi"
13#include "stm32mp13xf.dtsi"
14#include "stm32mp13-pinctrl.dtsi"
15
16/ {
17	model = "STMicroelectronics STM32MP135F-DK Discovery Board";
18	compatible = "st,stm32mp135f-dk", "st,stm32mp135";
19
20	aliases {
21		serial0 = &uart4;
22	};
23
24	memory@c0000000 {
25		device_type = "memory";
26		reg = <0xc0000000 0x20000000>;
27	};
28
29	reserved-memory {
30		#address-cells = <1>;
31		#size-cells = <1>;
32		ranges;
33
34		optee@dd000000 {
35			reg = <0xdd000000 0x3000000>;
36			no-map;
37		};
38	};
39
40	gpio-keys {
41		compatible = "gpio-keys";
42
43		button-user {
44			label = "User-PA13";
45			linux,code = <BTN_1>;
46			gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
47		};
48	};
49
50	leds {
51		compatible = "gpio-leds";
52
53		led-blue {
54			function = LED_FUNCTION_HEARTBEAT;
55			color = <LED_COLOR_ID_BLUE>;
56			gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
57			linux,default-trigger = "heartbeat";
58			default-state = "off";
59		};
60	};
61
62	v3v3_sw: v3v3-sw {
63		compatible = "regulator-fixed";
64		regulator-name = "v3v3_sw";
65		regulator-min-microvolt = <3300000>;
66		regulator-max-microvolt = <3300000>;
67		regulator-always-on;
68	};
69
70	vdd_adc: vdd-adc {
71		compatible = "regulator-fixed";
72		regulator-name = "vdd_adc";
73		regulator-min-microvolt = <3300000>;
74		regulator-max-microvolt = <3300000>;
75		regulator-always-on;
76	};
77
78	vdd_sd: vdd-sd {
79		compatible = "regulator-fixed";
80		regulator-name = "vdd_sd";
81		regulator-min-microvolt = <2900000>;
82		regulator-max-microvolt = <2900000>;
83		regulator-always-on;
84	};
85
86	vdd_usb: vdd-usb {
87		compatible = "regulator-fixed";
88		regulator-name = "vdd_usb";
89		regulator-min-microvolt = <3300000>;
90		regulator-max-microvolt = <3300000>;
91		regulator-always-on;
92	};
93};
94
95&adc_1 {
96	pinctrl-names = "default";
97	pinctrl-0 = <&adc1_usb_cc_pins_a>;
98	vdda-supply = <&vdd_adc>;
99	vref-supply = <&vdd_adc>;
100	status = "okay";
101	adc1: adc@0 {
102		status = "okay";
103		/*
104		 * Type-C USB_PWR_CC1 & USB_PWR_CC2 on in6 & in12.
105		 * Use at least 5 * RC time, e.g. 5 * (Rp + Rd) * C:
106		 * 5 * (5.1 + 47kOhms) * 5pF => 1.3us.
107		 * Use arbitrary margin here (e.g. 5us).
108		 */
109		channel@6 {
110			reg = <6>;
111			st,min-sample-time-ns = <5000>;
112		};
113		channel@12 {
114			reg = <12>;
115			st,min-sample-time-ns = <5000>;
116		};
117	};
118};
119
120&i2c1 {
121	pinctrl-names = "default", "sleep";
122	pinctrl-0 = <&i2c1_pins_a>;
123	pinctrl-1 = <&i2c1_sleep_pins_a>;
124	i2c-scl-rising-time-ns = <96>;
125	i2c-scl-falling-time-ns = <3>;
126	clock-frequency = <1000000>;
127	status = "okay";
128	/* spare dmas for other usage */
129	/delete-property/dmas;
130	/delete-property/dma-names;
131
132	mcp23017: pinctrl@21 {
133		compatible = "microchip,mcp23017";
134		reg = <0x21>;
135		gpio-controller;
136		#gpio-cells = <2>;
137		interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
138		interrupt-parent = <&gpiog>;
139		pinctrl-names = "default";
140		pinctrl-0 = <&mcp23017_pins_a>;
141		interrupt-controller;
142		#interrupt-cells = <2>;
143		microchip,irq-mirror;
144	};
145
146	typec@53 {
147		compatible = "st,stm32g0-typec";
148		reg = <0x53>;
149		/* Alert pin on PI2 */
150		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
151		interrupt-parent = <&gpioi>;
152		/* Internal pull-up on PI2 */
153		pinctrl-names = "default";
154		pinctrl-0 = <&stm32g0_intn_pins_a>;
155		firmware-name = "stm32g0-ucsi.mp135f-dk.fw";
156		connector {
157			compatible = "usb-c-connector";
158			label = "USB-C";
159
160			port {
161				con_usb_c_g0_ep: endpoint {
162					remote-endpoint = <&usbotg_hs_ep>;
163				};
164			};
165		};
166	};
167};
168
169&i2c5 {
170	pinctrl-names = "default", "sleep";
171	pinctrl-0 = <&i2c5_pins_a>;
172	pinctrl-1 = <&i2c5_sleep_pins_a>;
173	i2c-scl-rising-time-ns = <170>;
174	i2c-scl-falling-time-ns = <5>;
175	clock-frequency = <400000>;
176	status = "okay";
177	/* spare dmas for other usage */
178	/delete-property/dmas;
179	/delete-property/dma-names;
180};
181
182&iwdg2 {
183	timeout-sec = <32>;
184	status = "okay";
185};
186
187&rtc {
188	status = "okay";
189};
190
191&sdmmc1 {
192	pinctrl-names = "default", "opendrain", "sleep";
193	pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_clk_pins_a>;
194	pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_clk_pins_a>;
195	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
196	cd-gpios = <&gpioh 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
197	disable-wp;
198	st,neg-edge;
199	bus-width = <4>;
200	vmmc-supply = <&vdd_sd>;
201	status = "okay";
202};
203
204&spi5 {
205	pinctrl-names = "default", "sleep";
206	pinctrl-0 = <&spi5_pins_a>;
207	pinctrl-1 = <&spi5_sleep_pins_a>;
208	status = "disabled";
209};
210
211&timers3 {
212	/delete-property/dmas;
213	/delete-property/dma-names;
214	status = "disabled";
215	pwm {
216		pinctrl-0 = <&pwm3_pins_a>;
217		pinctrl-1 = <&pwm3_sleep_pins_a>;
218		pinctrl-names = "default", "sleep";
219		status = "okay";
220	};
221	timer@2 {
222		status = "okay";
223	};
224};
225
226&timers4 {
227	/delete-property/dmas;
228	/delete-property/dma-names;
229	status = "disabled";
230	pwm {
231		pinctrl-0 = <&pwm4_pins_a>;
232		pinctrl-1 = <&pwm4_sleep_pins_a>;
233		pinctrl-names = "default", "sleep";
234		status = "okay";
235	};
236	timer@3 {
237		status = "okay";
238	};
239};
240
241&timers8 {
242	/delete-property/dmas;
243	/delete-property/dma-names;
244	status = "disabled";
245	pwm {
246		pinctrl-0 = <&pwm8_pins_a>;
247		pinctrl-1 = <&pwm8_sleep_pins_a>;
248		pinctrl-names = "default", "sleep";
249		status = "okay";
250	};
251	timer@7 {
252		status = "okay";
253	};
254};
255
256&timers14 {
257	status = "disabled";
258	pwm {
259		pinctrl-0 = <&pwm14_pins_a>;
260		pinctrl-1 = <&pwm14_sleep_pins_a>;
261		pinctrl-names = "default", "sleep";
262		status = "okay";
263	};
264	timer@13 {
265		status = "okay";
266	};
267};
268
269&uart4 {
270	pinctrl-names = "default";
271	pinctrl-0 = <&uart4_pins_a>;
272	status = "okay";
273};
274
275&usbh_ehci {
276	phys = <&usbphyc_port0>;
277	status = "okay";
278	#address-cells = <1>;
279	#size-cells = <0>;
280	/* onboard HUB */
281	hub@1 {
282		compatible = "usb424,2514";
283		reg = <1>;
284		vdd-supply = <&v3v3_sw>;
285	};
286};
287
288&usbotg_hs {
289	phys = <&usbphyc_port1 0>;
290	phy-names = "usb2-phy";
291	usb-role-switch;
292	status = "okay";
293	port {
294		usbotg_hs_ep: endpoint {
295			remote-endpoint = <&con_usb_c_g0_ep>;
296		};
297	};
298};
299
300&usbphyc {
301	status = "okay";
302};
303
304&usbphyc_port0 {
305	phy-supply = <&vdd_usb>;
306	st,current-boost-microamp = <1000>;
307	st,decrease-hs-slew-rate;
308	st,tune-hs-dc-level = <2>;
309	st,enable-hs-rftime-reduction;
310	st,trim-hs-current = <11>;
311	st,trim-hs-impedance = <2>;
312	st,tune-squelch-level = <1>;
313	st,enable-hs-rx-gain-eq;
314	st,no-hs-ftime-ctrl;
315	st,no-lsfs-sc;
316};
317
318&usbphyc_port1 {
319	phy-supply = <&vdd_usb>;
320	st,current-boost-microamp = <1000>;
321	st,decrease-hs-slew-rate;
322	st,tune-hs-dc-level = <2>;
323	st,enable-hs-rftime-reduction;
324	st,trim-hs-current = <11>;
325	st,trim-hs-impedance = <2>;
326	st,tune-squelch-level = <1>;
327	st,enable-hs-rx-gain-eq;
328	st,no-hs-ftime-ctrl;
329	st,no-lsfs-sc;
330};
331