1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2/*
3 * Copyright (C) 2019-2020 Marek Vasut <marex@denx.de>
4 */
5
6#include "stm32mp15-pinctrl.dtsi"
7#include "stm32mp15xxaa-pinctrl.dtsi"
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/mfd/st,stpmic1.h>
10
11/ {
12	aliases {
13		ethernet0 = &ethernet0;
14		ethernet1 = &ksz8851;
15		rtc0 = &hwrtc;
16		rtc1 = &rtc;
17	};
18
19	memory@c0000000 {
20		device_type = "memory";
21		reg = <0xC0000000 0x40000000>;
22	};
23
24	reserved-memory {
25		#address-cells = <1>;
26		#size-cells = <1>;
27		ranges;
28
29		mcuram2: mcuram2@10000000 {
30			compatible = "shared-dma-pool";
31			reg = <0x10000000 0x40000>;
32			no-map;
33		};
34
35		vdev0vring0: vdev0vring0@10040000 {
36			compatible = "shared-dma-pool";
37			reg = <0x10040000 0x1000>;
38			no-map;
39		};
40
41		vdev0vring1: vdev0vring1@10041000 {
42			compatible = "shared-dma-pool";
43			reg = <0x10041000 0x1000>;
44			no-map;
45		};
46
47		vdev0buffer: vdev0buffer@10042000 {
48			compatible = "shared-dma-pool";
49			reg = <0x10042000 0x4000>;
50			no-map;
51		};
52
53		mcuram: mcuram@30000000 {
54			compatible = "shared-dma-pool";
55			reg = <0x30000000 0x40000>;
56			no-map;
57		};
58
59		retram: retram@38000000 {
60			compatible = "shared-dma-pool";
61			reg = <0x38000000 0x10000>;
62			no-map;
63		};
64	};
65
66	ethernet_vio: vioregulator {
67		compatible = "regulator-fixed";
68		regulator-name = "vio";
69		regulator-min-microvolt = <3300000>;
70		regulator-max-microvolt = <3300000>;
71		gpio = <&gpiog 3 GPIO_ACTIVE_LOW>;
72		regulator-always-on;
73		regulator-boot-on;
74		vin-supply = <&vdd>;
75	};
76};
77
78&adc {
79	vdd-supply = <&vdd>;
80	vdda-supply = <&vdda>;
81	vref-supply = <&vdda>;
82	status = "okay";
83
84	adc1: adc@0 {
85		st,min-sample-time-nsecs = <5000>;
86		st,adc-channels = <0>;
87		status = "okay";
88	};
89
90	adc2: adc@100 {
91		st,adc-channels = <1>;
92		st,min-sample-time-nsecs = <5000>;
93		status = "okay";
94	};
95};
96
97&crc1 {
98	status = "okay";
99};
100
101&dac {
102	pinctrl-names = "default";
103	pinctrl-0 = <&dac_ch1_pins_a &dac_ch2_pins_a>;
104	vref-supply = <&vdda>;
105	status = "okay";
106
107	dac1: dac@1 {
108		status = "okay";
109	};
110	dac2: dac@2 {
111		status = "okay";
112	};
113};
114
115&dts {
116	status = "okay";
117};
118
119&ethernet0 {
120	status = "okay";
121	pinctrl-0 = <&ethernet0_rmii_pins_a>;
122	pinctrl-1 = <&ethernet0_rmii_sleep_pins_a>;
123	pinctrl-names = "default", "sleep";
124	phy-mode = "rmii";
125	max-speed = <100>;
126	phy-handle = <&phy0>;
127	st,eth-ref-clk-sel;
128
129	mdio0 {
130		#address-cells = <1>;
131		#size-cells = <0>;
132		compatible = "snps,dwmac-mdio";
133
134		phy0: ethernet-phy@1 {
135			reg = <1>;
136			/* LAN8710Ai */
137			compatible = "ethernet-phy-id0007.c0f0",
138				     "ethernet-phy-ieee802.3-c22";
139			clocks = <&rcc ETHCK_K>;
140			reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
141			reset-assert-us = <500>;
142			reset-deassert-us = <500>;
143			smsc,disable-energy-detect;
144			interrupt-parent = <&gpioi>;
145			interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
146		};
147	};
148};
149
150&fmc {
151	pinctrl-names = "default", "sleep";
152	pinctrl-0 = <&fmc_pins_b>;
153	pinctrl-1 = <&fmc_sleep_pins_b>;
154	status = "okay";
155
156	ksz8851: ethernet@1,0 {
157		compatible = "micrel,ks8851-mll";
158		reg = <1 0x0 0x2>, <1 0x2 0x20000>;
159		interrupt-parent = <&gpioc>;
160		interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
161		bank-width = <2>;
162
163		/* Timing values are in nS */
164		st,fmc2-ebi-cs-mux-enable;
165		st,fmc2-ebi-cs-transaction-type = <4>;
166		st,fmc2-ebi-cs-buswidth = <16>;
167		st,fmc2-ebi-cs-address-setup-ns = <5>;
168		st,fmc2-ebi-cs-address-hold-ns = <5>;
169		st,fmc2-ebi-cs-bus-turnaround-ns = <5>;
170		st,fmc2-ebi-cs-data-setup-ns = <45>;
171		st,fmc2-ebi-cs-data-hold-ns = <1>;
172		st,fmc2-ebi-cs-write-address-setup-ns = <5>;
173		st,fmc2-ebi-cs-write-address-hold-ns = <5>;
174		st,fmc2-ebi-cs-write-bus-turnaround-ns = <5>;
175		st,fmc2-ebi-cs-write-data-setup-ns = <45>;
176		st,fmc2-ebi-cs-write-data-hold-ns = <1>;
177	};
178};
179
180&gpioa {
181	gpio-line-names = "", "", "", "",
182			  "", "", "DHCOM-K", "",
183			  "", "", "", "",
184			  "", "", "", "";
185};
186
187&gpiob {
188	gpio-line-names = "", "", "", "",
189			  "", "", "", "",
190			  "DHCOM-Q", "", "", "",
191			  "", "", "", "";
192};
193
194&gpioc {
195	gpio-line-names = "", "", "", "",
196			  "", "", "DHCOM-E", "",
197			  "", "", "", "",
198			  "", "", "", "";
199	status = "okay";
200};
201
202&gpiod {
203	gpio-line-names = "", "", "", "",
204			  "", "", "DHCOM-B", "",
205			  "", "", "", "DHCOM-F",
206			  "DHCOM-D", "", "", "";
207};
208
209&gpioe {
210	gpio-line-names = "", "", "", "",
211			  "", "", "DHCOM-P", "",
212			  "", "", "", "",
213			  "", "", "", "";
214};
215
216&gpiof {
217	gpio-line-names = "", "", "", "DHCOM-A",
218			  "", "", "", "",
219			  "", "", "", "",
220			  "", "", "", "";
221};
222
223&gpiog {
224	gpio-line-names = "DHCOM-C", "", "", "",
225			  "", "", "", "",
226			  "DHCOM-L", "", "", "",
227			  "", "", "", "";
228};
229
230&gpioh {
231	gpio-line-names = "", "", "", "",
232			  "", "", "", "DHCOM-N",
233			  "DHCOM-J", "DHCOM-W", "DHCOM-V", "DHCOM-U",
234			  "DHCOM-T", "", "DHCOM-S", "";
235};
236
237&gpioi {
238	gpio-line-names = "DHCOM-G", "DHCOM-O", "DHCOM-H", "DHCOM-I",
239			  "DHCOM-R", "DHCOM-M", "", "",
240			  "", "", "", "",
241			  "", "", "", "";
242};
243
244&i2c4 {
245	pinctrl-names = "default";
246	pinctrl-0 = <&i2c4_pins_a>;
247	i2c-scl-rising-time-ns = <185>;
248	i2c-scl-falling-time-ns = <20>;
249	status = "okay";
250	/* spare dmas for other usage */
251	/delete-property/dmas;
252	/delete-property/dma-names;
253
254	hwrtc: rtc@32 {
255		compatible = "microcrystal,rv8803";
256		reg = <0x32>;
257	};
258
259	pmic: stpmic@33 {
260		compatible = "st,stpmic1";
261		reg = <0x33>;
262		interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>;
263		interrupt-controller;
264		#interrupt-cells = <2>;
265		status = "okay";
266
267		regulators {
268			compatible = "st,stpmic1-regulators";
269			ldo1-supply = <&v3v3>;
270			ldo2-supply = <&v3v3>;
271			ldo3-supply = <&vdd_ddr>;
272			ldo5-supply = <&v3v3>;
273			ldo6-supply = <&v3v3>;
274			pwr_sw1-supply = <&bst_out>;
275			pwr_sw2-supply = <&bst_out>;
276
277			vddcore: buck1 {
278				regulator-name = "vddcore";
279				regulator-min-microvolt = <800000>;
280				regulator-max-microvolt = <1350000>;
281				regulator-always-on;
282				regulator-initial-mode = <0>;
283				regulator-over-current-protection;
284			};
285
286			vdd_ddr: buck2 {
287				regulator-name = "vdd_ddr";
288				regulator-min-microvolt = <1350000>;
289				regulator-max-microvolt = <1350000>;
290				regulator-always-on;
291				regulator-initial-mode = <0>;
292				regulator-over-current-protection;
293			};
294
295			vdd: buck3 {
296				regulator-name = "vdd";
297				regulator-min-microvolt = <3300000>;
298				regulator-max-microvolt = <3300000>;
299				regulator-always-on;
300				st,mask-reset;
301				regulator-initial-mode = <0>;
302				regulator-over-current-protection;
303			};
304
305			v3v3: buck4 {
306				regulator-name = "v3v3";
307				regulator-min-microvolt = <3300000>;
308				regulator-max-microvolt = <3300000>;
309				regulator-always-on;
310				regulator-over-current-protection;
311				regulator-initial-mode = <0>;
312			};
313
314			vdda: ldo1 {
315				regulator-name = "vdda";
316				regulator-always-on;
317				regulator-min-microvolt = <2900000>;
318				regulator-max-microvolt = <2900000>;
319				interrupts = <IT_CURLIM_LDO1 0>;
320			};
321
322			v2v8: ldo2 {
323				regulator-name = "v2v8";
324				regulator-min-microvolt = <2800000>;
325				regulator-max-microvolt = <2800000>;
326				interrupts = <IT_CURLIM_LDO2 0>;
327			};
328
329			vtt_ddr: ldo3 {
330				regulator-name = "vtt_ddr";
331				regulator-min-microvolt = <500000>;
332				regulator-max-microvolt = <750000>;
333				regulator-always-on;
334				regulator-over-current-protection;
335			};
336
337			vdd_usb: ldo4 {
338				regulator-name = "vdd_usb";
339				interrupts = <IT_CURLIM_LDO4 0>;
340			};
341
342			vdd_sd: ldo5 {
343				regulator-name = "vdd_sd";
344				regulator-min-microvolt = <2900000>;
345				regulator-max-microvolt = <2900000>;
346				interrupts = <IT_CURLIM_LDO5 0>;
347				regulator-boot-on;
348			};
349
350			v1v8: ldo6 {
351				regulator-name = "v1v8";
352				regulator-min-microvolt = <1800000>;
353				regulator-max-microvolt = <1800000>;
354				interrupts = <IT_CURLIM_LDO6 0>;
355			};
356
357			vref_ddr: vref_ddr {
358				regulator-name = "vref_ddr";
359				regulator-always-on;
360			};
361
362			bst_out: boost {
363				regulator-name = "bst_out";
364				interrupts = <IT_OCP_BOOST 0>;
365			};
366
367			vbus_otg: pwr_sw1 {
368				regulator-name = "vbus_otg";
369				interrupts = <IT_OCP_OTG 0>;
370			};
371
372			vbus_sw: pwr_sw2 {
373				regulator-name = "vbus_sw";
374				interrupts = <IT_OCP_SWOUT 0>;
375				regulator-active-discharge = <1>;
376			};
377		};
378
379		onkey {
380			compatible = "st,stpmic1-onkey";
381			interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 0>;
382			interrupt-names = "onkey-falling", "onkey-rising";
383			power-off-time-sec = <10>;
384			status = "okay";
385		};
386
387		watchdog {
388			compatible = "st,stpmic1-wdt";
389			status = "disabled";
390		};
391	};
392
393	touchscreen@49 {
394		compatible = "ti,tsc2004";
395		reg = <0x49>;
396		vio-supply = <&v3v3>;
397		interrupts-extended = <&gpioh 15 IRQ_TYPE_EDGE_FALLING>;
398	};
399
400	eeprom@50 {
401		compatible = "atmel,24c02";
402		reg = <0x50>;
403		pagesize = <16>;
404	};
405};
406
407&ipcc {
408	status = "okay";
409};
410
411&iwdg2 {
412	timeout-sec = <32>;
413	status = "okay";
414};
415
416&m4_rproc {
417	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
418			<&vdev0vring1>, <&vdev0buffer>;
419	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
420	mbox-names = "vq0", "vq1", "shutdown";
421	interrupt-parent = <&exti>;
422	interrupts = <68 1>;
423	status = "okay";
424};
425
426&pwr_regulators {
427	vdd-supply = <&vdd>;
428	vdd_3v3_usbfs-supply = <&vdd_usb>;
429};
430
431&qspi {
432	pinctrl-names = "default", "sleep";
433	pinctrl-0 = <&qspi_clk_pins_a &qspi_bk1_pins_a>;
434	pinctrl-1 = <&qspi_clk_sleep_pins_a &qspi_bk1_sleep_pins_a>;
435	reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
436	#address-cells = <1>;
437	#size-cells = <0>;
438	status = "okay";
439
440	flash0: flash@0 {
441		compatible = "jedec,spi-nor";
442		reg = <0>;
443		spi-rx-bus-width = <4>;
444		spi-max-frequency = <108000000>;
445		#address-cells = <1>;
446		#size-cells = <1>;
447	};
448};
449
450&rng1 {
451	status = "okay";
452};
453
454&rtc {
455	status = "okay";
456};
457
458&sdmmc1 {
459	pinctrl-names = "default", "opendrain", "sleep", "init";
460	pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>;
461	pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_a>;
462	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_a>;
463	pinctrl-3 = <&sdmmc1_b4_init_pins_a &sdmmc1_dir_init_pins_a>;
464	cd-gpios = <&gpiog 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
465	disable-wp;
466	st,sig-dir;
467	st,neg-edge;
468	st,use-ckin;
469	st,cmd-gpios = <&gpiod 2 0>;
470	st,ck-gpios = <&gpioc 12 0>;
471	st,ckin-gpios = <&gpioe 4 0>;
472	bus-width = <4>;
473	vmmc-supply = <&vdd_sd>;
474	status = "okay";
475};
476
477&sdmmc1_b4_pins_a {
478	/*
479	 * SD bus pull-up resistors:
480	 * - optional on SoMs with SD voltage translator
481	 * - mandatory on SoMs without SD voltage translator
482	 */
483	pins1 {
484		bias-pull-up;
485	};
486	pins2 {
487		bias-pull-up;
488	};
489};
490
491&sdmmc2 {
492	pinctrl-names = "default", "opendrain", "sleep";
493	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>;
494	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_a>;
495	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_a>;
496	non-removable;
497	no-sd;
498	no-sdio;
499	st,neg-edge;
500	bus-width = <8>;
501	vmmc-supply = <&v3v3>;
502	vqmmc-supply = <&v3v3>;
503	mmc-ddr-3_3v;
504	status = "okay";
505};
506
507&sdmmc3 {
508	pinctrl-names = "default", "opendrain", "sleep";
509	pinctrl-0 = <&sdmmc3_b4_pins_a>;
510	pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
511	pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
512	broken-cd;
513	st,neg-edge;
514	bus-width = <4>;
515	vmmc-supply = <&v3v3>;
516	vqmmc-supply = <&v3v3>;
517	mmc-ddr-3_3v;
518	status = "okay";
519};
520
521&uart4 {
522	pinctrl-names = "default";
523	pinctrl-0 = <&uart4_pins_a>;
524	status = "okay";
525};
526