add MTD support for Micron N25Qxxx family of QSPI flash

This commit is contained in:
ziggurat29 2016-04-17 12:20:07 -05:00
parent d71185ae46
commit 1b9d837df3
4 changed files with 1556 additions and 6 deletions

View File

@ -16,7 +16,7 @@ config MTD_PARTITION
accesses do not extend outside of the partition.
A FLASH device may be broken up into several partitions managed,
each managed by a separate MTD driver. The MTD parition interface
each managed by a separate MTD driver. The MTD partition interface
is described in:
include/nuttx/mtd/mtd.h
@ -43,7 +43,7 @@ config MTD_SECT512
If enabled, a MTD driver will be created that will convert the
sector size of any other MTD driver to a 512 byte "apparent" sector
size. The managed MTD driver in this case must have an erase block
size that is greater than 512B and an event multiple of 512B.
size that is greater than 512B and an even multiple of 512B.
if MTD_SECT512
@ -142,7 +142,7 @@ config MTD_CONFIG_RAM_CONSOLIDATE
(For configurations that have only a single erase block assigned
to the config device, RAM consolidation is the ONLY option.)
Another apporach is to allow the driver to use the entire MTD
Another approach is to allow the driver to use the entire MTD
device (or partition) to save config data, and then allocate a
RAM buffer (the size of one erase block) to perform the
consolidation. Enabling this feature basically trades off RAM
@ -305,7 +305,7 @@ config AT24XX_MULTI
default n
---help---
Build in additional support for multiple AT24XX devices, each with
dynamically allocated device structures wiath a separate I2C
dynamically allocated device structures with a separate I2C
addresses (but otherwise identical -- support for multiple, different
AT24xx, devices not yet supported).
@ -334,7 +334,7 @@ config AT24XX_EXTENDED
bool "Extended memory"
default n
---help---
If the device supports extended memory, then this operion may be set
If the device supports extended memory, then this operation may be set
to enabled the MTDIOC_EXTENDED ioctl() operation. When the
extended operation is selected, calls to the driver read method will
return data from the extended memory region.
@ -482,7 +482,7 @@ config S25FL1_SCRAMBLE
bool "Scramble data"
default n
---help---
Requires drviver support for data scrambling/descrambling.
Requires driver support for data scrambling/descrambling.
config S25FL1_SCRAMBLE_KEY
hex "Scramble key"
@ -491,6 +491,36 @@ config S25FL1_SCRAMBLE_KEY
endif
config MTD_N25QXXX
bool "QuadSPI-based Micron N25QXXX family FLASH"
default n
---help---
Support the N25Q016A, N25Q032A, N25Q064A, N25Q128A, N25Q256A
if MTD_N25QXXX
config N25QXXX_QSPIMODE
int "N25QXXX QuadSPI Mode"
default 0
---help---
This device can operate in SPI mode 0 or 3.
config N25QXXX_QSPI_FREQUENCY
int "N25QXXX QuadSPI Frequency"
default 108000000
---help---
- Clock frequency for all SPI commands except for Read Data
command (0x03)
- Clock frequency for Read Data command (0x03): 54 MHz
In this implementation, only "Quad" reads are performed.
config N25QXXX_SECTOR512
bool "Simulate 512 byte Erase Blocks"
default n
endif
config MTD_SMART
bool "Sector Mapped Allocation for Really Tiny (SMART) Flash support"
default n

View File

@ -104,6 +104,10 @@ ifeq ($(CONFIG_MTD_S25FL1),y)
CSRCS += s25fl1.c
endif
ifeq ($(CONFIG_MTD_N25QXXX),y)
CSRCS += n25qxxx.c
endif
ifeq ($(CONFIG_MTD_SMART),y)
ifeq ($(CONFIG_FS_SMARTFS),y)
CSRCS += smart.c

1503
drivers/mtd/n25qxxx.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -513,6 +513,19 @@ struct qspi_dev_s; /* Forward reference */
FAR struct mtd_dev_s *s25fl1_initialize(FAR struct qspi_dev_s *qspi,
bool unprotect);
/****************************************************************************
* Name: n25qxxx_initialize
*
* Description:
* Create an initialize MTD device instance for the QuadSPI-based N25Qxxx
* FLASH part from Micron.
*
****************************************************************************/
struct qspi_dev_s; /* Forward reference */
FAR struct mtd_dev_s *n25qxxx_initialize(FAR struct qspi_dev_s *qspi,
bool unprotect);
/****************************************************************************
* Name: up_flashinitialize
*