1
2 #ifndef __SPI_BITBANG_H
3 #define __SPI_BITBANG_H
4
5 #include <linux/workqueue.h>
6
7 struct spi_bitbang {
8 struct mutex lock;
9 u8 busy;
10 u8 use_dma;
11 u16 flags;
12
13 struct spi_master *master;
14
15
16
17
18 int (*setup_transfer)(struct spi_device *spi,
19 struct spi_transfer *t);
20
21 void (*chipselect)(struct spi_device *spi, int is_on);
22 #define BITBANG_CS_ACTIVE 1
23 #define BITBANG_CS_INACTIVE 0
24
25
26
27
28 int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t);
29
30
31 u32 (*txrx_word[4])(struct spi_device *spi,
32 unsigned nsecs,
33 u32 word, u8 bits, unsigned flags);
34 int (*set_line_direction)(struct spi_device *spi, bool output);
35 };
36
37
38
39
40 extern int spi_bitbang_setup(struct spi_device *spi);
41 extern void spi_bitbang_cleanup(struct spi_device *spi);
42 extern int spi_bitbang_setup_transfer(struct spi_device *spi,
43 struct spi_transfer *t);
44
45
46 extern int spi_bitbang_start(struct spi_bitbang *spi);
47 extern int spi_bitbang_init(struct spi_bitbang *spi);
48 extern void spi_bitbang_stop(struct spi_bitbang *spi);
49
50 #endif