From patchwork Mon Jul 7 16:16:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 367625 X-Patchwork-Delegate: jagannadh.teki@gmail.com 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 C61F4140086 for ; Tue, 8 Jul 2014 02:17:17 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1C5EC4B610; Mon, 7 Jul 2014 18:17: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 Q4puhpNtWjsJ; Mon, 7 Jul 2014 18:17:15 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 742504B150; Mon, 7 Jul 2014 18:17:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2C5EE4A05D for ; Mon, 7 Jul 2014 18:17:10 +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 9umhzVNRyTP3 for ; Mon, 7 Jul 2014 18:17:06 +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-ob0-f201.google.com (mail-ob0-f201.google.com [209.85.214.201]) by theia.denx.de (Postfix) with ESMTPS id B041F4B14B for ; Mon, 7 Jul 2014 18:16:58 +0200 (CEST) Received: by mail-ob0-f201.google.com with SMTP id nu7so950162obb.4 for ; Mon, 07 Jul 2014 09:16:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OWFpVz/dwEWUbLIbs7GKDXSTykyL+jgyG3z5UJH3ML4=; b=jgxHzJyHuMh3lKDFC6SfmmaBU+w6LpcZxFTx4FC5S1cAdLUoFhbFeaLKWW4yR5mOhv sKuRIB6MxlADRi93TQHAcxDbQyxxH7NTEHhAa/Fqg5y7uiRqvFYy8edsaGWTWhQC+huO GznUIVVDcRT6r5KKwu5mnIHYzWjefbymmi1UiJCqcy6kmk0Sg1qhfIcFvcC3mHe5hp0w dC4dc3esyDmqCkBa4geGo2pX4yefF0Lgom7/stFDb/vbV8z6ugMQZwux36uX87jgf/Lq susLrzYspR4hRCzrMx38USspTWtL4qI1EYqcC6fFwkmNQCoyY6O+YCBi5ZLJmtyCAi+3 vmqQ== X-Gm-Message-State: ALoCoQns2I7ny1YcHwqRjFFEzvHo2+QpRr7eFXNQNzW/JjvmrjSks4Zu33Y+YGrxd96C4q2Hnb6R X-Received: by 10.42.235.8 with SMTP id ke8mr15813098icb.22.1404749816925; Mon, 07 Jul 2014 09:16:56 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id j5si2336191yhi.1.2014.07.07.09.16.56 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Jul 2014 09:16:56 -0700 (PDT) Received: from kaki.bld.corp.google.com (kaki.bld.corp.google.com [172.29.216.32]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id C53325A473F; Mon, 7 Jul 2014 09:16:56 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 80E29220170; Mon, 7 Jul 2014 10:16:56 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 7 Jul 2014 10:16:38 -0600 Message-Id: <1404749802-22450-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.0.0.526.g5318336 In-Reply-To: <1404749802-22450-1-git-send-email-sjg@chromium.org> References: <1404749802-22450-1-git-send-email-sjg@chromium.org> Cc: Jagannadha Sutradharudu Teki , Ajay Kumar Subject: [U-Boot] [PATCH 2/6] exynos: spi: Fix calculation of SPI transaction start time X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 The SPI transaction delay is supposed to be measured from the end of one transaction to the start of the next. The code does not work that way, so fix it. Signed-off-by: Simon Glass Tested-by: Ajay Kumar --- drivers/spi/exynos_spi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c index c92276f..2969184 100644 --- a/drivers/spi/exynos_spi.c +++ b/drivers/spi/exynos_spi.c @@ -428,10 +428,6 @@ void spi_cs_activate(struct spi_slave *slave) clrbits_le32(&spi_slave->regs->cs_reg, SPI_SLAVE_SIG_INACT); debug("Activate CS, bus %d\n", spi_slave->slave.bus); spi_slave->skip_preamble = spi_slave->mode & SPI_PREAMBLE; - - /* Remember time of this transaction so we can honour the bus delay */ - if (spi_slave->bus->deactivate_delay_us) - spi_slave->last_transaction_us = timer_get_us(); } /** @@ -445,6 +441,11 @@ void spi_cs_deactivate(struct spi_slave *slave) struct exynos_spi_slave *spi_slave = to_exynos_spi(slave); setbits_le32(&spi_slave->regs->cs_reg, SPI_SLAVE_SIG_INACT); + + /* Remember time of this transaction so we can honour the bus delay */ + if (spi_slave->bus->deactivate_delay_us) + spi_slave->last_transaction_us = timer_get_us(); + debug("Deactivate CS, bus %d\n", spi_slave->slave.bus); }