[PATCH 7/7] nor: Don't use the sector for the unlock sequence

Wolfram Sang w.sang at pengutronix.de
Mon Apr 19 04:28:18 EDT 2010


Copy the behaviour from Linux which does:

cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL);
...

(Notice the third parameter which is simply chip->start).

Solves erase problems with SST flashes.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
Signed-off-by: Wolfram Sang <w.sang at pengutronix.de>
---

This should be tested on some other boards!

 drivers/nor/cfi_flash_amd.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/nor/cfi_flash_amd.c b/drivers/nor/cfi_flash_amd.c
index 4f0ab57..411d8e6 100644
--- a/drivers/nor/cfi_flash_amd.c
+++ b/drivers/nor/cfi_flash_amd.c
@@ -2,10 +2,10 @@
 #include <stdio.h>
 #include "cfi_flash.h"
 
-static void flash_unlock_seq (flash_info_t * info, flash_sect_t sect)
+static void flash_unlock_seq (flash_info_t * info)
 {
-	flash_write_cmd (info, sect, AMD_ADDR_START, AMD_CMD_UNLOCK_START);
-	flash_write_cmd (info, sect, AMD_ADDR_ACK, AMD_CMD_UNLOCK_ACK);
+	flash_write_cmd (info, 0, AMD_ADDR_START, AMD_CMD_UNLOCK_START);
+	flash_write_cmd (info, 0, AMD_ADDR_ACK, AMD_CMD_UNLOCK_ACK);
 }
 
 /*
@@ -21,7 +21,7 @@ static void amd_read_jedec_ids (flash_info_t * info)
 	info->device_id2      = 0;
 
 	flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
-	flash_unlock_seq(info, 0);
+	flash_unlock_seq(info);
 	flash_write_cmd(info, 0, AMD_ADDR_START, FLASH_CMD_READ_ID);
 	udelay(1000); /* some flash are slow to respond */
 	info->manufacturer_id = flash_read_uchar (info,
@@ -73,10 +73,10 @@ static int amd_flash_is_busy (flash_info_t * info, flash_sect_t sect)
 
 static int amd_flash_erase_one (flash_info_t * info, long sect)
 {
-	flash_unlock_seq (info, sect);
+	flash_unlock_seq(info);
 	flash_write_cmd (info, sect, AMD_ADDR_ERASE_START,
 				AMD_CMD_ERASE_START);
-	flash_unlock_seq (info, sect);
+	flash_unlock_seq(info);
 	flash_write_cmd (info, sect, 0, AMD_CMD_ERASE_SECTOR);
 
 	return flash_status_check(info, sect, info->erase_blk_tout, "erase");
@@ -84,7 +84,7 @@ static int amd_flash_erase_one (flash_info_t * info, long sect)
 
 static void amd_flash_prepare_write(flash_info_t * info)
 {
-	flash_unlock_seq (info, 0);
+	flash_unlock_seq(info);
 	flash_write_cmd (info, 0, AMD_ADDR_START, AMD_CMD_WRITE);
 }
 
@@ -103,7 +103,7 @@ static int amd_flash_write_cfibuffer (flash_info_t * info, ulong dest, const uch
 	dst.cp = (uchar *) dest;
 	sector = find_sector (info, dest);
 
-	flash_unlock_seq(info,0);
+	flash_unlock_seq(info);
 	flash_make_cmd (info, AMD_CMD_WRITE_TO_BUFFER, &cword);
 	flash_write_word(info, cword, (void *)dest);
 
-- 
1.7.0




More information about the barebox mailing list