From patchwork Fri May 24 13:18:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 17198 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B49D9238FC for ; Fri, 24 May 2013 13:12:23 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id hf12sf5593741vcb.10 for ; Fri, 24 May 2013 06:11:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:x-auditid:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-brightmail-tracker:x-brightmail-tracker :dlp-filter:x-mtr:x-cfilter-loop:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe; bh=qeGhVInZvJae0kKmYBDDhO+anj/CAYnS5QNpbQXCRyc=; b=KPnsZkoKuvJP6TdpSbuCWGzV4qNm5Lpm4a+wQMK/zrRHkFmgWv+0Bd21mETjCwzcBJ z0aHOhLTOOYQxwSsS9LpFrLUmJw6KvgKdvXTvJyan/Sh5f/n868a/oyqWc6ozqi+lz8F 9Q6pavbzkP5Vn0hcRbYecRE4kHrJao84CBTG3auk7MKHNivKzUNK/ugQDEJ0WdNEDZwj CC8fgRYrB3rc1iRpb2Md3rYXEc1u0xZahYkvibmNB4hZ/Iq8K9X6ZYu6wleTv4pYFgmJ 1hRwpc4meurIcLFf+CGeDTnwZdBscmYaTGcte1VFNouFrY567lj4iynOzvwEbxhLyb+D DUFg== X-Received: by 10.224.205.138 with SMTP id fq10mr2423616qab.1.1369401085815; Fri, 24 May 2013 06:11:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.120.33 with SMTP id kz1ls1930041qeb.15.gmail; Fri, 24 May 2013 06:11:25 -0700 (PDT) X-Received: by 10.58.75.73 with SMTP id a9mr8449479vew.25.1369401085627; Fri, 24 May 2013 06:11:25 -0700 (PDT) Received: from mail-ve0-x230.google.com (mail-ve0-x230.google.com [2607:f8b0:400c:c01::230]) by mx.google.com with ESMTPS id ef7si9418193vdc.46.2013.05.24.06.11.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 May 2013 06:11:25 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::230 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::230; Received: by mail-ve0-f176.google.com with SMTP id jz10so3367440veb.35 for ; Fri, 24 May 2013 06:11:25 -0700 (PDT) X-Received: by 10.220.246.8 with SMTP id lw8mr8368382vcb.8.1369401085454; Fri, 24 May 2013 06:11:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp100813vcs; Fri, 24 May 2013 06:11:24 -0700 (PDT) X-Received: by 10.68.245.200 with SMTP id xq8mr18140269pbc.32.1369401084337; Fri, 24 May 2013 06:11:24 -0700 (PDT) Received: from mailout3.samsung.com (mailout3.samsung.com. [203.254.224.33]) by mx.google.com with ESMTP id wn4si11799650pbc.25.2013.05.24.06.11.23 for ; Fri, 24 May 2013 06:11:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.33 as permitted sender) client-ip=203.254.224.33; Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MNB0083W0MZT4V0@mailout3.samsung.com> for patches@linaro.org; Fri, 24 May 2013 22:11:23 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id BF.57.08825.AF66F915; Fri, 24 May 2013 22:11:23 +0900 (KST) X-AuditID: cbfee68e-b7f276d000002279-0b-519f66fa59bd Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id B3.03.21068.AF66F915; Fri, 24 May 2013 22:11:22 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MNB008JZ0L9SE20@mmp1.samsung.com>; Fri, 24 May 2013 22:11:22 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, u-boot-review@google.com Subject: [PATCH 1/2 V3] SPI: Add support for preamble bytes Date: Fri, 24 May 2013 18:48:25 +0530 Message-id: <1369401506-865-2-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1369401506-865-1-git-send-email-rajeshwari.s@samsung.com> References: <1369401506-865-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRmVeSWpSXmKPExsWyRsSkVvd32vxAg50T2Cw6jrQwWkw5/IXF 4tuWbYwWy19vZLd4u7eT3YHVY3bDRRaPBZtKPe5c28PmcfbODkaPvi2rGANYo7hsUlJzMstS i/TtErgyTq6fwF6wnLfizaeVbA2Ml7m6GDk5JARMJLav2sYGYYtJXLi3Hsjm4hASWMoosW7Z OWaYog/z+lkgEosYJeav28QO4UxkkmjeP40VpIpNwEhi68lpjCC2iICExK/+q2A2s0CUxPfu S+wgtrCAtcSnx+tYQGwWAVWJhQcXgfXyCrhJ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SC1CKYLUwcnFINjKu2 hhq1mi/SPVKere8SdmGF9vcrJ0W9Y7Lla3vsC93Dv0gbmj37sFQzfTa3lNC53Xd6ff5o3eVg vdMW9W1LEu/DuVvFH83eaqUfFuazuzu2j2WvUF/0dM55mh9EhfYfddxheP3kQ76Lmx879/Ev qnE9e1pso5xe7cRTgezxlf7e6/dMFeA8rsRSnJFoqMVcVJwIAESTMYzdAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQkypjEN0JXGpdFxZRLl1NSGOX7exLEqy1g8S4SugXX0XG3hI4kB9pamIU9FyVT8tnHvGhHd X-Original-Sender: rajeshwari.s@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::230 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , A SPI slave may take time to react to a request. For SPI flash devices this time is defined as one bit time, or a whole byte for 'fast read' mode. If the SPI slave is another CPU, then the time it takes to react may vary. It is convenient to allow the slave device to tag the start of the actual reply so that the host can determine when this 'preamble' finishes and the actual message starts. Add a preamble flag to the available SPI flags. If supported by the driver then it will ignore any received bytes before the preamble on each transaction. This ensures that reliable communication with the slave is possible. Signed-off-by: Simon Glass Signed-off-by: Rajeshwari Shinde --- Changes in V2: - None Changes in V3: - None. include/spi.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/include/spi.h b/include/spi.h index 3fe2e1e..1638b50 100644 --- a/include/spi.h +++ b/include/spi.h @@ -37,11 +37,16 @@ #define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */ #define SPI_3WIRE 0x10 /* SI/SO signals shared */ #define SPI_LOOP 0x20 /* loopback mode */ +#define SPI_SLAVE 0x40 /* slave mode */ +#define SPI_PREAMBLE 0x80 /* Skip preamble bytes */ /* SPI transfer flags */ #define SPI_XFER_BEGIN 0x01 /* Assert CS before transfer */ #define SPI_XFER_END 0x02 /* Deassert CS after transfer */ +/* Header byte that marks the start of the message */ +#define SPI_PREAMBLE_END_BYTE 0xec + /*----------------------------------------------------------------------- * Representation of a SPI slave, i.e. what we're communicating with. *