1// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
2/*
3 * Copyright (C) Linaro Ltd 2019 - All Rights Reserved
4 * Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
5 * Copyright (C) 2020 Marek Vasut <marex@denx.de>
6 */
7
8/* Avenger96 uses DHCOR SoM configured for 1V8 IO operation */
9#include "stm32mp15xx-dhcor-io1v8.dtsi"
10
11/ {
12	aliases {
13		ethernet0 = &ethernet0;
14		mmc0 = &sdmmc1;
15		serial0 = &uart4;
16		serial1 = &uart7;
17		serial2 = &usart2;
18		spi0 = &qspi;
19	};
20
21	/* XTal Q1 */
22	cec_clock: clk-cec-fixed {
23		#clock-cells = <0>;
24		compatible = "fixed-clock";
25		clock-frequency = <24000000>;
26	};
27
28	chosen {
29		stdout-path = "serial0:115200n8";
30	};
31
32	hdmi-out {
33		compatible = "hdmi-connector";
34		type = "a";
35
36		port {
37			hdmi_con: endpoint {
38				remote-endpoint = <&adv7513_out>;
39			};
40		};
41	};
42
43	led {
44		compatible = "gpio-leds";
45		led1 {
46			label = "green:user0";
47			gpios = <&gpioz 7 GPIO_ACTIVE_HIGH>;
48			linux,default-trigger = "heartbeat";
49			default-state = "off";
50		};
51
52		led2 {
53			label = "green:user1";
54			gpios = <&gpiof 3 GPIO_ACTIVE_HIGH>;
55			linux,default-trigger = "mmc0";
56			default-state = "off";
57		};
58
59		led3 {
60			label = "green:user2";
61			gpios = <&gpiog 0 GPIO_ACTIVE_HIGH>;
62			linux,default-trigger = "mmc1";
63			default-state = "off";
64		};
65
66		led4 {
67			label = "green:user3";
68			gpios = <&gpiog 1 GPIO_ACTIVE_HIGH>;
69			linux,default-trigger = "none";
70			default-state = "off";
71			panic-indicator;
72		};
73	};
74
75	sd_switch: regulator-sd_switch {
76		compatible = "regulator-gpio";
77		regulator-name = "sd_switch";
78		regulator-min-microvolt = <1800000>;
79		regulator-max-microvolt = <2900000>;
80		regulator-type = "voltage";
81		regulator-always-on;
82
83		gpios = <&gpioi 5 GPIO_ACTIVE_HIGH>;
84		gpios-states = <0>;
85		states = <1800000 0x1>,
86			 <2900000 0x0>;
87	};
88
89	sound {
90		compatible = "audio-graph-card";
91		label = "STM32MP1-AV96-HDMI";
92		dais = <&sai2a_port>;
93		status = "okay";
94	};
95
96	wlan_pwr: regulator-wlan {
97		compatible = "regulator-fixed";
98
99		regulator-name = "wl-reg";
100		regulator-min-microvolt = <3300000>;
101		regulator-max-microvolt = <3300000>;
102
103		gpios = <&gpioz 3 GPIO_ACTIVE_HIGH>;
104		enable-active-high;
105	};
106};
107
108&adc {
109	pinctrl-names = "default";
110	pinctrl-0 = <&adc12_ain_pins_b>;
111	vdd-supply = <&vdd>;
112	vdda-supply = <&vdda>;
113	vref-supply = <&vdda>;
114	status = "okay";
115
116	adc1: adc@0 {
117		st,adc-channels = <0 1 6>;
118		st,min-sample-time-nsecs = <5000>;
119		status = "okay";
120	};
121
122	adc2: adc@100 {
123		st,adc-channels = <0 1 2>;
124		st,min-sample-time-nsecs = <5000>;
125		status = "okay";
126	};
127};
128
129&dcmi {
130	pinctrl-names = "default", "sleep";
131	pinctrl-0 = <&dcmi_pins_c>;
132	pinctrl-1 = <&dcmi_sleep_pins_c>;
133	status = "disabled";
134
135	port {
136		dcmi_0: endpoint {
137			remote-endpoint = <&stmipi_2>;
138			bus-type = <5>;
139			bus-width = <8>;
140			pclk-sample = <0>;
141		};
142	};
143};
144
145&ethernet0 {
146	status = "okay";
147	pinctrl-0 = <&ethernet0_rgmii_pins_c>;
148	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_c>;
149	pinctrl-names = "default", "sleep";
150	phy-mode = "rgmii";
151	max-speed = <1000>;
152	phy-handle = <&phy0>;
153
154	mdio0 {
155		#address-cells = <1>;
156		#size-cells = <0>;
157		compatible = "snps,dwmac-mdio";
158		reset-gpios = <&gpioz 2 GPIO_ACTIVE_LOW>;
159		reset-delay-us = <1000>;
160		reset-post-delay-us = <1000>;
161
162		phy0: ethernet-phy@7 {
163			reg = <7>;
164
165			rxc-skew-ps = <1500>;
166			rxdv-skew-ps = <540>;
167			rxd0-skew-ps = <420>;
168			rxd1-skew-ps = <420>;
169			rxd2-skew-ps = <420>;
170			rxd3-skew-ps = <420>;
171
172			txc-skew-ps = <1440>;
173			txen-skew-ps = <540>;
174			txd0-skew-ps = <420>;
175			txd1-skew-ps = <420>;
176			txd2-skew-ps = <420>;
177			txd3-skew-ps = <420>;
178		};
179	};
180};
181
182&gpioa {
183	gpio-line-names = "", "", "", "",
184			  "", "", "", "",
185			  "", "", "", "AV96-K",
186			  "AV96-I", "", "AV96-A", "";
187};
188
189&gpiob {
190	gpio-line-names = "", "", "", "",
191			  "", "AV96-J", "", "",
192			  "", "", "", "AV96-B",
193			  "", "AV96-L", "", "";
194};
195
196&gpioc {
197	gpio-line-names = "", "", "", "AV96-C",
198			  "", "", "", "",
199			  "", "", "", "",
200			  "", "", "", "";
201};
202
203&gpiod {
204	gpio-line-names = "", "", "", "",
205			  "", "", "", "",
206			  "AV96-D", "", "", "",
207			  "", "", "AV96-E", "AV96-F";
208};
209
210&gpiof {
211	gpio-line-names = "", "", "", "",
212			  "", "", "", "",
213			  "", "", "", "",
214			  "AV96-G", "AV96-H", "", "";
215};
216
217&i2c1 {	/* X6 I2C1 */
218	pinctrl-names = "default";
219	pinctrl-0 = <&i2c1_pins_b>;
220	i2c-scl-rising-time-ns = <185>;
221	i2c-scl-falling-time-ns = <20>;
222	status = "okay";
223	/delete-property/dmas;
224	/delete-property/dma-names;
225};
226
227&i2c2 {	/* X6 I2C2 */
228	pinctrl-names = "default";
229	pinctrl-0 = <&i2c2_pins_c>;
230	i2c-scl-rising-time-ns = <185>;
231	i2c-scl-falling-time-ns = <20>;
232	status = "okay";
233	/delete-property/dmas;
234	/delete-property/dma-names;
235};
236
237&i2c4 {
238	stmipi: stmipi@14 {
239		compatible = "st,st-mipid02";
240		pinctrl-names = "default", "sleep";
241		pinctrl-0 = <&mco1_pins_a>;
242		pinctrl-1 = <&mco1_sleep_pins_a>;
243		reg = <0x14>;
244		clocks = <&rcc CK_MCO1>;
245		clock-names = "xclk";
246		assigned-clocks = <&rcc CK_MCO1>;
247		assigned-clock-parents = <&rcc CK_HSE>;
248		assigned-clock-rates = <24000000>;
249		VDDE-supply = <&v1v8>;
250		VDDIN-supply = <&v1v8>;
251		reset-gpios = <&gpioz 0 GPIO_ACTIVE_LOW>;
252		status = "disabled";
253
254		ports {
255			#address-cells = <1>;
256			#size-cells = <0>;
257
258			port@0 {
259				reg = <0>;
260				stmipi_0: endpoint {
261				};
262			};
263
264			port@2 {
265				reg = <2>;
266				stmipi_2: endpoint {
267					bus-width = <8>;
268					hsync-active = <0>;
269					vsync-active = <0>;
270					pclk-sample = <0>;
271					remote-endpoint = <&dcmi_0>;
272				};
273			};
274		};
275	};
276
277	hdmi-transmitter@3d {
278		compatible = "adi,adv7513";
279		reg = <0x3d>, <0x4d>, <0x2d>, <0x5d>;
280		reg-names = "main", "edid", "cec", "packet";
281		clocks = <&cec_clock>;
282		clock-names = "cec";
283
284		avdd-supply = <&v3v3>;
285		dvdd-supply = <&v3v3>;
286		pvdd-supply = <&v3v3>;
287		dvdd-3v-supply = <&v3v3>;
288		bgvdd-supply = <&v3v3>;
289
290		interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
291		interrupt-parent = <&gpiog>;
292
293		status = "okay";
294
295		adi,input-depth = <8>;
296		adi,input-colorspace = "rgb";
297		adi,input-clock = "1x";
298
299		ports {
300			#address-cells = <1>;
301			#size-cells = <0>;
302
303			port@0 {
304				reg = <0>;
305				adv7513_in: endpoint {
306					remote-endpoint = <&ltdc_ep0_out>;
307				};
308			};
309
310			port@1 {
311				reg = <1>;
312				adv7513_out: endpoint {
313					remote-endpoint = <&hdmi_con>;
314				};
315			};
316
317			port@2 {
318				reg = <2>;
319				adv7513_i2s0: endpoint {
320					remote-endpoint = <&sai2a_endpoint>;
321				};
322			};
323		};
324	};
325};
326
327&ltdc {
328	pinctrl-names = "default", "sleep";
329	pinctrl-0 = <&ltdc_pins_d>;
330	pinctrl-1 = <&ltdc_sleep_pins_d>;
331	status = "okay";
332
333	port {
334		#address-cells = <1>;
335		#size-cells = <0>;
336
337		ltdc_ep0_out: endpoint@0 {
338			reg = <0>;
339			remote-endpoint = <&adv7513_in>;
340		};
341	};
342};
343
344&sai2 {
345	clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
346	pinctrl-names = "default", "sleep";
347	pinctrl-0 = <&sai2a_pins_c>;
348	pinctrl-1 = <&sai2a_sleep_pins_c>;
349	clock-names = "pclk", "x8k", "x11k";
350	status = "okay";
351
352	sai2a: audio-controller@4400b004 {
353		#clock-cells = <0>;
354		dma-names = "tx";
355		clocks = <&rcc SAI2_K>;
356		clock-names = "sai_ck";
357		status = "okay";
358
359		sai2a_port: port {
360			sai2a_endpoint: endpoint {
361				remote-endpoint = <&adv7513_i2s0>;
362				format = "i2s";
363				mclk-fs = <256>;
364			};
365		};
366	};
367};
368
369&sdmmc1 {
370	pinctrl-names = "default", "opendrain", "sleep";
371	pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_b>;
372	pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_b>;
373	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_b>;
374	cd-gpios = <&gpioi 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
375	disable-wp;
376	st,sig-dir;
377	st,neg-edge;
378	st,use-ckin;
379	bus-width = <4>;
380	vmmc-supply = <&vdd_sd>;
381	vqmmc-supply = <&sd_switch>;
382	status = "okay";
383};
384
385&sdmmc2 {
386	pinctrl-names = "default", "opendrain", "sleep";
387	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_c>;
388	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_c>;
389	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_c>;
390	bus-width = <8>;
391	mmc-ddr-1_8v;
392	no-sd;
393	no-sdio;
394	non-removable;
395	st,neg-edge;
396	vmmc-supply = <&v3v3>;
397	vqmmc-supply = <&vdd_io>;
398	status = "okay";
399};
400
401&sdmmc3 {
402	pinctrl-names = "default", "opendrain", "sleep";
403	pinctrl-0 = <&sdmmc3_b4_pins_b>;
404	pinctrl-1 = <&sdmmc3_b4_od_pins_b>;
405	pinctrl-2 = <&sdmmc3_b4_sleep_pins_b>;
406	broken-cd;
407	non-removable;
408	st,neg-edge;
409	bus-width = <4>;
410	vmmc-supply = <&wlan_pwr>;
411	status = "okay";
412
413	#address-cells = <1>;
414	#size-cells = <0>;
415	brcmf: bcrmf@1 {
416		reg = <1>;
417		compatible = "brcm,bcm4329-fmac";
418	};
419};
420
421&spi2 {
422	pinctrl-names = "default";
423	pinctrl-0 = <&spi2_pins_a>;
424	cs-gpios = <&gpioi 0 0>;
425	status = "disabled";
426	/delete-property/dmas;
427	/delete-property/dma-names;
428};
429
430&uart4 {
431	/* On Low speed expansion header */
432	label = "LS-UART1";
433	pinctrl-names = "default";
434	pinctrl-0 = <&uart4_pins_b>;
435	/delete-property/dmas;
436	/delete-property/dma-names;
437	status = "okay";
438};
439
440&uart7 {
441	/* On Low speed expansion header */
442	label = "LS-UART0";
443	pinctrl-names = "default";
444	pinctrl-0 = <&uart7_pins_a>;
445	uart-has-rtscts;
446	/delete-property/dmas;
447	/delete-property/dma-names;
448	status = "okay";
449};
450
451/* Bluetooth */
452&usart2 {
453	pinctrl-names = "default", "sleep";
454	pinctrl-0 = <&usart2_pins_a>;
455	pinctrl-1 = <&usart2_sleep_pins_a>;
456	st,hw-flow-ctrl;
457	/delete-property/dmas;
458	/delete-property/dma-names;
459	status = "okay";
460
461	bluetooth {
462		compatible = "brcm,bcm43438-bt";
463		max-speed = <3000000>;
464		shutdown-gpios = <&gpioz 6 GPIO_ACTIVE_HIGH>;
465	};
466};
467
468&usbh_ehci {
469	phys = <&usbphyc_port0>;
470	phy-names = "usb";
471	status = "okay";
472};
473
474&usbotg_hs {
475	pinctrl-0 = <&usbotg_hs_pins_a>;
476	pinctrl-names = "default";
477	phy-names = "usb2-phy";
478	phys = <&usbphyc_port1 0>;
479	status = "okay";
480	vbus-supply = <&vbus_otg>;
481};
482
483&usbphyc {
484	status = "okay";
485};
486
487&usbphyc_port0 {
488	phy-supply = <&vdd_usb>;
489};
490
491&usbphyc_port1 {
492	phy-supply = <&vdd_usb>;
493};
494