mirror of
https://gitee.com/Vancouver2017/luban-lite.git
synced 2025-12-25 13:38:54 +00:00
v1.0.3
This commit is contained in:
@@ -26,8 +26,8 @@
|
||||
* Created on: 2016-06-09
|
||||
*/
|
||||
|
||||
#ifndef _SFUD_FLASH_DEF_H_
|
||||
#define _SFUD_FLASH_DEF_H_
|
||||
#ifndef BSP_PERIPHERAL_SPINOR_SFUD_INC_SFUD_FLASH_DEF_H_
|
||||
#define BSP_PERIPHERAL_SPINOR_SFUD_INC_SFUD_FLASH_DEF_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sfud_cfg.h>
|
||||
@@ -220,7 +220,7 @@ typedef struct {
|
||||
{SFUD_MF_ID_ZETTA, 0x32, 0x17, NORMAL_SPI_READ|DUAL_OUTPUT|DUAL_IO|QUAD_OUTPUT}, \
|
||||
}
|
||||
|
||||
/* those flash SFDP basic_len < 15, and the QE at SR1-BIT6, the sfud can not recognition */
|
||||
/* those flash SFDP basic_len < 15, and the QE at SR1-BIT6, or specially SFDP (ZB25VQ16C QE info at Dword-14), the sfud can not recognition */
|
||||
#define SFUD_FLASH_QE_INFO_TABLE \
|
||||
{ \
|
||||
/* MX25L6433FM2I */ \
|
||||
@@ -229,6 +229,8 @@ typedef struct {
|
||||
{SFUD_MF_ID_MACRONIX, 0x20, 0x18, SFUD_CMD_WRITE_STATUS_REGISTER, SFUD_CMD_READ_STATUS_REGISTER, 6}, \
|
||||
/* MX25L25635E */ \
|
||||
{SFUD_MF_ID_MACRONIX, 0x20, 0x19, SFUD_CMD_WRITE_STATUS_REGISTER, SFUD_CMD_READ_STATUS_REGISTER, 6}, \
|
||||
/* ZB25VQ16C */ \
|
||||
{SFUD_MF_ID_ZBIT, 0x40, 0x15, SFUD_CMD_WRITE_STATUS2_REGISTER, SFUD_CMD_READ_CONFIG_REGISTER, 1}, \
|
||||
}
|
||||
|
||||
#endif /* SFUD_USING_QSPI */
|
||||
@@ -237,4 +239,4 @@ typedef struct {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SFUD_FLASH_DEF_H_ */
|
||||
#endif /* BSP_PERIPHERAL_SPINOR_SFUD_INC_SFUD_FLASH_DEF_H_ */
|
||||
|
||||
@@ -492,8 +492,8 @@ sfud_err sfud_read(const sfud_flash *flash, uint32_t addr, size_t size, uint8_t
|
||||
}
|
||||
if (result == SFUD_SUCCESS) {
|
||||
do {
|
||||
if ((dolen & (READ_ALIGN_SIZE - 1)) && (dolen > SFUD_WRITE_MAX_PAGE_SIZE)) {
|
||||
dolen -= dolen & (READ_ALIGN_SIZE - 1);
|
||||
if ((dolen & (CACHE_LINE_SIZE - 1)) && (dolen > SFUD_WRITE_MAX_PAGE_SIZE)) {
|
||||
dolen -= dolen & (CACHE_LINE_SIZE- 1);
|
||||
}
|
||||
|
||||
result = sfud_read_data(flash, addr, dolen, p);
|
||||
|
||||
@@ -202,7 +202,7 @@ static bool read_basic_table(sfud_flash *flash, sfdp_para_header *basic_header)
|
||||
uint32_t table_addr = basic_header->ptp;
|
||||
/* parameter table */
|
||||
uint8_t table[BASIC_TABLE_LEN * 4] __attribute__((aligned(CACHE_LINE_SIZE)));
|
||||
uint8_t i, j;
|
||||
uint8_t i, j, erase_param_off = 24;
|
||||
uint32_t bfpt_len;
|
||||
|
||||
SFUD_ASSERT(flash);
|
||||
@@ -216,6 +216,8 @@ static bool read_basic_table(sfud_flash *flash, sfdp_para_header *basic_header)
|
||||
SFUD_INFO("Warning: Can't read JEDEC basic flash parameter table.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* print JEDEC basic flash parameter table info */
|
||||
SFUD_DEBUG("JEDEC basic flash parameter table info:");
|
||||
SFUD_DEBUG("MSB-LSB 3 2 1 0");
|
||||
@@ -240,7 +242,7 @@ static bool read_basic_table(sfud_flash *flash, sfdp_para_header *basic_header)
|
||||
return false;
|
||||
}
|
||||
/* get write granularity */
|
||||
//TODO 目前为 1.0 所提供的方式,后期支持 V1.5 及以上的方式读取 page size
|
||||
//TODO At present, the way provided by V1.0, later support V1.5 and above to read page size.
|
||||
switch ((table[0] & (0x01 << 2)) >> 2) {
|
||||
case 0:
|
||||
sfdp->write_gran = 1;
|
||||
@@ -321,10 +323,12 @@ static bool read_basic_table(sfud_flash *flash, sfdp_para_header *basic_header)
|
||||
}
|
||||
SFUD_DEBUG("Capacity is %ld Bytes.", sfdp->capacity);
|
||||
/* get erase size and erase command */
|
||||
if (table[erase_param_off] == 0xFF)
|
||||
erase_param_off = 28;
|
||||
for (i = 0, j = 0; i < SFUD_SFDP_ERASE_TYPE_MAX_NUM; i++) {
|
||||
if (table[28 + 2 * i] != 0x00) {
|
||||
sfdp->eraser[j].size = 1L << table[28 + 2 * i];
|
||||
sfdp->eraser[j].cmd = table[28 + 2 * i + 1];
|
||||
if (table[erase_param_off + 2 * i] != 0x00) {
|
||||
sfdp->eraser[j].size = 1L << table[erase_param_off + 2 * i];
|
||||
sfdp->eraser[j].cmd = table[erase_param_off + 2 * i + 1];
|
||||
SFUD_DEBUG("Flash device supports %ldKB block erase. Command is 0x%02X.", sfdp->eraser[j].size / 1024,
|
||||
sfdp->eraser[j].cmd);
|
||||
j++;
|
||||
@@ -378,7 +382,8 @@ static bool read_basic_table(sfud_flash *flash, sfdp_para_header *basic_header)
|
||||
* supported.
|
||||
*/
|
||||
flash->flags |= SNOR_F_HAS_16BIT_SR | SNOR_F_NO_READ_CR;
|
||||
flash->quad_enable = spi_nor_sr2_bit1_quad_enable;
|
||||
|
||||
flash->quad_enable = spi_nor_quad_enable;
|
||||
break;
|
||||
|
||||
case BFPT_DWORD15_QER_SR1_BIT6:
|
||||
|
||||
Reference in New Issue
Block a user