summaryrefslogtreecommitdiff
path: root/include/spi.h
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <lg@denx.de>2008-04-15 14:14:25 +0200
committerWolfgang Denk <wd@denx.de>2008-04-18 00:43:23 -0700
commit38254f45b0b412332726c90d3184ad47479fcffb (patch)
tree927798cfb0fb9f53e461071b63af16ebdc0b5912 /include/spi.h
parent248b7d984cffa3107b5acb4c3f5501b7538d877a (diff)
New i.MX31 SPI driver
This is an SPI driver for i.MX and MXC based SoCs from Freescale. So far only implemented and tested on i.MX31, can with a modified register layout and definitions be used for i.MX27, I think, MXC CPUs have similar SPI controllers too. Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
Diffstat (limited to 'include/spi.h')
-rw-r--r--include/spi.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/spi.h b/include/spi.h
index 03dc5bc0368..3a55a68c4d1 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -24,6 +24,18 @@
#ifndef _SPI_H_
#define _SPI_H_
+/* SPI mode flags */
+#define SPI_CPHA 0x01 /* clock phase */
+#define SPI_CPOL 0x02 /* clock polarity */
+#define SPI_MODE_0 (0|0) /* (original MicroWire) */
+#define SPI_MODE_1 (0|SPI_CPHA)
+#define SPI_MODE_2 (SPI_CPOL|0)
+#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
+#define SPI_CS_HIGH 0x04 /* chipselect active high? */
+#define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */
+#define SPI_3WIRE 0x10 /* SI/SO signals shared */
+#define SPI_LOOP 0x20 /* loopback mode */
+
/*
* The function call pointer type used to drive the chip select.
*/
@@ -68,6 +80,8 @@ void spi_init(void);
*
* Returns: 0 on success, not 0 on failure
*/
-int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din);
+int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din);
+
+int spi_select(unsigned int bus, unsigned int dev, unsigned long mode);
#endif /* _SPI_H_ */