]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
spi: Add support for preamble bytes
authorRajeshwari Shinde <rajeshwari.s@samsung.com>
Tue, 28 May 2013 20:10:37 +0000 (20:10 +0000)
committerJagannadha Sutradharudu Teki <jaganna@xilinx.com>
Sun, 2 Jun 2013 18:34:40 +0000 (00:04 +0530)
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 <sjg@chromium.org>
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
include/spi.h

index 3fe2e1eab2defc568079cd8a035225bbf682b18d..1638b503945071c9ccbd5486a870ac1814160779 100644 (file)
 #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.
  *