Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiP: add W25N01GW and GD5F1GQ4RB9IG #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/spi_nand_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@

/* SPI NAND Device ID */
#define _SPI_NAND_DEVICE_ID_GD5F1GQ4UAYIG 0xF1
#define _SPI_NAND_DEVICE_ID_GD5F1GQ4RB9IG 0xC1
#define _SPI_NAND_DEVICE_ID_GD5F1GQ4UBYIG 0xD1
#define _SPI_NAND_DEVICE_ID_GD5F1GQ4UCYIG 0xB1
#define _SPI_NAND_DEVICE_ID_GD5F2GQ4UBYIG 0xD2
Expand All @@ -133,6 +134,8 @@
#define _SPI_NAND_DEVICE_ID_F50L2G41LB 0x0A
#define _SPI_NAND_DEVICE_ID_1_W25N01GV 0xAA
#define _SPI_NAND_DEVICE_ID_2_W25N01GV 0x21
#define _SPI_NAND_DEVICE_ID_1_W25N01GW 0xBA
#define _SPI_NAND_DEVICE_ID_2_W25N01GW 0x21
#define _SPI_NAND_DEVICE_ID_1_W25N02KV 0xAA
#define _SPI_NAND_DEVICE_ID_2_W25N02KV 0x22
#define _SPI_NAND_DEVICE_ID_1_W25M02GV 0xAB
Expand Down Expand Up @@ -297,6 +300,20 @@ static const struct SPI_NAND_FLASH_INFO_T spi_nand_flash_tables[] = {
feature: SPI_NAND_FLASH_FEATURE_NONE,
},

{
mfr_id: _SPI_NAND_MANUFACTURER_ID_GIGADEVICE,
dev_id: _SPI_NAND_DEVICE_ID_GD5F1GQ4RB9IG,
ptr_name: "GIGADEVICE GD5F1GQ4xBxIG",
device_size: _SPI_NAND_CHIP_SIZE_1GBIT,
page_size: _SPI_NAND_PAGE_SIZE_2KBYTE,
oob_size: _SPI_NAND_OOB_SIZE_128BYTE,
erase_size: _SPI_NAND_BLOCK_SIZE_128KBYTE,
dummy_mode: SPI_NAND_FLASH_READ_DUMMY_BYTE_APPEND,
read_mode: SPI_NAND_FLASH_READ_SPEED_MODE_DUAL,
write_mode: SPI_NAND_FLASH_WRITE_SPEED_MODE_SINGLE,
feature: SPI_NAND_FLASH_FEATURE_NONE,
},

{
mfr_id: _SPI_NAND_MANUFACTURER_ID_GIGADEVICE,
dev_id: _SPI_NAND_DEVICE_ID_GD5F1GQ4UBYIG,
Expand Down Expand Up @@ -508,6 +525,21 @@ static const struct SPI_NAND_FLASH_INFO_T spi_nand_flash_tables[] = {
feature: SPI_NAND_FLASH_FEATURE_NONE,
},

{
mfr_id: _SPI_NAND_MANUFACTURER_ID_WINBOND,
dev_id: _SPI_NAND_DEVICE_ID_1_W25N01GW,
dev_id_2: _SPI_NAND_DEVICE_ID_2_W25N01GW,
ptr_name: "WINBOND W25N01G",
device_size: _SPI_NAND_CHIP_SIZE_1GBIT,
page_size: _SPI_NAND_PAGE_SIZE_2KBYTE,
oob_size: _SPI_NAND_OOB_SIZE_64BYTE,
erase_size: _SPI_NAND_BLOCK_SIZE_128KBYTE,
dummy_mode: SPI_NAND_FLASH_READ_DUMMY_BYTE_APPEND,
read_mode: SPI_NAND_FLASH_READ_SPEED_MODE_DUAL,
write_mode: SPI_NAND_FLASH_WRITE_SPEED_MODE_SINGLE,
feature: SPI_NAND_FLASH_FEATURE_NONE,
},

{
mfr_id: _SPI_NAND_MANUFACTURER_ID_WINBOND,
dev_id: _SPI_NAND_DEVICE_ID_1_W25N02KV,
Expand Down Expand Up @@ -2326,6 +2358,7 @@ static SPI_NAND_FLASH_RTN_T ecc_fail_check( u32 page_number )

if((ptr_dev_info_t->mfr_id == _SPI_NAND_MANUFACTURER_ID_GIGADEVICE) &&
((ptr_dev_info_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4UAYIG) ||
(ptr_dev_info_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4RB9IG) ||
(ptr_dev_info_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4UBYIG) ||
(ptr_dev_info_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4UCYIG) ||
(ptr_dev_info_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4UEYIS) ||
Expand All @@ -2338,6 +2371,7 @@ static SPI_NAND_FLASH_RTN_T ecc_fail_check( u32 page_number )
(ptr_dev_info_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F4GQ4UCYIG)))
{
if((ptr_dev_info_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4UAYIG) ||
(ptr_dev_info_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4RB9IG) ||
(ptr_dev_info_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4UBYIG) ||
(ptr_dev_info_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4UEYIS) ||
(ptr_dev_info_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ5UEYIG) ||
Expand Down Expand Up @@ -3145,6 +3179,7 @@ static void spi_nand_manufacute_init( struct SPI_NAND_FLASH_INFO_T *ptr_device_t
_SPI_NAND_DEBUG_PRINTF(SPI_NAND_FLASH_DEBUG_LEVEL_1,"SPI NAND Chip Init : Unlock all block and Enable Quad Mode\n");

if(((ptr_device_t->mfr_id == _SPI_NAND_MANUFACTURER_ID_GIGADEVICE) && (ptr_device_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4UAYIG)) ||
((ptr_device_t->mfr_id == _SPI_NAND_MANUFACTURER_ID_GIGADEVICE) && (ptr_device_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4RB9IG)) ||
((ptr_device_t->mfr_id == _SPI_NAND_MANUFACTURER_ID_GIGADEVICE) && (ptr_device_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4UBYIG)) ||
((ptr_device_t->mfr_id == _SPI_NAND_MANUFACTURER_ID_GIGADEVICE) && (ptr_device_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4UCYIG)) ||
((ptr_device_t->mfr_id == _SPI_NAND_MANUFACTURER_ID_GIGADEVICE) && (ptr_device_t->dev_id == _SPI_NAND_DEVICE_ID_GD5F1GQ4UEYIS)) ||
Expand Down