From patchwork Sat Jul 16 09:37:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Graeme Russ X-Patchwork-Id: 104940 X-Patchwork-Delegate: wd@denx.de 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 13BB1B6F6B for ; Sat, 16 Jul 2011 19:37:39 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5DF7B280CB; Sat, 16 Jul 2011 11:37:36 +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 2RN2+E42RZLR; Sat, 16 Jul 2011 11:37:36 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9695C280B3; Sat, 16 Jul 2011 11:37:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0FB71280B3 for ; Sat, 16 Jul 2011 11:37:32 +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 jaV0us-JEUpF for ; Sat, 16 Jul 2011 11:37:31 +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-iw0-f172.google.com (mail-iw0-f172.google.com [209.85.214.172]) by theia.denx.de (Postfix) with ESMTPS id 1A78D2809A for ; Sat, 16 Jul 2011 11:37:29 +0200 (CEST) Received: by iwn39 with SMTP id 39so1700711iwn.3 for ; Sat, 16 Jul 2011 02:37:28 -0700 (PDT) Received: by 10.42.156.8 with SMTP id x8mr4834762icw.519.1310809048337; Sat, 16 Jul 2011 02:37:28 -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 o10sm2457626icc.0.2011.07.16.02.37.24 (version=SSLv3 cipher=OTHER); Sat, 16 Jul 2011 02:37:26 -0700 (PDT) From: Graeme Russ To: u-boot@lists.denx.de Date: Sat, 16 Jul 2011 19:37:21 +1000 Message-Id: <1310809041-3442-1-git-send-email-graeme.russ@gmail.com> X-Mailer: git-send-email 1.7.5.2.317.g391b14 In-Reply-To: <1310732440-5497-1-git-send-email-graeme.russ@gmail.com> References: <1310732440-5497-1-git-send-email-graeme.russ@gmail.com> Subject: [U-Boot] [PATCH v3 6/7]Timer: Fix at91rm9200/spi.c timer usage 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 --- Changes since v2: - Added Signed-off-by Changes since v1 ((WIP) [Timer]API Rewrite): - Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6 arch/arm/cpu/arm920t/at91rm9200/spi.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) -- 1.7.5.2.317.g391b14 diff --git a/arch/arm/cpu/arm920t/at91rm9200/spi.c b/arch/arm/cpu/arm920t/at91rm9200/spi.c index f3cb5d8..c70efc6 100644 --- a/arch/arm/cpu/arm920t/at91rm9200/spi.c +++ b/arch/arm/cpu/arm920t/at91rm9200/spi.c @@ -108,6 +108,7 @@ void AT91F_SpiEnable(int cs) unsigned int AT91F_SpiWrite ( AT91PS_DataflashDesc pDesc ) { unsigned int timeout; + unsigned long start; pDesc->state = BUSY; @@ -132,12 +133,12 @@ unsigned int AT91F_SpiWrite ( AT91PS_DataflashDesc pDesc ) } /* arm simple, non interrupt dependent timer */ - reset_timer_masked(); + start = get_timer(0); timeout = 0; AT91C_BASE_SPI->SPI_PTCR = AT91C_PDC_TXTEN + AT91C_PDC_RXTEN; while(!(AT91C_BASE_SPI->SPI_SR & AT91C_SPI_RXBUFF) && - ((timeout = get_timer_masked() ) < CONFIG_SYS_SPI_WRITE_TOUT)); + ((timeout = get_timer(start) ) < CONFIG_SYS_SPI_WRITE_TOUT)); AT91C_BASE_SPI->SPI_PTCR = AT91C_PDC_TXTDIS + AT91C_PDC_RXTDIS; pDesc->state = IDLE;