[U-Boot] [U-BOOT] cfi_flash.c fails to program NOR Flash SST39LF040

Po-Yu Chuang ratbert.chuang at gmail.com
Fri Apr 24 04:39:04 CEST 2009


Hello,


I have a board on which there is a NOR Flash SST39LF040.

Previously, I copied flash.c from other boards.

Now I am trying to migrate NOR Flash driver to use CFI, but it fails
to program sectors which
are not on the 0x10000 boundaries.

I found that in function flash_write_cfiword()
@drivers/mtd/cfi_flash.c it issues command
with address relative to sector address.
However, according to SST39 series data sheet, it seems that we should
issue command
with address relative to flash base address?

After I modified flash_write_cfiword() to issue command to sector 0,
everything works fine.

Is it a bug?

Index: cfi_flash.c
===================================================================
RCS file: /usr/local/cvsroot/ctd/FA5A320LINUX26_u-boot/drivers/mtd/cfi_flash.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 cfi_flash.c
--- cfi_flash.c	23 Mar 2009 02:54:57 -0000	1.1.1.1
+++ cfi_flash.c	24 Apr 2009 02:28:32 -0000
@@ -839,8 +839,8 @@
 	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);
+		flash_unlock_seq (info, 0);
+		flash_write_cmd (info, 0, info->addr_unlock1, AMD_CMD_WRITE);
 		sect_found = 1;
 		break;
 	}

regards

Po-Yu Chuang


More information about the U-Boot mailing list