summaryrefslogtreecommitdiff
path: root/include/spi.h
diff options
context:
space:
mode:
authorJerry Huang <Chang-Ming.Huang@freescale.com>2009-10-22 16:42:11 +0800
committerScott Sweeny <scott.sweeny@timesys.com>2010-09-29 17:32:29 -0400
commit9e2ee7c62e1f7596ad01432063396664f7af0b75 (patch)
tree91b0559b558df95138fabc0983d0c5f5ff057f83 /include/spi.h
parent63b85137a85f1c11fe2763caf479f2b56c4afffa (diff)
eSPI and eSPI controller support
This patch is from MPC8536, and fixed some hunk failed error. Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com> Singed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
Diffstat (limited to 'include/spi.h')
-rw-r--r--include/spi.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/spi.h b/include/spi.h
index 320e50e529..01c9bb4a39 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -2,6 +2,8 @@
* (C) Copyright 2001
* Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com.
*
+ * Copyright(c) 2009 Freescale Semiconductor, Inc
+ *
* See file CREDITS for list of people who contributed to this
* project.
*
@@ -50,16 +52,38 @@
#define SPI_XFER_END 0x02 /* Deassert CS after transfer */
/*-----------------------------------------------------------------------
+ * Representation of a eSPI transaction, which is always embeded in
+ * structure spi_slave.
+ *
+ * cmd_len: Length of the command.
+ * data_len: Length of the transmit/receive data.
+ * tx_buf: Buffer to store the transmit command and data.
+ * rx_buf: Buffer to store the receive data.
+ * flags: Flags to indicate the begin/end of the transfer.
+ */
+struct espi_transfer {
+ unsigned int cmd_len;
+ unsigned int data_len;
+ const void *tx_buf;
+ void *rx_buf;
+
+ unsigned long flags;
+};
+
+/*-----------------------------------------------------------------------
* Representation of a SPI slave, i.e. what we're communicating with.
*
* Drivers are expected to extend this with controller-specific data.
*
* bus: ID of the bus that the slave is attached to.
* cs: ID of the chip select connected to the slave.
+ * transfer: Represent an eSPI transaction.
*/
struct spi_slave {
unsigned int bus;
unsigned int cs;
+
+ struct espi_transfer *transfer;
};
/*-----------------------------------------------------------------------
@@ -148,6 +172,14 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
void *din, unsigned long flags);
/*-----------------------------------------------------------------------
+ * eSPI transfer
+ *
+ * Returns: 0 on success, not 0 on failure
+ */
+int espi_xfer(struct spi_slave *slave);
+
+
+/*-----------------------------------------------------------------------
* Determine if a SPI chipselect is valid.
* This function is provided by the board if the low-level SPI driver
* needs it to determine if a given chipselect is actually valid.