From patchwork Thu Jan 27 22:46:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Remy Bohmer X-Patchwork-Id: 80747 X-Patchwork-Delegate: info@emk-elektronik.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 E020CB711B for ; Fri, 28 Jan 2011 09:46:32 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9BD5A280C4; Thu, 27 Jan 2011 23:46:31 +0100 (CET) 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 Ts6tB95VwbeC; Thu, 27 Jan 2011 23:46:31 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 832732809C; Thu, 27 Jan 2011 23:46:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 17BBE28098 for ; Thu, 27 Jan 2011 23:46:28 +0100 (CET) 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 cySkAHzbqZNU for ; Thu, 27 Jan 2011 23:46:26 +0100 (CET) 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-ew0-f44.google.com (mail-ew0-f44.google.com [209.85.215.44]) by theia.denx.de (Postfix) with ESMTPS id 04E462808B for ; Thu, 27 Jan 2011 23:46:24 +0100 (CET) Received: by ewy8 with SMTP id 8so1341564ewy.3 for ; Thu, 27 Jan 2011 14:46:24 -0800 (PST) Received: by 10.213.33.205 with SMTP id i13mr3896452ebd.32.1296168383942; Thu, 27 Jan 2011 14:46:23 -0800 (PST) Received: from localhost (541EDD7F.cm-5-7d.dynamic.ziggo.nl [84.30.221.127]) by mx.google.com with ESMTPS id q52sm737056eei.21.2011.01.27.14.46.21 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 27 Jan 2011 14:46:22 -0800 (PST) From: Remy Bohmer To: u-boot@lists.denx.de, Alexander Stein , Reinhard Meyer Date: Thu, 27 Jan 2011 23:46:17 +0100 Message-Id: <1296168378-8399-1-git-send-email-linux@bohmer.net> X-Mailer: git-send-email 1.7.1 Subject: [U-Boot] [PATCH 1/2] Fix timer usage of the Atmel SPI dataflash driver 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: Remy Bohmer --- drivers/spi/atmel_dataflash_spi.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/atmel_dataflash_spi.c b/drivers/spi/atmel_dataflash_spi.c index 4a5c4aa..2f23f54 100644 --- a/drivers/spi/atmel_dataflash_spi.c +++ b/drivers/spi/atmel_dataflash_spi.c @@ -133,7 +133,7 @@ unsigned int AT91F_SpiWrite1(AT91PS_DataflashDesc pDesc); unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc) { - unsigned int timeout; + u32 time_start, timeout; pDesc->state = BUSY; @@ -158,12 +158,12 @@ unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc) } /* arm simple, non interrupt dependent timer */ - reset_timer_masked(); - timeout = 0; + time_start = get_timer(0); writel(AT91_SPI_TXTEN + AT91_SPI_RXTEN, AT91_BASE_SPI + AT91_SPI_PTCR); while (!(readl(AT91_BASE_SPI + AT91_SPI_SR) & AT91_SPI_RXBUFF) && - ((timeout = get_timer_masked()) < CONFIG_SYS_SPI_WRITE_TOUT)); + ((timeout = get_timer(time_start)) < CONFIG_SYS_SPI_WRITE_TOUT)); + writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, AT91_BASE_SPI + AT91_SPI_PTCR); pDesc->state = IDLE;