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				regulator-min-microvolt = <3300000>;
188				regulator-max-microvolt = <3300000>;
189				interrupts = <IT_CURLIM_LDO4 0>;
190			};
191
192			vdd_sd: ldo5 {
193				regulator-name = "vdd_sd";
194				regulator-min-microvolt = <2900000>;
195				regulator-max-microvolt = <2900000>;
196				interrupts = <IT_CURLIM_LDO5 0>;
197				regulator-boot-on;
198			};
199
200			v1v8: ldo6 {
201				regulator-name = "v1v8";
202				regulator-min-microvolt = <1800000>;
203				regulator-max-microvolt = <1800000>;
204				regulator-always-on;
205				interrupts = <IT_CURLIM_LDO6 0>;
206			};
207
208			vref_ddr: vref_ddr {
209				regulator-name = "vref_ddr";
210				regulator-always-on;
211				regulator-over-current-protection;
212			};
213
214			bst_out: boost {
215				regulator-name = "bst_out";
216				interrupts = <IT_OCP_BOOST 0>;
217			};
218
219			vbus_otg: pwr_sw1 {
220				regulator-name = "vbus_otg";
221				interrupts = <IT_OCP_OTG 0>;
222				regulator-active-discharge;
223			};
224
225			vbus_sw: pwr_sw2 {
226				regulator-name = "vbus_sw";
227				interrupts = <IT_OCP_SWOUT 0>;
228				regulator-active-discharge;
229			};
230		};
231
232		onkey {
233			compatible = "st,stpmic1-onkey";
234			interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 1>;
235			interrupt-names = "onkey-falling", "onkey-rising";
236			status = "okay";
237		};
238
239		watchdog {
240			compatible = "st,stpmic1-wdt";
241			status = "disabled";
242		};
243	};
244};
245
246&iwdg2 {
247	timeout-sec = <32>;
248	status = "okay";
249};
250
251&pwr_regulators {
252	vdd-supply = <&vdd>;
253	vdd_3v3_usbfs-supply = <&vdd_usb>;
254};
255
256&rng1 {
257	status = "okay";
258};
259
260&rtc {
261	status = "okay";
262};
263
264&sdmmc1 {
265	pinctrl-names = "default", "opendrain", "sleep";
266	pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_b>;
267	pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_b>;
268	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_b>;
269	broken-cd;
270	disable-wp;
271	st,sig-dir;
272	st,neg-edge;
273	st,use-ckin;
274	bus-width = <4>;
275	vmmc-supply = <&vdd_sd>;
276	vqmmc-supply = <&sd_switch>;
277	status = "okay";
278};
279
280/* LS-SPI0 */
281&spi4 {
282	pinctrl-names = "default";
283	pinctrl-0 = <&spi4_pins_a>;
284	cs-gpios = <&gpioe 11 GPIO_ACTIVE_HIGH>;
285	status = "okay";
286};
287
288/* BG96 */
289&usart2 {
290	pinctrl-names = "default", "sleep";
291	pinctrl-0 = <&usart2_pins_b>;
292	pinctrl-1 = <&usart2_sleep_pins_b>;
293	st,hw-flow-ctrl;
294	status = "okay";
295};
296
297/* LS-UART0 */
298&uart4 {
299	pinctrl-names = "default";
300	pinctrl-0 = <&uart4_pins_c>;
301	st,hw-flow-ctrl;
302	status = "okay";
303};
304
305/* Debug console */
306&uart7 {
307	pinctrl-names = "default";
308	pinctrl-0 = <&uart7_pins_b>;
309	status = "okay";
310};
311
312&usbh_ehci {
313	phys = <&usbphyc_port0>;
314	phy-names = "usb";
315	status = "okay";
316};
317
318&usbotg_hs {
319	dr_mode = "peripheral";
320	pinctrl-0 = <&usbotg_hs_pins_a>;
321	pinctrl-names = "default";
322	phy-names = "usb2-phy";
323	phys = <&usbphyc_port1 0>;
324	vbus-supply = <&vbus_otg>;
325	status = "okay";
326};
327
328&usbphyc {
329	status = "okay";
330};
331
332&usbphyc_port0 {
333	phy-supply = <&vdd_usb>;
334};
335
336&usbphyc_port1 {
337	phy-supply = <&vdd_usb>;
338};
339