1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2/*
3 * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
4 * Author: Ludovic Barre <ludovic.barre@st.com> for STMicroelectronics.
5 */
6/dts-v1/;
7
8#include "stm32mp157c-ed1.dts"
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/input/input.h>
11#include <dt-bindings/media/video-interfaces.h>
12
13/ {
14	model = "STMicroelectronics STM32MP157C eval daughter on eval mother";
15	compatible = "st,stm32mp157c-ev1", "st,stm32mp157c-ed1", "st,stm32mp157";
16
17	aliases {
18		serial1 = &usart3;
19		ethernet0 = &ethernet0;
20	};
21
22	chosen {
23		stdout-path = "serial0:115200n8";
24	};
25
26	clocks {
27		clk_ext_camera: clk-ext-camera {
28			#clock-cells = <0>;
29			compatible = "fixed-clock";
30			clock-frequency = <24000000>;
31		};
32	};
33
34	joystick {
35		compatible = "gpio-keys";
36		pinctrl-0 = <&joystick_pins>;
37		pinctrl-names = "default";
38		button-0 {
39			label = "JoySel";
40			linux,code = <KEY_ENTER>;
41			interrupt-parent = <&stmfx_pinctrl>;
42			interrupts = <0 IRQ_TYPE_EDGE_RISING>;
43		};
44		button-1 {
45			label = "JoyDown";
46			linux,code = <KEY_DOWN>;
47			interrupt-parent = <&stmfx_pinctrl>;
48			interrupts = <1 IRQ_TYPE_EDGE_RISING>;
49		};
50		button-2 {
51			label = "JoyLeft";
52			linux,code = <KEY_LEFT>;
53			interrupt-parent = <&stmfx_pinctrl>;
54			interrupts = <2 IRQ_TYPE_EDGE_RISING>;
55		};
56		button-3 {
57			label = "JoyRight";
58			linux,code = <KEY_RIGHT>;
59			interrupt-parent = <&stmfx_pinctrl>;
60			interrupts = <3 IRQ_TYPE_EDGE_RISING>;
61		};
62		button-4 {
63			label = "JoyUp";
64			linux,code = <KEY_UP>;
65			interrupt-parent = <&stmfx_pinctrl>;
66			interrupts = <4 IRQ_TYPE_EDGE_RISING>;
67		};
68	};
69
70	panel_backlight: panel-backlight {
71		compatible = "gpio-backlight";
72		gpios = <&gpiod 13 GPIO_ACTIVE_LOW>;
73		default-on;
74		status = "okay";
75	};
76};
77
78&cec {
79	pinctrl-names = "default";
80	pinctrl-0 = <&cec_pins_a>;
81	status = "okay";
82};
83
84&dcmi {
85	status = "okay";
86	pinctrl-names = "default", "sleep";
87	pinctrl-0 = <&dcmi_pins_a>;
88	pinctrl-1 = <&dcmi_sleep_pins_a>;
89
90	port {
91		dcmi_0: endpoint {
92			remote-endpoint = <&ov5640_0>;
93			bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
94			bus-width = <8>;
95			hsync-active = <0>;
96			vsync-active = <0>;
97			pclk-sample = <1>;
98		};
99	};
100};
101
102&dsi {
103	#address-cells = <1>;
104	#size-cells = <0>;
105	status = "okay";
106
107	panel@0 {
108		compatible = "raydium,rm68200";
109		reg = <0>;
110		reset-gpios = <&gpiof 15 GPIO_ACTIVE_LOW>;
111		backlight = <&panel_backlight>;
112		power-supply = <&v3v3>;
113		status = "okay";
114
115		port {
116			dsi_panel_in: endpoint {
117				remote-endpoint = <&dsi_out>;
118			};
119		};
120	};
121};
122
123&dsi_in {
124	remote-endpoint = <&ltdc_ep0_out>;
125};
126
127&dsi_out {
128	remote-endpoint = <&dsi_panel_in>;
129};
130
131&ethernet0 {
132	status = "okay";
133	pinctrl-0 = <&ethernet0_rgmii_pins_a>;
134	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_a>;
135	pinctrl-names = "default", "sleep";
136	phy-mode = "rgmii-id";
137	max-speed = <1000>;
138	phy-handle = <&phy0>;
139
140	mdio {
141		#address-cells = <1>;
142		#size-cells = <0>;
143		compatible = "snps,dwmac-mdio";
144		phy0: ethernet-phy@0 {
145			reg = <0>;
146		};
147	};
148};
149
150&fmc {
151	pinctrl-names = "default", "sleep";
152	pinctrl-0 = <&fmc_pins_a>;
153	pinctrl-1 = <&fmc_sleep_pins_a>;
154	status = "okay";
155
156	nand-controller@4,0 {
157		status = "okay";
158
159		nand@0 {
160			reg = <0>;
161			nand-on-flash-bbt;
162			#address-cells = <1>;
163			#size-cells = <1>;
164		};
165	};
166};
167
168&i2c2 {
169	pinctrl-names = "default", "sleep";
170	pinctrl-0 = <&i2c2_pins_a>;
171	pinctrl-1 = <&i2c2_sleep_pins_a>;
172	i2c-scl-rising-time-ns = <185>;
173	i2c-scl-falling-time-ns = <20>;
174	status = "okay";
175
176	ov5640: camera@3c {
177		compatible = "ovti,ov5640";
178		reg = <0x3c>;
179		clocks = <&clk_ext_camera>;
180		clock-names = "xclk";
181		AVDD-supply = <&v2v8>;
182		DOVDD-supply = <&v2v8>;
183		DVDD-supply = <&v2v8>;
184		powerdown-gpios = <&stmfx_pinctrl 18 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL)>;
185		reset-gpios = <&stmfx_pinctrl 19 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
186		rotation = <180>;
187		status = "okay";
188
189		port {
190			ov5640_0: endpoint {
191				remote-endpoint = <&dcmi_0>;
192				bus-width = <8>;
193				data-shift = <2>; /* lines 9:2 are used */
194				hsync-active = <0>;
195				vsync-active = <0>;
196				pclk-sample = <1>;
197			};
198		};
199	};
200
201	stmfx: stmfx@42 {
202		compatible = "st,stmfx-0300";
203		reg = <0x42>;
204		interrupts = <8 IRQ_TYPE_EDGE_RISING>;
205		interrupt-parent = <&gpioi>;
206		vdd-supply = <&v3v3>;
207
208		stmfx_pinctrl: pinctrl {
209			compatible = "st,stmfx-0300-pinctrl";
210			gpio-controller;
211			#gpio-cells = <2>;
212			interrupt-controller;
213			#interrupt-cells = <2>;
214			gpio-ranges = <&stmfx_pinctrl 0 0 24>;
215
216			joystick_pins: joystick-pins {
217				pins = "gpio0", "gpio1", "gpio2", "gpio3", "gpio4";
218				bias-pull-down;
219			};
220		};
221	};
222};
223
224&i2c5 {
225	pinctrl-names = "default", "sleep";
226	pinctrl-0 = <&i2c5_pins_a>;
227	pinctrl-1 = <&i2c5_sleep_pins_a>;
228	i2c-scl-rising-time-ns = <185>;
229	i2c-scl-falling-time-ns = <20>;
230	status = "okay";
231};
232
233&ltdc {
234	status = "okay";
235
236	port {
237		ltdc_ep0_out: endpoint {
238			remote-endpoint = <&dsi_in>;
239		};
240	};
241};
242
243&m_can1 {
244	pinctrl-names = "default", "sleep";
245	pinctrl-0 = <&m_can1_pins_a>;
246	pinctrl-1 = <&m_can1_sleep_pins_a>;
247	status = "okay";
248};
249
250&qspi {
251	pinctrl-names = "default", "sleep";
252	pinctrl-0 = <&qspi_clk_pins_a
253		     &qspi_bk1_pins_a
254		     &qspi_cs1_pins_a
255		     &qspi_bk2_pins_a
256		     &qspi_cs2_pins_a>;
257	pinctrl-1 = <&qspi_clk_sleep_pins_a
258		     &qspi_bk1_sleep_pins_a
259		     &qspi_cs1_sleep_pins_a
260		     &qspi_bk2_sleep_pins_a
261		     &qspi_cs2_sleep_pins_a>;
262	reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
263	#address-cells = <1>;
264	#size-cells = <0>;
265	status = "okay";
266
267	flash0: flash@0 {
268		compatible = "jedec,spi-nor";
269		reg = <0>;
270		spi-rx-bus-width = <4>;
271		spi-max-frequency = <108000000>;
272		#address-cells = <1>;
273		#size-cells = <1>;
274	};
275
276	flash1: flash@1 {
277		compatible = "jedec,spi-nor";
278		reg = <1>;
279		spi-rx-bus-width = <4>;
280		spi-max-frequency = <108000000>;
281		#address-cells = <1>;
282		#size-cells = <1>;
283	};
284};
285
286&sdmmc3 {
287	pinctrl-names = "default", "opendrain", "sleep";
288	pinctrl-0 = <&sdmmc3_b4_pins_a>;
289	pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
290	pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
291	broken-cd;
292	st,neg-edge;
293	bus-width = <4>;
294	vmmc-supply = <&v3v3>;
295	status = "disabled";
296};
297
298&spi1 {
299	pinctrl-names = "default";
300	pinctrl-0 = <&spi1_pins_a>;
301	status = "disabled";
302};
303
304&timers2 {
305	/* spare dmas for other usage (un-delete to enable pwm capture) */
306	/delete-property/dmas;
307	/delete-property/dma-names;
308	status = "disabled";
309	pwm {
310		pinctrl-0 = <&pwm2_pins_a>;
311		pinctrl-1 = <&pwm2_sleep_pins_a>;
312		pinctrl-names = "default", "sleep";
313		status = "okay";
314	};
315	timer@1 {
316		status = "okay";
317	};
318};
319
320&timers8 {
321	/delete-property/dmas;
322	/delete-property/dma-names;
323	status = "disabled";
324	pwm {
325		pinctrl-0 = <&pwm8_pins_a>;
326		pinctrl-1 = <&pwm8_sleep_pins_a>;
327		pinctrl-names = "default", "sleep";
328		status = "okay";
329	};
330	timer@7 {
331		status = "okay";
332	};
333};
334
335&timers12 {
336	/delete-property/dmas;
337	/delete-property/dma-names;
338	status = "disabled";
339	pwm {
340		pinctrl-0 = <&pwm12_pins_a>;
341		pinctrl-1 = <&pwm12_sleep_pins_a>;
342		pinctrl-names = "default", "sleep";
343		status = "okay";
344	};
345	timer@11 {
346		status = "okay";
347	};
348};
349
350&usart3 {
351	pinctrl-names = "default", "sleep", "idle";
352	pinctrl-0 = <&usart3_pins_b>;
353	pinctrl-1 = <&usart3_sleep_pins_b>;
354	pinctrl-2 = <&usart3_idle_pins_b>;
355	/*
356	 * HW flow control USART3_RTS is optional, and isn't default wired to
357	 * the connector. SB23 needs to be soldered in order to use it, and R77
358	 * (ETH_CLK) should be removed.
359	 */
360	uart-has-rtscts;
361	status = "disabled";
362};
363
364&usbh_ehci {
365	phys = <&usbphyc_port0>;
366	status = "okay";
367	#address-cells = <1>;
368	#size-cells = <0>;
369	/* onboard HUB */
370	hub@1 {
371		compatible = "usb424,2514";
372		reg = <1>;
373		vdd-supply = <&v3v3>;
374	};
375};
376
377&usbotg_hs {
378	pinctrl-0 = <&usbotg_hs_pins_a>;
379	pinctrl-names = "default";
380	phys = <&usbphyc_port1 0>;
381	phy-names = "usb2-phy";
382	status = "okay";
383};
384
385&usbphyc {
386	status = "okay";
387};
388
389&usbphyc_port0 {
390	st,tune-hs-dc-level = <2>;
391	st,enable-fs-rftime-tuning;
392	st,enable-hs-rftime-reduction;
393	st,trim-hs-current = <15>;
394	st,trim-hs-impedance = <1>;
395	st,tune-squelch-level = <3>;
396	st,tune-hs-rx-offset = <2>;
397	st,no-lsfs-sc;
398
399	connector {
400		compatible = "usb-a-connector";
401		vbus-supply = <&vbus_sw>;
402	};
403};
404
405&usbphyc_port1 {
406	st,tune-hs-dc-level = <2>;
407	st,enable-fs-rftime-tuning;
408	st,enable-hs-rftime-reduction;
409	st,trim-hs-current = <15>;
410	st,trim-hs-impedance = <1>;
411	st,tune-squelch-level = <3>;
412	st,tune-hs-rx-offset = <2>;
413	st,no-lsfs-sc;
414};
415