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	mdio0 {
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 &qspi_bk1_pins_a>;
395	pinctrl-1 = <&qspi_clk_sleep_pins_a &qspi_bk1_sleep_pins_a>;
396	reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
397	#address-cells = <1>;
398	#size-cells = <0>;
399	status = "okay";
400
401	flash0: flash@0 {
402		compatible = "jedec,spi-nor";
403		reg = <0>;
404		spi-max-frequency = <133000000>;
405		spi-rx-bus-width = <1>;
406		spi-tx-bus-width = <1>;
407		#address-cells = <1>;
408		#size-cells = <1>;
409	};
410};
411
412&rng1 {
413	status = "okay";
414};
415
416&rtc {
417	status = "okay";
418};
419
420&sdmmc2 {
421	arm,primecell-periphid = <0x10153180>;
422	pinctrl-names = "default", "opendrain", "sleep";
423	pinctrl-0 = <&sdmmc2_b4_pins_b>;
424	pinctrl-1 = <&sdmmc2_b4_od_pins_b>;
425	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a>;
426	non-removable;
427	st,neg-edge;
428	bus-width = <4>;
429	vmmc-supply = <&v3v3>;
430	status = "okay";
431};
432
433&spi1 {
434	pinctrl-names = "default";
435	pinctrl-0 = <&spi1_pins_a>;
436	cs-gpios = <&gpioz 3 0>;
437	status = "disabled";
438};
439
440&timers1 {
441	/* spare dmas for other usage */
442	/delete-property/dmas;
443	/delete-property/dma-names;
444	pwm {
445		pinctrl-0 = <&pwm1_pins_b>;
446		pinctrl-1 = <&pwm1_sleep_pins_b>;
447		pinctrl-names = "default", "sleep";
448		status = "okay";
449	};
450	timer@0 {
451		status = "okay";
452	};
453};
454
455&timers4 {
456	/delete-property/dmas;
457	/delete-property/dma-names;
458	pwm {
459		pinctrl-0 = <&pwm4_pins_b>;
460		pinctrl-1 = <&pwm4_sleep_pins_b>;
461		pinctrl-names = "default", "sleep";
462		status = "okay";
463	};
464	timer@3 {
465		status = "okay";
466	};
467};
468
469&timers5 {
470	/delete-property/dmas;
471	/delete-property/dma-names;
472	pwm {
473		pinctrl-0 = <&pwm5_pins_a>;
474		pinctrl-1 = <&pwm5_sleep_pins_a>;
475		pinctrl-names = "default", "sleep";
476		status = "okay";
477	};
478	timer@4 {
479		status = "okay";
480	};
481};
482
483&uart4 {
484	pinctrl-names = "default", "sleep", "idle";
485	pinctrl-0 = <&uart4_pins_a>;
486	pinctrl-1 = <&uart4_sleep_pins_a>;
487	pinctrl-2 = <&uart4_idle_pins_a>;
488	status = "okay";
489};
490
491&usart2 {
492	pinctrl-names = "default", "sleep";
493	pinctrl-0 = <&usart2_pins_a>;
494	pinctrl-1 = <&usart2_sleep_pins_a>;
495	status = "okay";
496};
497
498&usart3 {
499	pinctrl-names = "default", "sleep", "idle";
500	pinctrl-0 = <&usart3_pins_d>;
501	pinctrl-1 = <&usart3_sleep_pins_d>;
502	pinctrl-2 = <&usart3_idle_pins_d>;
503	status = "okay";
504};
505
506&usbh_ehci {
507	phys = <&usbphyc_port0>;
508	phy-names = "usb";
509	status = "okay";
510};
511
512&usbh_ohci {
513	phys = <&usbphyc_port0>;
514	phy-names = "usb";
515	status = "okay";
516};
517
518&usbotg_hs {
519	dr_mode = "peripheral";
520	pinctrl-names = "default";
521	pinctrl-0 = <&usbotg_hs_pins_a>;
522	phy-names = "usb2-phy";
523	phys = <&usbphyc_port1 0>;
524	vbus-supply = <&vbus_otg>;
525	status = "okay";
526};
527
528&usbphyc {
529	status = "okay";
530};
531
532&usbphyc_port0 {
533	phy-supply = <&vdd_usb>;
534};
535
536&usbphyc_port1 {
537	phy-supply = <&vdd_usb>;
538};
539
540&vrefbuf {
541	regulator-min-microvolt = <2500000>;
542	regulator-max-microvolt = <2500000>;
543	vdda-supply = <&vdd>;
544	status = "okay";
545};
546
547