1// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-3-Clause)
2/*
3 * Copyright (C) 2020 STMicroelectronics - All Rights Reserved
4 * Copyright (C) 2021 Rouven Czerwinski, Pengutronix
5 * Copyright (C) 2023 Leonard Göhrs, Pengutronix
6 */
7
8#include "stm32mp15xc.dtsi"
9#include "stm32mp15xx-osd32.dtsi"
10#include "stm32mp15xxac-pinctrl.dtsi"
11
12#include <dt-bindings/gpio/gpio.h>
13#include <dt-bindings/input/input.h>
14#include <dt-bindings/leds/common.h>
15#include <dt-bindings/pwm/pwm.h>
16
17/ {
18	aliases {
19		can0 = &m_can1;
20		can1 = &m_can2;
21		ethernet0 = &ethernet0;
22		ethernet1 = &port_uplink;
23		ethernet2 = &port_dut;
24		i2c0 = &i2c1;
25		i2c1 = &i2c4;
26		i2c2 = &i2c5;
27		mmc1 = &sdmmc2;
28		serial0 = &uart4;
29		serial1 = &usart3;
30		spi0 = &spi2;
31		spi1 = &spi4;
32		spi2 = &spi5;
33	};
34
35	chosen {
36		stdout-path = &uart4;
37	};
38
39	led-controller-0 {
40		compatible = "gpio-leds";
41
42		led-0 {
43			label = "tac:green:user1";
44			gpios = <&gpiof 10 GPIO_ACTIVE_HIGH>;
45			linux,default-trigger = "heartbeat";
46		};
47
48		led-1 {
49			label = "tac:green:user2";
50			gpios = <&gpiog 7 GPIO_ACTIVE_HIGH>;
51		};
52
53		led-2 {
54			label = "tac:green:statusdut";
55			gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
56		};
57
58		/* led-3 and led-4 are internally connected antiparallel to one
59		 * another inside the ethernet jack like this:
60		 * GPIOA14 ---+---|led-3|>--+--- GPIOD15
61		 *            +--<|led-4|---+
62		 * E.g. only one of the LEDs can be illuminated at a time while
63		 * the other output must be driven low.
64		 * This should likely be implemented using a multi color LED
65		 * driver for antiparallel LEDs.
66		 */
67		led-3 {
68			label = "tac:green:statuslab";
69			gpios = <&gpioa 14 GPIO_ACTIVE_HIGH>;
70		};
71
72		led-4 {
73			label = "tac:orange:statuslab";
74			gpios = <&gpiod 15 GPIO_ACTIVE_HIGH>;
75		};
76	};
77
78	gpio-keys {
79		compatible = "gpio-keys";
80
81		button-lower {
82			label = "USER_BTN2";
83			linux,code = <KEY_ESC>;
84			gpios = <&gpioe 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
85		};
86
87		button-upper {
88			label = "USER_BTN";
89			linux,code = <KEY_HOME>;
90			gpios = <&gpioi 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
91		};
92	};
93
94	/* supplied by either barrel connector or PoE */
95	reg_12v: regulator-12v {
96		compatible = "regulator-fixed";
97		regulator-name = "12V";
98		regulator-min-microvolt = <12000000>;
99		regulator-max-microvolt = <12000000>;
100		regulator-always-on;
101	};
102
103	reg_5v: regulator-5v {
104		compatible = "regulator-fixed";
105		regulator-name = "5V";
106		regulator-min-microvolt = <5000000>;
107		regulator-max-microvolt = <5000000>;
108		regulator-always-on;
109		vin-supply = <&reg_12v>;
110	};
111
112	reg_1v2: regulator-1v2 {
113		compatible = "regulator-fixed";
114		regulator-name = "1V2";
115		regulator-min-microvolt = <1200000>;
116		regulator-max-microvolt = <1200000>;
117		regulator-always-on;
118		vin-supply = <&reg_5v>;
119	};
120
121	reg_pb_5v: regulator-pb-5v {
122		compatible = "regulator-fixed";
123		regulator-name = "5V_POWERBOARD";
124		regulator-min-microvolt = <5000000>;
125		regulator-max-microvolt = <5000000>;
126		regulator-always-on;
127		vin-supply = <&reg_5v>;
128	};
129
130	reg_pb_3v3: regulator-pb-3v3 {
131		compatible = "regulator-fixed";
132		regulator-name = "3V3_POWERBOARD";
133		regulator-min-microvolt = <3300000>;
134		regulator-max-microvolt = <3300000>;
135		regulator-always-on;
136		vin-supply = <&reg_pb_5v>;
137	};
138
139	output-iobus-12v {
140		compatible = "regulator-output";
141		vout-supply = <&reg_iobus_12v>;
142	};
143
144	output-vuart {
145		compatible = "regulator-output";
146		vout-supply = <&v3v3_hdmi>;
147	};
148};
149
150baseboard_eeprom: &sip_eeprom {
151};
152
153&crc1 {
154	status = "okay";
155};
156
157&cryp1 {
158	status = "okay";
159};
160
161&dts {
162	status = "okay";
163};
164
165&ethernet0 {
166	assigned-clocks = <&rcc ETHCK_K>, <&rcc PLL4_P>;
167	assigned-clock-parents = <&rcc PLL4_P>;
168	assigned-clock-rates = <125000000>; /* Clock PLL4 to 750Mhz in ATF */
169
170	pinctrl-names = "default", "sleep";
171	pinctrl-0 = <&ethernet0_rgmii_pins_e>;
172	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_e>;
173
174	st,eth-clk-sel;
175	phy-mode = "rgmii-id";
176
177	status = "okay";
178
179	fixed-link {
180		speed = <1000>;
181		full-duplex;
182	};
183};
184
185&ethernet0_rgmii_pins_e {
186	pins1 {
187		/* Reduce EMI emission by reducing RGMII drive strength */
188		slew-rate = <1>;
189	};
190};
191
192&gpiob {
193	gpio-line-names = "", "", "", "", "", /*  0 */
194	"", "USB_RESET", "", "", "",          /*  5 */
195	"", "", "", "", "",                   /* 10 */
196	"";                                   /* 15 */
197};
198
199&gpiod {
200	gpio-line-names = "", "", "", "", "TP38", /*  0 */
201	"TP39", "", "", "TP41", "TP42",           /*  5 */
202	"OLED_DC", "", "", "ETH_CS", "",          /* 10 */
203	"ETH_LAB_LEDRN";                          /* 15 */
204};
205
206&gpiof {
207	gpio-line-names = "TP36", "TP37", "", "", "OLED_CS", /*  0 */
208	"", "", "", "", "",                                  /*  5 */
209	"USER_LED1", "", "STACK_CS0", "", "",                /* 10 */
210	"";                                                  /* 15 */
211};
212
213&gpioh {
214	gpio-line-names = "", "", "OUT_1", "OUT_0", "OLED_RESET", /*  0 */
215	"", "", "", "", "",                                       /*  5 */
216	"ETH1_PPS_B", "ETH_GPIO2", "", "IOBUS_PWR_EN", "",        /* 10 */
217	"TP33";                                                   /* 15 */
218};
219
220&gpioi {
221	gpio-line-names = "TIM_RTS", "", "", "", "DEVICE_DATA_EN", /*  0 */
222	"", "", "", "ETH_WOL", "TP43",                             /*  5 */
223	"", "USER_BTN";                                            /* 10 */
224};
225
226&gpioz {
227	gpio-line-names = "HWID0", "HWID1", "HWID2", "HWID3", "", /*  0 */
228	"", "HWID4", "HWID5";                                     /*  5 */
229};
230
231&hash1 {
232	status = "okay";
233};
234
235&i2c1 {
236	pinctrl-names = "default", "sleep";
237	pinctrl-0 = <&i2c1_pins_b>;
238	pinctrl-1 = <&i2c1_sleep_pins_b>;
239	status = "okay";
240
241	powerboard_eeprom: eeprom@50 {
242		compatible = "atmel,24c02";
243		reg = <0x50>;
244		vcc-supply = <&v3v3>;
245	};
246
247	temperature-sensor@48 {
248		compatible = "national,lm75a";
249		reg = <0x48>;
250		status = "disabled";
251	};
252};
253
254&i2c5 {
255	/delete-property/dmas;
256	/delete-property/dma-names;
257
258	pinctrl-names = "default", "sleep";
259	pinctrl-0 = <&i2c5_pins_b>;
260	pinctrl-1 = <&i2c5_sleep_pins_b>;
261
262	status = "okay";
263
264	usbhub: usbhub@2c {
265		compatible ="microchip,usb2514b";
266		reg = <0x2c>;
267		vdd-supply = <&v3v3>;
268		reset-gpios = <&gpiob 6 GPIO_ACTIVE_LOW>;
269	};
270};
271
272&iwdg2 {
273	timeout-sec = <8>;
274	status = "okay";
275};
276
277&m_can1 {
278	pinctrl-names = "default", "sleep";
279	pinctrl-0 = <&m_can1_pins_b>;
280	pinctrl-1 = <&m_can1_sleep_pins_b>;
281	status = "okay";
282};
283
284&m_can2 {
285	pinctrl-names = "default", "sleep";
286	pinctrl-0 = <&m_can2_pins_a>;
287	pinctrl-1 = <&m_can2_sleep_pins_a>;
288	status = "okay";
289};
290
291&pmic {
292	regulators {
293		buck1-supply = <&reg_5v>;	/* VIN */
294		buck2-supply = <&reg_5v>;	/* VIN */
295		buck3-supply = <&reg_5v>;	/* VIN */
296		buck4-supply = <&reg_5v>;	/* VIN */
297		ldo2-supply = <&reg_5v>;	/* PMIC_LDO25IN */
298		ldo4-supply = <&reg_5v>;	/* VIN */
299		ldo5-supply = <&reg_5v>;	/* PMIC_LDO25IN */
300		vref_ddr-supply = <&reg_5v>;	/* VIN */
301		boost-supply = <&reg_5v>;	/* PMIC_BSTIN */
302		pwr_sw2-supply = <&bst_out>;	/* PMIC_SWIN */
303	};
304};
305
306&sdmmc2 {
307	pinctrl-names = "default", "opendrain", "sleep";
308	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_b>;
309	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_b>;
310	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_b>;
311	vmmc-supply = <&v3v3>;
312
313	bus-width = <8>;
314	mmc-ddr-3_3v;
315	no-1-8-v;
316	non-removable;
317	no-sd;
318	no-sdio;
319	st,neg-edge;
320
321	status = "okay";
322};
323
324&spi2 {
325	pinctrl-names = "default";
326	pinctrl-0 = <&spi2_pins_c>;
327	cs-gpios = <&gpiof 12 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
328	status = "okay";
329};
330
331&spi4 {
332	pinctrl-names = "default";
333	pinctrl-0 = <&spi4_pins_a>;
334	cs-gpios = <&gpiof 4 GPIO_ACTIVE_LOW>;
335	status = "okay";
336
337	lcd: display@0 {
338		compatible = "shineworld,lh133k", "panel-mipi-dbi-spi";
339		reg = <0>;
340		power-supply = <&v3v3>;
341		io-supply = <&v3v3>;
342		backlight = <&backlight>;
343		dc-gpios = <&gpiod 10 GPIO_ACTIVE_HIGH>;
344		reset-gpios = <&gpioh 4 GPIO_ACTIVE_HIGH>;
345		spi-3wire;
346		spi-max-frequency = <32000000>;
347
348		width-mm = <23>;
349		height-mm = <23>;
350		rotation = <180>;
351
352		panel-timing {
353			hactive = <240>;
354			vactive = <240>;
355			hback-porch = <0>;
356			vback-porch = <0>;
357
358			clock-frequency = <0>;
359			hfront-porch = <0>;
360			hsync-len = <0>;
361			vfront-porch = <0>;
362			vsync-len = <0>;
363		};
364	};
365};
366
367&spi5 {
368	pinctrl-names = "default";
369	pinctrl-0 = <&spi5_pins_a>;
370
371	/* spare dmas for other usage */
372	/delete-property/dmas;
373	/delete-property/dma-names;
374
375	cs-gpios = <&gpiod 13 GPIO_ACTIVE_LOW>;
376
377	status = "okay";
378
379	switch: switch@0 {
380		compatible = "microchip,ksz9563";
381		reg = <0>;
382
383		reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>;
384		spi-max-frequency = <44000000>;
385
386		interrupt-parent = <&gpioa>;
387		interrupts = <6 IRQ_TYPE_EDGE_RISING>;
388
389		/* Reduce RGMII EMI emissions by reducing drive strength */
390		microchip,hi-drive-strength-microamp = <2000>;
391		microchip,lo-drive-strength-microamp = <8000>;
392
393		ports {
394			#address-cells = <1>;
395			#size-cells = <0>;
396			port_dut: port@0 {
397				reg = <0>;
398				label = "dut";
399			};
400
401			port_uplink: port@1 {
402				reg = <1>;
403				label = "uplink";
404			};
405
406			port_cpu: port@2 {
407				reg = <2>;
408				label = "cpu";
409
410				ethernet = <&ethernet0>;
411
412				phy-mode = "rgmii-id";
413				rx-internal-delay-ps = <2000>;
414				tx-internal-delay-ps = <2000>;
415
416				fixed-link {
417					speed = <1000>;
418					full-duplex;
419				};
420			};
421		};
422	};
423};
424
425&timers2 {
426	/* spare dmas for other usage */
427	/delete-property/dmas;
428	/delete-property/dma-names;
429
430	status = "okay";
431
432	timer@1 {
433		status = "okay";
434	};
435};
436
437&timers3 {
438	/* spare dmas for other usage */
439	/delete-property/dmas;
440	/delete-property/dma-names;
441
442	status = "okay";
443
444	timer@2 {
445		status = "okay";
446	};
447};
448
449&timers4 {
450	/* spare dmas for other usage */
451	/delete-property/dmas;
452	/delete-property/dma-names;
453
454	status = "okay";
455
456	timer@3 {
457		status = "okay";
458	};
459};
460
461&uart4 {
462	label = "debug";
463
464	pinctrl-names = "default";
465	pinctrl-0 = <&uart4_pins_a>;
466
467	/* spare dmas for other usage */
468	/delete-property/dmas;
469	/delete-property/dma-names;
470
471	status = "okay";
472};
473
474&usart3 {
475	label = "dut";
476	uart-has-rtscts;
477
478	pinctrl-names = "default";
479	pinctrl-0 = <&usart3_pins_f>;
480
481	/* spare dmas for other usage */
482	/delete-property/dmas;
483	/delete-property/dma-names;
484
485	status = "okay";
486};
487
488&usbh_ehci {
489	status = "okay";
490};
491
492&usbotg_hs {
493	phys = <&usbphyc_port1 0>;
494	phy-names = "usb2-phy";
495
496	vusb_d-supply = <&vdd_usb>;
497	vusb_a-supply = <&reg18>;
498
499	g-rx-fifo-size = <512>;
500	g-np-tx-fifo-size = <32>;
501	g-tx-fifo-size = <128 128 64 16 16 16 16 16>;
502
503	dr_mode = "peripheral";
504
505	status = "okay";
506};
507
508&usbphyc {
509	status = "okay";
510};
511
512&vrefbuf {
513	regulator-min-microvolt = <2500000>;
514	regulator-max-microvolt = <2500000>;
515	vdda-supply = <&vdda>;
516
517	status = "okay";
518};
519