mtd/cfi: SST39VF3201B flash model not properly handled
Dear All,
as Wolfgang Denx suggested me, i am trying to use the u-boot CFI driver with a CFI flash (SSTVF3201B).
This flash chip allows erasing/writing blocks of 4 KBytes (called "sectors" in the SST datasheet), or 64 KBytes (called "blocks").
The command sequence table for this flash shows 2 different commands to operate on these 2 kind of blocks. 0x50 is for "sector erase" and "0x30" (the command used from u-boot CFI driver as AMD_CMD_ERASE_SECTOR) is for the 64KB "block" erase.
The issue:
now, u-boot CFI driver works fine on 64KB boundary ranges, but if i expect to erase a 4KB sector size i get a full 64KB block erased.
Proposed solution:
Initially, a single sector size definition would be good enough for this chip, so the user should specify if he wants a 64 or 4 KB sector to be used, using some CFG_X.
CFI driver, through queries, should be able to identify this particular chip so that it can be handled in a specific way from the CFI driver (cmd 0x50 for 4KB secotrs, or 0x30 for 64KB secotrs).
I am thinking about to post a patch on this.
Anyway, until new AMCORE board patch is not accepted, there is the chance this can result as a "dead code" if no-one use this flash chip except me.
So, before i start, please let me know how to proceed, maybe is better to use a specific flash.c for my board for now ?
Or if you think a patch can be useful, any suggestion on how to implement it is really welcome.
Best Regards,
Angelo Dureghello
Hi Angelo,
Quoted 2 lines · Angelo Dureghello
as Wolfgang Denx suggested me, i am trying to use the u-boot CFI driver with a CFI flash (SSTVF3201B).
Yes. But please take a look at the CONFIG_FLASH_CFI_LEGACY config option. This enables the legacy CFI flash devices. And IIRC the SST flash chips are supported via this driver/extension.
Quoted 20 lines
This flash chip allows erasing/writing blocks of 4 KBytes (called "sectors" in the SST datasheet), or 64 KBytes (called "blocks").
The command sequence table for this flash shows 2 different commands to operate on these 2 kind of blocks.
0x50is for "sector erase" and "0x30" (the command used from u-boot CFI driver asAMD_CMD_ERASE_SECTOR) is for the 64KB "block" erase.The issue:
now, u-boot CFI driver works fine on 64KB boundary ranges, but if i expect to erase a 4KB sector size i get a full 64KB block erased.Proposed solution:
Initially, a single sector size definition would be good enough for this chip, so the user should specify if he wants a 64 or 4 KB sector to be used, using someCFG_X.
CFI driver, through queries, should be able to identify this particular chip so that it can be handled in a specific way from the CFI driver (cmd0x50for 4KB secotrs, or0x30for 64KB secotrs).
Quoted 8 lines
I am thinking about to post a patch on this.
Anyway, until new AMCORE board patch is not accepted, there is the chance this can result as a "dead code" if no-one use this flash chip except me.So, before i start, please let me know how to proceed, maybe is better to use a specific
flash.cfor my board for now ?
Or if you think a patch can be useful, any suggestion on how to implement it is really welcome.
Please see my comment above. And grep for CONFIG_FLASH_CFI_LEGACY to see how its used in the config header. And if necessary, you can always extend the CFI configuration in the JEDEC source:
drivers/mtd/jedec_flash.c
Thanks,
Stefan
Dear Stefan Roese,
Quoted 11 lines
Quoted 2 lines
as Wolfgang Denx suggested me, i am trying to use the u-boot CFI driver with a CFI flash (SSTVF3201B).
Yes. But please take a look at the
CONFIG_FLASH_CFI_LEGACYconfig option. This enables the legacy CFI flash devices. And IIRC the SST flash chips are supported via this driver/extension.Quoted 3 lines
This flash chip allows erasing/writing blocks of 4 KBytes (called "sectors" in the SST datasheet), or 64 KBytes (called "blocks").
Quoted 6 lines
Quoted 1 line
The command sequence table for this flash shows 2 different commands to >
Please see my comment above. And grep for
CONFIG_FLASH_CFI_LEGACYto see how its used in the config header. And if necessary, you can always extend the CFI configuration in the JEDEC source:
drivers/mtd/jedec_flash.c
thaks for the hint, anyway seems i am unfortunate whit this flash chip:
first of all, i would understand why a flash chip is defined/handled as leagacy. Can someone kindly clarify this ? SST39VF3201B is a 2M x 16, CFI compliant.
CFI legacy dont seems anyway to support 0x50 command for erasing a sector, i grepped and found "only" a CMD_CLEAR_STATUS as 0x50 that don't seems to fit the case. But the code is not trivial, and i can miss something of course.
Also, legacy flash_info_t don't have any field to define the erase sector command. But still, i am not sure this chip should be considered legacy.
I grepped for *3201* SST chip, only baord that seems to use it is
esd/common
and this board has her own flash.c
But still, has been suggested me to use CFI driver, so i need to know what the u-boot community would prefer as approach.
Still a note. I found issues in Linux also for this chip (STT39VF3201B) and had to ask for a patch on the command set to allow the correct erase command to be used.
So how should i proceed ?
Many thanks.
Best Regards
Angelo Dureghello