1/*
2 * Copyright 2020-2024 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8
9#include <nxp/nxp_rt6xx.dtsi>
10#include <zephyr/dt-bindings/pwm/pwm.h>
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13#include "mimxrt685_evk-pinctrl.dtsi"
14
15/ {
16	model = "NXP MIMXRT685-EVK board";
17	compatible = "nxp,mimxrt685";
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		/* For pwm test suites */
27		pwm-0 = &sc_timer;
28		pwm-led0 = &green_pwm_led;
29		green-pwm-led = &green_pwm_led;
30		blue-pwm-led = &blue_pwm_led;
31		red-pwm-led = &red_pwm_led;
32		watchdog0 = &wwdt0;
33		magn0 = &fxos8700;
34		accel0 = &fxos8700;
35		sdhc0 = &usdhc0;
36		dmic-dev = &dmic0;
37		mcuboot-button0 = &user_button_1;
38	};
39
40	chosen {
41		zephyr,flash-controller = &mx25um51345g;
42		zephyr,flash = &mx25um51345g;
43		zephyr,code-partition = &slot0_partition;
44		zephyr,uart-mcumgr = &flexcomm0;
45		zephyr,sram = &sram0;
46		zephyr,console = &flexcomm0;
47		zephyr,shell-uart = &flexcomm0;
48	};
49
50	gpio_keys {
51		compatible = "gpio-keys";
52		user_button_1: button_0 {
53			label = "User SW1";
54			gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
55			zephyr,code = <INPUT_KEY_0>;
56		};
57		user_button_2: button_1 {
58			label = "User SW2";
59			gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
60			zephyr,code = <INPUT_KEY_1>;
61		};
62	};
63
64	leds: leds {
65		compatible = "gpio-leds";
66		green_led: led_1 {
67			gpios = <&gpio0 14 0>;
68			label = "User LED_GREEN";
69		};
70		blue_led: led_2 {
71			gpios = <&gpio0 26 0>;
72			label = "User LED_BLUE";
73		};
74		red_led: led_3 {
75			gpios = <&gpio0 31 0>;
76			label = "User LED_RED";
77		};
78	};
79
80	pwmleds {
81		compatible = "pwm-leds";
82		green_pwm_led: green_pwm_led {
83			pwms = <&sc_timer 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
84			label = "Green PWM LED";
85			status = "okay";
86		};
87		blue_pwm_led: blue_pwm_led {
88			pwms = <&sc_timer 6 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
89			label = "Blue PWM LED";
90			status = "okay";
91		};
92		red_pwm_led: red_pwm_led {
93			pwms = <&sc_timer 6 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
94			label = "Red PWM LED";
95			status = "disabled";
96		};
97	};
98
99	arduino_header: arduino-connector {
100		compatible = "arduino-header-r3";
101		#gpio-cells = <2>;
102		gpio-map-mask = <0xffffffff 0xffffffc0>;
103		gpio-map-pass-thru = <0 0x3f>;
104		gpio-map =	<0 0 &gpio0 5 0>,	/* A0 */
105				<1 0 &gpio0 6 0>,	/* A1 */
106				<2 0 &gpio0 19 0>,	/* A2 */
107				<3 0 &gpio0 20 0>,	/* A3 */
108				<4 0 &gpio0 17 0>,	/* A4 */
109				<5 0 &gpio0 18 0>,	/* A5 */
110				<6 0 &gpio0 30 0>,	/* D0 */
111				<7 0 &gpio0 29 0>,	/* D1 */
112				<8 0 &gpio0 28 0>,	/* D2 */
113				<9 0 &gpio0 27 0>,	/* D3 */
114				<10 0 &gpio1 0 0>,	/* D4 */
115				<11 0 &gpio1 10 0>,	/* D5 */
116				<12 0 &gpio1 2 0>,	/* D6 */
117				<13 0 &gpio1 8 0>,	/* D7 */
118				<14 0 &gpio1 9 0>,	/* D8 */
119				<15 0 &gpio1 7 0>,	/* D9 */
120				<16 0 &gpio1 6 0>,	/* D10 */
121				<17 0 &gpio1 5 0>,	/* D11 */
122				<18 0 &gpio1 4 0>,	/* D12 */
123				<19 0 &gpio1 3 0>,	/* D13 */
124				<20 0 &gpio0 17 0>,	/* D14 */
125				<21 0 &gpio0 18 0>;	/* D15 */
126	};
127};
128
129/*
130 * RT600 EVK board uses OS timer as the kernel timer
131 * In case we need to switch to SYSTICK timer, then
132 * replace &os_timer with &systick
133 */
134&os_timer {
135	status = "okay";
136	wakeup-source;
137};
138
139&rtc {
140	status = "okay";
141};
142
143&flexcomm0 {
144	compatible = "nxp,lpc-usart";
145	status = "okay";
146	current-speed = <115200>;
147	pinctrl-0 = <&pinmux_flexcomm0_usart>;
148	pinctrl-names = "default";
149	dmas = <&dma0 0>, <&dma0 1>;
150	dma-names = "rx", "tx";
151};
152
153arduino_i2c: &flexcomm2 {
154	compatible = "nxp,lpc-i2c";
155	status = "okay";
156	pinctrl-0 = <&pinmux_flexcomm2_i2c>;
157	pinctrl-names = "default";
158	clock-frequency = <I2C_BITRATE_FAST>;
159	#address-cells = <1>;
160	#size-cells = <0>;
161
162	fxos8700: fxos8700@1e {
163		compatible = "nxp,fxos8700";
164		reg = <0x1e>;
165		int1-gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
166		reset-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
167	};
168};
169
170arduino_serial: &flexcomm4 {
171	compatible = "nxp,lpc-usart";
172	status = "okay";
173	current-speed = <115200>;
174	pinctrl-0 = <&pinmux_flexcomm4_usart>;
175	pinctrl-names = "default";
176	dmas = <&dma0 8>, <&dma0 9>;
177	dma-names = "rx", "tx";
178};
179
180arduino_spi: &flexcomm5 {
181	compatible = "nxp,lpc-spi";
182	status = "okay";
183	#address-cells = <1>;
184	#size-cells = <0>;
185	dmas = <&dma0 10>, <&dma0 11>;
186	dma-names = "rx", "tx";
187	pinctrl-0 = <&pinmux_flexcomm5_spi>;
188	pinctrl-names = "default";
189};
190
191/* I2S receive channel */
192i2s0: &flexcomm1 {
193	status = "okay";
194	compatible = "nxp,lpc-i2s";
195	#address-cells = <1>;
196	#size-cells = <0>;
197	dmas = <&dma0 2>;
198	dma-names = "rx";
199	pinctrl-0 = <&pinmux_flexcomm1_i2s>;
200	pinctrl-names = "default";
201};
202
203/* I2S transmit channel */
204i2s1: &flexcomm3 {
205	status = "okay";
206	compatible = "nxp,lpc-i2s";
207	#address-cells = <1>;
208	#size-cells = <0>;
209	dmas = <&dma0 7>;
210	dma-names = "tx";
211	pinctrl-0 = <&pinmux_flexcomm3_i2s>;
212	pinctrl-names = "default";
213};
214
215/* PCA9420 PMIC */
216&pmic_i2c {
217	status = "okay";
218	compatible = "nxp,lpc-i2c";
219	clock-frequency = <I2C_BITRATE_FAST>;
220	#address-cells = <1>;
221	#size-cells = <0>;
222	pinctrl-0 = <&pinmux_pmic_i2c>;
223	pinctrl-names = "default";
224
225	pca9420: pca9420@61 {
226		compatible = "nxp,pca9420";
227		reg = <0x61>;
228		nxp,enable-modesel-pins;
229
230		buck1: BUCK1 {
231			regulator-boot-on;
232		};
233
234		buck2: BUCK2 {
235			regulator-boot-on;
236		};
237
238		ldo1: LDO1 {
239			regulator-boot-on;
240		};
241
242		ldo2: LDO2 {
243			regulator-boot-on;
244		};
245
246
247	};
248};
249
250&flexspi {
251	pinctrl-0 = <&pinmux_flexspi>;
252	pinctrl-names = "default";
253	status = "okay";
254	mx25um51345g: mx25um51345g@2 {
255		compatible = "nxp,imx-flexspi-mx25um51345g";
256		/* MX25UM51245G is 64MB, 512MBit flash part */
257		size = <DT_SIZE_M(64 * 8)>;
258		reg = <2>;
259		spi-max-frequency = <200000000>;
260		status = "okay";
261		jedec-id = [c2 81 3a];
262		erase-block-size = <4096>;
263		write-block-size = <1>; /* FLASH_MCUX_FLEXSPI_MX25UM51345G_OPI_STR set */
264
265		partitions {
266			compatible = "fixed-partitions";
267			#address-cells = <1>;
268			#size-cells = <1>;
269
270			boot_partition: partition@0 {
271				label = "mcuboot";
272				reg = <0x00000000 DT_SIZE_K(128)>;
273			};
274			/* The MCUBoot swap-move algorithm uses the last 2 sectors
275			 * of the primary slot0 for swap status and move.
276			 */
277			slot0_partition: partition@20000 {
278				label = "image-0";
279				reg = <0x00020000 (DT_SIZE_M(3) + DT_SIZE_K(2 * 4))>;
280			};
281			slot1_partition: partition@323000 {
282				label = "image-1";
283				reg = <0x00323000 DT_SIZE_M(3)>;
284			};
285			storage_partition: partition@623000 {
286				label = "storage";
287				reg = <0x00623000 (DT_SIZE_M(58) - DT_SIZE_K(136))>;
288			};
289		};
290	};
291};
292
293&gpio0 {
294	status = "okay";
295};
296
297&gpio1 {
298	status = "okay";
299};
300
301&gpio2 {
302	status = "okay";
303};
304
305&dma0 {
306	status = "okay";
307};
308
309&wwdt0 {
310	status = "okay";
311};
312
313&user_button_1 {
314	status = "okay";
315};
316
317&user_button_2 {
318	status = "okay";
319};
320
321&green_led {
322	status = "okay";
323};
324
325&blue_led {
326	status = "okay";
327};
328
329&red_led {
330	status = "okay";
331};
332
333&sc_timer {
334	status = "okay";
335	pinctrl-0 = <&pinmux_sctimer>;
336	pinctrl-names = "default";
337};
338
339&usdhc0 {
340	status = "okay";
341	/* Quick fix for 1.8V SD cards on RT600- disable 1.8V negotiation */
342	no-1-8-v;
343	pwr-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
344	cd-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>;
345	sdmmc {
346		compatible = "zephyr,sdmmc-disk";
347		disk-name = "SD";
348		status = "okay";
349	};
350	pinctrl-0 = <&pinmux_usdhc>;
351	pinctrl-names = "default";
352};
353
354&lpadc0 {
355	status = "okay";
356	pinctrl-0 = <&pinmux_lpadc0>;
357	pinctrl-names = "default";
358};
359
360zephyr_udc0: &usbhs {
361	status = "okay";
362	phy_handle = <&usbphy>;
363};
364
365&usbphy {
366	status = "okay";
367	tx-d-cal = <12>;
368	tx-cal-45-dp-ohms = <6>;
369	tx-cal-45-dm-ohms = <6>;
370};
371
372&ctimer0 {
373	status = "okay";
374};
375
376&ctimer1 {
377	status = "okay";
378};
379
380&ctimer2 {
381	status = "okay";
382};
383
384&ctimer3 {
385	status = "okay";
386};
387
388&ctimer4 {
389	status = "okay";
390};
391
392&i3c0 {
393	pinctrl-0 = <&pinmux_i3c>;
394	pinctrl-names = "default";
395
396	status = "okay";
397
398	audio_codec: wm8904@1a0000000000000000 {
399		compatible = "wolfson,wm8904";
400		reg = <0x1a 0 0>;
401
402		clock-source = "MCLK";
403
404		clocks = <&clkctl0 MCUX_AUDIO_MCLK>;
405		clock-names = "mclk";
406	};
407};
408
409/* Disable this node if not using USB and need another MPU region */
410&sram1 {
411	status = "okay";
412};
413
414&dmic0 {
415	status = "okay";
416	pinctrl-0 = <&pinmux_dmic0>;
417	pinctrl-names = "default";
418	use2fs;
419};
420
421/* Configure pdm channels 0 and 1 with gain, and cutoff settings
422 * appropriate for the attached MEMS microphones.
423 */
424&pdmc0 {
425	status = "okay";
426	gainshift = <3>;
427	dc-cutoff = "155hz";
428	dc-gain = <1>;
429};
430
431&pdmc1 {
432	status = "okay";
433	gainshift = <3>;
434	dc-cutoff = "155hz";
435	dc-gain = <1>;
436};
437