summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPoonam Aggrwal <poonam.aggrwal@freescale.com>2009-10-28 13:24:03 +0530
committerScott Sweeny <scott.sweeny@timesys.com>2010-11-10 14:52:24 -0500
commit1ed5bbfd3582857458074b474b495f4bd0db2e0d (patch)
tree1c7cce33e9a091e3da9d4a535a3381aab9b25018 /include
parent1b81b5d902fec7b67b244991770f085670e7a4a9 (diff)
eSPI controller support under the SPI framework.
This patch has been borrowed from MPC8536DS SPI Support. Signed-off-by: Poonam Aggrwal <poonam.aggrwal@freescale.com> Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
Diffstat (limited to 'include')
-rw-r--r--include/spi.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/spi.h b/include/spi.h
index 320e50e5296..4f145edcc0f 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -1,6 +1,7 @@
/*
* (C) Copyright 2001
* Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com.
+ * Copyright 2009 Freescale Semiconductor, Inc.
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -50,16 +51,36 @@
#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 +169,12 @@ 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.