1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2/*
3 * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
4 * Author: Ludovic Barre <[email protected]> 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	counter {
310		status = "okay";
311	};
312	pwm {
313		pinctrl-0 = <&pwm2_pins_a>;
314		pinctrl-1 = <&pwm2_sleep_pins_a>;
315		pinctrl-names = "default", "sleep";
316		status = "okay";
317	};
318	timer@1 {
319		status = "okay";
320	};
321};
322
323&timers8 {
324	/delete-property/dmas;
325	/delete-property/dma-names;
326	status = "disabled";
327	counter {
328		status = "okay";
329	};
330	pwm {
331		pinctrl-0 = <&pwm8_pins_a>;
332		pinctrl-1 = <&pwm8_sleep_pins_a>;
333		pinctrl-names = "default", "sleep";
334		status = "okay";
335	};
336	timer@7 {
337		status = "okay";
338	};
339};
340
341&timers12 {
342	/delete-property/dmas;
343	/delete-property/dma-names;
344	status = "disabled";
345	counter {
346		status = "okay";
347	};
348	pwm {
349		pinctrl-0 = <&pwm12_pins_a>;
350		pinctrl-1 = <&pwm12_sleep_pins_a>;
351		pinctrl-names = "default", "sleep";
352		status = "okay";
353	};
354	timer@11 {
355		status = "okay";
356	};
357};
358
359&usart3 {
360	pinctrl-names = "default", "sleep", "idle";
361	pinctrl-0 = <&usart3_pins_b>;
362	pinctrl-1 = <&usart3_sleep_pins_b>;
363	pinctrl-2 = <&usart3_idle_pins_b>;
364	/*
365	 * HW flow control USART3_RTS is optional, and isn't default wired to
366	 * the connector. SB23 needs to be soldered in order to use it, and R77
367	 * (ETH_CLK) should be removed.
368	 */
369	uart-has-rtscts;
370	status = "disabled";
371};
372
373&usbh_ehci {
374	status = "okay";
375	#address-cells = <1>;
376	#size-cells = <0>;
377	/* onboard HUB */
378	hub@1 {
379		compatible = "usb424,2514";
380		reg = <1>;
381		vdd-supply = <&v3v3>;
382	};
383};
384
385&usbotg_hs {
386	pinctrl-0 = <&usbotg_hs_pins_a>;
387	pinctrl-names = "default";
388	phys = <&usbphyc_port1 0>;
389	phy-names = "usb2-phy";
390	status = "okay";
391};
392
393&usbphyc {
394	status = "okay";
395};
396
397&usbphyc_port0 {
398	st,tune-hs-dc-level = <2>;
399	st,enable-fs-rftime-tuning;
400	st,enable-hs-rftime-reduction;
401	st,trim-hs-current = <15>;
402	st,trim-hs-impedance = <1>;
403	st,tune-squelch-level = <3>;
404	st,tune-hs-rx-offset = <2>;
405	st,no-lsfs-sc;
406
407	connector {
408		compatible = "usb-a-connector";
409		vbus-supply = <&vbus_sw>;
410	};
411};
412
413&usbphyc_port1 {
414	st,tune-hs-dc-level = <2>;
415	st,enable-fs-rftime-tuning;
416	st,enable-hs-rftime-reduction;
417	st,trim-hs-current = <15>;
418	st,trim-hs-impedance = <1>;
419	st,tune-squelch-level = <3>;
420	st,tune-hs-rx-offset = <2>;
421	st,no-lsfs-sc;
422};
423