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