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