1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (C) 2020 Manivannan Sadhasivam
4 */
5
6/dts-v1/;
7
8#include "stm32mp157.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		mmc0 = &sdmmc1;
17		serial0 = &uart4;
18		serial1 = &uart7;
19		serial2 = &usart2;
20		spi0 = &spi4;
21	};
22
23	chosen {
24		stdout-path = "serial1:115200n8";
25	};
26
27	memory@c0000000 {
28		device_type = "memory";
29		reg = <0xc0000000 0x10000000>;
30	};
31
32	led {
33		compatible = "gpio-leds";
34
35		led1 {
36			label = "green:user1";
37			gpios = <&gpioa 13 GPIO_ACTIVE_HIGH>;
38			linux,default-trigger = "heartbeat";
39			default-state = "off";
40		};
41
42		led2 {
43			label = "green:user2";
44			gpios = <&gpioh 3 GPIO_ACTIVE_HIGH>;
45			linux,default-trigger = "mmc0";
46			default-state = "off";
47		};
48
49		led3 {
50			label = "green:user3";
51			gpios = <&gpioh 2 GPIO_ACTIVE_HIGH>;
52			linux,default-trigger = "mmc1";
53			default-state = "off";
54		};
55
56		led4 {
57			label = "green:user4";
58			gpios = <&gpiof 12 GPIO_ACTIVE_HIGH>;
59			linux,default-trigger = "none";
60			default-state = "off";
61			panic-indicator;
62		};
63	};
64
65	sd_switch: regulator-sd_switch {
66		compatible = "regulator-gpio";
67		regulator-name = "sd_switch";
68		regulator-min-microvolt = <1800000>;
69		regulator-max-microvolt = <2900000>;
70		regulator-type = "voltage";
71		regulator-always-on;
72
73		gpios = <&gpioa 8 GPIO_ACTIVE_HIGH>;
74		gpios-states = <0>;
75		states = <1800000 0x1>,
76			 <2900000 0x0>;
77	};
78};
79
80/* Only headless mode is supported */
81&gpu {
82	status = "disabled";
83};
84
85/* LS-I2C0 */
86&i2c2 {
87	pinctrl-names = "default";
88	pinctrl-0 = <&i2c2_pins_a>;
89	i2c-scl-rising-time-ns = <1000>;
90	i2c-scl-falling-time-ns = <300>;
91	status = "okay";
92	/delete-property/dmas;
93	/delete-property/dma-names;
94};
95
96&i2c4 {
97	pinctrl-names = "default";
98	pinctrl-0 = <&i2c4_pins_a>;
99	i2c-scl-rising-time-ns = <185>;
100	i2c-scl-falling-time-ns = <20>;
101	status = "okay";
102	/delete-property/dmas;
103	/delete-property/dma-names;
104
105	pmic: stpmic@33 {
106		compatible = "st,stpmic1";
107		reg = <0x33>;
108		interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>;
109		interrupt-controller;
110		#interrupt-cells = <2>;
111		status = "okay";
112
113		regulators {
114			compatible = "st,stpmic1-regulators";
115
116			ldo1-supply = <&v3v3>;
117			ldo2-supply = <&v3v3>;
118			ldo3-supply = <&vdd_ddr>;
119			ldo5-supply = <&v3v3>;
120			ldo6-supply = <&v3v3>;
121			pwr_sw1-supply = <&bst_out>;
122			pwr_sw2-supply = <&bst_out>;
123
124			vddcore: buck1 {
125				regulator-name = "vddcore";
126				regulator-min-microvolt = <1200000>;
127				regulator-max-microvolt = <1350000>;
128				regulator-always-on;
129				regulator-initial-mode = <0>;
130				regulator-over-current-protection;
131			};
132
133			vdd_ddr: buck2 {
134				regulator-name = "vdd_ddr";
135				regulator-min-microvolt = <1500000>;
136				regulator-max-microvolt = <1500000>;
137				regulator-always-on;
138				regulator-initial-mode = <0>;
139				regulator-over-current-protection;
140			};
141
142			vdd: buck3 {
143				regulator-name = "vdd";
144				regulator-min-microvolt = <1800000>;
145				regulator-max-microvolt = <1800000>;
146				regulator-always-on;
147				st,mask-reset;
148				regulator-initial-mode = <0>;
149				regulator-over-current-protection;
150			};
151
152			v3v3: buck4 {
153				regulator-name = "v3v3";
154				regulator-min-microvolt = <3300000>;
155				regulator-max-microvolt = <3300000>;
156				regulator-always-on;
157				regulator-over-current-protection;
158				regulator-initial-mode = <0>;
159			};
160
161			vdda: ldo1 {
162				regulator-name = "vdda";
163				regulator-min-microvolt = <1800000>;
164				regulator-max-microvolt = <1800000>;
165				regulator-always-on;
166				interrupts = <IT_CURLIM_LDO1 0>;
167			};
168
169			v2v9: ldo2 {
170				regulator-name = "v2v9";
171				regulator-min-microvolt = <2900000>;
172				regulator-max-microvolt = <2900000>;
173				regulator-always-on;
174				interrupts = <IT_CURLIM_LDO2 0>;
175			};
176
177			vtt_ddr: ldo3 {
178				regulator-name = "vtt_ddr";
179				regulator-min-microvolt = <500000>;
180				regulator-max-microvolt = <750000>;
181				regulator-always-on;
182				regulator-over-current-protection;
183			};
184
185			vdd_usb: ldo4 {
186				regulator-name = "vdd_usb";
187				interrupts = <IT_CURLIM_LDO4 0>;
188			};
189
190			vdd_sd: ldo5 {
191				regulator-name = "vdd_sd";
192				regulator-min-microvolt = <2900000>;
193				regulator-max-microvolt = <2900000>;
194				interrupts = <IT_CURLIM_LDO5 0>;
195				regulator-boot-on;
196			};
197
198			v1v8: ldo6 {
199				regulator-name = "v1v8";
200				regulator-min-microvolt = <1800000>;
201				regulator-max-microvolt = <1800000>;
202				regulator-always-on;
203				interrupts = <IT_CURLIM_LDO6 0>;
204			};
205
206			vref_ddr: vref_ddr {
207				regulator-name = "vref_ddr";
208				regulator-always-on;
209			};
210
211			bst_out: boost {
212				regulator-name = "bst_out";
213				interrupts = <IT_OCP_BOOST 0>;
214			};
215
216			vbus_otg: pwr_sw1 {
217				regulator-name = "vbus_otg";
218				interrupts = <IT_OCP_OTG 0>;
219				regulator-active-discharge = <1>;
220			};
221
222			vbus_sw: pwr_sw2 {
223				regulator-name = "vbus_sw";
224				interrupts = <IT_OCP_SWOUT 0>;
225				regulator-active-discharge = <1>;
226			};
227		};
228
229		onkey {
230			compatible = "st,stpmic1-onkey";
231			interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 1>;
232			interrupt-names = "onkey-falling", "onkey-rising";
233			status = "okay";
234		};
235
236		watchdog {
237			compatible = "st,stpmic1-wdt";
238			status = "disabled";
239		};
240	};
241};
242
243&iwdg2 {
244	timeout-sec = <32>;
245	status = "okay";
246};
247
248&pwr_regulators {
249	vdd-supply = <&vdd>;
250	vdd_3v3_usbfs-supply = <&vdd_usb>;
251};
252
253&rng1 {
254	status = "okay";
255};
256
257&rtc {
258	status = "okay";
259};
260
261&sdmmc1 {
262	pinctrl-names = "default", "opendrain", "sleep";
263	pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_b>;
264	pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_b>;
265	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_b>;
266	broken-cd;
267	disable-wp;
268	st,sig-dir;
269	st,neg-edge;
270	st,use-ckin;
271	bus-width = <4>;
272	vmmc-supply = <&vdd_sd>;
273	vqmmc-supply = <&sd_switch>;
274	status = "okay";
275};
276
277/* LS-SPI0 */
278&spi4 {
279	pinctrl-names = "default";
280	pinctrl-0 = <&spi4_pins_a>;
281	cs-gpios = <&gpioe 11 GPIO_ACTIVE_HIGH>;
282	status = "okay";
283};
284
285/* BG96 */
286&usart2 {
287	pinctrl-names = "default", "sleep";
288	pinctrl-0 = <&usart2_pins_b>;
289	pinctrl-1 = <&usart2_sleep_pins_b>;
290	st,hw-flow-ctrl;
291	status = "okay";
292};
293
294/* LS-UART0 */
295&uart4 {
296	pinctrl-names = "default";
297	pinctrl-0 = <&uart4_pins_c>;
298	st,hw-flow-ctrl;
299	status = "okay";
300};
301
302/* Debug console */
303&uart7 {
304	pinctrl-names = "default";
305	pinctrl-0 = <&uart7_pins_b>;
306	status = "okay";
307};
308
309&usbh_ehci {
310	phys = <&usbphyc_port0>;
311	phy-names = "usb";
312	status = "okay";
313};
314
315&usbotg_hs {
316	dr_mode = "peripheral";
317	pinctrl-0 = <&usbotg_hs_pins_a>;
318	pinctrl-names = "default";
319	phy-names = "usb2-phy";
320	phys = <&usbphyc_port1 0>;
321	vbus-supply = <&vbus_otg>;
322	status = "okay";
323};
324
325&usbphyc {
326	status = "okay";
327};
328
329&usbphyc_port0 {
330	phy-supply = <&vdd_usb>;
331};
332
333&usbphyc_port1 {
334	phy-supply = <&vdd_usb>;
335};
336