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