9
0
Fork 0

nor: Don't use the sector for the unlock sequence

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@pengutronix.de>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Wolfram Sang 2010-04-19 10:28:18 +02:00 committed by Sascha Hauer
parent f498576cb6
commit ac2d4d71ba
1 changed files with 8 additions and 8 deletions

View File

@ -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);