From patchwork Tue Sep 18 18:21:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1474151 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 3E2FBDF24C for ; Tue, 18 Sep 2012 18:27:10 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TE2Tw-0007Uq-EQ; Tue, 18 Sep 2012 18:25:12 +0000 Received: from mail-lpp01m010-f73.google.com ([209.85.215.73]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TE2TN-0007KO-4P for linux-arm-kernel@lists.infradead.org; Tue, 18 Sep 2012 18:24:39 +0000 Received: by lahi5 with SMTP id i5so6187lah.0 for ; Tue, 18 Sep 2012 11:24:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=oV3Hz+5BA9vXFX8XqrcD24zDqa6Alo+HQmWV0ojeP6w=; b=gWG4o3lPqCK+iJI8a7QsyzCYhFAz4LUA7CNnIcSqF9kzQBx7dg+GVjgUOzioerbipY 9C+xwVbi0zUs5rkMGirvkJzHJIfRzy1E+GF4MmgSxVEM+McKVzrJKZFJzpqolVvRPpgu KJbMolT6/FTs4/+RHPKTIsN3LY8RnWs8vMrI8ST0asE0CjzqQOyPGoU7ofVWi+PVwx3/ fvzpcLL8bG3A5cRMj109gjJlBTkJi8HvzFD6U2z+rdwzNcNYsF4FRX/xe+nFExHNWKze KJtGsv58hGPmaLYSDRnPQC7C9j4jNnb/uKBiNqqOZtFIm8V89B456x+jqX9I9YmwyfPr igmw== Received: by 10.180.105.2 with SMTP id gi2mr180040wib.4.1347992674353; Tue, 18 Sep 2012 11:24:34 -0700 (PDT) Received: by 10.180.105.2 with SMTP id gi2mr180033wib.4.1347992674297; Tue, 18 Sep 2012 11:24:34 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id hm1si33651wib.3.2012.09.18.11.24.34 (version=TLSv1/SSLv3 cipher=AES128-SHA); Tue, 18 Sep 2012 11:24:34 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id E0A635C0050; Tue, 18 Sep 2012 11:24:33 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 3CEE4161E00; Tue, 18 Sep 2012 11:24:33 -0700 (PDT) From: Simon Glass To: LKML , linux-arm-kernel@lists.infradead.org Subject: [PATCH 7/7] spi: s3c64xx: Write to PACKET_CNT after reset Date: Tue, 18 Sep 2012 11:21:59 -0700 Message-Id: <1347992519-6904-8-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1347992519-6904-1-git-send-email-sjg@chromium.org> References: <1347992519-6904-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQnZLUe9lGtQAabKofRZjeXuL60IbQzN08T+7ZhQPxU34oSb8G6EBp+gUDIKfK2xzb7rbthM430/M6j6M/VwoOnqhI1I1wdxyVp9CEEucELgUB1S3css9yq5XPk8iP8OqdSeZWRqhkRk5+BiBvD17tP8/fxKYVlPz5NM1hgt0v7nawV+VD1n+bSCV+9xAuhM91GQZPO1/tXnh30kLk2N3sh6LrdkRQ== X-Spam-Note: CRM114 invocation failed X-Spam-Score: -3.1 (---) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-3.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.73 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Simon Glass , "kgene.kim" , Ben Dooks , Srinivas KANDAGATLA X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The Exynos5 datasheet specifically says that a software reset of SPI must be performed before writing to the PACKET_CNT register. Also, the current code sometimes causes an extra transfer or two to be performed. Adjust the code slightly to fix this problem. Test flashrom operation on snow. See that SPI operation with ChromeOS EC is reliable now. Signed-off-by: Simon Glass --- drivers/spi/spi-s3c64xx.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index c34ef8f..3716825 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -213,7 +213,9 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) unsigned long loops; u32 val; - writel(0, regs + S3C64XX_SPI_PACKET_CNT); + val = readl(regs + S3C64XX_SPI_CH_CFG); + val &= ~(S3C64XX_SPI_CH_RXCH_ON | S3C64XX_SPI_CH_TXCH_ON); + writel(val, regs + S3C64XX_SPI_CH_CFG); val = readl(regs + S3C64XX_SPI_CH_CFG); val |= S3C64XX_SPI_CH_SW_RST; @@ -250,9 +252,7 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) val &= ~(S3C64XX_SPI_MODE_TXDMA_ON | S3C64XX_SPI_MODE_RXDMA_ON); writel(val, regs + S3C64XX_SPI_MODE_CFG); - val = readl(regs + S3C64XX_SPI_CH_CFG); - val &= ~(S3C64XX_SPI_CH_RXCH_ON | S3C64XX_SPI_CH_TXCH_ON); - writel(val, regs + S3C64XX_SPI_CH_CFG); + writel(0, regs + S3C64XX_SPI_PACKET_CNT); } static void s3c64xx_spi_dmacb(void *data)