1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2/*
3 * Copyright (C) STMicroelectronics 2019 - All Rights Reserved
4 * Author: Alexandre Torgue <[email protected]> for STMicroelectronics.
5 */
6
7#include <dt-bindings/gpio/gpio.h>
8#include <dt-bindings/mfd/st,stpmic1.h>
9
10/ {
11	memory@c0000000 {
12		device_type = "memory";
13		reg = <0xc0000000 0x20000000>;
14	};
15
16	reserved-memory {
17		#address-cells = <1>;
18		#size-cells = <1>;
19		ranges;
20
21		mcuram2: mcuram2@10000000 {
22			compatible = "shared-dma-pool";
23			reg = <0x10000000 0x40000>;
24			no-map;
25		};
26
27		vdev0vring0: vdev0vring0@10040000 {
28			compatible = "shared-dma-pool";
29			reg = <0x10040000 0x1000>;
30			no-map;
31		};
32
33		vdev0vring1: vdev0vring1@10041000 {
34			compatible = "shared-dma-pool";
35			reg = <0x10041000 0x1000>;
36			no-map;
37		};
38
39		vdev0buffer: vdev0buffer@10042000 {
40			compatible = "shared-dma-pool";
41			reg = <0x10042000 0x4000>;
42			no-map;
43		};
44
45		mcuram: mcuram@30000000 {
46			compatible = "shared-dma-pool";
47			reg = <0x30000000 0x40000>;
48			no-map;
49		};
50
51		retram: retram@38000000 {
52			compatible = "shared-dma-pool";
53			reg = <0x38000000 0x10000>;
54			no-map;
55		};
56
57		gpu_reserved: gpu@d4000000 {
58			reg = <0xd4000000 0x4000000>;
59			no-map;
60		};
61	};
62
63	led {
64		compatible = "gpio-leds";
65		led-blue {
66			label = "heartbeat";
67			gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>;
68			linux,default-trigger = "heartbeat";
69			default-state = "off";
70		};
71	};
72
73	sound {
74		compatible = "audio-graph-card";
75		label = "STM32MP1-DK";
76		routing =
77			"Playback" , "MCLK",
78			"Capture" , "MCLK",
79			"MICL" , "Mic Bias";
80		dais = <&sai2a_port &sai2b_port &i2s2_port>;
81		status = "okay";
82	};
83};
84
85&adc {
86	pinctrl-names = "default";
87	pinctrl-0 = <&adc12_ain_pins_a>, <&adc12_usb_cc_pins_a>;
88	vdd-supply = <&vdd>;
89	vdda-supply = <&vdd>;
90	vref-supply = <&vrefbuf>;
91	status = "disabled";
92	adc1: adc@0 {
93		/*
94		 * Type-C USB_PWR_CC1 & USB_PWR_CC2 on in18 & in19.
95		 * Use at least 5 * RC time, e.g. 5 * (Rp + Rd) * C:
96		 * 5 * (56 + 47kOhms) * 5pF => 2.5us.
97		 * Use arbitrary margin here (e.g. 5us).
98		 */
99		st,min-sample-time-nsecs = <5000>;
100		/* AIN connector, USB Type-C CC1 & CC2 */
101		st,adc-channels = <0 1 6 13 18 19>;
102		status = "okay";
103	};
104	adc2: adc@100 {
105		/* AIN connector, USB Type-C CC1 & CC2 */
106		st,adc-channels = <0 1 2 6 18 19>;
107		st,min-sample-time-nsecs = <5000>;
108		status = "okay";
109	};
110};
111
112&cec {
113	pinctrl-names = "default", "sleep";
114	pinctrl-0 = <&cec_pins_b>;
115	pinctrl-1 = <&cec_sleep_pins_b>;
116	status = "okay";
117};
118
119&dts {
120	status = "okay";
121};
122
123&ethernet0 {
124	status = "okay";
125	pinctrl-0 = <&ethernet0_rgmii_pins_a>;
126	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_a>;
127	pinctrl-names = "default", "sleep";
128	phy-mode = "rgmii-id";
129	max-speed = <1000>;
130	phy-handle = <&phy0>;
131
132	mdio0 {
133		#address-cells = <1>;
134		#size-cells = <0>;
135		compatible = "snps,dwmac-mdio";
136		phy0: ethernet-phy@0 {
137			reg = <0>;
138		};
139	};
140};
141
142&gpu {
143	contiguous-area = <&gpu_reserved>;
144};
145
146&i2c1 {
147	pinctrl-names = "default", "sleep";
148	pinctrl-0 = <&i2c1_pins_a>;
149	pinctrl-1 = <&i2c1_sleep_pins_a>;
150	i2c-scl-rising-time-ns = <100>;
151	i2c-scl-falling-time-ns = <7>;
152	status = "okay";
153	/delete-property/dmas;
154	/delete-property/dma-names;
155
156	hdmi-transmitter@39 {
157		compatible = "sil,sii9022";
158		reg = <0x39>;
159		iovcc-supply = <&v3v3_hdmi>;
160		cvcc12-supply = <&v1v2_hdmi>;
161		reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>;
162		interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
163		interrupt-parent = <&gpiog>;
164		#sound-dai-cells = <0>;
165		status = "okay";
166
167		ports {
168			#address-cells = <1>;
169			#size-cells = <0>;
170
171			port@0 {
172				reg = <0>;
173				sii9022_in: endpoint {
174					remote-endpoint = <&ltdc_ep0_out>;
175				};
176			};
177
178			port@3 {
179				reg = <3>;
180				sii9022_tx_endpoint: endpoint {
181					remote-endpoint = <&i2s2_endpoint>;
182				};
183			};
184		};
185	};
186
187	cs42l51: cs42l51@4a {
188		compatible = "cirrus,cs42l51";
189		reg = <0x4a>;
190		#sound-dai-cells = <0>;
191		VL-supply = <&v3v3>;
192		VD-supply = <&v1v8_audio>;
193		VA-supply = <&v1v8_audio>;
194		VAHP-supply = <&v1v8_audio>;
195		reset-gpios = <&gpiog 9 GPIO_ACTIVE_LOW>;
196		clocks = <&sai2a>;
197		clock-names = "MCLK";
198		status = "okay";
199
200		cs42l51_port: port {
201			#address-cells = <1>;
202			#size-cells = <0>;
203
204			cs42l51_tx_endpoint: endpoint@0 {
205				reg = <0>;
206				remote-endpoint = <&sai2a_endpoint>;
207				frame-master;
208				bitclock-master;
209			};
210
211			cs42l51_rx_endpoint: endpoint@1 {
212				reg = <1>;
213				remote-endpoint = <&sai2b_endpoint>;
214				frame-master;
215				bitclock-master;
216			};
217		};
218	};
219};
220
221&i2c4 {
222	pinctrl-names = "default", "sleep";
223	pinctrl-0 = <&i2c4_pins_a>;
224	pinctrl-1 = <&i2c4_sleep_pins_a>;
225	i2c-scl-rising-time-ns = <185>;
226	i2c-scl-falling-time-ns = <20>;
227	clock-frequency = <400000>;
228	status = "okay";
229	/* spare dmas for other usage */
230	/delete-property/dmas;
231	/delete-property/dma-names;
232
233	pmic: stpmic@33 {
234		compatible = "st,stpmic1";
235		reg = <0x33>;
236		interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>;
237		interrupt-controller;
238		#interrupt-cells = <2>;
239		status = "okay";
240
241		regulators {
242			compatible = "st,stpmic1-regulators";
243			ldo1-supply = <&v3v3>;
244			ldo3-supply = <&vdd_ddr>;
245			ldo6-supply = <&v3v3>;
246			pwr_sw1-supply = <&bst_out>;
247			pwr_sw2-supply = <&bst_out>;
248
249			vddcore: buck1 {
250				regulator-name = "vddcore";
251				regulator-min-microvolt = <1200000>;
252				regulator-max-microvolt = <1350000>;
253				regulator-always-on;
254				regulator-initial-mode = <0>;
255				regulator-over-current-protection;
256			};
257
258			vdd_ddr: buck2 {
259				regulator-name = "vdd_ddr";
260				regulator-min-microvolt = <1350000>;
261				regulator-max-microvolt = <1350000>;
262				regulator-always-on;
263				regulator-initial-mode = <0>;
264				regulator-over-current-protection;
265			};
266
267			vdd: buck3 {
268				regulator-name = "vdd";
269				regulator-min-microvolt = <3300000>;
270				regulator-max-microvolt = <3300000>;
271				regulator-always-on;
272				st,mask-reset;
273				regulator-initial-mode = <0>;
274				regulator-over-current-protection;
275			};
276
277			v3v3: buck4 {
278				regulator-name = "v3v3";
279				regulator-min-microvolt = <3300000>;
280				regulator-max-microvolt = <3300000>;
281				regulator-always-on;
282				regulator-over-current-protection;
283				regulator-initial-mode = <0>;
284			};
285
286			v1v8_audio: ldo1 {
287				regulator-name = "v1v8_audio";
288				regulator-min-microvolt = <1800000>;
289				regulator-max-microvolt = <1800000>;
290				regulator-always-on;
291				interrupts = <IT_CURLIM_LDO1 0>;
292			};
293
294			v3v3_hdmi: ldo2 {
295				regulator-name = "v3v3_hdmi";
296				regulator-min-microvolt = <3300000>;
297				regulator-max-microvolt = <3300000>;
298				regulator-always-on;
299				interrupts = <IT_CURLIM_LDO2 0>;
300			};
301
302			vtt_ddr: ldo3 {
303				regulator-name = "vtt_ddr";
304				regulator-min-microvolt = <500000>;
305				regulator-max-microvolt = <750000>;
306				regulator-always-on;
307				regulator-over-current-protection;
308			};
309
310			vdd_usb: ldo4 {
311				regulator-name = "vdd_usb";
312				interrupts = <IT_CURLIM_LDO4 0>;
313			};
314
315			vdda: ldo5 {
316				regulator-name = "vdda";
317				regulator-min-microvolt = <2900000>;
318				regulator-max-microvolt = <2900000>;
319				interrupts = <IT_CURLIM_LDO5 0>;
320				regulator-boot-on;
321			};
322
323			v1v2_hdmi: ldo6 {
324				regulator-name = "v1v2_hdmi";
325				regulator-min-microvolt = <1200000>;
326				regulator-max-microvolt = <1200000>;
327				regulator-always-on;
328				interrupts = <IT_CURLIM_LDO6 0>;
329			};
330
331			vref_ddr: vref_ddr {
332				regulator-name = "vref_ddr";
333				regulator-always-on;
334			};
335
336			 bst_out: boost {
337				regulator-name = "bst_out";
338				interrupts = <IT_OCP_BOOST 0>;
339			 };
340
341			vbus_otg: pwr_sw1 {
342				regulator-name = "vbus_otg";
343				interrupts = <IT_OCP_OTG 0>;
344			 };
345
346			 vbus_sw: pwr_sw2 {
347				regulator-name = "vbus_sw";
348				interrupts = <IT_OCP_SWOUT 0>;
349				regulator-active-discharge = <1>;
350			 };
351		};
352
353		onkey {
354			compatible = "st,stpmic1-onkey";
355			interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 0>;
356			interrupt-names = "onkey-falling", "onkey-rising";
357			power-off-time-sec = <10>;
358			status = "okay";
359		};
360
361		watchdog {
362			compatible = "st,stpmic1-wdt";
363			status = "disabled";
364		};
365	};
366};
367
368&i2c5 {
369	pinctrl-names = "default", "sleep";
370	pinctrl-0 = <&i2c5_pins_a>;
371	pinctrl-1 = <&i2c5_sleep_pins_a>;
372	i2c-scl-rising-time-ns = <185>;
373	i2c-scl-falling-time-ns = <20>;
374	clock-frequency = <400000>;
375	/* spare dmas for other usage */
376	/delete-property/dmas;
377	/delete-property/dma-names;
378	status = "disabled";
379};
380
381&i2s2 {
382	clocks = <&rcc SPI2>, <&rcc SPI2_K>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
383	clock-names = "pclk", "i2sclk", "x8k", "x11k";
384	pinctrl-names = "default", "sleep";
385	pinctrl-0 = <&i2s2_pins_a>;
386	pinctrl-1 = <&i2s2_sleep_pins_a>;
387	status = "okay";
388
389	i2s2_port: port {
390		i2s2_endpoint: endpoint {
391			remote-endpoint = <&sii9022_tx_endpoint>;
392			format = "i2s";
393			mclk-fs = <256>;
394		};
395	};
396};
397
398&ipcc {
399	status = "okay";
400};
401
402&iwdg2 {
403	timeout-sec = <32>;
404	status = "okay";
405};
406
407&ltdc {
408	pinctrl-names = "default", "sleep";
409	pinctrl-0 = <&ltdc_pins_a>;
410	pinctrl-1 = <&ltdc_sleep_pins_a>;
411	status = "okay";
412
413	port {
414		ltdc_ep0_out: endpoint@0 {
415			reg = <0>;
416			remote-endpoint = <&sii9022_in>;
417		};
418	};
419};
420
421&m4_rproc {
422	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
423			<&vdev0vring1>, <&vdev0buffer>;
424	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
425	mbox-names = "vq0", "vq1", "shutdown";
426	interrupt-parent = <&exti>;
427	interrupts = <68 1>;
428	status = "okay";
429};
430
431&pwr_regulators {
432	vdd-supply = <&vdd>;
433	vdd_3v3_usbfs-supply = <&vdd_usb>;
434};
435
436&rng1 {
437	status = "okay";
438};
439
440&rtc {
441	status = "okay";
442};
443
444&sai2 {
445	clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
446	clock-names = "pclk", "x8k", "x11k";
447	pinctrl-names = "default", "sleep";
448	pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
449	pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;
450	status = "okay";
451
452	sai2a: audio-controller@4400b004 {
453		#clock-cells = <0>;
454		dma-names = "tx";
455		clocks = <&rcc SAI2_K>;
456		clock-names = "sai_ck";
457		status = "okay";
458
459		sai2a_port: port {
460			sai2a_endpoint: endpoint {
461				remote-endpoint = <&cs42l51_tx_endpoint>;
462				format = "i2s";
463				mclk-fs = <256>;
464				dai-tdm-slot-num = <2>;
465				dai-tdm-slot-width = <32>;
466			};
467		};
468	};
469
470	sai2b: audio-controller@4400b024 {
471		dma-names = "rx";
472		st,sync = <&sai2a 2>;
473		clocks = <&rcc SAI2_K>, <&sai2a>;
474		clock-names = "sai_ck", "MCLK";
475		status = "okay";
476
477		sai2b_port: port {
478			sai2b_endpoint: endpoint {
479				remote-endpoint = <&cs42l51_rx_endpoint>;
480				format = "i2s";
481				mclk-fs = <256>;
482				dai-tdm-slot-num = <2>;
483				dai-tdm-slot-width = <32>;
484			};
485		};
486	};
487};
488
489&sdmmc1 {
490	pinctrl-names = "default", "opendrain", "sleep";
491	pinctrl-0 = <&sdmmc1_b4_pins_a>;
492	pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
493	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
494	cd-gpios = <&gpiob 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
495	disable-wp;
496	st,neg-edge;
497	bus-width = <4>;
498	vmmc-supply = <&v3v3>;
499	status = "okay";
500};
501
502&sdmmc3 {
503	pinctrl-names = "default", "opendrain", "sleep";
504	pinctrl-0 = <&sdmmc3_b4_pins_a>;
505	pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
506	pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
507	broken-cd;
508	st,neg-edge;
509	bus-width = <4>;
510	vmmc-supply = <&v3v3>;
511	status = "disabled";
512};
513
514&timers1 {
515	/* spare dmas for other usage */
516	/delete-property/dmas;
517	/delete-property/dma-names;
518	status = "disabled";
519	pwm {
520		pinctrl-0 = <&pwm1_pins_a>;
521		pinctrl-1 = <&pwm1_sleep_pins_a>;
522		pinctrl-names = "default", "sleep";
523		status = "okay";
524	};
525	timer@0 {
526		status = "okay";
527	};
528};
529
530&timers3 {
531	/delete-property/dmas;
532	/delete-property/dma-names;
533	status = "disabled";
534	pwm {
535		pinctrl-0 = <&pwm3_pins_a>;
536		pinctrl-1 = <&pwm3_sleep_pins_a>;
537		pinctrl-names = "default", "sleep";
538		status = "okay";
539	};
540	timer@2 {
541		status = "okay";
542	};
543};
544
545&timers4 {
546	/delete-property/dmas;
547	/delete-property/dma-names;
548	status = "disabled";
549	pwm {
550		pinctrl-0 = <&pwm4_pins_a &pwm4_pins_b>;
551		pinctrl-1 = <&pwm4_sleep_pins_a &pwm4_sleep_pins_b>;
552		pinctrl-names = "default", "sleep";
553		status = "okay";
554	};
555	timer@3 {
556		status = "okay";
557	};
558};
559
560&timers5 {
561	/delete-property/dmas;
562	/delete-property/dma-names;
563	status = "disabled";
564	pwm {
565		pinctrl-0 = <&pwm5_pins_a>;
566		pinctrl-1 = <&pwm5_sleep_pins_a>;
567		pinctrl-names = "default", "sleep";
568		status = "okay";
569	};
570	timer@4 {
571		status = "okay";
572	};
573};
574
575&timers6 {
576	/delete-property/dmas;
577	/delete-property/dma-names;
578	status = "disabled";
579	timer@5 {
580		status = "okay";
581	};
582};
583
584&timers12 {
585	/delete-property/dmas;
586	/delete-property/dma-names;
587	status = "disabled";
588	pwm {
589		pinctrl-0 = <&pwm12_pins_a>;
590		pinctrl-1 = <&pwm12_sleep_pins_a>;
591		pinctrl-names = "default", "sleep";
592		status = "okay";
593	};
594	timer@11 {
595		status = "okay";
596	};
597};
598
599&uart4 {
600	pinctrl-names = "default", "sleep", "idle";
601	pinctrl-0 = <&uart4_pins_a>;
602	pinctrl-1 = <&uart4_sleep_pins_a>;
603	pinctrl-2 = <&uart4_idle_pins_a>;
604	status = "okay";
605};
606
607&uart7 {
608	pinctrl-names = "default", "sleep", "idle";
609	pinctrl-0 = <&uart7_pins_c>;
610	pinctrl-1 = <&uart7_sleep_pins_c>;
611	pinctrl-2 = <&uart7_idle_pins_c>;
612	status = "disabled";
613};
614
615&usart3 {
616	pinctrl-names = "default", "sleep", "idle";
617	pinctrl-0 = <&usart3_pins_c>;
618	pinctrl-1 = <&usart3_sleep_pins_c>;
619	pinctrl-2 = <&usart3_idle_pins_c>;
620	uart-has-rtscts;
621	status = "disabled";
622};
623
624&usbh_ehci {
625	phys = <&usbphyc_port0>;
626	status = "okay";
627};
628
629&usbotg_hs {
630	phys = <&usbphyc_port1 0>;
631	phy-names = "usb2-phy";
632	usb-role-switch;
633	status = "okay";
634};
635
636&usbphyc {
637	status = "okay";
638};
639
640&usbphyc_port0 {
641	phy-supply = <&vdd_usb>;
642	vdda1v1-supply = <&reg11>;
643	vdda1v8-supply = <&reg18>;
644};
645
646&usbphyc_port1 {
647	phy-supply = <&vdd_usb>;
648	vdda1v1-supply = <&reg11>;
649	vdda1v8-supply = <&reg18>;
650};
651
652&vrefbuf {
653	regulator-min-microvolt = <2500000>;
654	regulator-max-microvolt = <2500000>;
655	vdda-supply = <&vdd>;
656	status = "okay";
657};
658