Skip to contentSkip to conversation

cfi_flash write fix for AMD legacy

PATCH New Ed Swarthout 2 participants 2 messages Oct 9, 2008 – Oct 13, 2008 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cfi_flash write fix for AMD legacy

The flash_unlock_seq requires a sector for AMD_LEGACY. Fix a retcode check typeo.

---

This patch is needed to make flash work on an internal testcard.

 drivers/mtd/cfi_flash.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/cfi_flash.c +5 -3
index 0d1ee8a..6cd2c5a 100644
@@ -681,7 +681,7 @@ static int flash_full_status_check (flash_info_t * info, flash_sect_t sector,
 	case CFI_CMDSET_INTEL_PROG_REGIONS:
 	case CFI_CMDSET_INTEL_EXTENDED:
 	case CFI_CMDSET_INTEL_STANDARD:
-		if ((retcode == ERR_OK)
+		if ((retcode != ERR_OK)
 		    && !flash_isequal (info, sector, 0, FLASH_STATUS_DONE)) {
 			retcode = ERR_INVAL;
 			printf ("Flash %s error at address %lx\n", prompt,
@@ -777,6 +777,7 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest,
 {
 	void *dstaddr;
 	int flag;
+	flash_sect_t sect;
 
 	dstaddr = map_physmem(dest, info->portwidth, MAP_NOCACHE);
 
@@ -818,8 +819,9 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest,
 #ifdef CONFIG_FLASH_CFI_LEGACY
 	case CFI_CMDSET_AMD_LEGACY:
 #endif
-		flash_unlock_seq (info, 0);
-		flash_write_cmd (info, 0, info->addr_unlock1, AMD_CMD_WRITE);
+		sect = find_sector(info, dest);
+		flash_unlock_seq (info, sect);
+		flash_write_cmd (info, sect, info->addr_unlock1, AMD_CMD_WRITE);
 		break;
 	}
 
Signature · 1 line
1.5.6.5
Applied
#1 lore raw

PATCH 1/1 cfi_flash write fix for AMD legacy

Quoted 2 lines · Ed Swarthout

The flash_unlock_seq requires a sector for AMD_LEGACY. Fix a retcode check typeo.

Applied to cfi/master. 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
=====================================================================