1 /*
2  * Copyright 2019-2020 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #include "evkmimxrt1010_flexspi_nor_config.h"
9 
10 /* Component ID definition, used by tools. */
11 #ifndef FSL_COMPONENT_ID
12 #define FSL_COMPONENT_ID "platform.drivers.xip_board"
13 #endif
14 
15 /*******************************************************************************
16  * Code
17  ******************************************************************************/
18 #if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1)
19 #if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__)
20 __attribute__((section(".boot_hdr.conf"), used))
21 #elif defined(__ICCARM__)
22 #pragma location = ".boot_hdr.conf"
23 #endif
24 
25 const flexspi_nor_config_t qspiflash_config = {
26     .memConfig =
27         {
28             .tag              = FLEXSPI_CFG_BLK_TAG,
29             .version          = FLEXSPI_CFG_BLK_VERSION,
30             .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad,
31             .csHoldTime       = 3u,
32             .csSetupTime      = 3u,
33             .deviceType       = kFlexSpiDeviceType_SerialNOR,
34             .sflashPadType    = kSerialFlash_4Pads,
35             .serialClkFreq    = kFlexSpiSerialClk_120MHz,
36             .sflashA1Size     = 16u * 1024u * 1024u,
37             .lookupTable =
38                 {
39                     // Read LUTs
40                     FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
41                     FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04),
42 
43                     // Read Status LUTs
44                     [4 * 1 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x04),
45 
46                     // Write Enable LUTs
47                     [4 * 3 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP, FLEXSPI_1PAD, 0x0),
48 
49                     // Erase Sector LUTs
50                     [4 * 5 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20, RADDR_SDR, FLEXSPI_1PAD, 0x18),
51 
52                     // Erase Block LUTs
53                     [4 * 8 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8, RADDR_SDR, FLEXSPI_1PAD, 0x18),
54 
55                     // Pape Program LUTs
56                     [4 * 9 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02, RADDR_SDR, FLEXSPI_1PAD, 0x18),
57                     [4 * 9 + 1] = FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04, STOP, FLEXSPI_1PAD, 0x0),
58 
59                     // Erase Chip LUTs
60                     [4 * 11 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60, STOP, FLEXSPI_1PAD, 0x0),
61                 },
62         },
63     .pageSize           = 256u,
64     .sectorSize         = 4u * 1024u,
65     .ipcmdSerialClkFreq = 1u,
66     .blockSize          = 64u * 1024u,
67     .isUniformBlockSize = false,
68 };
69 #endif /* XIP_BOOT_HEADER_ENABLE */
70