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