1/*
2 * Copyright 2022-2023, NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8
9#include <nxp/nxp_rt5xx.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12#include "mimxrt595_evk_mimxrt595s_cm33-pinctrl.dtsi"
13
14
15/ {
16	model = "NXP MIMXRT595-EVK board";
17	compatible = "nxp,mimxrt595";
18
19	aliases {
20		sw0 = &user_button_1;
21		sw1 = &user_button_2;
22		led0 = &green_led;
23		led1 = &blue_led;
24		led2 = &red_led;
25		usart-0 = &flexcomm0;
26		watchdog0 = &wwdt0;
27		magn0 = &fxos8700;
28		accel0 = &fxos8700;
29		sdhc0 = &usdhc0;
30		pwm-0 = &sc_timer;
31		dmic-dev = &dmic0;
32		mcuboot-button0 = &user_button_1;
33	};
34
35	chosen {
36		zephyr,flash-controller = &mx25um51345g;
37		zephyr,flash = &mx25um51345g;
38		zephyr,code-partition = &slot0_partition;
39		zephyr,uart-mcumgr = &flexcomm0;
40		zephyr,sram = &sram0;
41		zephyr,console = &flexcomm0;
42		zephyr,shell-uart = &flexcomm0;
43		zephyr,display = &lcdif;
44	};
45
46	gpio_keys {
47		compatible = "gpio-keys";
48		user_button_1: button_0 {
49			label = "User SW1";
50			gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
51			zephyr,code = <INPUT_KEY_0>;
52		};
53		user_button_2: button_1 {
54			label = "User SW2";
55			gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
56			zephyr,code = <INPUT_KEY_1>;
57		};
58	};
59
60	leds {
61		compatible = "gpio-leds";
62		green_led: led_1 {
63			gpios = <&gpio1 0 0>;
64			label = "User LED_GREEN";
65		};
66		blue_led: led_2 {
67			gpios = <&gpio3 17 0>;
68			label = "User LED_BLUE";
69		};
70		red_led: led_3 {
71			gpios = <&gpio0 14 0>;
72			label = "User LED_RED";
73		};
74	};
75
76	arduino_header: arduino-connector {
77		compatible = "arduino-header-r3";
78		#gpio-cells = <2>;
79		gpio-map-mask = <0xffffffff 0xffffffc0>;
80		gpio-map-pass-thru = <0 0x3f>;
81		gpio-map =	<0 0 &gpio0 5 0>,	/* A0 */
82				<1 0 &gpio0 6 0>,	/* A1 */
83				<2 0 &gpio0 19 0>,	/* A2 */
84				<3 0 &gpio0 13 0>,	/* A3 */
85				<4 0 &gpio4 22 0>,	/* A4 */
86				<5 0 &gpio4 21 0>,	/* A5 */
87				<6 0 &gpio4 31 0>,	/* D0 */
88				<7 0 &gpio4 30 0>,	/* D1 */
89				<8 0 &gpio4 20 0>,	/* D2 */
90				<9 0 &gpio4 23 0>,	/* D3 */
91				<10 0 &gpio4 24 0>,	/* D4 */
92				<11 0 &gpio4 25 0>,	/* D5 */
93				<12 0 &gpio4 26 0>,	/* D6 */
94				<13 0 &gpio4 27 0>,	/* D7 */
95				<14 0 &gpio4 28 0>,	/* D8 */
96				<15 0 &gpio4 29 0>,	/* D9 */
97				<16 0 &gpio5 0 0>,	/* D10 */
98				<17 0 &gpio5 1 0>,	/* D11 */
99				<18 0 &gpio5 2 0>,	/* D12 */
100				<19 0 &gpio5 3 0>,	/* D13 */
101				<20 0 &gpio4 22 0>,	/* D14 */
102				<21 0 &gpio4 21 0>;	/* D15 */
103	};
104
105	/*
106	 * This node describes the GPIO pins of the MIPI FPC interface,
107	 * J44 on the EVK. This interface is standard to several
108	 * NXP EVKs, and is used with several MIPI displays
109	 * (available as zephyr shields)
110	 */
111	nxp_mipi_connector: mipi-connector {
112		compatible = "gpio-nexus";
113		#gpio-cells = <2>;
114		gpio-map-mask = <0xffffffff 0xffffffc0>;
115		gpio-map-pass-thru = <0 0x3f>;
116		gpio-map =	<0  0 &gpio0 12 0>,	/* Pin 1, LEDK */
117				<21 0 &gpio3 21 0>,	/* Pin 21, RESET */
118				<22 0 &gpio3 18 0>,	/* Pin 22, LPTE */
119				<26 0 &gpio0 30 0>,	/* Pin 26, CTP_I2C SDA */
120				<27 0 &gpio0 29 0>,	/* Pin 27, CTP_I2C SCL */
121				<28 0 &gpio4 4 0>,	/* Pin 28, CTP_RST */
122				<29 0 &gpio3 19 0>,	/* Pin 29, CTP_INT */
123				<32 0 &gpio3 15 0>,	/* Pin 32, PWR_EN */
124				<34 0 &gpio0 12 0>;	/* Pin 34, BL_PWM */
125	};
126
127	en_mipi_display: enable-mipi-display {
128		compatible = "regulator-fixed";
129		regulator-name = "en_mipi_display";
130		enable-gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
131		regulator-boot-on;
132	};
133};
134
135/*
136 * RT595 EVK board uses OS timer as the kernel timer
137 * In case we need to switch to SYSTICK timer, then
138 * replace &os_timer with &systick
139 */
140&os_timer {
141	status = "okay";
142	wakeup-source;
143};
144
145&rtc {
146	status = "okay";
147};
148
149&flexcomm0 {
150	compatible = "nxp,lpc-usart";
151	status = "okay";
152	current-speed = <115200>;
153	pinctrl-0 = <&pinmux_flexcomm0_usart>;
154	pinctrl-names = "default";
155	dmas = <&dma0 0>, <&dma0 1>;
156	dma-names = "rx", "tx";
157};
158
159arduino_i2c: &flexcomm4 {
160	compatible = "nxp,lpc-i2c";
161	status = "okay";
162	clock-frequency = <I2C_BITRATE_FAST>;
163	#address-cells = <1>;
164	#size-cells = <0>;
165	pinctrl-0 = <&pinmux_flexcomm4_i2c>;
166	pinctrl-names = "default";
167
168	fxos8700: fxos8700@1e {
169		compatible = "nxp,fxos8700";
170		reg = <0x1e>;
171		int1-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
172		reset-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
173	};
174};
175
176nxp_mipi_i2c: &arduino_i2c {};
177
178zephyr_mipi_dsi: &mipi_dsi {};
179
180zephyr_lcdif: &lcdif {};
181
182
183hs_spi1: &hs_lspi1 {
184	compatible = "nxp,lpc-spi";
185	pinctrl-0 = <&pinmux_flexcomm16_spi>;
186	pinctrl-names = "default";
187	dmas = <&dma0 28>, <&dma0 29>;
188	dma-names = "rx", "tx";
189	status = "okay";
190};
191
192/* I2S RX */
193i2s0: &flexcomm1 {
194	compatible = "nxp,lpc-i2s";
195	pinctrl-0 = <&pinmux_flexcomm1_i2s>;
196	pinctrl-names = "default";
197	#address-cells = <1>;
198	#size-cells = <0>;
199	dmas = <&dma0 2>;
200	dma-names = "rx";
201	status = "disabled";
202};
203
204/* I2S TX */
205i2s1: &flexcomm3 {
206	compatible = "nxp,lpc-i2s";
207	pinctrl-0 = <&pinmux_flexcomm3_i2s>;
208	pinctrl-names = "default";
209	#address-cells = <1>;
210	#size-cells = <0>;
211	dmas = <&dma0 7>;
212	dma-names = "tx";
213	status = "disabled";
214};
215
216arduino_serial: &flexcomm12 {
217	compatible = "nxp,lpc-usart";
218	status = "okay";
219	current-speed = <115200>;
220	pinctrl-0 = <&pinmux_flexcomm12_usart>;
221	pinctrl-names = "default";
222	dmas = <&dma0 34>, <&dma0 35>;
223	dma-names = "rx", "tx";
224};
225
226/* PCA9420 PMIC */
227&pmic_i2c {
228	status = "okay";
229	clock-frequency = <I2C_BITRATE_FAST>;
230	#address-cells = <1>;
231	#size-cells = <0>;
232	pinctrl-0 = <&pinmux_pmic_i2c>;
233	pinctrl-names = "default";
234
235	pca9420: pca9420@61 {
236		compatible = "nxp,pca9420";
237		reg = <0x61>;
238		nxp,enable-modesel-pins;
239
240		pca9420_sw1: BUCK1 {
241			regulator-boot-on;
242			nxp,mode0-microvolt = <1100000>;
243			nxp,mode1-microvolt = <600000>;
244			nxp,mode2-microvolt = <900000>;
245			nxp,mode3-microvolt = <800000>;
246		};
247
248		pca9420_sw2: BUCK2 {
249			regulator-boot-on;
250			nxp,mode0-microvolt = <1800000>;
251			nxp,mode1-microvolt = <1800000>;
252			nxp,mode2-microvolt = <1800000>;
253			nxp,mode3-microvolt = <1800000>;
254		};
255
256		pca9420_ldo1: LDO1 {
257			regulator-boot-on;
258			nxp,mode0-microvolt = <1800000>;
259			nxp,mode1-microvolt = <1800000>;
260			nxp,mode2-microvolt = <1800000>;
261			nxp,mode3-microvolt = <1800000>;
262		};
263
264		pca9420_ldo2: LDO2 {
265			regulator-boot-on;
266			nxp,mode0-microvolt = <3300000>;
267			nxp,mode1-microvolt = <3300000>;
268			nxp,mode2-microvolt = <3300000>;
269			nxp,mode3-microvolt = <3300000>;
270		};
271	};
272};
273
274&lpadc0 {
275	status = "okay";
276	pinctrl-0 = <&pinmux_lpadc0>;
277	pinctrl-names = "default";
278};
279
280&gpio0 {
281	status = "okay";
282};
283
284&gpio1 {
285	status = "okay";
286};
287
288&gpio2 {
289	status = "okay";
290};
291
292/*
293 * GPIO module interrupts are shared between all GPIO devices on this
294 * SOC, but Zephyr does not currently support sharing interrupts between
295 * devices. The user can select GPIO modules to support interrupts by
296 * setting the appropriate `int-source` and `interrupt` property for
297 * a given module. On this board, GPIO3 and GPIO4 are configured to support
298 * interrupts.
299 */
300&gpio3 {
301	status = "okay";
302	int-source = "int-a";
303	interrupts = <2 0>;
304};
305
306&gpio4 {
307	status = "okay";
308	int-source = "int-b";
309	interrupts = <3 0>;
310};
311
312&gpio5 {
313	status = "okay";
314};
315
316&gpio6 {
317	status = "okay";
318};
319
320&user_button_1 {
321	status = "okay";
322};
323
324&user_button_2 {
325	status = "okay";
326};
327
328&green_led {
329	status = "okay";
330};
331
332&blue_led {
333	status = "okay";
334};
335
336&red_led {
337	status = "okay";
338};
339
340&dma0 {
341	status = "okay";
342};
343
344zephyr_udc0: &usbhs {
345	status = "okay";
346};
347
348&ctimer0 {
349	status = "okay";
350};
351
352&ctimer1 {
353	status = "okay";
354};
355
356&ctimer2 {
357	status = "okay";
358};
359
360&ctimer3 {
361	status = "okay";
362};
363
364&ctimer4 {
365	status = "okay";
366};
367
368&usdhc0 {
369	status = "okay";
370	pwr-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
371	cd-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>;
372	mmc {
373		compatible = "zephyr,mmc-disk";
374		disk-name = "SD2";
375		status = "okay";
376	};
377	pinctrl-0 = <&pinmux_usdhc>;
378	pinctrl-names = "default";
379	mmc-hs200-1_8v;
380	mmc-hs400-1_8v;
381};
382
383&wwdt0 {
384	status = "okay";
385};
386
387&flexspi {
388	status = "okay";
389	pinctrl-0 = <&pinmux_flexspi>;
390	pinctrl-1 = <&pinmux_flexspi_sleep>;
391	pinctrl-names = "default", "sleep";
392
393	mx25um51345g: mx25um51345g@0 {
394		compatible = "nxp,imx-flexspi-mx25um51345g";
395		/* MX25UM51245G is 64MB, 512MBit flash part */
396		size = <DT_SIZE_M(64 * 8)>;
397		reg = <0>;
398		spi-max-frequency = <200000000>;
399		status = "okay";
400		jedec-id = [c2 81 3a];
401		erase-block-size = <4096>;
402		write-block-size = <2>; /* FLASH_MCUX_FLEXSPI_MX25UM51345G_OPI_DTR set */
403
404		partitions {
405			compatible = "fixed-partitions";
406			#address-cells = <1>;
407			#size-cells = <1>;
408
409			boot_partition: partition@0 {
410				label = "mcuboot";
411				reg = <0x00000000 DT_SIZE_K(128)>;
412			};
413			/* The MCUBoot swap-move algorithm uses the last 3 sectors
414			 * of the primary slot0 for swap status and move.
415			 */
416			slot0_partition: partition@20000 {
417				label = "image-0";
418				reg = <0x00020000 (DT_SIZE_M(3) + DT_SIZE_K(3 * 4))>;
419			};
420			slot1_partition: partition@323000 {
421				label = "image-1";
422				reg = <0x00323000 DT_SIZE_M(3)>;
423			};
424			storage_partition: partition@623000 {
425				label = "storage";
426				reg = <0x00623000 (DT_SIZE_M(58) - DT_SIZE_K(140))>;
427			};
428		};
429	};
430};
431
432&flexspi2 {
433	status = "okay";
434	pinctrl-0 = <&pinmux_flexspi2>;
435	pinctrl-names = "default";
436	rx-clock-source = <3>;
437	ahb-prefetch;
438	ahb-bufferable;
439	ahb-cacheable;
440	ahb-read-addr-opt;
441	aps6408l: aps6408l@0 {
442		compatible = "nxp,imx-flexspi-aps6408l";
443		/* APS6408L is 8MB, 64MBit pSRAM */
444		size = <DT_SIZE_M(8 * 8)>;
445		reg = <0>;
446		spi-max-frequency = <198000000>;
447		status = "okay";
448		cs-interval-unit = <1>;
449		cs-interval = <5>;
450		cs-hold-time = <3>;
451		cs-setup-time = <3>;
452		data-valid-time = <1>;
453		column-space = <0>;
454		ahb-write-wait-unit = <2>;
455		ahb-write-wait-interval = <0>;
456	};
457};
458
459&sc_timer {
460	pinctrl-0 = <&pinmux_sctimer_default>;
461	pinctrl-names = "default";
462	status = "okay";
463};
464
465&i3c0 {
466	pinctrl-0 = <&pinmux_i3c>;
467	pinctrl-names = "default";
468
469	status = "okay";
470
471	audio_codec: wm8904@1a0000000000000000 {
472		compatible = "wolfson,wm8904";
473		reg = <0x1a 0 0>;
474		clock-source = "MCLK";
475
476		clocks = <&clkctl0 MCUX_AUDIO_MCLK>;
477		clock-names = "mclk";
478	};
479};
480
481&mbox {
482	status = "okay";
483};
484
485/* Disable this node if not using USB and need another MPU region */
486&sram1 {
487	status = "okay";
488};
489
490/* Enable smartDMA controller */
491&smartdma {
492	status = "okay";
493};
494
495/* Add smartDMA to mipi DSI */
496&mipi_dsi {
497	dmas = <&smartdma>;
498	dma-names = "smartdma";
499};
500
501&dmic0 {
502	status = "okay";
503	pinctrl-0 = <&pinmux_dmic0>;
504	pinctrl-names = "default";
505	use2fs;
506};
507
508/* Configure pdm channels 0 and 1 with gain, and cutoff settings
509 * appropriate for the attached MEMS microphones.
510 */
511&pdmc0 {
512	status = "okay";
513	gainshift = <3>;
514	dc-cutoff = "155hz";
515	dc-gain = <1>;
516};
517
518&pdmc1 {
519	status = "okay";
520	gainshift = <3>;
521	dc-cutoff = "155hz";
522	dc-gain = <1>;
523};
524
525&mrt_channel0 {
526	status = "okay";
527};
528