1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2/*
3 * Copyright (C) 2024 Marek Vasut <marex@denx.de>
4 *
5 * DHCOR STM32MP13 variant:
6 * DHCR-STM32MP135F-C100-R051-EE-F0409-SPI4-RTC-WBT-I-01LG
7 * DHCOR PCB number: 718-100 or newer
8 * DHSBC PCB number: 719-100 or newer
9 */
10
11/dts-v1/;
12
13#include <dt-bindings/regulator/st,stm32mp13-regulator.h>
14#include "stm32mp135.dtsi"
15#include "stm32mp13xf.dtsi"
16#include "stm32mp13xx-dhcor-som.dtsi"
17
18/ {
19	model = "DH electronics STM32MP135F DHCOR DHSBC";
20	compatible = "dh,stm32mp135f-dhcor-dhsbc",
21		     "dh,stm32mp135f-dhcor-som",
22		     "st,stm32mp135";
23
24	aliases {
25		ethernet0 = &ethernet1;
26		ethernet1 = &ethernet2;
27		serial2 = &usart1;
28		serial3 = &usart2;
29	};
30
31	chosen {
32		stdout-path = "serial0:115200n8";
33	};
34};
35
36&adc_1 {
37	pinctrl-names = "default";
38	pinctrl-0 = <&adc1_pins_a &adc1_usb_cc_pins_b>;
39	vdda-supply = <&vdd_adc>;
40	vref-supply = <&vdd_adc>;
41	status = "okay";
42
43	adc1: adc@0 {
44		status = "okay";
45
46		/*
47		 * Type-C USB_PWR_CC1 & USB_PWR_CC2 on in2 & in11.
48		 * Use at least 5 * RC time, e.g. 5 * (Rp + Rd) * C:
49		 * 5 * (5.1 + 47kOhms) * 5pF => 1.3us.
50		 * Use arbitrary margin here (e.g. 5us).
51		 *
52		 * The pinmux pins must be set as ANALOG, use datasheet
53		 * DS13483 Table 7. STM32MP135C/F ball definitions to
54		 * find out which 'pin name' maps to which 'additional
55		 * functions', which lists the mapping between pin and
56		 * ADC channel. In this case, PA5 maps to ADC1_INP2 and
57		 * PF13 maps to ADC1_INP11 .
58		 */
59		channel@2 {
60			reg = <2>;
61			st,min-sample-time-ns = <5000>;
62		};
63
64		channel@11 {
65			reg = <11>;
66			st,min-sample-time-ns = <5000>;
67		};
68
69		/* Expansion connector: INP12:pin29 */
70		channel@12 {
71			reg = <12>;
72			st,min-sample-time-ns = <5000>;
73		};
74	};
75};
76
77&ethernet1 {
78	nvmem-cell-names = "mac-address";
79	nvmem-cells = <&ethernet_mac1_address>;
80	phy-handle = <&ethphy1>;
81	phy-mode = "rgmii-id";
82	pinctrl-0 = <&eth1_rgmii_pins_a>;
83	pinctrl-1 = <&eth1_rgmii_sleep_pins_a>;
84	pinctrl-names = "default", "sleep";
85	st,ext-phyclk;
86	status = "okay";
87
88	mdio {
89		#address-cells = <1>;
90		#size-cells = <0>;
91		compatible = "snps,dwmac-mdio";
92
93		ethphy1: ethernet-phy@1 {
94			/* RTL8211F */
95			compatible = "ethernet-phy-id001c.c916";
96			interrupt-parent = <&gpiog>;
97			interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
98			reg = <1>;
99			realtek,clkout-disable;
100			reset-assert-us = <15000>;
101			reset-deassert-us = <55000>;
102			reset-gpios = <&gpioa 11 GPIO_ACTIVE_LOW>;
103
104			leds {
105				#address-cells = <1>;
106				#size-cells = <0>;
107
108				led@0 {
109					reg = <0>;
110					color = <LED_COLOR_ID_GREEN>;
111					function = LED_FUNCTION_WAN;
112					linux,default-trigger = "netdev";
113				};
114
115				led@1 {
116					reg = <1>;
117					color = <LED_COLOR_ID_YELLOW>;
118					function = LED_FUNCTION_WAN;
119					linux,default-trigger = "netdev";
120				};
121			};
122		};
123	};
124};
125
126&ethernet2 {
127	nvmem-cell-names = "mac-address";
128	nvmem-cells = <&ethernet_mac2_address>;
129	phy-handle = <&ethphy2>;
130	phy-mode = "rgmii-id";
131	pinctrl-0 = <&eth2_rgmii_pins_a>;
132	pinctrl-1 = <&eth2_rgmii_sleep_pins_a>;
133	pinctrl-names = "default", "sleep";
134	st,ext-phyclk;
135	status = "okay";
136
137	mdio {
138		#address-cells = <1>;
139		#size-cells = <0>;
140		compatible = "snps,dwmac-mdio";
141
142		ethphy2: ethernet-phy@1 {
143			/* RTL8211F */
144			compatible = "ethernet-phy-id001c.c916";
145			interrupt-parent = <&gpiog>;
146			interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
147			reg = <1>;
148			realtek,clkout-disable;
149			reset-assert-us = <15000>;
150			reset-deassert-us = <55000>;
151			reset-gpios = <&gpiog 8 GPIO_ACTIVE_LOW>;
152
153			leds {
154				#address-cells = <1>;
155				#size-cells = <0>;
156
157				led@0 {
158					reg = <0>;
159					color = <LED_COLOR_ID_GREEN>;
160					function = LED_FUNCTION_LAN;
161					linux,default-trigger = "netdev";
162				};
163
164				led@1 {
165					reg = <1>;
166					color = <LED_COLOR_ID_YELLOW>;
167					function = LED_FUNCTION_LAN;
168					linux,default-trigger = "netdev";
169				};
170			};
171		};
172	};
173};
174
175&gpioa {
176	gpio-line-names = "", "", "", "",
177			  "", "DHSBC_USB_PWR_CC1", "", "",
178			  "", "", "", "DHSBC_nETH1_RST",
179			  "", "DHCOR_HW-CODING_0", "", "DHSBC_HW-CODE_2";
180};
181
182&gpiob {
183	gpio-line-names = "", "", "", "",
184			  "", "", "", "DHCOR_BT_HOST_WAKE",
185			  "", "", "", "",
186			  "", "DHSBC_nTPM_CS", "", "";
187};
188
189&gpioc {
190	gpio-line-names = "", "", "", "DHSBC_USB_5V_MEAS",
191			  "", "", "", "",
192			  "", "", "", "",
193			  "", "", "", "";
194};
195
196&gpiod {
197	gpio-line-names = "", "", "", "",
198			  "", "DHCOR_RAM-CODING_0", "", "",
199			  "", "DHCOR_RAM-CODING_1", "", "",
200			  "", "DHSBC_HW-CODE_1", "", "";
201};
202
203&gpioe {
204	gpio-line-names = "", "", "", "",
205			  "", "", "", "",
206			  "", "DHSBC_nTPM_RST", "", "",
207			  "DHSBC_nTPM_PIRQ", "", "DHCOR_WL_HOST_WAKE", "";
208};
209
210&gpiof {
211	gpio-line-names = "", "", "DHSBC_USB_PWR_nFLT", "",
212			  "", "", "", "",
213			  "", "", "", "",
214			  "DHCOR_WL_REG_ON", "DHSBC_USB_PWR_CC2", "", "";
215};
216
217&gpiog {
218	gpio-line-names = "", "", "", "",
219			  "", "", "", "",
220			  "DHSBC_nETH2_RST", "DHCOR_BT_DEV_WAKE", "", "",
221			  "DHSBC_ETH1_INTB", "", "", "DHSBC_ETH2_INTB";
222};
223
224&gpioh {
225	gpio-line-names = "", "", "", "DHSBC_HW-CODE_0",
226			  "", "", "", "",
227			  "", "", "", "",
228			  "", "", "", "";
229};
230
231&gpioi {
232	gpio-line-names = "DHCOR_RTC_nINT", "DHCOR_HW-CODING_1",
233			  "DHCOR_BT_REG_ON", "DHCOR_PMIC_nINT",
234			  "DHSBC_BOOT0", "DHSBC_BOOT1",
235			  "DHSBC_BOOT2", "DHSBC_USB-C_DATA_VBUS";
236};
237
238&i2c1 { /* Expansion connector: SDA:pin27 SCL:pin28 */
239	pinctrl-names = "default", "sleep";
240	pinctrl-0 = <&i2c1_pins_a>;
241	pinctrl-1 = <&i2c1_sleep_pins_a>;
242	i2c-scl-rising-time-ns = <96>;
243	i2c-scl-falling-time-ns = <3>;
244	clock-frequency = <400000>;
245	status = "okay";
246	/* spare dmas for other usage */
247	/delete-property/dmas;
248	/delete-property/dma-names;
249};
250
251&i2c5 { /* Expansion connector: SDA:pin3 SCL:pin5 */
252	pinctrl-names = "default", "sleep";
253	pinctrl-0 = <&i2c5_pins_b>;
254	pinctrl-1 = <&i2c5_sleep_pins_b>;
255	i2c-scl-rising-time-ns = <96>;
256	i2c-scl-falling-time-ns = <3>;
257	clock-frequency = <400000>;
258	status = "okay";
259	/* spare dmas for other usage */
260	/delete-property/dmas;
261	/delete-property/dma-names;
262};
263
264&m_can1 { /* Expansion connector: TX:pin16 RX:pin18 */
265	pinctrl-names = "default", "sleep";
266	pinctrl-0 = <&m_can1_pins_a>;
267	pinctrl-1 = <&m_can1_sleep_pins_a>;
268	status = "okay";
269};
270
271&m_can2 { /* Expansion connector: TX:pin22 RX:pin26 */
272	pinctrl-names = "default", "sleep";
273	pinctrl-0 = <&m_can2_pins_a>;
274	pinctrl-1 = <&m_can2_sleep_pins_a>;
275	status = "okay";
276};
277
278&pwr_regulators {
279	vdd-supply = <&vdd>;
280	vdd_3v3_usbfs-supply = <&vdd_usb>;
281	status = "okay";
282};
283
284&sai1 { /* Expansion connector: SCK-A:pin12 FS-A:pin35 SD-A:pin38 SD-B:pin40 */
285	clocks = <&rcc SAI1>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
286	clock-names = "pclk", "x8k", "x11k";
287	pinctrl-names = "default", "sleep";
288	pinctrl-0 = <&sai1a_pins_a &sai1b_pins_a>;
289	pinctrl-1 = <&sai1a_sleep_pins_a &sai1b_sleep_pins_a>;
290};
291
292&scmi_voltd {
293	status = "disabled";
294};
295
296&spi2 {
297	pinctrl-names = "default", "sleep";
298	pinctrl-0 = <&spi2_pins_a>;
299	pinctrl-1 = <&spi2_sleep_pins_a>;
300	cs-gpios = <&gpiob 13 0>;
301	status = "okay";
302
303	st33htph: tpm@0 {
304		compatible = "st,st33htpm-spi", "tcg,tpm_tis-spi";
305		reg = <0>;
306		interrupt-parent = <&gpioe>;
307		interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
308		reset-gpios = <&gpioe 12 GPIO_ACTIVE_LOW>;
309		spi-max-frequency = <24000000>;
310	};
311};
312
313&spi3 { /* Expansion connector: MOSI:pin19 MISO:pin21 SCK:pin22 nCS:pin24 */
314	pinctrl-names = "default", "sleep";
315	pinctrl-0 = <&spi3_pins_a>;
316	pinctrl-1 = <&spi3_sleep_pins_a>;
317	cs-gpios = <&gpiof 3 0>;
318	status = "disabled";
319};
320
321&timers5 { /* Expansion connector: CH3:pin31 */
322	/delete-property/dmas;
323	/delete-property/dma-names;
324	status = "okay";
325
326	pwm {
327		pinctrl-0 = <&pwm5_pins_a>;
328		pinctrl-1 = <&pwm5_sleep_pins_a>;
329		pinctrl-names = "default", "sleep";
330		status = "okay";
331	};
332	timer@4 {
333		status = "okay";
334	};
335};
336
337&timers13 { /* Expansion connector: CH1:pin32 */
338	/delete-property/dmas;
339	/delete-property/dma-names;
340	status = "okay";
341
342	pwm {
343		pinctrl-0 = <&pwm13_pins_a>;
344		pinctrl-1 = <&pwm13_sleep_pins_a>;
345		pinctrl-names = "default", "sleep";
346		status = "okay";
347	};
348	timer@12 {
349		status = "okay";
350	};
351};
352
353&usart1 { /* Expansion connector: RX:pin33 TX:pin37 */
354	pinctrl-names = "default", "sleep", "idle";
355	pinctrl-0 = <&usart1_pins_b>;
356	pinctrl-1 = <&usart1_sleep_pins_b>;
357	pinctrl-2 = <&usart1_idle_pins_b>;
358	status = "okay";
359};
360
361&usart2 { /* Expansion connector: RX:pin10 TX:pin8 RTS:pin11 CTS:pin36 */
362	pinctrl-names = "default", "sleep", "idle";
363	pinctrl-0 = <&usart2_pins_b>;
364	pinctrl-1 = <&usart2_sleep_pins_b>;
365	pinctrl-2 = <&usart2_idle_pins_b>;
366	uart-has-rtscts;
367	status = "okay";
368};
369
370&usbh_ehci {
371	phys = <&usbphyc_port0>;
372	status = "okay";
373};
374
375&usbh_ohci {
376	phys = <&usbphyc_port0>;
377	status = "okay";
378};
379
380&usbotg_hs {
381	dr_mode = "peripheral";
382	phys = <&usbphyc_port1 0>;
383	phy-names = "usb2-phy";
384	usb33d-supply = <&usb33>;
385	status = "okay";
386};
387
388&usbphyc {
389	status = "okay";
390	vdda1v1-supply = <&reg11>;
391	vdda1v8-supply = <&reg18>;
392};
393
394&usbphyc_port0 {
395	phy-supply = <&vdd_usb>;
396	st,current-boost-microamp = <1000>;
397	st,decrease-hs-slew-rate;
398	st,tune-hs-dc-level = <2>;
399	st,enable-hs-rftime-reduction;
400	st,trim-hs-current = <11>;
401	st,trim-hs-impedance = <2>;
402	st,tune-squelch-level = <1>;
403	st,enable-hs-rx-gain-eq;
404	st,no-hs-ftime-ctrl;
405	st,no-lsfs-sc;
406	connector {
407		compatible = "usb-a-connector";
408		vbus-supply = <&vbus_sw>;
409	};
410};
411
412&usbphyc_port1 {
413	phy-supply = <&vdd_usb>;
414	st,current-boost-microamp = <1000>;
415	st,decrease-hs-slew-rate;
416	st,tune-hs-dc-level = <2>;
417	st,enable-hs-rftime-reduction;
418	st,trim-hs-current = <11>;
419	st,trim-hs-impedance = <2>;
420	st,tune-squelch-level = <1>;
421	st,enable-hs-rx-gain-eq;
422	st,no-hs-ftime-ctrl;
423	st,no-lsfs-sc;
424	connector {
425		compatible = "gpio-usb-b-connector", "usb-b-connector";
426		vbus-gpios = <&gpioi 7 GPIO_ACTIVE_HIGH>;
427		label = "Type-C";
428		self-powered;
429		type = "micro";
430	};
431};
432
433/* LDO2 is expansion connector 3V3 supply on STM32MP13xx DHCOR DHSBC rev.200 */
434&vdd_ldo2 {
435	regulator-always-on;
436	regulator-boot-on;
437	regulator-min-microvolt = <3300000>;
438	regulator-max-microvolt = <3300000>;
439};
440
441/* LDO5 is carrier board 3V3 supply on STM32MP13xx DHCOR DHSBC rev.200 */
442&vdd_sd {
443	regulator-always-on;
444	regulator-boot-on;
445	regulator-min-microvolt = <3300000>;
446	regulator-max-microvolt = <3300000>;
447};
448