Skip to content

Commit eb205eb

Browse files
saurabh-nxpgalak
authored andcommitted
boards: arm: Enable FlexSPI driver on mimxrt685_evk.
Enable FlexSPI NOR flash driver with XIP build options. Configure FlexSPI pins, update board documentation. Add FlexSPI NOR flash dts node for mimxrt685_evk. Enable flash storage by adding partition to dts file. Using last 1MB for storage, and reserving 63MB for code. Signed-off-by: Saurabh Jagdhane <[email protected]>
1 parent 241374e commit eb205eb

File tree

5 files changed

+299
-0
lines changed

5 files changed

+299
-0
lines changed

boards/arm/mimxrt685_evk/Kconfig.defconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ config XTAL_SYS_CLK_HZ
1414
config SYSOSC_SETTLING_US
1515
default 260
1616

17+
config FLASH_MCUX_FLEXSPI_MX25UM51345G
18+
default y if FLASH
19+
20+
config FLASH_MCUX_FLEXSPI_XIP
21+
default y if FLASH
22+
23+
choice FLASH_MCUX_FLEXSPI_XIP_MEM_TARGET
24+
default FLASH_MCUX_FLEXSPI_XIP_MEM_SRAM
25+
endchoice
26+
1727
if GPIO_MCUX_LPC
1828

1929
config GPIO_MCUX_LPC_PORT0

boards/arm/mimxrt685_evk/doc/index.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ features:
7171
+-----------+------------+-------------------------------------+
7272
| GPIO | on-chip | gpio |
7373
+-----------+------------+-------------------------------------+
74+
| FLASH | on-chip | OctalSPI Flash |
75+
+-----------+------------+-------------------------------------+
7476
| USART | on-chip | serial port-polling |
7577
+-----------+------------+-------------------------------------+
7678
| I2C | on-chip | i2c |
@@ -127,6 +129,28 @@ functionality of a pin.
127129
+---------+-----------------+----------------------------+
128130
| PIO0_9 | I2S | I2S DATAIN |
129131
+---------+-----------------+----------------------------+
132+
| PIO1_11 | FLEXSPI0B_DATA0 | OctalSPI Flash |
133+
+---------+-----------------+----------------------------+
134+
| PIO1_12 | FLEXSPI0B_DATA1 | OctalSPI Flash |
135+
+---------+-----------------+----------------------------+
136+
| PIO1_13 | FLEXSPI0B_DATA2 | OctalSPI Flash |
137+
+---------+-----------------+----------------------------+
138+
| PIO1_14 | FLEXSPI0B_DATA3 | OctalSPI Flash |
139+
+---------+-----------------+----------------------------+
140+
| PIO1_29 | FLEXSPI0B_SCLK | OctalSPI Flash |
141+
+---------+-----------------+----------------------------+
142+
| PIO2_12 | PIO2_12 | OctalSPI Flash |
143+
+---------+-----------------+----------------------------+
144+
| PIO2_17 | FLEXSPI0B_DATA4 | OctalSPI Flash |
145+
+---------+-----------------+----------------------------+
146+
| PIO2_18 | FLEXSPI0B_DATA5 | OctalSPI Flash |
147+
+---------+-----------------+----------------------------+
148+
| PIO2_19 | FLEXSPI0B_SS0_N | OctalSPI Flash |
149+
+---------+-----------------+----------------------------+
150+
| PIO2_22 | FLEXSPI0B_DATA6 | OctalSPI Flash |
151+
+---------+-----------------+----------------------------+
152+
| PIO2_23 | FLEXSPI0B_DATA7 | OctalSPI Flash |
153+
+---------+-----------------+----------------------------+
130154

131155
System Clock
132156
============

boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.dts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,30 @@ i2s1: &flexcomm3 {
170170
dma-names = "tx";
171171
};
172172

173+
&flexspi {
174+
reg = <0x50134000 0x4000>, <0x18000000 DT_SIZE_M(64)>;
175+
mx25um51345g: mx25um51345g@2 {
176+
compatible = "nxp,imx-flexspi-mx25um51345g";
177+
size = <536870912>;
178+
label = "MX25UM51345G";
179+
reg = <2>;
180+
spi-max-frequency = <200000000>;
181+
status = "okay";
182+
jedec-id = [c2 81 3a];
183+
184+
partitions {
185+
compatible = "fixed-partitions";
186+
#address-cells = <1>;
187+
#size-cells = <1>;
188+
189+
storage_partition: partition@3f00000 {
190+
label = "storage";
191+
reg = <0x03f00000 DT_SIZE_M(1)>;
192+
};
193+
};
194+
};
195+
};
196+
173197
&gpio0 {
174198
status = "okay";
175199
};

boards/arm/mimxrt685_evk/pinmux.c

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,239 @@ static int mimxrt685_evk_pinmux_init(const struct device *dev)
396396
/* PORT0 PIN9 (coords: L3) is configured as FC1_RXD_SDA_MOSI_DATA */
397397
IOPCTL_PinMuxSet(IOPCTL, 0U, 9U, port0_pin9_config);
398398

399+
#endif
400+
401+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexspi), okay) && CONFIG_FLASH
402+
const uint32_t port1_pin11_config = (/* Pin is configured as FLEXSPI0B_DATA0 */
403+
IOPCTL_PIO_FUNC6 |
404+
/* Disable pull-up / pull-down function */
405+
IOPCTL_PIO_PUPD_DI |
406+
/* Enable pull-down function */
407+
IOPCTL_PIO_PULLDOWN_EN |
408+
/* Enables input buffer function */
409+
IOPCTL_PIO_INBUF_EN |
410+
/* Normal mode */
411+
IOPCTL_PIO_SLEW_RATE_NORMAL |
412+
/* Full drive enable */
413+
IOPCTL_PIO_FULLDRIVE_EN |
414+
/* Analog mux is disabled */
415+
IOPCTL_PIO_ANAMUX_DI |
416+
/* Pseudo Output Drain is disabled */
417+
IOPCTL_PIO_PSEDRAIN_DI |
418+
/* Input function is not inverted */
419+
IOPCTL_PIO_INV_DI);
420+
/* PORT1 PIN11 (coords: L2) is configured as FLEXSPI0B_DATA0 */
421+
IOPCTL_PinMuxSet(IOPCTL, 1U, 11U, port1_pin11_config);
422+
423+
const uint32_t port1_pin12_config = (/* Pin is configured as FLEXSPI0B_DATA1 */
424+
IOPCTL_PIO_FUNC6 |
425+
/* Disable pull-up / pull-down function */
426+
IOPCTL_PIO_PUPD_DI |
427+
/* Enable pull-down function */
428+
IOPCTL_PIO_PULLDOWN_EN |
429+
/* Enables input buffer function */
430+
IOPCTL_PIO_INBUF_EN |
431+
/* Normal mode */
432+
IOPCTL_PIO_SLEW_RATE_NORMAL |
433+
/* Full drive enable */
434+
IOPCTL_PIO_FULLDRIVE_EN |
435+
/* Analog mux is disabled */
436+
IOPCTL_PIO_ANAMUX_DI |
437+
/* Pseudo Output Drain is disabled */
438+
IOPCTL_PIO_PSEDRAIN_DI |
439+
/* Input function is not inverted */
440+
IOPCTL_PIO_INV_DI);
441+
/* PORT1 PIN12 (coords: M2) is configured as FLEXSPI0B_DATA1 */
442+
IOPCTL_PinMuxSet(IOPCTL, 1U, 12U, port1_pin12_config);
443+
444+
const uint32_t port1_pin13_config = (/* Pin is configured as FLEXSPI0B_DATA2 */
445+
IOPCTL_PIO_FUNC6 |
446+
/* Disable pull-up / pull-down function */
447+
IOPCTL_PIO_PUPD_DI |
448+
/* Enable pull-down function */
449+
IOPCTL_PIO_PULLDOWN_EN |
450+
/* Enables input buffer function */
451+
IOPCTL_PIO_INBUF_EN |
452+
/* Normal mode */
453+
IOPCTL_PIO_SLEW_RATE_NORMAL |
454+
/* Full drive enable */
455+
IOPCTL_PIO_FULLDRIVE_EN |
456+
/* Analog mux is disabled */
457+
IOPCTL_PIO_ANAMUX_DI |
458+
/* Pseudo Output Drain is disabled */
459+
IOPCTL_PIO_PSEDRAIN_DI |
460+
/* Input function is not inverted */
461+
IOPCTL_PIO_INV_DI);
462+
/* PORT1 PIN13 (coords: N1) is configured as FLEXSPI0B_DATA2 */
463+
IOPCTL_PinMuxSet(IOPCTL, 1U, 13U, port1_pin13_config);
464+
465+
const uint32_t port1_pin14_config = (/* Pin is configured as FLEXSPI0B_DATA3 */
466+
IOPCTL_PIO_FUNC6 |
467+
/* Disable pull-up / pull-down function */
468+
IOPCTL_PIO_PUPD_DI |
469+
/* Enable pull-down function */
470+
IOPCTL_PIO_PULLDOWN_EN |
471+
/* Enables input buffer function */
472+
IOPCTL_PIO_INBUF_EN |
473+
/* Normal mode */
474+
IOPCTL_PIO_SLEW_RATE_NORMAL |
475+
/* Full drive enable */
476+
IOPCTL_PIO_FULLDRIVE_EN |
477+
/* Analog mux is disabled */
478+
IOPCTL_PIO_ANAMUX_DI |
479+
/* Pseudo Output Drain is disabled */
480+
IOPCTL_PIO_PSEDRAIN_DI |
481+
/* Input function is not inverted */
482+
IOPCTL_PIO_INV_DI);
483+
/* PORT1 PIN14 (coords: N2) is configured as FLEXSPI0B_DATA3 */
484+
IOPCTL_PinMuxSet(IOPCTL, 1U, 14U, port1_pin14_config);
485+
486+
const uint32_t port1_pin29_config = (/* Pin is configured as FLEXSPI0B_SCLK */
487+
IOPCTL_PIO_FUNC5 |
488+
/* Disable pull-up / pull-down function */
489+
IOPCTL_PIO_PUPD_DI |
490+
/* Enable pull-down function */
491+
IOPCTL_PIO_PULLDOWN_EN |
492+
/* Enables input buffer function */
493+
IOPCTL_PIO_INBUF_EN |
494+
/* Normal mode */
495+
IOPCTL_PIO_SLEW_RATE_NORMAL |
496+
/* Full drive enable */
497+
IOPCTL_PIO_FULLDRIVE_EN |
498+
/* Analog mux is disabled */
499+
IOPCTL_PIO_ANAMUX_DI |
500+
/* Pseudo Output Drain is disabled */
501+
IOPCTL_PIO_PSEDRAIN_DI |
502+
/* Input function is not inverted */
503+
IOPCTL_PIO_INV_DI);
504+
/* PORT1 PIN29 (coords: U3) is configured as FLEXSPI0B_SCLK */
505+
IOPCTL_PinMuxSet(IOPCTL, 1U, 29U, port1_pin29_config);
506+
507+
const uint32_t port2_pin12_config = (/* Pin is configured as PIO2_12 */
508+
IOPCTL_PIO_FUNC0 |
509+
/* Disable pull-up / pull-down function */
510+
IOPCTL_PIO_PUPD_DI |
511+
/* Enable pull-down function */
512+
IOPCTL_PIO_PULLDOWN_EN |
513+
/* Disable input buffer function */
514+
IOPCTL_PIO_INBUF_DI |
515+
/* Normal mode */
516+
IOPCTL_PIO_SLEW_RATE_NORMAL |
517+
/* Normal drive */
518+
IOPCTL_PIO_FULLDRIVE_DI |
519+
/* Analog mux is disabled */
520+
IOPCTL_PIO_ANAMUX_DI |
521+
/* Pseudo Output Drain is disabled */
522+
IOPCTL_PIO_PSEDRAIN_DI |
523+
/* Input function is not inverted */
524+
IOPCTL_PIO_INV_DI);
525+
/* PORT2 PIN12 (coords: T3) is configured as PIO2_12 */
526+
IOPCTL_PinMuxSet(IOPCTL, 2U, 12U, port2_pin12_config);
527+
528+
const uint32_t port2_pin17_config = (/* Pin is configured as FLEXSPI0B_DATA4 */
529+
IOPCTL_PIO_FUNC6 |
530+
/* Disable pull-up / pull-down function */
531+
IOPCTL_PIO_PUPD_DI |
532+
/* Enable pull-down function */
533+
IOPCTL_PIO_PULLDOWN_EN |
534+
/* Enables input buffer function */
535+
IOPCTL_PIO_INBUF_EN |
536+
/* Normal mode */
537+
IOPCTL_PIO_SLEW_RATE_NORMAL |
538+
/* Full drive enable */
539+
IOPCTL_PIO_FULLDRIVE_EN |
540+
/* Analog mux is disabled */
541+
IOPCTL_PIO_ANAMUX_DI |
542+
/* Pseudo Output Drain is disabled */
543+
IOPCTL_PIO_PSEDRAIN_DI |
544+
/* Input function is not inverted */
545+
IOPCTL_PIO_INV_DI);
546+
/* PORT2 PIN17 (coords: U1) is configured as FLEXSPI0B_DATA4 */
547+
IOPCTL_PinMuxSet(IOPCTL, 2U, 17U, port2_pin17_config);
548+
549+
const uint32_t port2_pin18_config = (/* Pin is configured as FLEXSPI0B_DATA5 */
550+
IOPCTL_PIO_FUNC6 |
551+
/* Disable pull-up / pull-down function */
552+
IOPCTL_PIO_PUPD_DI |
553+
/* Enable pull-down function */
554+
IOPCTL_PIO_PULLDOWN_EN |
555+
/* Enables input buffer function */
556+
IOPCTL_PIO_INBUF_EN |
557+
/* Normal mode */
558+
IOPCTL_PIO_SLEW_RATE_NORMAL |
559+
/* Full drive enable */
560+
IOPCTL_PIO_FULLDRIVE_EN |
561+
/* Analog mux is disabled */
562+
IOPCTL_PIO_ANAMUX_DI |
563+
/* Pseudo Output Drain is disabled */
564+
IOPCTL_PIO_PSEDRAIN_DI |
565+
/* Input function is not inverted */
566+
IOPCTL_PIO_INV_DI);
567+
/* PORT2 PIN18 (coords: R2) is configured as FLEXSPI0B_DATA5 */
568+
IOPCTL_PinMuxSet(IOPCTL, 2U, 18U, port2_pin18_config);
569+
570+
const uint32_t port2_pin19_config = (/* Pin is configured as FLEXSPI0B_SS0_N */
571+
IOPCTL_PIO_FUNC6 |
572+
/* Disable pull-up / pull-down function */
573+
IOPCTL_PIO_PUPD_DI |
574+
/* Enable pull-down function */
575+
IOPCTL_PIO_PULLDOWN_EN |
576+
/* Enables input buffer function */
577+
IOPCTL_PIO_INBUF_EN |
578+
/* Normal mode */
579+
IOPCTL_PIO_SLEW_RATE_NORMAL |
580+
/* Full drive enable */
581+
IOPCTL_PIO_FULLDRIVE_EN |
582+
/* Analog mux is disabled */
583+
IOPCTL_PIO_ANAMUX_DI |
584+
/* Pseudo Output Drain is disabled */
585+
IOPCTL_PIO_PSEDRAIN_DI |
586+
/* Input function is not inverted */
587+
IOPCTL_PIO_INV_DI);
588+
/* PORT2 PIN19 (coords: T2) is configured as FLEXSPI0B_SS0_N */
589+
IOPCTL_PinMuxSet(IOPCTL, 2U, 19U, port2_pin19_config);
590+
591+
const uint32_t port2_pin22_config = (/* Pin is configured as FLEXSPI0B_DATA6 */
592+
IOPCTL_PIO_FUNC6 |
593+
/* Disable pull-up / pull-down function */
594+
IOPCTL_PIO_PUPD_DI |
595+
/* Enable pull-down function */
596+
IOPCTL_PIO_PULLDOWN_EN |
597+
/* Enables input buffer function */
598+
IOPCTL_PIO_INBUF_EN |
599+
/* Normal mode */
600+
IOPCTL_PIO_SLEW_RATE_NORMAL |
601+
/* Full drive enable */
602+
IOPCTL_PIO_FULLDRIVE_EN |
603+
/* Analog mux is disabled */
604+
IOPCTL_PIO_ANAMUX_DI |
605+
/* Pseudo Output Drain is disabled */
606+
IOPCTL_PIO_PSEDRAIN_DI |
607+
/* Input function is not inverted */
608+
IOPCTL_PIO_INV_DI);
609+
/* PORT2 PIN22 (coords: P3) is configured as FLEXSPI0B_DATA6 */
610+
IOPCTL_PinMuxSet(IOPCTL, 2U, 22U, port2_pin22_config);
611+
612+
const uint32_t port2_pin23_config = (/* Pin is configured as FLEXSPI0B_DATA7 */
613+
IOPCTL_PIO_FUNC6 |
614+
/* Disable pull-up / pull-down function */
615+
IOPCTL_PIO_PUPD_DI |
616+
/* Enable pull-down function */
617+
IOPCTL_PIO_PULLDOWN_EN |
618+
/* Enables input buffer function */
619+
IOPCTL_PIO_INBUF_EN |
620+
/* Normal mode */
621+
IOPCTL_PIO_SLEW_RATE_NORMAL |
622+
/* Full drive enable */
623+
IOPCTL_PIO_FULLDRIVE_EN |
624+
/* Analog mux is disabled */
625+
IOPCTL_PIO_ANAMUX_DI |
626+
/* Pseudo Output Drain is disabled */
627+
IOPCTL_PIO_PSEDRAIN_DI |
628+
/* Input function is not inverted */
629+
IOPCTL_PIO_INV_DI);
630+
/* PORT2 PIN23 (coords: P5) is configured as FLEXSPI0B_DATA7 */
631+
IOPCTL_PinMuxSet(IOPCTL, 2U, 23U, port2_pin23_config);
399632
#endif
400633

401634
return 0;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright 2021 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: NXP FlexSPI MX25UM51345G
5+
6+
compatible: "nxp,imx-flexspi-mx25um51345g"
7+
8+
include: ["nxp,imx-flexspi-device.yaml", soc-nv-flash.yaml]

0 commit comments

Comments
 (0)