From patchwork Fri May 24 13:54:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Birje X-Patchwork-Id: 246145 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 52B112C008E for ; Fri, 24 May 2013 23:47:42 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F5554A03A; Fri, 24 May 2013 15:47:40 +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 Hi6Ev9na7ny3; Fri, 24 May 2013 15:47:39 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 656064A03B; Fri, 24 May 2013 15:47:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5A5F84A033 for ; Fri, 24 May 2013 15:47:31 +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 VocLvHHAD470 for ; Fri, 24 May 2013 15:47:26 +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 mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by theia.denx.de (Postfix) with ESMTP id 1DEB34A026 for ; Fri, 24 May 2013 15:47:21 +0200 (CEST) Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MNB00D3W2AIQSQ0@mailout4.samsung.com> for u-boot@lists.denx.de; Fri, 24 May 2013 22:47:19 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.122]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 7A.04.29708.76F6F915; Fri, 24 May 2013 22:47:19 +0900 (KST) X-AuditID: cbfee690-b7f6f6d00000740c-2a-519f6f67b92f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 96.98.21068.66F6F915; Fri, 24 May 2013 22:47:19 +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 <0MNB009282A1MN40@mmp1.samsung.com>; Fri, 24 May 2013 22:47:18 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Date: Fri, 24 May 2013 19:24:53 +0530 Message-id: <1369403694-15098-2-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1369403694-15098-1-git-send-email-rajeshwari.s@samsung.com> References: <1369403694-15098-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRmVeSWpSXmKPExsWyRsSkSjc9f36gwYodAhYdR1oYLaYc/sJi 8W3LNkaL5a83slu83dvJ7sDqMbvhIovHgk2lHneu7WHzOHtnB6NH35ZVjAGsUVw2Kak5mWWp Rfp2CVwZ55cvYik4yFvxp6mfpYHxKVcXIyeHhICJRMvcFcwQtpjEhXvr2boYuTiEBJYySuzd uokVpqjx70EWiMQiRolN3ycyQTgTmST67/WBVbEJGElsPTmNEcQWEZCQ+NV/FcxmFoiS+N59 iR3EFhawlmjdfY4JxGYRUJW42/AeyObg4BXwkGieLg+xTEHi2NSv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H9DldVJYHJt+vKF4isvLBNOcFV7/Htzz/ydrZobJ1BfPat2dSy1Zbf5vrfKn62LLqeR2n bKb6HFj8MeFq8Dv7WSEygRw19/7W1liU3ZmhtPNGp5G26YXJJ3kn7M++lMVTIiRQMO3OMgev 2TtvcMh5z5E4PUW36jPP14LA182L/TeoeSuxFGckGmoxFxUnAgDFoqMQ3AIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: u-boot-review@google.com, patches@linaro.org Subject: [U-Boot] [PATCH 1/2 V4] SPI: Add support for preamble bytes 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 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. Changes in V4: - 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. *