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 Shinde X-Patchwork-Id: 17201 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2AA69238FC for ; Fri, 24 May 2013 13:48:19 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 1sf5985557qec.0 for ; Fri, 24 May 2013 06:47:21 -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=QcFAMkCsu4BqVOxjyy+6LKATEO67CanJYsojlS4BNNk=; b=QvpxTB4DS8DoIT1zSghtbIGiFgBIZOORcmC1Lwy8V+NG4NTwKjCejXwTTkZHmWiaNk k7uz1Ui1V3YnyYwWC+OeNRinw2YWsAIB1b4rNoMYdg5Nmj1P5gZDt/0qcjqtmCE0v3gK ZsNUEhbwkWfI1jKMh24XMHB8JSJjqxMbpqg6v8wURcyX4vZKCI3yIupm6MSyk2VOWMwF shgFrkgVWp1kqR7H0JHf5iUGilsdFXVbIFY07cBVqbK6bDKpQqPA+wotd4/7jNt6Y3rn tAgO+zqV0x4+qnmu9me7VDfegFxdmvbYJ8bZS5RsnjdfWNe99sUsYyb7IZosBb4+yryf EMzg== X-Received: by 10.224.215.194 with SMTP id hf2mr8662932qab.0.1369403241790; Fri, 24 May 2013 06:47:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.24.174 with SMTP id v14ls1928611qef.26.gmail; Fri, 24 May 2013 06:47:21 -0700 (PDT) X-Received: by 10.220.78.212 with SMTP id m20mr8623492vck.46.1369403241617; Fri, 24 May 2013 06:47:21 -0700 (PDT) Received: from mail-vb0-x22c.google.com (mail-vb0-x22c.google.com [2607:f8b0:400c:c02::22c]) by mx.google.com with ESMTPS id l3si5300279vca.13.2013.05.24.06.47.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 May 2013 06:47:21 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22c 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:c02::22c; Received: by mail-vb0-f44.google.com with SMTP id i3so1347009vbh.3 for ; Fri, 24 May 2013 06:47:21 -0700 (PDT) X-Received: by 10.220.92.195 with SMTP id s3mr8645147vcm.9.1369403241484; Fri, 24 May 2013 06:47:21 -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 c10csp102423vcs; Fri, 24 May 2013 06:47:20 -0700 (PDT) X-Received: by 10.68.131.195 with SMTP id oo3mr17792188pbb.143.1369403240495; Fri, 24 May 2013 06:47:20 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id lm2si12868723pab.267.2013.05.24.06.47.20 for ; Fri, 24 May 2013 06:47:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.34 as permitted sender) client-ip=203.254.224.34; 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 patches@linaro.org; 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 Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, u-boot-review@google.com Subject: [PATCH 1/2 V4] SPI: Add support for preamble bytes 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/AeyObg4BXwk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iYOTqkGxrgK wVXH9DldVJYHJt+vKF4isvLBNOcFV7/Htzz/ydrZobJ1BfPat2dSy1Zbf5vrfKn62LLqeR2n bKb6HFj8MeFq8Dv7WSEygRw19/7W1liU3ZmhtPNGp5G26YXJJ3kn7M++lMVTIiRQMO3OMgev 2TtvcMh5z5E4PUW36jPP14LA182L/TeoeSuxFGckGmoxFxUnAgDFoqMQ3AIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQlJsZFlZCXk1TPIiECJxcRAalxTkl+NvEiBlvbyUNoY5OgLwkAtQpkcg+q2Rwomwir7+PO0 X-Original-Sender: rajeshwari.s@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22c 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. 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. *