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	phy-dsi-supply = <&reg18>;
104	#address-cells = <1>;
105	#size-cells = <0>;
106	status = "okay";
107
108	ports {
109		#address-cells = <1>;
110		#size-cells = <0>;
111
112		port@0 {
113			reg = <0>;
114			dsi_in: endpoint {
115				remote-endpoint = <&ltdc_ep0_out>;
116			};
117		};
118
119		port@1 {
120			reg = <1>;
121			dsi_out: endpoint {
122				remote-endpoint = <&dsi_panel_in>;
123			};
124		};
125	};
126
127	panel@0 {
128		compatible = "raydium,rm68200";
129		reg = <0>;
130		reset-gpios = <&gpiof 15 GPIO_ACTIVE_LOW>;
131		backlight = <&panel_backlight>;
132		power-supply = <&v3v3>;
133		status = "okay";
134
135		port {
136			dsi_panel_in: endpoint {
137				remote-endpoint = <&dsi_out>;
138			};
139		};
140	};
141};
142
143&ethernet0 {
144	status = "okay";
145	pinctrl-0 = <&ethernet0_rgmii_pins_a>;
146	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_a>;
147	pinctrl-names = "default", "sleep";
148	phy-mode = "rgmii-id";
149	max-speed = <1000>;
150	phy-handle = <&phy0>;
151
152	mdio {
153		#address-cells = <1>;
154		#size-cells = <0>;
155		compatible = "snps,dwmac-mdio";
156		phy0: ethernet-phy@0 {
157			reg = <0>;
158		};
159	};
160};
161
162&fmc {
163	pinctrl-names = "default", "sleep";
164	pinctrl-0 = <&fmc_pins_a>;
165	pinctrl-1 = <&fmc_sleep_pins_a>;
166	status = "okay";
167
168	nand-controller@4,0 {
169		status = "okay";
170
171		nand@0 {
172			reg = <0>;
173			nand-on-flash-bbt;
174			#address-cells = <1>;
175			#size-cells = <1>;
176		};
177	};
178};
179
180&i2c2 {
181	pinctrl-names = "default", "sleep";
182	pinctrl-0 = <&i2c2_pins_a>;
183	pinctrl-1 = <&i2c2_sleep_pins_a>;
184	i2c-scl-rising-time-ns = <185>;
185	i2c-scl-falling-time-ns = <20>;
186	status = "okay";
187
188	ov5640: camera@3c {
189		compatible = "ovti,ov5640";
190		reg = <0x3c>;
191		clocks = <&clk_ext_camera>;
192		clock-names = "xclk";
193		AVDD-supply = <&v2v8>;
194		DOVDD-supply = <&v2v8>;
195		DVDD-supply = <&v2v8>;
196		powerdown-gpios = <&stmfx_pinctrl 18 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL)>;
197		reset-gpios = <&stmfx_pinctrl 19 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
198		rotation = <180>;
199		status = "okay";
200
201		port {
202			ov5640_0: endpoint {
203				remote-endpoint = <&dcmi_0>;
204				bus-width = <8>;
205				data-shift = <2>; /* lines 9:2 are used */
206				hsync-active = <0>;
207				vsync-active = <0>;
208				pclk-sample = <1>;
209			};
210		};
211	};
212
213	stmfx: stmfx@42 {
214		compatible = "st,stmfx-0300";
215		reg = <0x42>;
216		interrupts = <8 IRQ_TYPE_EDGE_RISING>;
217		interrupt-parent = <&gpioi>;
218		vdd-supply = <&v3v3>;
219
220		stmfx_pinctrl: pinctrl {
221			compatible = "st,stmfx-0300-pinctrl";
222			gpio-controller;
223			#gpio-cells = <2>;
224			interrupt-controller;
225			#interrupt-cells = <2>;
226			gpio-ranges = <&stmfx_pinctrl 0 0 24>;
227
228			joystick_pins: joystick-pins {
229				pins = "gpio0", "gpio1", "gpio2", "gpio3", "gpio4";
230				bias-pull-down;
231			};
232		};
233	};
234};
235
236&i2c5 {
237	pinctrl-names = "default", "sleep";
238	pinctrl-0 = <&i2c5_pins_a>;
239	pinctrl-1 = <&i2c5_sleep_pins_a>;
240	i2c-scl-rising-time-ns = <185>;
241	i2c-scl-falling-time-ns = <20>;
242	status = "okay";
243};
244
245&ltdc {
246	status = "okay";
247
248	port {
249		ltdc_ep0_out: endpoint {
250			remote-endpoint = <&dsi_in>;
251		};
252	};
253};
254
255&m_can1 {
256	pinctrl-names = "default", "sleep";
257	pinctrl-0 = <&m_can1_pins_a>;
258	pinctrl-1 = <&m_can1_sleep_pins_a>;
259	status = "okay";
260};
261
262&qspi {
263	pinctrl-names = "default", "sleep";
264	pinctrl-0 = <&qspi_clk_pins_a
265		     &qspi_bk1_pins_a
266		     &qspi_cs1_pins_a
267		     &qspi_bk2_pins_a
268		     &qspi_cs2_pins_a>;
269	pinctrl-1 = <&qspi_clk_sleep_pins_a
270		     &qspi_bk1_sleep_pins_a
271		     &qspi_cs1_sleep_pins_a
272		     &qspi_bk2_sleep_pins_a
273		     &qspi_cs2_sleep_pins_a>;
274	reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
275	#address-cells = <1>;
276	#size-cells = <0>;
277	status = "okay";
278
279	flash0: flash@0 {
280		compatible = "jedec,spi-nor";
281		reg = <0>;
282		spi-rx-bus-width = <4>;
283		spi-max-frequency = <108000000>;
284		#address-cells = <1>;
285		#size-cells = <1>;
286	};
287
288	flash1: flash@1 {
289		compatible = "jedec,spi-nor";
290		reg = <1>;
291		spi-rx-bus-width = <4>;
292		spi-max-frequency = <108000000>;
293		#address-cells = <1>;
294		#size-cells = <1>;
295	};
296};
297
298&sdmmc3 {
299	pinctrl-names = "default", "opendrain", "sleep";
300	pinctrl-0 = <&sdmmc3_b4_pins_a>;
301	pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
302	pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
303	broken-cd;
304	st,neg-edge;
305	bus-width = <4>;
306	vmmc-supply = <&v3v3>;
307	status = "disabled";
308};
309
310&spi1 {
311	pinctrl-names = "default";
312	pinctrl-0 = <&spi1_pins_a>;
313	status = "disabled";
314};
315
316&timers2 {
317	/* spare dmas for other usage (un-delete to enable pwm capture) */
318	/delete-property/dmas;
319	/delete-property/dma-names;
320	status = "disabled";
321	pwm {
322		pinctrl-0 = <&pwm2_pins_a>;
323		pinctrl-1 = <&pwm2_sleep_pins_a>;
324		pinctrl-names = "default", "sleep";
325		status = "okay";
326	};
327	timer@1 {
328		status = "okay";
329	};
330};
331
332&timers8 {
333	/delete-property/dmas;
334	/delete-property/dma-names;
335	status = "disabled";
336	pwm {
337		pinctrl-0 = <&pwm8_pins_a>;
338		pinctrl-1 = <&pwm8_sleep_pins_a>;
339		pinctrl-names = "default", "sleep";
340		status = "okay";
341	};
342	timer@7 {
343		status = "okay";
344	};
345};
346
347&timers12 {
348	/delete-property/dmas;
349	/delete-property/dma-names;
350	status = "disabled";
351	pwm {
352		pinctrl-0 = <&pwm12_pins_a>;
353		pinctrl-1 = <&pwm12_sleep_pins_a>;
354		pinctrl-names = "default", "sleep";
355		status = "okay";
356	};
357	timer@11 {
358		status = "okay";
359	};
360};
361
362&usart3 {
363	pinctrl-names = "default", "sleep", "idle";
364	pinctrl-0 = <&usart3_pins_b>;
365	pinctrl-1 = <&usart3_sleep_pins_b>;
366	pinctrl-2 = <&usart3_idle_pins_b>;
367	/*
368	 * HW flow control USART3_RTS is optional, and isn't default wired to
369	 * the connector. SB23 needs to be soldered in order to use it, and R77
370	 * (ETH_CLK) should be removed.
371	 */
372	uart-has-rtscts;
373	status = "disabled";
374};
375
376&usbh_ehci {
377	phys = <&usbphyc_port0>;
378	status = "okay";
379	#address-cells = <1>;
380	#size-cells = <0>;
381	/* onboard HUB */
382	hub@1 {
383		compatible = "usb424,2514";
384		reg = <1>;
385		vdd-supply = <&v3v3>;
386	};
387};
388
389&usbotg_hs {
390	pinctrl-0 = <&usbotg_hs_pins_a>;
391	pinctrl-names = "default";
392	phys = <&usbphyc_port1 0>;
393	phy-names = "usb2-phy";
394	status = "okay";
395};
396
397&usbphyc {
398	status = "okay";
399};
400
401&usbphyc_port0 {
402	st,tune-hs-dc-level = <2>;
403	st,enable-fs-rftime-tuning;
404	st,enable-hs-rftime-reduction;
405	st,trim-hs-current = <15>;
406	st,trim-hs-impedance = <1>;
407	st,tune-squelch-level = <3>;
408	st,tune-hs-rx-offset = <2>;
409	st,no-lsfs-sc;
410
411	connector {
412		compatible = "usb-a-connector";
413		vbus-supply = <&vbus_sw>;
414	};
415};
416
417&usbphyc_port1 {
418	st,tune-hs-dc-level = <2>;
419	st,enable-fs-rftime-tuning;
420	st,enable-hs-rftime-reduction;
421	st,trim-hs-current = <15>;
422	st,trim-hs-impedance = <1>;
423	st,tune-squelch-level = <3>;
424	st,tune-hs-rx-offset = <2>;
425	st,no-lsfs-sc;
426};
427