fsl_flexspi_nor_flash.c 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * The Clear BSD License
  3. * Copyright 2017 NXP
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted (subject to the limitations in the disclaimer below) provided
  8. * that the following conditions are met:
  9. *
  10. * o Redistributions of source code must retain the above copyright notice, this list
  11. * of conditions and the following disclaimer.
  12. *
  13. * o Redistributions in binary form must reproduce the above copyright notice, this
  14. * list of conditions and the following disclaimer in the documentation and/or
  15. * other materials provided with the distribution.
  16. *
  17. * o Neither the name of the copyright holder nor the names of its
  18. * contributors may be used to endorse or promote products derived from this
  19. * software without specific prior written permission.
  20. *
  21. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  23. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  24. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  26. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  27. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  29. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. #include "fsl_flexspi_nor_flash.h"
  34. /*******************************************************************************
  35. * Code
  36. ******************************************************************************/
  37. #if defined(__CC_ARM) || defined(__GNUC__)
  38. __attribute__((section(".boot_hdr.conf")))
  39. #elif defined(__ICCARM__)
  40. #pragma location=".boot_hdr.conf"
  41. #endif
  42. const flexspi_nor_config_t qspiflash_config = {
  43. .memConfig =
  44. {
  45. .tag = FLEXSPI_CFG_BLK_TAG,
  46. .version = FLEXSPI_CFG_BLK_VERSION,
  47. .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad,
  48. .csHoldTime = 3u,
  49. .csSetupTime = 3u,
  50. // Enable DDR mode, Wordaddassable, Safe configuration, Differential clock
  51. .sflashPadType = kSerialFlash_4Pads,
  52. .serialClkFreq = kFlexSpiSerialClk_100MHz,
  53. .sflashA1Size = 8u * 1024u * 1024u,
  54. .lookupTable =
  55. {
  56. // Read LUTs
  57. FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
  58. FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04),
  59. },
  60. },
  61. .pageSize = 256u,
  62. .sectorSize = 4u * 1024u,
  63. .blockSize = 256u * 1024u,
  64. .isUniformBlockSize = false,
  65. };