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