Skip to content

Commit 3be63df

Browse files
authored
Merge pull request #688 from MulattoKid/imx_non_quad_read_in_lut
Support single reads in i.MX RT FCB LUT
2 parents b7cd9d7 + 57dfba3 commit 3be63df

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

docs/Targets.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,6 +2749,10 @@ section, e.g.:
27492749
If an external `.dcd_data` section is provided, the option `NXP_CUSTOM_DCD=1` must
27502750
be added to the configuration.
27512751

2752+
### FlexSPI Configuration Block (FCB) Look-Up Table (LUT)
2753+
2754+
By default the read LUT sequence for all i.MX RT targets uses a quad read. If your flash chip does not support this feature by default, e.g. the QE-bit is disabled from the factory, it is necessary to use a single read instead. This can be accomplished by defining `CONFIG_IMX_FCB_LUT_SINGLE_READ_DATA` when compiling wolfBoot, e.g. by adding it to the `CFLAGS_EXTRA` variable in the configuration file.
2755+
27522756
### Building wolfBoot for HAB (High Assurance Boot)
27532757

27542758
The `imx_rt` target supports building without a flash configuration, IVT, Boot Data and DCD. This is needed when wanting to use HAB through NXP's *Secure Provisioning Tool* to sign wolfBoot to enable secure boot. To build wolfBoot this way `TARGET_IMX_HAB` needs to be set to 1 in the configuration file (see `config/examples/imx-rt1060 _hab.config` for an example). When built with `TARGET_IMX_HAB=1` wolfBoot must be written to flash using NXP's *Secure Provisioning Tool*.

hal/imx_rt.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,13 @@ const flexspi_nor_config_t FLASH_CONFIG_SECTION qspiflash_config = {
280280
.serialClkFreq = CONFIG_SERIAL_CLK_FREQ,
281281
.sflashA1Size = CONFIG_FLASH_SIZE,
282282
.lookupTable = {
283+
#if defined(CONFIG_IMX_FCB_LUT_SINGLE_READ_DATA)
284+
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x03, RADDR_SDR, FLEXSPI_1PAD, 0x18),
285+
FLEXSPI_LUT_SEQ(READ_SDR, FLEXSPI_1PAD, 0x04, STOP, FLEXSPI_1PAD, 0),
286+
#else /* Default assumes flash chip supports Fast Read Quad (command 0xEB) out-of-the-box (has QE-bit enabled) */
283287
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
284288
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04),
289+
#endif
285290
},
286291
},
287292
.pageSize = CONFIG_FLASH_PAGE_SIZE,
@@ -340,8 +345,13 @@ const flexspi_nor_config_t FLASH_CONFIG_SECTION qspiflash_config = {
340345
.serialClkFreq = CONFIG_SERIAL_CLK_FREQ,
341346
.sflashA1Size = CONFIG_FLASH_SIZE,
342347
.lookupTable = {
348+
#if defined(CONFIG_IMX_FCB_LUT_SINGLE_READ_DATA)
349+
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x03, RADDR_SDR, FLEXSPI_1PAD, 0x18),
350+
FLEXSPI_LUT_SEQ(READ_SDR, FLEXSPI_1PAD, 0x04, STOP, FLEXSPI_1PAD, 0),
351+
#else /* Default assumes flash chip supports Fast Read Quad (command 0xEB) out-of-the-box (has QE-bit enabled) */
343352
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
344353
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04),
354+
#endif
345355
},
346356
},
347357
.pageSize = CONFIG_FLASH_PAGE_SIZE,
@@ -581,13 +591,18 @@ const flexspi_nor_config_t FLASH_CONFIG_SECTION qspiflash_config = {
581591
READ_SDR, FLEXSPI_4PAD, 0x04 /* any non-zero value */,
582592
JMP_ON_CS, FLEXSPI_1PAD, 0x01),
583593
#else
594+
#if defined(CONFIG_IMX_FCB_LUT_SINGLE_READ_DATA)
595+
[LUT_SEQ_IDX_0 + LUT_SEQ_INS_0_1] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x03, RADDR_SDR, FLEXSPI_1PAD, 0x18),
596+
[LUT_SEQ_IDX_0 + LUT_SEQ_INS_2_3] = FLEXSPI_LUT_SEQ(READ_SDR, FLEXSPI_1PAD, 0x04, STOP, FLEXSPI_1PAD, 0),
597+
#else /* Default assumes flash chip supports Fast Read Quad (command 0xEB) out-of-the-box (has QE-bit enabled) */
584598
/* Quad Input/output read sequence */
585599
[LUT_SEQ_IDX_0 + LUT_SEQ_INS_0_1] = FLEXSPI_LUT_SEQ(
586600
CMD_SDR, FLEXSPI_1PAD, 0xEB,
587601
RADDR_SDR, FLEXSPI_4PAD, CONFIG_FLASH_ADDR_WIDTH),
588602
[LUT_SEQ_IDX_0 + LUT_SEQ_INS_2_3] = FLEXSPI_LUT_SEQ(
589603
DUMMY_SDR, FLEXSPI_4PAD, 0x06 /* 6 dummy cycles */,
590604
READ_SDR, FLEXSPI_4PAD, 0x04 /* any non-zero value */ ),
605+
#endif
591606
#endif
592607
/* Read Status */
593608
[LUT_SEQ_IDX_1 + LUT_SEQ_INS_0_1] = FLEXSPI_LUT_SEQ(

0 commit comments

Comments
 (0)