|
@@ -147,6 +147,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
|
|
int iflag, cflag, prot, sect;
|
|
int iflag, cflag, prot, sect;
|
|
int rc = ERR_OK;
|
|
int rc = ERR_OK;
|
|
int chip1;
|
|
int chip1;
|
|
|
|
+ ulong start;
|
|
|
|
|
|
/* first look for protection bits */
|
|
/* first look for protection bits */
|
|
|
|
|
|
@@ -190,7 +191,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
|
|
printf ("Erasing sector %2d ... ", sect);
|
|
printf ("Erasing sector %2d ... ", sect);
|
|
|
|
|
|
/* arm simple, non interrupt dependent timer */
|
|
/* arm simple, non interrupt dependent timer */
|
|
- set_timer (0);
|
|
|
|
|
|
+ start = get_timer(0);
|
|
|
|
|
|
if (info->protect[sect] == 0) { /* not protected */
|
|
if (info->protect[sect] == 0) { /* not protected */
|
|
volatile u16 *addr =
|
|
volatile u16 *addr =
|
|
@@ -211,7 +212,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
|
|
result = *addr;
|
|
result = *addr;
|
|
|
|
|
|
/* check timeout */
|
|
/* check timeout */
|
|
- if (get_timer (0) > CONFIG_SYS_FLASH_ERASE_TOUT) {
|
|
|
|
|
|
+ if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
|
|
MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
|
|
MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
|
|
chip1 = TMO;
|
|
chip1 = TMO;
|
|
break;
|
|
break;
|
|
@@ -264,6 +265,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
|
|
int rc = ERR_OK;
|
|
int rc = ERR_OK;
|
|
int cflag, iflag;
|
|
int cflag, iflag;
|
|
int chip1;
|
|
int chip1;
|
|
|
|
+ ulong start;
|
|
|
|
|
|
/*
|
|
/*
|
|
* Check if Flash is (sufficiently) erased
|
|
* Check if Flash is (sufficiently) erased
|
|
@@ -291,7 +293,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
|
|
*addr = data;
|
|
*addr = data;
|
|
|
|
|
|
/* arm simple, non interrupt dependent timer */
|
|
/* arm simple, non interrupt dependent timer */
|
|
- set_timer (0);
|
|
|
|
|
|
+ start = get_timer(0);
|
|
|
|
|
|
/* wait until flash is ready */
|
|
/* wait until flash is ready */
|
|
chip1 = 0;
|
|
chip1 = 0;
|
|
@@ -299,7 +301,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
|
|
result = *addr;
|
|
result = *addr;
|
|
|
|
|
|
/* check timeout */
|
|
/* check timeout */
|
|
- if (get_timer (0) > CONFIG_SYS_FLASH_ERASE_TOUT) {
|
|
|
|
|
|
+ if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
|
|
chip1 = ERR | TMO;
|
|
chip1 = ERR | TMO;
|
|
break;
|
|
break;
|
|
}
|
|
}
|