driver/mtd: add support for mx25l16 serial flash

Signed-off-by: Hang Fan <fanhang@xiaomi.com>
This commit is contained in:
Hang Fan 2022-11-14 17:25:14 +08:00 committed by Petro Karashchenko
parent 596ce5e7b1
commit 5a367ad59d
1 changed files with 19 additions and 1 deletions

View File

@ -64,6 +64,12 @@
/* Chip Geometries **********************************************************/
/* MX25L1606E capacity is 16Mbit (2048Kbit x 8) = 2Mb (256kb x 8) */
#define MX25L_MX25L1606E_SECTOR_SHIFT 12 /* Sector size 1 << 12 = 4Kb */
#define MX25L_MX25L1606E_NSECTORS 512
#define MX25L_MX25L1606E_PAGE_SHIFT 8 /* Page size 1 << 8 = 256 */
/* MX25L3233F capacity is 32Mbit (4096Kbit x 8) = 4Mb (512kb x 8) */
#define MX25L_MX25L3233F_SECTOR_SHIFT 12 /* Sector size 1 << 12 = 4Kb */
@ -177,6 +183,8 @@
#define MX25L_JEDEC_MANUFACTURER 0xc2 /* Macronix manufacturer ID */
#define MX25L_JEDEC_MEMORY_TYPE 0x20 /* MX25Lx memory type */
#define MX25L_JEDEC_MX25L1606E_CAPACITY 0x15 /* MX25L1606E memory capacity */
#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 */
@ -368,7 +376,17 @@ static inline int mx25l_readid(FAR struct mx25l_dev_s *priv)
{
/* Okay.. is it a FLASH capacity that we understand? */
if (capacity == MX25L_JEDEC_MX25L3233F_CAPACITY)
if (capacity == MX25L_JEDEC_MX25L1606E_CAPACITY)
{
/* Save the FLASH geometry */
priv->sectorshift = MX25L_MX25L1606E_SECTOR_SHIFT;
priv->nsectors = MX25L_MX25L1606E_NSECTORS;
priv->pageshift = MX25L_MX25L1606E_PAGE_SHIFT;
priv->addressbytes = MX25L_ADDRESSBYTES_3;
return OK;
}
else if (capacity == MX25L_JEDEC_MX25L3233F_CAPACITY)
{
/* Save the FLASH geometry */