summaryrefslogtreecommitdiff
path: root/board/BuS
diff options
context:
space:
mode:
Diffstat (limited to 'board/BuS')
-rw-r--r--board/BuS/EB+MCF-EV123/flash.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/board/BuS/EB+MCF-EV123/flash.c b/board/BuS/EB+MCF-EV123/flash.c
index 3c36367..8b7f957 100644
--- a/board/BuS/EB+MCF-EV123/flash.c
+++ b/board/BuS/EB+MCF-EV123/flash.c
@@ -157,6 +157,7 @@ int amd_flash_erase_sector(flash_info_t * info, int sector)
{
int state;
ulong result;
+ ulong start;
volatile u16 *addr =
(volatile u16 *) (info->start[sector]);
@@ -171,13 +172,13 @@ int amd_flash_erase_sector(flash_info_t * info, int sector)
/* wait until flash is ready */
state = 0;
- set_timer (0);
+ start = get_timer(0);
do {
result = *addr;
/* 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;
state = ERR_TIMOUT;
}
@@ -267,6 +268,7 @@ volatile static int amd_write_word (flash_info_t * info, ulong dest, u16 data)
ulong result;
int cflag, iflag;
int state;
+ ulong start;
/*
* Check if Flash is (sufficiently) erased
@@ -295,7 +297,7 @@ volatile static int amd_write_word (flash_info_t * info, ulong dest, u16 data)
*addr = data;
/* arm simple, non interrupt dependent timer */
- set_timer (0);
+ start = get_timer(0);
/* wait until flash is ready */
state = 0;
@@ -303,7 +305,7 @@ volatile static int amd_write_word (flash_info_t * info, ulong dest, u16 data)
result = *addr;
/* check timeout */
- if (get_timer (0) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+ if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
state = ERR_TIMOUT;
}
if (!state && ((result & BIT_RDY_MASK) == (data & BIT_RDY_MASK)))