0001
0002 #ifndef __SPI_BITBANG_H
0003 #define __SPI_BITBANG_H
0004
0005 #include <linux/workqueue.h>
0006
0007 struct spi_bitbang {
0008 struct mutex lock;
0009 u8 busy;
0010 u8 use_dma;
0011 u16 flags;
0012
0013 struct spi_master *master;
0014
0015
0016
0017
0018 int (*setup_transfer)(struct spi_device *spi,
0019 struct spi_transfer *t);
0020
0021 void (*chipselect)(struct spi_device *spi, int is_on);
0022 #define BITBANG_CS_ACTIVE 1
0023 #define BITBANG_CS_INACTIVE 0
0024
0025
0026
0027
0028 int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t);
0029
0030
0031 u32 (*txrx_word[4])(struct spi_device *spi,
0032 unsigned nsecs,
0033 u32 word, u8 bits, unsigned flags);
0034 int (*set_line_direction)(struct spi_device *spi, bool output);
0035 };
0036
0037
0038
0039
0040 extern int spi_bitbang_setup(struct spi_device *spi);
0041 extern void spi_bitbang_cleanup(struct spi_device *spi);
0042 extern int spi_bitbang_setup_transfer(struct spi_device *spi,
0043 struct spi_transfer *t);
0044
0045
0046 extern int spi_bitbang_start(struct spi_bitbang *spi);
0047 extern int spi_bitbang_init(struct spi_bitbang *spi);
0048 extern void spi_bitbang_stop(struct spi_bitbang *spi);
0049
0050 #endif