int flash_erase (flash_info_t * info, int s_first, int s_last)
{
int flag, prot, sect;
- ulong type, start, last;
+ ulong type, start;
int rcode = 0, intel = 0;
if ((s_first < 0) || (s_first > s_last)) {
}
start = get_timer (0);
- last = start;
/* Disable interrupts which might cause a timeout here */
flag = disable_interrupts ();
printf (" done\n");
}
}
+ if (flag)
+ enable_interrupts();
+
return rcode;
}
{
FPWV *addr = (FPWV *) dest;
ulong start;
- int flag;
+ int flag, rc = 0;
/* Check if Flash is (sufficiently) erased */
if ((*addr & data) != data) {
/* wait while polling the status register */
while ((*addr & (FPW) 0x00800080) != (FPW) 0x00800080) {
if (get_timer (start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
- *addr = (FPW) 0x00FF00FF; /* restore read mode */
- return (1);
+ rc = 1;
+ goto OUT;
}
}
- *addr = (FPW) 0x00FF00FF; /* restore read mode */
+OUT:
+ *addr = (FPW)0x00FF00FF; /* restore read mode */
- return (0);
+ if (flag)
+ enable_interrupts();
+
+ return rc;
}
/*-----------------------------------------------------------------------
FPWV *srcaddr = (FPWV *) src;
FPWV *dstaddr = (FPWV *) dest;
ulong start;
- int flag, i;
+ int flag, i, rc = 0;
/* Check if Flash is (sufficiently) erased */
for (i = 0; i < WR_BLOCK; i++)
start = get_timer (0);
/* wait while polling the status register */
- while ((*dstaddr & (FPW) 0x00800080) != (FPW) 0x00800080) {
- if (get_timer (start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
- *dstaddr = (FPW) 0x00FF00FF; /* restore read mode */
- return (1);
+ while ((*dstaddr & (FPW)0x00800080) != (FPW)0x00800080) {
+ if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
+ rc = 1;
+ goto OUT;
}
}
}
}
- *dstaddr = (FPW) 0x00FF00FF; /* restore read mode */
+OUT:
+ *dstaddr = (FPW)0x00FF00FF; /* restore read mode */
+ if (flag)
+ enable_interrupts();
- return (0);
+ return rc;
}
/*-----------------------------------------------------------------------