1
2
3
4
5
6
7
8
9
10
11 #ifndef _I2C_STM32_H
12 #define _I2C_STM32_H
13
14 #include <linux/dma-direction.h>
15 #include <linux/dmaengine.h>
16 #include <linux/dma-mapping.h>
17
18 enum stm32_i2c_speed {
19 STM32_I2C_SPEED_STANDARD,
20 STM32_I2C_SPEED_FAST,
21 STM32_I2C_SPEED_FAST_PLUS,
22 STM32_I2C_SPEED_END,
23 };
24
25
26
27
28
29
30
31
32
33
34
35
36 struct stm32_i2c_dma {
37 struct dma_chan *chan_tx;
38 struct dma_chan *chan_rx;
39 struct dma_chan *chan_using;
40 dma_addr_t dma_buf;
41 unsigned int dma_len;
42 enum dma_transfer_direction dma_transfer_dir;
43 enum dma_data_direction dma_data_dir;
44 struct completion dma_complete;
45 };
46
47 struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
48 dma_addr_t phy_addr,
49 u32 txdr_offset, u32 rxdr_offset);
50
51 void stm32_i2c_dma_free(struct stm32_i2c_dma *dma);
52
53 int stm32_i2c_prep_dma_xfer(struct device *dev, struct stm32_i2c_dma *dma,
54 bool rd_wr, u32 len, u8 *buf,
55 dma_async_tx_callback callback,
56 void *dma_async_param);
57
58 #endif