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