issue write command to base for JEDEC flash
PATCH v2 1/1 issue write command to base for JEDEC flash
From: Po-Yu Chuang <[email protected]>
For JEDEC flash, we should issue word programming command relative to base address rather than sector base address. Original source makes SST Flash fails to program sectors which are not on the 0x10000 boundaries.
e.g.
SST39LF040 uses addr1=0x5555 and addr2=0x2AAA, however, each sector is 0x1000 bytes.
Thus, if we issue command to "sector base (0x41000) + offset(0x5555)", it sends to 0x46555 and the chip fails to recognize that address.
This patch is tested with SST39LF040.
--- drivers/mtd/cfi_flash.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
drivers/mtd/cfi_flash.c +8 -3
@@ -835,14 +835,19 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest,break ;case CFI_CMDSET_AMD_EXTENDED :case CFI_CMDSET_AMD_STANDARD : -#ifdef CONFIG_FLASH_CFI_LEGACY -case CFI_CMDSET_AMD_LEGACY : -#endif sect =find_sector (info, dest);flash_unlock_seq (info, sect);flash_write_cmd (info, sect, info->addr_unlock1,AMD_CMD_WRITE ); sect_found =1 ;break ; +#ifdef CONFIG_FLASH_CFI_LEGACY +case CFI_CMDSET_AMD_LEGACY : + sect =find_sector (info, dest); +flash_unlock_seq (info,0 ); +flash_write_cmd (info,0 , info->addr_unlock1,AMD_CMD_WRITE ); + sect_found =1 ; +break ; +#endif }switch (info->portwidth) {
Signature · 1 line
1.6.3.3
PATCH v2 1/1 issue write command to base for JEDEC flash
Quoted 6 lines · On Friday 10 July 2009 12:03:57 ratbert.chuang at gmail.com wrote:
From: Po-Yu Chuang <[email protected]>
For JEDEC flash, we should issue word programming command relative to base address rather than sector base address. Original source makes SST Flash fails to program sectors which are not on the
0x10000boundaries.
Quoted 8 lines
e.g.
SST39LF040 uses addr1=0x5555 and addr2=0x2AAA, however, each sector is0x1000bytes.Thus, if we issue command to "sector base (
0x41000) + offset(0x5555)", it sends to0x46555and the chip fails to recognize that address.This patch is tested with SST39LF040.
Applied to u-boot-cfi. Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================