0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef _I2C_STM32_H
0012 #define _I2C_STM32_H
0013
0014 #include <linux/dma-direction.h>
0015 #include <linux/dmaengine.h>
0016 #include <linux/dma-mapping.h>
0017
0018 enum stm32_i2c_speed {
0019 STM32_I2C_SPEED_STANDARD,
0020 STM32_I2C_SPEED_FAST,
0021 STM32_I2C_SPEED_FAST_PLUS,
0022 STM32_I2C_SPEED_END,
0023 };
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 struct stm32_i2c_dma {
0037 struct dma_chan *chan_tx;
0038 struct dma_chan *chan_rx;
0039 struct dma_chan *chan_using;
0040 dma_addr_t dma_buf;
0041 unsigned int dma_len;
0042 enum dma_transfer_direction dma_transfer_dir;
0043 enum dma_data_direction dma_data_dir;
0044 struct completion dma_complete;
0045 };
0046
0047 struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
0048 dma_addr_t phy_addr,
0049 u32 txdr_offset, u32 rxdr_offset);
0050
0051 void stm32_i2c_dma_free(struct stm32_i2c_dma *dma);
0052
0053 int stm32_i2c_prep_dma_xfer(struct device *dev, struct stm32_i2c_dma *dma,
0054 bool rd_wr, u32 len, u8 *buf,
0055 dma_async_tx_callback callback,
0056 void *dma_async_param);
0057
0058 #endif