From patchwork Fri Jul 15 12:20:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Graeme Russ X-Patchwork-Id: 104814 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 753D8B6F18 for ; Fri, 15 Jul 2011 22:20:55 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D64C2280FA; Fri, 15 Jul 2011 14:20:53 +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 lvLQ5gYTUcIV; Fri, 15 Jul 2011 14:20:53 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9551328166; Fri, 15 Jul 2011 14:20:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 56D5828166 for ; Fri, 15 Jul 2011 14:20:49 +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 cMwe6qjXM32h for ; Fri, 15 Jul 2011 14:20:48 +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-yi0-f44.google.com (mail-yi0-f44.google.com [209.85.218.44]) by theia.denx.de (Postfix) with ESMTPS id 65D87280FA for ; Fri, 15 Jul 2011 14:20:47 +0200 (CEST) Received: by yie30 with SMTP id 30so533593yie.3 for ; Fri, 15 Jul 2011 05:20:46 -0700 (PDT) Received: by 10.236.195.65 with SMTP id o41mr4157779yhn.337.1310732446086; Fri, 15 Jul 2011 05:20:46 -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 c63sm1076224yhe.46.2011.07.15.05.20.44 (version=SSLv3 cipher=OTHER); Fri, 15 Jul 2011 05:20:45 -0700 (PDT) From: Graeme Russ To: u-boot@lists.denx.de Date: Fri, 15 Jul 2011 22:20:40 +1000 Message-Id: <1310732440-5497-1-git-send-email-graeme.russ@gmail.com> X-Mailer: git-send-email 1.7.5.2.317.g391b14 In-Reply-To: <1309261269-4363-7-git-send-email-graeme.russ@gmail.com> References: <1309261269-4363-7-git-send-email-graeme.russ@gmail.com> Subject: [U-Boot] [PATCH v2 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 --- 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;