From patchwork Tue Jun 28 11:41:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Graeme Russ X-Patchwork-Id: 102362 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id BD511B6F68 for ; Tue, 28 Jun 2011 21:43:03 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0D06228111; Tue, 28 Jun 2011 13:42:40 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id V7IDb40cv8Gg; Tue, 28 Jun 2011 13:42:39 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7CC082811F; Tue, 28 Jun 2011 13:42:18 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 54DB1280D4 for ; Tue, 28 Jun 2011 13:42:16 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lI5cD3zCW6VZ for ; Tue, 28 Jun 2011 13:42:15 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-gw0-f44.google.com (mail-gw0-f44.google.com [74.125.83.44]) by theia.denx.de (Postfix) with ESMTPS id 5AC88280E9 for ; Tue, 28 Jun 2011 13:41:45 +0200 (CEST) Received: by mail-gw0-f44.google.com with SMTP id 20so31225gwb.3 for ; Tue, 28 Jun 2011 04:41:45 -0700 (PDT) Received: by 10.151.78.15 with SMTP id f15mr7641041ybl.322.1309261305461; Tue, 28 Jun 2011 04:41:45 -0700 (PDT) Received: from localhost.localdomain (d122-104-32-184.sbr6.nsw.optusnet.com.au [122.104.32.184]) by mx.google.com with ESMTPS id 5sm1223607ybq.23.2011.06.28.04.41.43 (version=SSLv3 cipher=OTHER); Tue, 28 Jun 2011 04:41:45 -0700 (PDT) From: Graeme Russ To: u-boot@lists.denx.de Date: Tue, 28 Jun 2011 21:41:02 +1000 Message-Id: <1309261269-4363-10-git-send-email-graeme.russ@gmail.com> X-Mailer: git-send-email 1.7.5.2.317.g391b14 In-Reply-To: <1309261269-4363-1-git-send-email-graeme.russ@gmail.com> References: <1309261269-4363-1-git-send-email-graeme.russ@gmail.com> Subject: [U-Boot] [PATCH v1 (WIP) 09/16] [Timer]Replace get_timer() usage in drivers/block/ X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Graeme Russ --- drivers/block/mg_disk.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index 2198017..c8cc195 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c @@ -88,17 +88,16 @@ static void mg_dump_status (const char *msg, unsigned int stat, unsigned err) static unsigned int mg_wait (u32 expect, u32 msec) { u8 status; - u32 from, cur, err; + u32 ts, err; err = MG_ERR_NONE; #ifdef CONFIG_NIOS2 reset_timer(); #endif - from = get_timer(0); + ts = time_now_ms(); status = readb(mg_base() + MG_REG_STATUS); do { - cur = get_timer(from); if (status & MG_REG_STATUS_BIT_BUSY) { if (expect == MG_REG_STATUS_BIT_BUSY) break; @@ -119,9 +118,9 @@ static unsigned int mg_wait (u32 expect, u32 msec) break; } status = readb(mg_base() + MG_REG_STATUS); - } while (cur < msec); + } while (time_since_ms(ts) < msec); - if (cur >= msec) + if (time_since_ms(ts) >= msec) err = MG_ERR_TIMEOUT; return err;