diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2007-07-05 18:01:15 +0200 |
---|---|---|
committer | Sascha Hauer <sha@octopus.labnet.pengutronix.de> | 2007-07-05 18:01:15 +0200 |
commit | 363266d818c3504458fe005ef0308ea48f71e7ca (patch) | |
tree | fa11b8ab9cb69096d9482eda32d2d0be400810ee /drivers | |
parent | fecf0fd93e63938080c6a86c7e0918ab9f310908 (diff) | |
download | barebox-363266d818c3504458fe005ef0308ea48f71e7ca.tar.gz barebox-363266d818c3504458fe005ef0308ea48f71e7ca.tar.xz |
svn_rev_033
change to clocksource api
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cfi_flash.c | 14 | ||||
-rw-r--r-- | drivers/cs8900.c | 18 |
2 files changed, 17 insertions, 15 deletions
diff --git a/drivers/cfi_flash.c b/drivers/cfi_flash.c index 2699cce859..d8e6223186 100644 --- a/drivers/cfi_flash.c +++ b/drivers/cfi_flash.c @@ -788,18 +788,18 @@ static int flash_is_busy (flash_info_t * info, flash_sect_t sect) * This routine does not set the flash to read-array mode. */ static int flash_status_check (flash_info_t * info, flash_sect_t sector, - ulong tout, char *prompt) + uint64_t tout, char *prompt) { - ulong start; + uint64_t start; #if CFG_HZ != 1000 tout *= CFG_HZ/1000; #endif /* Wait for command completion */ - start = get_timer (0); + start = get_time_ns(); while (flash_is_busy (info, sector)) { - if (get_timer (start) > tout) { + if (is_timeout(start, tout)) { printf ("Flash %s timeout at address %lx data %lx\n", prompt, info->start[sector], flash_read_long (info, sector, 0)); @@ -816,7 +816,7 @@ static int flash_status_check (flash_info_t * info, flash_sect_t sector, * This routine sets the flash to read-array mode. */ static int flash_full_status_check (flash_info_t * info, flash_sect_t sector, - ulong tout, char *prompt) + uint64_t tout, char *prompt) { int retcode; @@ -1318,10 +1318,10 @@ ulong flash_get_size (ulong base, int banknum) info->erase_blk_tout = (tmp * (1 << flash_read_uchar (info, FLASH_OFFSET_EMAX_TOUT))); tmp = (1 << flash_read_uchar (info, FLASH_OFFSET_WBTOUT)) * (1 << flash_read_uchar (info, FLASH_OFFSET_WBMAX_TOUT)); - info->buffer_write_tout = tmp / 1000 + (tmp % 1000 ? 1 : 0); /* round up when converting to ms */ + info->buffer_write_tout = tmp * 1000; tmp = (1 << flash_read_uchar (info, FLASH_OFFSET_WTOUT)) * (1 << flash_read_uchar (info, FLASH_OFFSET_WMAX_TOUT)); - info->write_tout = tmp / 1000 + (tmp % 1000 ? 1 : 0); /* round up when converting to ms */ + info->write_tout = tmp * 1000; info->flash_id = FLASH_MAN_CFI; if ((info->interface == FLASH_CFI_X8X16) && (info->chipwidth == FLASH_CFI_BY8)) { info->portwidth >>= 1; /* XXX - Need to test on x8/x16 in parallel. */ diff --git a/drivers/cs8900.c b/drivers/cs8900.c index 082434ca28..78d0149284 100644 --- a/drivers/cs8900.c +++ b/drivers/cs8900.c @@ -40,6 +40,7 @@ #include <command.h> #include "cs8900.h" #include <net.h> +#include <clock.h> #ifdef CONFIG_DRIVER_CS8900 @@ -84,7 +85,7 @@ static void put_reg (int regno, unsigned short val) static void eth_reset (void) { - int tmo; + uint64_t start; unsigned short us; /* reset NIC */ @@ -94,9 +95,9 @@ static void eth_reset (void) udelay (200000); /* Wait until the chip is reset */ - tmo = get_timer (0) + 1 * CFG_HZ; + start = get_time_ns(); while ((((us = get_reg_init_bus (PP_SelfSTAT)) & PP_SelfSTAT_InitD) == 0) - && tmo < get_timer (0)) + && !is_timeout(start, SECOND)) /*NOP*/; } @@ -236,7 +237,7 @@ extern int eth_rx (void) extern int eth_send (volatile void *packet, int length) { volatile unsigned short *addr; - int tmo; + uint64_t start; unsigned short s; retry: @@ -250,8 +251,9 @@ retry: #ifdef DEBUG printf ("cs: unable to send packet; retrying...\n"); #endif - for (tmo = get_timer (0) + 5 * CFG_HZ; get_timer (0) < tmo;) - /*NOP*/; + /* FIXME */ + udelay(5000); + eth_reset (); eth_reginit (); goto retry; @@ -263,9 +265,9 @@ retry: CS8900_RTDATA = *addr++; /* wait for transfer to succeed */ - tmo = get_timer (0) + 5 * CFG_HZ; + start = get_time_ns(); while ((s = get_reg (PP_TER) & ~0x1F) == 0) { - if (get_timer (0) >= tmo) + if (is_timeout(start, SECOND)) break; } |