1// SPDX-License-Identifier: (GPL-2.0 or MIT)
2//
3// Copyright (c) 2021 emtrion GmbH
4// Author: Reinhold Müller <reinhold.mueller@emtrion.de>.
5//
6
7#include "stm32mp157.dtsi"
8#include "stm32mp15xc.dtsi"
9#include "stm32mp15-pinctrl.dtsi"
10#include "stm32mp15xxac-pinctrl.dtsi"
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/mfd/st,stpmic1.h>
13
14/ {
15	aliases {
16		ethernet0 = &ethernet0;
17		serial0 = &uart4;
18		serial1 = &usart2;
19		serial2 = &usart3;
20	};
21
22	chosen {
23		stdout-path = "serial0:115200n8";
24	};
25
26	memory@c0000000 {
27		device_type = "memory";
28		reg = <0xc0000000 0x20000000>;
29	};
30
31	reserved-memory {
32		#address-cells = <1>;
33		#size-cells = <1>;
34		ranges;
35
36		mcuram2: mcuram2@10000000 {
37			compatible = "shared-dma-pool";
38			reg = <0x10000000 0x40000>;
39			no-map;
40		};
41
42		vdev0vring0: vdev0vring0@10040000 {
43			compatible = "shared-dma-pool";
44			reg = <0x10040000 0x2000>;
45			no-map;
46		};
47
48		vdev0vring1: vdev0vring1@10042000 {
49			compatible = "shared-dma-pool";
50			reg = <0x10042000 0x2000>;
51			no-map;
52		};
53
54		vdev0buffer: vdev0buffer@10044000 {
55			compatible = "shared-dma-pool";
56			reg = <0x10044000 0x4000>;
57			no-map;
58		};
59
60		mcuram: mcuram@30000000 {
61			compatible = "shared-dma-pool";
62			reg = <0x30000000 0x40000>;
63			no-map;
64		};
65
66		retram: retram@38000000 {
67			compatible = "shared-dma-pool";
68			reg = <0x38000000 0x10000>;
69			no-map;
70		};
71
72		gpu_reserved: gpu@dc000000 {
73			reg = <0xdc000000 0x4000000>;
74			no-map;
75		};
76	};
77
78	led: gpio_leds {
79		compatible = "gpio-leds";
80		led-0 {
81			label = "panic";
82			gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
83			linux,default-trigger = "none";
84			default-state = "off";
85			panic-indicator;
86		};
87		led-1 {
88			label = "heartbeat";
89			gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
90			linux,default-trigger = "heartbeat";
91			default-state = "on";
92		};
93	};
94};
95
96&adc {
97	vdd-supply = <&vdd>;
98	vdda-supply = <&vdd>;
99	vref-supply = <&vrefbuf>;
100	status = "okay";
101
102	adc1: adc@0 {
103		pinctrl-names = "default";
104		pinctrl-0 = <&adc1_in6_pins_a>;
105		st,min-sample-time-nsecs = <5000>;
106		st,adc-channels = <6>;
107		status = "disabled";
108	};
109
110	adc2: adc@100 {
111		#address-cells = <1>;
112		#size-cells = <0>;
113		status = "okay";
114		channel@12 {
115			reg = <12>;
116			label = "sense_temp";
117			st,min-sample-time-ns = <9000>;
118		};
119		channel@15 {
120			reg = <15>;
121			label = "vbat";
122			st,min-sample-time-ns = <9000>;
123		};
124		channel@16 {
125			reg = <16>;
126			label = "dac_out1";
127			st,min-sample-time-ns = <9000>;
128		};
129		channel@17 {
130			reg = <17>;
131			label = "dac_out1";
132			st,min-sample-time-ns = <9000>;
133		};
134	};
135};
136
137&crc1 {
138	status = "okay";
139};
140
141&cryp1 {
142	status = "okay";
143};
144
145&dac {
146	pinctrl-names = "default";
147	pinctrl-0 = <&dac_ch1_pins_a &dac_ch2_pins_a>;
148	vref-supply = <&vdda>;
149	status = "disabled";
150
151	dac1: dac@1 {
152		status = "okay";
153	};
154	dac2: dac@2 {
155		status = "okay";
156	};
157};
158
159&dts {
160	status = "okay";
161};
162
163&ethernet0 {
164	status = "okay";
165	snps,reset-gpio = <&gpioa 1 GPIO_ACTIVE_LOW>;
166	snps,reset-active-low;
167	snps,reset-delays-us = <0 30000 50000>;
168	pinctrl-0 = <&ethernet0_rmii_pins_b>;
169	pinctrl-1 = <&ethernet0_rmii_sleep_pins_b>;
170	pinctrl-names = "default", "sleep";
171	phy-mode = "rmii";
172	max-speed = <100>;
173	phy-handle = <&phy0>;
174	st,eth-ref-clk-sel;
175
176	mdio {
177		#address-cells = <1>;
178		#size-cells = <0>;
179		compatible = "snps,dwmac-mdio";
180		phy0: ethernet-phy@0 {
181			reg = <0>;
182		};
183	};
184};
185
186&gpu {
187	contiguous-area = <&gpu_reserved>;
188};
189
190&hash1 {
191	status = "okay";
192};
193
194&i2c1 {
195	pinctrl-names = "default", "sleep";
196	pinctrl-0 = <&i2c1_pins_a>;
197	pinctrl-1 = <&i2c1_sleep_pins_a>;
198	i2c-scl-rising-time-ns = <100>;
199	i2c-scl-falling-time-ns = <7>;
200	status = "disabled";
201	/delete-property/dmas;
202	/delete-property/dma-names;
203};
204
205&i2c4 {
206	pinctrl-names = "default", "sleep";
207	pinctrl-0 = <&i2c4_pins_a>;
208	pinctrl-1 = <&i2c4_sleep_pins_a>;
209	i2c-scl-rising-time-ns = <185>;
210	i2c-scl-falling-time-ns = <20>;
211	status = "okay";
212	/delete-property/dmas;
213	/delete-property/dma-names;
214
215	pmic: stpmic@33 {
216		compatible = "st,stpmic1";
217		reg = <0x33>;
218		interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>;
219		interrupt-controller;
220		#interrupt-cells = <2>;
221		status = "okay";
222
223		regulators {
224			compatible = "st,stpmic1-regulators";
225
226			ldo1-supply = <&v3v3>;
227			ldo3-supply = <&vdd_ddr>;
228			ldo6-supply = <&v3v3>;
229			pwr_sw1-supply = <&bst_out>;
230			pwr_sw2-supply = <&bst_out>;
231
232			vddcore: buck1 {
233				regulator-name = "vddcore";
234				regulator-min-microvolt = <1200000>;
235				regulator-max-microvolt = <1350000>;
236				regulator-always-on;
237				regulator-initial-mode = <0>;
238				regulator-over-current-protection;
239			};
240
241			vdd_ddr: buck2 {
242				regulator-name = "vdd_ddr";
243				regulator-min-microvolt = <1350000>;
244				regulator-max-microvolt = <1350000>;
245				regulator-always-on;
246				regulator-initial-mode = <0>;
247				regulator-over-current-protection;
248			};
249
250			vdd: buck3 {
251				regulator-name = "vdd";
252				regulator-min-microvolt = <3300000>;
253				regulator-max-microvolt = <3300000>;
254				regulator-always-on;
255				st,mask-reset;
256				regulator-initial-mode = <0>;
257				regulator-over-current-protection;
258			};
259
260			v3v3: buck4 {
261				regulator-name = "v3v3";
262				regulator-min-microvolt = <3300000>;
263				regulator-max-microvolt = <3300000>;
264				regulator-always-on;
265				regulator-over-current-protection;
266				regulator-initial-mode = <0>;
267			};
268
269			v1v8_audio: ldo1 {
270				regulator-name = "v1v8_audio";
271				regulator-min-microvolt = <1800000>;
272				regulator-max-microvolt = <1800000>;
273				regulator-always-on;
274				interrupts = <IT_CURLIM_LDO1 0>;
275			};
276
277			v3v3_hdmi: ldo2 {
278				regulator-name = "v3v3_hdmi";
279				regulator-min-microvolt = <3300000>;
280				regulator-max-microvolt = <3300000>;
281				regulator-always-on;
282				interrupts = <IT_CURLIM_LDO2 0>;
283			};
284
285			vtt_ddr: ldo3 {
286				regulator-name = "vtt_ddr";
287				regulator-min-microvolt = <500000>;
288				regulator-max-microvolt = <750000>;
289				regulator-always-on;
290				regulator-over-current-protection;
291			};
292
293			vdd_usb: ldo4 {
294				regulator-name = "vdd_usb";
295				regulator-min-microvolt = <3300000>;
296				regulator-max-microvolt = <3300000>;
297				interrupts = <IT_CURLIM_LDO4 0>;
298			};
299
300			vdd_sd: ldo5 {
301				regulator-name = "vdd_sd";
302				regulator-min-microvolt = <3300000>;
303				regulator-max-microvolt = <3300000>;
304				interrupts = <IT_CURLIM_LDO5 0>;
305				regulator-always-on;
306			};
307
308			vdda: ldo6 {
309				regulator-name = "vdda";
310				regulator-min-microvolt = <2900000>;
311				regulator-max-microvolt = <2900000>;
312				regulator-always-on;
313				interrupts = <IT_CURLIM_LDO6 0>;
314				regulator-boot-on;
315			};
316
317			vref_ddr: vref_ddr {
318				regulator-name = "vref_ddr";
319				regulator-always-on;
320				regulator-over-current-protection;
321			};
322
323			bst_out: boost {
324				regulator-name = "bst_out";
325				interrupts = <IT_OCP_BOOST 0>;
326			};
327
328			vbus_otg: pwr_sw1 {
329				regulator-name = "vbus_otg";
330				interrupts = <IT_OCP_OTG 0>;
331				regulator-active-discharge;
332			};
333
334			vbus_usbh: pwr_sw2 {
335				regulator-name = "usbh_vbus";
336				interrupts = <IT_OCP_SWOUT 0>;
337				regulator-always-on;
338				regulator-boot-on;
339			};
340		};
341
342		onkey {
343			compatible = "st,stpmic1-onkey";
344			interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 1>;
345			interrupt-names = "onkey-falling", "onkey-rising";
346			status = "okay";
347		};
348
349		watchdog {
350			compatible = "st,stpmic1-wdt";
351			status = "disabled";
352		};
353	};
354};
355
356&i2c5 {
357	pinctrl-names = "default", "sleep";
358	pinctrl-0 = <&i2c5_pins_a>;
359	pinctrl-1 = <&i2c5_sleep_pins_a>;
360	i2c-scl-rising-time-ns = <185>;
361	i2c-scl-falling-time-ns = <20>;
362	/delete-property/dmas;
363	/delete-property/dma-names;
364};
365
366&ipcc {
367	status = "okay";
368};
369
370&iwdg2 {
371	timeout-sec = <32>;
372	status = "okay";
373};
374
375&m4_rproc {
376	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
377			<&vdev0vring1>, <&vdev0buffer>;
378	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
379	mbox-names = "vq0", "vq1", "shutdown";
380	interrupt-parent = <&exti>;
381	interrupts = <68 1>;
382	interrupt-names = "wdg";
383	recovery;
384	status = "okay";
385};
386
387&pwr_regulators {
388	vdd-supply = <&vdd>;
389	vdd_3v3_usbfs-supply = <&vdd_usb>;
390};
391
392&qspi {
393	pinctrl-names = "default", "sleep";
394	pinctrl-0 = <&qspi_clk_pins_a
395		     &qspi_bk1_pins_a
396		     &qspi_cs1_pins_a>;
397	pinctrl-1 = <&qspi_clk_sleep_pins_a
398		     &qspi_bk1_sleep_pins_a
399		     &qspi_cs1_sleep_pins_a>;
400	reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
401	#address-cells = <1>;
402	#size-cells = <0>;
403	status = "okay";
404
405	flash0: flash@0 {
406		compatible = "jedec,spi-nor";
407		reg = <0>;
408		spi-max-frequency = <133000000>;
409		spi-rx-bus-width = <1>;
410		spi-tx-bus-width = <1>;
411		#address-cells = <1>;
412		#size-cells = <1>;
413	};
414};
415
416&rng1 {
417	status = "okay";
418};
419
420&rtc {
421	status = "okay";
422};
423
424&sdmmc2 {
425	arm,primecell-periphid = <0x10153180>;
426	pinctrl-names = "default", "opendrain", "sleep";
427	pinctrl-0 = <&sdmmc2_b4_pins_b>;
428	pinctrl-1 = <&sdmmc2_b4_od_pins_b>;
429	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a>;
430	non-removable;
431	st,neg-edge;
432	bus-width = <4>;
433	vmmc-supply = <&v3v3>;
434	status = "okay";
435};
436
437&spi1 {
438	pinctrl-names = "default";
439	pinctrl-0 = <&spi1_pins_a>;
440	cs-gpios = <&gpioz 3 0>;
441	status = "disabled";
442};
443
444&timers1 {
445	/* spare dmas for other usage */
446	/delete-property/dmas;
447	/delete-property/dma-names;
448	pwm {
449		pinctrl-0 = <&pwm1_pins_b>;
450		pinctrl-1 = <&pwm1_sleep_pins_b>;
451		pinctrl-names = "default", "sleep";
452		status = "okay";
453	};
454	timer@0 {
455		status = "okay";
456	};
457};
458
459&timers4 {
460	/delete-property/dmas;
461	/delete-property/dma-names;
462	pwm {
463		pinctrl-0 = <&pwm4_pins_b>;
464		pinctrl-1 = <&pwm4_sleep_pins_b>;
465		pinctrl-names = "default", "sleep";
466		status = "okay";
467	};
468	timer@3 {
469		status = "okay";
470	};
471};
472
473&timers5 {
474	/delete-property/dmas;
475	/delete-property/dma-names;
476	pwm {
477		pinctrl-0 = <&pwm5_pins_a>;
478		pinctrl-1 = <&pwm5_sleep_pins_a>;
479		pinctrl-names = "default", "sleep";
480		status = "okay";
481	};
482	timer@4 {
483		status = "okay";
484	};
485};
486
487&uart4 {
488	pinctrl-names = "default", "sleep", "idle";
489	pinctrl-0 = <&uart4_pins_a>;
490	pinctrl-1 = <&uart4_sleep_pins_a>;
491	pinctrl-2 = <&uart4_idle_pins_a>;
492	status = "okay";
493};
494
495&usart2 {
496	pinctrl-names = "default", "sleep";
497	pinctrl-0 = <&usart2_pins_a>;
498	pinctrl-1 = <&usart2_sleep_pins_a>;
499	status = "okay";
500};
501
502&usart3 {
503	pinctrl-names = "default", "sleep", "idle";
504	pinctrl-0 = <&usart3_pins_d>;
505	pinctrl-1 = <&usart3_sleep_pins_d>;
506	pinctrl-2 = <&usart3_idle_pins_d>;
507	status = "okay";
508};
509
510&usbh_ehci {
511	phys = <&usbphyc_port0>;
512	phy-names = "usb";
513	status = "okay";
514};
515
516&usbh_ohci {
517	phys = <&usbphyc_port0>;
518	phy-names = "usb";
519	status = "okay";
520};
521
522&usbotg_hs {
523	dr_mode = "peripheral";
524	pinctrl-names = "default";
525	pinctrl-0 = <&usbotg_hs_pins_a>;
526	phy-names = "usb2-phy";
527	phys = <&usbphyc_port1 0>;
528	vbus-supply = <&vbus_otg>;
529	status = "okay";
530};
531
532&usbphyc {
533	status = "okay";
534};
535
536&usbphyc_port0 {
537	phy-supply = <&vdd_usb>;
538};
539
540&usbphyc_port1 {
541	phy-supply = <&vdd_usb>;
542};
543
544&vrefbuf {
545	regulator-min-microvolt = <2500000>;
546	regulator-max-microvolt = <2500000>;
547	vdda-supply = <&vdd>;
548	status = "okay";
549};
550
551