Merged in david_s5/nuttx/Lampoo-master-spi-flash (pull request #735)

drivers/mtd: add support to Macronix MX25LF25635F serial NOR flash

Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
David Sidrane 2018-10-17 23:24:45 +00:00 committed by GregoryN
parent 986bbf3ae7
commit 9547b186df
1 changed files with 16 additions and 0 deletions

View File

@ -94,6 +94,12 @@
#define MX25L_MX25L6433F_NSECTORS 2048
#define MX25L_MX25L6433F_PAGE_SHIFT 8 /* Page size 1 << 8 = 256 */
/* MX25L25635F capacity is 256Mbit */
#define MX25L_MX25L25635F_SECTOR_SHIFT 12 /* Sector size 1 << 12 = 4Kb */
#define MX25L_MX25L25635F_NSECTORS 8192
#define MX25L_MX25L25635F_PAGE_SHIFT 8 /* Page size 1 << 8 = 256 */
#ifdef CONFIG_MX25L_SECTOR512 /* Simulate a 512 byte sector */
# define MX25L_SECTOR512_SHIFT 9 /* Sector size 1 << 9 = 512 bytes */
#endif
@ -169,6 +175,7 @@
#define MX25L_JEDEC_MEMORY_TYPE 0x20 /* MX25Lx memory type */
#define MX25L_JEDEC_MX25L3233F_CAPACITY 0x16 /* MX25L3233F memory capacity */
#define MX25L_JEDEC_MX25L6433F_CAPACITY 0x17 /* MX25L6433F memory capacity */
#define MX25L_JEDEC_MX25L25635F_CAPACITY 0x19 /* MX25L25635F memory capacity */
/* Status register bit definitions */
@ -356,6 +363,15 @@ static inline int mx25l_readid(FAR struct mx25l_dev_s *priv)
priv->pageshift = MX25L_MX25L6433F_PAGE_SHIFT;
return OK;
}
else if (capacity == MX25L_JEDEC_MX25L25635F_CAPACITY)
{
/* Save the FLASH geometry */
priv->sectorshift = MX25L_MX25L25635F_SECTOR_SHIFT;
priv->nsectors = MX25L_MX25L25635F_NSECTORS;
priv->pageshift = MX25L_MX25L25635F_PAGE_SHIFT;
return OK;
}
}
return -ENODEV;