From patchwork Tue Jun 3 12:37:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshay Saraswat X-Patchwork-Id: 355507 X-Patchwork-Delegate: promsoft@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 46D7614009E for ; Tue, 3 Jun 2014 22:40:22 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C25F24B8EF; Tue, 3 Jun 2014 14:40: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 iXubc9grm7DJ; Tue, 3 Jun 2014 14:40:16 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5F2E94B8C1; Tue, 3 Jun 2014 14:40:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 674D04B8F0 for ; Tue, 3 Jun 2014 14:40:12 +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 l07-CBu+pz6m for ; Tue, 3 Jun 2014 14:40:09 +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 mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by theia.denx.de (Postfix) with ESMTPS id 8CB0E4B8BD for ; Tue, 3 Jun 2014 14:40:00 +0200 (CEST) Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N6L00EYMF6LDT70@mailout1.samsung.com> for u-boot@lists.denx.de; Tue, 03 Jun 2014 21:39:57 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 1A.78.19452.C12CD835; Tue, 03 Jun 2014 21:39:57 +0900 (KST) X-AuditID: cbfee68e-b7fb96d000004bfc-e1-538dc21c9abd Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id C6.17.07139.C12CD835; Tue, 03 Jun 2014 21:39:56 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N6L00BHSF5R8X10@mmp1.samsung.com>; Tue, 03 Jun 2014 21:39:56 +0900 (KST) From: Akshay Saraswat To: u-boot@lists.denx.de Date: Tue, 03 Jun 2014 18:07:50 +0530 Message-id: <1401799074-3801-2-git-send-email-akshay.s@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1401799074-3801-1-git-send-email-akshay.s@samsung.com> References: <1401799074-3801-1-git-send-email-akshay.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsWyRsSkWlf2UG+wQe8aVotTfx4zWkx9cI7R 4tuWbYwWy19vZLd4u7eT3eLfslnsDmwesxsusnjsnHWX3WPBplKPs3d2MHr0bVnFGMAaxWWT kpqTWZZapG+XwJVxpyOkYDpnxeNn9g2Mn9i6GDk5JARMJGYf/ssMYYtJXLi3HijOxSEksJRR 4vO0DywwRVMvbgCzhQQWMUpMuKULUTSBSWL/1w5WkASbgI7E9iXf2UFsEQEJiV/9VxlBbGaB JkaJvjepILawgIvEv7kPwLaxCKhKHLq0A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YmFiZklacJK4rwHW60DhQTSE0tSs1NTC1KLYLYwcXBK NTA6v7/kcPCRxYELV5usg3w2NRU1bvuk5DMldmf7FpaJD72YUzKvqk13TxaZvTrskkP9WqU+ x6SuufO49MJfbXSpz/tit1v9W6rYryWFq9wVehrO7k5hMDiycZ1Y8JJr7FsutTB9f3dYuW/B uW9mp07INkz89lvLmyP08HMzpgfGe/pncxk9LbFWYinOSDTUYi4qTgQA4DObTd4CAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: vbendeb@chromium.org, u-boot-review@google.com Subject: [U-Boot] [PATCH v2 1/5] Exynos: SPI: Fix reading data from SPI flash 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 SPI recieve and transfer code in exynos_spi driver has a logical bug. We read data in a variable which can hold an integer. Then we assign this integer 32 bit value to another variable which has data type uchar. Latter represents a unit of our recieve buffer. Everytime when we write a value to our recieve buffer we step ahead by 4 units when actually we wrote to one unit. This results in the loss of 3 bytes out of every 4 bytes recieved. This patch intends to fix this bug. Signed-off-by: Akshay Saraswat Acked-by: Simon Glass Tested-by: Simon Glass --- Changes since v1: - Added check for step. drivers/spi/exynos_spi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c index 4d5def2..68d1206 100644 --- a/drivers/spi/exynos_spi.c +++ b/drivers/spi/exynos_spi.c @@ -302,6 +302,11 @@ static int spi_rx_tx(struct exynos_spi_slave *spi_slave, int todo, } } else { if (rxp || stopping) { + if (step == 4) { + *(rxp + 3) = temp >> 24; + *(rxp + 2) = temp >> 16; + *(rxp + 1) = temp >> 8; + } *rxp = temp; rxp += step; }