cfi_flash_intel: support 1024b buffer write
PATCH 1/1 cfi_flash_intel: support 1024b buffer write
newer Numonyx Strataflash P3x have 1024b buffer, thus, it's possible to write a buffer size of 0x200 which the actual flash_write_cmd doesn't permit as it's limited to a uchar parameter.
--- drivers/nor/cfi_flash.c | 11 +++++++++++ drivers/nor/cfi_flash.h | 1 + drivers/nor/cfi_flash_intel.c | 5 ++++- 3 files changed, 16 insertions(+), 1 deletions(-)
drivers/nor/cfi_flash.c +11 -0
@@ -863,6 +863,17 @@ void flash_write_cmd (flash_info_t * info, flash_sect_t sect, uint offset, ucharflash_write_word (info, cword, addr); } +void flash_write_cmd16 (flash_info_t * info,flash_sect_t sect,uint offset,ushort cmd) +{ + +uchar *addr; +cfiword_t cword; + + addr =flash_make_addr (info, sect, offset); + cword.w = cmd; +flash_write_word (info, cword, addr); +} +int flash_isequal (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd) {cfiptr_t cptr;
drivers/nor/cfi_flash.h +1 -0
@@ -182,6 +182,7 @@ extern struct cfi_cmd_set cfi_cmd_set_amd;int flash_isset (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd);void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd); +void flash_write_cmd16 (flash_info_t * info,flash_sect_t sect,uint offset,ushort cmd);flash_sect_t find_sector (flash_info_t * info,ulong addr);int flash_status_check (flash_info_t * info,flash_sect_t sector,uint64_t tout,char *prompt);
drivers/nor/cfi_flash_intel.c +4 -1
@@ -71,7 +71,10 @@ static int intel_flash_write_cfibuffer (flash_info_t * info, ulong dest, const u/* reduce the number of loops by the width of the port */ cnt = len >> (info->portwidth -1 ); -flash_write_cmd (info, sector,0 , (uchar ) cnt -1 ); +if (cnt >0x100 ) +flash_write_cmd16 (info, sector,0 , (ushort ) cnt -1 ); +else +flash_write_cmd (info, sector,0 , (uchar ) cnt -1 );while (cnt-- >0 ) {if (bankwidth_is_1 (info)) { *dst.cp++ = *src.cp++;
Signature · 7 lines
1.6.3.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 4 lines · Eric Bénard
newer Numonyx Strataflash P3x have 1024b buffer, thus, it's possible to write a buffer size of
0x200which the actualflash_write_cmddoesn't permit as it's limited to a uchar parameter.
note : there is certainly a better way to fix this problem but I think this would need much more work in cfi_flash and may break other platforms, so I sent this patch which may help peoples using recent flashs but I'm quite sure it won't be pushed ;-)
Eric
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox