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				regulator-over-current-protection;
314			};
315
316			bst_out: boost {
317				regulator-name = "bst_out";
318				interrupts = <IT_OCP_BOOST 0>;
319			};
320
321			vbus_otg: pwr_sw1 {
322				regulator-name = "vbus_otg";
323				interrupts = <IT_OCP_OTG 0>;
324				regulator-active-discharge;
325			};
326
327			vbus_usbh: pwr_sw2 {
328				regulator-name = "usbh_vbus";
329				interrupts = <IT_OCP_SWOUT 0>;
330				regulator-always-on;
331				regulator-boot-on;
332			};
333		};
334
335		onkey {
336			compatible = "st,stpmic1-onkey";
337			interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 1>;
338			interrupt-names = "onkey-falling", "onkey-rising";
339			status = "okay";
340		};
341
342		watchdog {
343			compatible = "st,stpmic1-wdt";
344			status = "disabled";
345		};
346	};
347};
348
349&i2c5 {
350	pinctrl-names = "default", "sleep";
351	pinctrl-0 = <&i2c5_pins_a>;
352	pinctrl-1 = <&i2c5_sleep_pins_a>;
353	i2c-scl-rising-time-ns = <185>;
354	i2c-scl-falling-time-ns = <20>;
355	/delete-property/dmas;
356	/delete-property/dma-names;
357};
358
359&ipcc {
360	status = "okay";
361};
362
363&iwdg2 {
364	timeout-sec = <32>;
365	status = "okay";
366};
367
368&m4_rproc {
369	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
370			<&vdev0vring1>, <&vdev0buffer>;
371	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
372	mbox-names = "vq0", "vq1", "shutdown";
373	interrupt-parent = <&exti>;
374	interrupts = <68 1>;
375	interrupt-names = "wdg";
376	recovery;
377	status = "okay";
378};
379
380&pwr_regulators {
381	vdd-supply = <&vdd>;
382	vdd_3v3_usbfs-supply = <&vdd_usb>;
383};
384
385&qspi {
386	pinctrl-names = "default", "sleep";
387	pinctrl-0 = <&qspi_clk_pins_a
388		     &qspi_bk1_pins_a
389		     &qspi_cs1_pins_a>;
390	pinctrl-1 = <&qspi_clk_sleep_pins_a
391		     &qspi_bk1_sleep_pins_a
392		     &qspi_cs1_sleep_pins_a>;
393	reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
394	#address-cells = <1>;
395	#size-cells = <0>;
396	status = "okay";
397
398	flash0: flash@0 {
399		compatible = "jedec,spi-nor";
400		reg = <0>;
401		spi-max-frequency = <133000000>;
402		spi-rx-bus-width = <1>;
403		spi-tx-bus-width = <1>;
404		#address-cells = <1>;
405		#size-cells = <1>;
406	};
407};
408
409&rng1 {
410	status = "okay";
411};
412
413&rtc {
414	status = "okay";
415};
416
417&sdmmc2 {
418	arm,primecell-periphid = <0x10153180>;
419	pinctrl-names = "default", "opendrain", "sleep";
420	pinctrl-0 = <&sdmmc2_b4_pins_b>;
421	pinctrl-1 = <&sdmmc2_b4_od_pins_b>;
422	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a>;
423	non-removable;
424	st,neg-edge;
425	bus-width = <4>;
426	vmmc-supply = <&v3v3>;
427	status = "okay";
428};
429
430&spi1 {
431	pinctrl-names = "default";
432	pinctrl-0 = <&spi1_pins_a>;
433	cs-gpios = <&gpioz 3 0>;
434	status = "disabled";
435};
436
437&timers1 {
438	/* spare dmas for other usage */
439	/delete-property/dmas;
440	/delete-property/dma-names;
441	pwm {
442		pinctrl-0 = <&pwm1_pins_b>;
443		pinctrl-1 = <&pwm1_sleep_pins_b>;
444		pinctrl-names = "default", "sleep";
445		status = "okay";
446	};
447	timer@0 {
448		status = "okay";
449	};
450};
451
452&timers4 {
453	/delete-property/dmas;
454	/delete-property/dma-names;
455	pwm {
456		pinctrl-0 = <&pwm4_pins_b>;
457		pinctrl-1 = <&pwm4_sleep_pins_b>;
458		pinctrl-names = "default", "sleep";
459		status = "okay";
460	};
461	timer@3 {
462		status = "okay";
463	};
464};
465
466&timers5 {
467	/delete-property/dmas;
468	/delete-property/dma-names;
469	pwm {
470		pinctrl-0 = <&pwm5_pins_a>;
471		pinctrl-1 = <&pwm5_sleep_pins_a>;
472		pinctrl-names = "default", "sleep";
473		status = "okay";
474	};
475	timer@4 {
476		status = "okay";
477	};
478};
479
480&uart4 {
481	pinctrl-names = "default", "sleep", "idle";
482	pinctrl-0 = <&uart4_pins_a>;
483	pinctrl-1 = <&uart4_sleep_pins_a>;
484	pinctrl-2 = <&uart4_idle_pins_a>;
485	status = "okay";
486};
487
488&usart2 {
489	pinctrl-names = "default", "sleep";
490	pinctrl-0 = <&usart2_pins_a>;
491	pinctrl-1 = <&usart2_sleep_pins_a>;
492	status = "okay";
493};
494
495&usart3 {
496	pinctrl-names = "default", "sleep", "idle";
497	pinctrl-0 = <&usart3_pins_d>;
498	pinctrl-1 = <&usart3_sleep_pins_d>;
499	pinctrl-2 = <&usart3_idle_pins_d>;
500	status = "okay";
501};
502
503&usbh_ehci {
504	phys = <&usbphyc_port0>;
505	phy-names = "usb";
506	status = "okay";
507};
508
509&usbh_ohci {
510	phys = <&usbphyc_port0>;
511	phy-names = "usb";
512	status = "okay";
513};
514
515&usbotg_hs {
516	dr_mode = "peripheral";
517	pinctrl-names = "default";
518	pinctrl-0 = <&usbotg_hs_pins_a>;
519	phy-names = "usb2-phy";
520	phys = <&usbphyc_port1 0>;
521	vbus-supply = <&vbus_otg>;
522	status = "okay";
523};
524
525&usbphyc {
526	status = "okay";
527};
528
529&usbphyc_port0 {
530	phy-supply = <&vdd_usb>;
531};
532
533&usbphyc_port1 {
534	phy-supply = <&vdd_usb>;
535};
536
537&vrefbuf {
538	regulator-min-microvolt = <2500000>;
539	regulator-max-microvolt = <2500000>;
540	vdda-supply = <&vdd>;
541	status = "okay";
542};
543
544