mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-19 05:53:31 +08:00
[sfud] 同步上游
This commit is contained in:
parent
448843ffd8
commit
b7572303f0
@ -91,7 +91,7 @@ typedef struct {
|
||||
#define SFUD_MF_ID_GIGADEVICE 0xC8
|
||||
#define SFUD_MF_ID_ISSI 0xD5
|
||||
#define SFUD_MF_ID_WINBOND 0xEF
|
||||
#define SFUD_MF_ID_NM 0x52
|
||||
#define SFUD_MF_ID_NOR_MEM 0x52
|
||||
|
||||
/* SFUD supported manufacturer information table */
|
||||
#define SFUD_MF_TABLE \
|
||||
@ -112,7 +112,7 @@ typedef struct {
|
||||
{"ISSI", SFUD_MF_ID_ISSI}, \
|
||||
{"Winbond", SFUD_MF_ID_WINBOND}, \
|
||||
{"Macronix", SFUD_MF_ID_MACRONIX}, \
|
||||
{"NOR-MEM", SFUD_MF_ID_NM}, \
|
||||
{"NOR-MEM", SFUD_MF_ID_NOR_MEM}, \
|
||||
}
|
||||
|
||||
#ifdef SFUD_USING_FLASH_INFO_TABLE
|
||||
@ -125,11 +125,15 @@ typedef struct {
|
||||
{ \
|
||||
{"AT45DB161E", SFUD_MF_ID_ATMEL, 0x26, 0x00, 2L*1024L*1024L, SFUD_WM_BYTE|SFUD_WM_DUAL_BUFFER, 512, 0x81}, \
|
||||
{"W25Q40BV", SFUD_MF_ID_WINBOND, 0x40, 0x13, 512L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"W25X40CL", SFUD_MF_ID_WINBOND, 0x30, 0x13, 512L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"W25X16AV", SFUD_MF_ID_WINBOND, 0x30, 0x15, 2L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"W25Q16BV", SFUD_MF_ID_WINBOND, 0x40, 0x15, 2L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"W25Q32BV", SFUD_MF_ID_WINBOND, 0x40, 0x16, 4L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"W25Q64CV", SFUD_MF_ID_WINBOND, 0x40, 0x17, 8L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"W25Q64DW", SFUD_MF_ID_WINBOND, 0x60, 0x17, 8L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"W25Q128BV", SFUD_MF_ID_WINBOND, 0x40, 0x18, 16L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"W25Q256FV", SFUD_MF_ID_WINBOND, 0x40, 0x19, 32L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"SST25VF080B", SFUD_MF_ID_SST, 0x25, 0x8E, 1L*1024L*1024L, SFUD_WM_BYTE|SFUD_WM_AAI, 4096, 0x20}, \
|
||||
{"SST25VF016B", SFUD_MF_ID_SST, 0x25, 0x41, 2L*1024L*1024L, SFUD_WM_BYTE|SFUD_WM_AAI, 4096, 0x20}, \
|
||||
{"M25P32", SFUD_MF_ID_MICRON, 0x20, 0x16, 4L*1024L*1024L, SFUD_WM_PAGE_256B, 64L*1024L, 0xD8}, \
|
||||
{"M25P80", SFUD_MF_ID_MICRON, 0x20, 0x14, 1L*1024L*1024L, SFUD_WM_PAGE_256B, 64L*1024L, 0xD8}, \
|
||||
@ -137,12 +141,13 @@ typedef struct {
|
||||
{"EN25Q32B", SFUD_MF_ID_EON, 0x30, 0x16, 4L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"GD25Q64B", SFUD_MF_ID_GIGADEVICE, 0x40, 0x17, 8L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"GD25Q16B", SFUD_MF_ID_GIGADEVICE, 0x40, 0x15, 2L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"GD25Q32C", SFUD_MF_ID_GIGADEVICE, 0x40, 0x16, 4L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"S25FL216K", SFUD_MF_ID_CYPRESS, 0x40, 0x15, 2L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"S25FL032P", SFUD_MF_ID_CYPRESS, 0x02, 0x15, 4L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"A25L080", SFUD_MF_ID_AMIC, 0x30, 0x14, 1L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"F25L004", SFUD_MF_ID_ESMT, 0x20, 0x13, 512L*1024L, SFUD_WM_BYTE|SFUD_WM_AAI, 4096, 0x20}, \
|
||||
{"PCT25VF016B", SFUD_MF_ID_SST, 0x25, 0x41, 2L*1024L*1024L, SFUD_WM_BYTE|SFUD_WM_AAI, 4096, 0x20}, \
|
||||
{"NM25Q128EVB", SFUD_MF_ID_NM, 0x21, 0x18, 16L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
{"NM25Q128EVB", SFUD_MF_ID_NOR_MEM, 0x21, 0x18, 16L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
|
||||
}
|
||||
#endif /* SFUD_USING_FLASH_INFO_TABLE */
|
||||
|
||||
@ -182,7 +187,7 @@ typedef struct {
|
||||
/* GD25Q64B */ \
|
||||
{SFUD_MF_ID_GIGADEVICE, 0x40, 0x17, NORMAL_SPI_READ|DUAL_OUTPUT}, \
|
||||
/* NM25Q128EVB */ \
|
||||
{SFUD_MF_ID_NM, 0x21, 0x18, NORMAL_SPI_READ|DUAL_OUTPUT|DUAL_IO|QUAD_OUTPUT|QUAD_IO}, \
|
||||
{SFUD_MF_ID_NOR_MEM, 0x21, 0x18, NORMAL_SPI_READ|DUAL_OUTPUT|DUAL_IO|QUAD_OUTPUT|QUAD_IO}, \
|
||||
}
|
||||
#endif /* SFUD_USING_QSPI */
|
||||
|
||||
|
@ -348,14 +348,18 @@ static sfud_err hardware_init(sfud_flash *flash) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/* I found when the flash write mode is supported AAI mode. The flash all blocks is protected,
|
||||
* so need change the flash status to unprotected before write and erase operate. */
|
||||
/* The flash all blocks is protected,so need change the flash status to unprotected before write and erase operate. */
|
||||
if (flash->chip.write_mode & SFUD_WM_AAI) {
|
||||
result = sfud_write_status(flash, true, 0x00);
|
||||
if (result != SFUD_SUCCESS) {
|
||||
return result;
|
||||
} else {
|
||||
/* MX25L3206E */
|
||||
if ((0xC2 == flash->chip.mf_id) && (0x20 == flash->chip.type_id) && (0x16 == flash->chip.capacity_id)) {
|
||||
result = sfud_write_status(flash, false, 0x00);
|
||||
}
|
||||
}
|
||||
if (result != SFUD_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/* if the flash is large than 16MB (256Mb) then enter in 4-Byte addressing mode */
|
||||
if (flash->chip.capacity > (1L << 24)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user