1/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
2/*
3 * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
4 * Author: Ludovic Barre <ludovic.barre@st.com> for STMicroelectronics.
5 */
6
7/dts-v1/;
8
9#include "stm32mp157.dtsi"
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/input/input.h>
12#include <dt-bindings/pinctrl/stm32-pinfunc.h>
13#include <dt-bindings/mfd/st,stpmu1.h>
14
15/ {
16	model = "STMicroelectronics STM32MP157C pmic eval daughter";
17	compatible = "st,stm32mp157c-ed1", "st,stm32mp157";
18
19	chosen {
20		bootargs = "earlyprintk console=ttyS3,115200 root=/dev/ram";
21		stdout-path = "serial3:115200n8";
22	};
23
24	memory {
25		reg = <0xC0000000 0x40000000>;
26	};
27
28	sd_switch: regulator-sd_switch {
29		compatible = "regulator-gpio";
30		regulator-name = "sd_switch";
31		regulator-min-microvolt = <1800000>;
32		regulator-max-microvolt = <2900000>;
33		regulator-type = "voltage";
34		regulator-always-on;
35
36		gpios = <&gpiof 14 GPIO_ACTIVE_HIGH>;
37		gpios-states = <0>;
38		states = <1800000 0x1 2900000 0x0>;
39	};
40};
41
42&gpioa {
43	status = "okay";
44};
45
46&gpiob {
47	status = "okay";
48};
49
50&gpioc {
51	status = "okay";
52};
53
54&gpiod {
55	status = "okay";
56};
57
58&gpioe {
59	status = "okay";
60};
61
62&gpiof {
63	status = "okay";
64};
65
66&gpiog {
67	status = "okay";
68};
69
70&gpioh {
71	status = "okay";
72};
73
74&gpioi {
75	status = "okay";
76};
77
78&gpioj {
79	status = "okay";
80};
81
82&gpiok {
83	status = "okay";
84};
85
86&gpioz {
87	status = "okay";
88};
89
90&pinctrl {
91	uart4_pins_a: uart4@0 {
92		pins1 {
93			pinmux = <STM32_PINMUX('G', 11, AF6)>; /* UART4_TX */
94			bias-disable;
95			drive-push-pull;
96			slew-rate = <0>;
97		};
98		pins2 {
99			pinmux = <STM32_PINMUX('B', 2, AF8)>; /* UART4_RX */
100			bias-disable;
101		};
102	};
103
104	sdmmc1_b4_pins_a: sdmmc1-b4@0 {
105		pins {
106			pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1_D0 */
107				 <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1_D1 */
108				 <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1_D2 */
109				 <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1_D3 */
110				 <STM32_PINMUX('C', 12, AF12)>, /* SDMMC1_CK */
111				 <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1_CMD */
112			slew-rate = <3>;
113			drive-push-pull;
114			bias-disable;
115		};
116	};
117
118	sdmmc1_dir_pins_a: sdmmc1-dir@0 {
119		pins {
120			pinmux = <STM32_PINMUX('F', 2, AF11)>, /* SDMMC1_D0DIR */
121				 <STM32_PINMUX('C', 7, AF8)>, /* SDMMC1_D123DIR */
122				 <STM32_PINMUX('B', 9, AF11)>, /* SDMMC1_CDIR */
123				 <STM32_PINMUX('E', 4, AF8)>; /* SDMMC1_CKIN */
124			slew-rate = <3>;
125			drive-push-pull;
126			bias-pull-up;
127		};
128	};
129	sdmmc2_b4_pins_a: sdmmc2-b4@0 {
130		pins {
131			pinmux = <STM32_PINMUX('B', 14, AF9)>, /* SDMMC2_D0 */
132				 <STM32_PINMUX('B', 15, AF9)>, /* SDMMC2_D1 */
133				 <STM32_PINMUX('B', 3, AF9)>, /* SDMMC2_D2 */
134				 <STM32_PINMUX('B', 4, AF9)>, /* SDMMC2_D3 */
135				 <STM32_PINMUX('E', 3, AF9)>, /* SDMMC2_CK */
136				 <STM32_PINMUX('G', 6, AF10)>; /* SDMMC2_CMD */
137			slew-rate = <3>;
138			drive-push-pull;
139			bias-pull-up;
140		};
141	};
142
143	sdmmc2_d47_pins_a: sdmmc2-d47@0 {
144		pins {
145			pinmux = <STM32_PINMUX('A', 8, AF9)>, /* SDMMC2_D4 */
146				 <STM32_PINMUX('A', 9, AF10)>, /* SDMMC2_D5 */
147				 <STM32_PINMUX('E', 5, AF9)>, /* SDMMC2_D6 */
148				 <STM32_PINMUX('D', 3, AF9)>; /* SDMMC2_D7 */
149			slew-rate = <3>;
150			drive-push-pull;
151			bias-pull-up;
152		};
153	};
154};
155
156&pinctrl_z {
157	i2c4_pins_a: i2c4@0 {
158		pins {
159			pinmux = <STM32_PINMUX('Z', 4, AF6)>, /* I2C4_SCL */
160				 <STM32_PINMUX('Z', 5, AF6)>; /* I2C4_SDA */
161			bias-disable;
162			drive-open-drain;
163			slew-rate = <0>;
164		};
165	};
166};
167
168&i2c4 {
169	pinctrl-names = "default";
170	pinctrl-0 = <&i2c4_pins_a>;
171	i2c-scl-rising-time-ns = <185>;
172	i2c-scl-falling-time-ns = <20>;
173	status = "okay";
174
175	pmic: stpmu1@33 {
176		compatible = "st,stpmu1";
177		reg = <0x33>;
178		interrupts = <0 2>;
179		interrupt-parent = <&gpioa>;
180		interrupt-controller;
181		#interrupt-cells = <2>;
182		status = "okay";
183
184		st,main_control_register = <0x04>;
185		st,vin_control_register = <0xc0>;
186		st,usb_control_register = <0x30>;
187
188		regulators {
189			compatible = "st,stpmu1-regulators";
190
191			ldo1-supply = <&v3v3>;
192			ldo2-supply = <&v3v3>;
193			ldo3-supply = <&vdd_ddr>;
194			ldo5-supply = <&v3v3>;
195			ldo6-supply = <&v3v3>;
196			pwr_sw1-supply = <&bst_out>;
197			pwr_sw2-supply = <&bst_out>;
198
199			vddcore: buck1 {
200				regulator-name = "vddcore";
201				regulator-min-microvolt = <800000>;
202				regulator-max-microvolt = <1350000>;
203				regulator-always-on;
204				regulator-initial-mode = <2>;
205				regulator-over-current-protection;
206
207				regulator-state-standby {
208					regulator-on-in-suspend;
209					regulator-suspend-microvolt = <1200000>;
210					regulator-mode = <8>;
211				};
212				regulator-state-mem {
213					regulator-off-in-suspend;
214				};
215				regulator-state-disk {
216					regulator-off-in-suspend;
217				};
218			};
219
220			vdd_ddr: buck2 {
221				regulator-name = "vdd_ddr";
222				regulator-min-microvolt = <1350000>;
223				regulator-max-microvolt = <1350000>;
224				regulator-always-on;
225				regulator-initial-mode = <2>;
226				regulator-over-current-protection;
227
228				regulator-state-standby {
229					regulator-suspend-microvolt = <1350000>;
230					regulator-on-in-suspend;
231					regulator-mode = <8>;
232				};
233				regulator-state-mem {
234					regulator-suspend-microvolt = <1350000>;
235					regulator-on-in-suspend;
236					regulator-mode = <8>;
237				};
238				regulator-state-disk {
239					regulator-off-in-suspend;
240				};
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 = <8>;
250				regulator-over-current-protection;
251
252				regulator-state-standby {
253					regulator-suspend-microvolt = <3300000>;
254					regulator-on-in-suspend;
255					regulator-mode = <8>;
256				};
257				regulator-state-mem {
258					regulator-suspend-microvolt = <3300000>;
259					regulator-on-in-suspend;
260					regulator-mode = <8>;
261				};
262				regulator-state-disk {
263					regulator-suspend-microvolt = <3300000>;
264					regulator-on-in-suspend;
265					regulator-mode = <8>;
266				};
267			};
268
269			v3v3: buck4 {
270				regulator-name = "v3v3";
271				regulator-min-microvolt = <3300000>;
272				regulator-max-microvolt = <3300000>;
273				regulator-boot-on;
274				regulator-over-current-protection;
275				regulator-initial-mode = <8>;
276
277				regulator-state-standby {
278					regulator-suspend-microvolt = <3300000>;
279					regulator-unchanged-in-suspend;
280					regulator-mode = <8>;
281				};
282				regulator-state-mem {
283					regulator-off-in-suspend;
284				};
285				regulator-state-disk {
286					regulator-off-in-suspend;
287				};
288			};
289
290			vdda: ldo1 {
291				regulator-name = "vdda";
292				regulator-min-microvolt = <2900000>;
293				regulator-max-microvolt = <2900000>;
294				interrupts = <IT_CURLIM_LDO1 0>;
295				interrupt-parent = <&pmic>;
296
297				regulator-state-standby {
298					regulator-suspend-microvolt = <2900000>;
299					regulator-unchanged-in-suspend;
300				};
301				regulator-state-mem {
302					regulator-off-in-suspend;
303				};
304				regulator-state-disk {
305					regulator-off-in-suspend;
306				};
307			};
308
309			v2v8: ldo2 {
310				regulator-name = "v2v8";
311				regulator-min-microvolt = <2800000>;
312				regulator-max-microvolt = <2800000>;
313				interrupts = <IT_CURLIM_LDO2 0>;
314				interrupt-parent = <&pmic>;
315
316				regulator-state-standby {
317					regulator-suspend-microvolt = <2800000>;
318					regulator-unchanged-in-suspend;
319				};
320				regulator-state-mem {
321					regulator-off-in-suspend;
322				};
323				regulator-state-disk {
324					regulator-off-in-suspend;
325				};
326			};
327
328			vtt_ddr: ldo3 {
329				regulator-name = "vtt_ddr";
330				regulator-min-microvolt = <0000000>;
331				regulator-max-microvolt = <1000000>;
332				regulator-always-on;
333				regulator-over-current-protection;
334
335				regulator-state-standby {
336					regulator-off-in-suspend;
337				};
338				regulator-state-mem {
339					regulator-off-in-suspend;
340				};
341				regulator-state-disk {
342					regulator-off-in-suspend;
343				};
344			};
345
346			vdd_usb: ldo4 {
347				regulator-name = "vdd_usb";
348				regulator-min-microvolt = <3300000>;
349				regulator-max-microvolt = <3300000>;
350				interrupts = <IT_CURLIM_LDO4 0>;
351				interrupt-parent = <&pmic>;
352
353				regulator-state-standby {
354					regulator-unchanged-in-suspend;
355				};
356				regulator-state-mem {
357					regulator-off-in-suspend;
358				};
359				regulator-state-disk {
360					regulator-off-in-suspend;
361				};
362			};
363
364			vdd_sd: ldo5 {
365				regulator-name = "vdd_sd";
366				regulator-min-microvolt = <2900000>;
367				regulator-max-microvolt = <2900000>;
368				interrupts = <IT_CURLIM_LDO5 0>;
369				interrupt-parent = <&pmic>;
370				regulator-boot-on;
371
372				regulator-state-standby {
373					regulator-suspend-microvolt = <2900000>;
374					regulator-unchanged-in-suspend;
375				};
376				regulator-state-mem {
377					regulator-off-in-suspend;
378				};
379				regulator-state-disk {
380					regulator-off-in-suspend;
381				};
382			};
383
384			v1v8: ldo6 {
385				regulator-name = "v1v8";
386				regulator-min-microvolt = <1800000>;
387				regulator-max-microvolt = <1800000>;
388				interrupts = <IT_CURLIM_LDO6 0>;
389				interrupt-parent = <&pmic>;
390
391				regulator-state-standby {
392					regulator-suspend-microvolt = <1800000>;
393					regulator-unchanged-in-suspend;
394				};
395				regulator-state-mem {
396					regulator-off-in-suspend;
397				};
398				regulator-state-disk {
399					regulator-off-in-suspend;
400				};
401			};
402
403			vref_ddr: vref_ddr {
404				regulator-name = "vref_ddr";
405				regulator-always-on;
406				regulator-over-current-protection;
407
408				regulator-state-standby {
409					regulator-on-in-suspend;
410				};
411				regulator-state-mem {
412					regulator-on-in-suspend;
413				};
414				regulator-state-disk {
415					regulator-off-in-suspend;
416				};
417			};
418
419			 bst_out: boost {
420				regulator-name = "bst_out";
421				interrupts = <IT_OCP_BOOST 0>;
422				interrupt-parent = <&pmic>;
423			 };
424
425			vbus_otg: pwr_sw1 {
426				regulator-name = "vbus_otg";
427				interrupts = <IT_OCP_OTG 0>;
428				interrupt-parent = <&pmic>;
429				regulator-active-discharge;
430			 };
431
432			 vbus_sw: pwr_sw2 {
433				regulator-name = "vbus_sw";
434				interrupts = <IT_OCP_SWOUT 0>;
435				interrupt-parent = <&pmic>;
436				regulator-active-discharge;
437			 };
438		};
439	};
440};
441
442&sdmmc1 {
443	pinctrl-names = "default";
444	pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>;
445	broken-cd;
446	st,dirpol;
447	st,negedge;
448	st,pin-ckin;
449	bus-width = <4>;
450	vmmc-supply = <&vdd_sd>;
451	vqmmc-supply = <&sd_switch>;
452	sd-uhs-sdr12;
453	sd-uhs-sdr25;
454	sd-uhs-sdr50;
455	sd-uhs-ddr50;
456	sd-uhs-sdr104;
457	status = "okay";
458};
459
460&sdmmc2 {
461	pinctrl-names = "default";
462	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>;
463	non-removable;
464	no-sd;
465	no-sdio;
466	st,dirpol;
467	st,negedge;
468	bus-width = <8>;
469	status = "okay";
470};
471
472&uart4 {
473	pinctrl-names = "default";
474	pinctrl-0 = <&uart4_pins_a>;
475	status = "okay";
476};
477