Macronix MX25RXX driver: add support for MX25LXX as well

Co-authored-by: Peter van der Perk <peter.vanderperk@nxp.com>
This commit is contained in:
Jari van Ewijk 2022-07-22 10:20:39 +02:00 committed by Xiang Xiao
parent 8eae3bb5ff
commit d3b1ee9866
2 changed files with 21 additions and 0 deletions

View File

@ -716,6 +716,14 @@ config MX25RXX_SECTOR512
bool "Simulate 512 byte Erase Blocks"
default n
config MX25RXX_PAGE128
bool "128 byte size pages"
default n
config MX25RXX_LXX
bool "Run MX25RXX driver in MX25LXX mode"
default n
endif # MTD_MX25RXX
config MTD_SMART

View File

@ -100,7 +100,11 @@
/* JEDEC Read ID register values */
#define MX25R_JEDEC_MANUFACTURER 0xc2 /* Macronix manufacturer ID */
#ifdef CONFIG_MX25RXX_LXX
#define MX25R_JEDEC_MEMORY_TYPE 0x20 /* MX25Lx memory type */
#else
#define MX25R_JEDEC_MEMORY_TYPE 0x28 /* MX25Rx memory type */
#endif
#define MX25R_JEDEC_MX25R6435F_CAPACITY 0x17 /* MX25R6435F memory capacity */
#define MX25R_JEDEC_MX25R8035F_CAPACITY 0x14 /* MX25R8035F memory capacity */
@ -112,7 +116,12 @@
#define MX25R6435F_SECTOR_SHIFT (12)
#define MX25R6435F_SECTOR_COUNT (2048)
#define MX25R6435F_PAGE_SIZE (256)
#ifdef CONFIG_MX25RXX_PAGE128
#define MX25R6435F_PAGE_SHIFT (7)
#else
#define MX25R6435F_PAGE_SHIFT (8)
#endif
/* Status register bit definitions */
@ -539,7 +548,11 @@ void mx25rxx_write_status_config(FAR struct mx25rxx_dev_s *dev,
dev->cmdbuf[1] = config & 0xff;
dev->cmdbuf[2] = config >> 8;
#ifdef CONFIG_MX25RXX_LXX
mx25rxx_command_write(dev->qspi, MX25R_WRSR, dev->cmdbuf, 2);
#else
mx25rxx_command_write(dev->qspi, MX25R_WRSR, dev->cmdbuf, 3);
#endif
mx25rxx_write_enable(dev, false);
}