1
2
3
4
5
6
7
8
9
10
11
12#ifndef DW_DMAC_H
13#define DW_DMAC_H
14
15#include <linux/dmaengine.h>
16
17
18
19
20
21
22
23
24
25
26
27struct dw_dma_platform_data {
28 unsigned int nr_channels;
29 bool is_private;
30#define CHAN_ALLOCATION_ASCENDING 0
31#define CHAN_ALLOCATION_DESCENDING 1
32 unsigned char chan_allocation_order;
33#define CHAN_PRIORITY_ASCENDING 0
34#define CHAN_PRIORITY_DESCENDING 1
35 unsigned char chan_priority;
36 unsigned short block_size;
37 unsigned char nr_masters;
38 unsigned char data_width[4];
39};
40
41
42enum dw_dma_msize {
43 DW_DMA_MSIZE_1,
44 DW_DMA_MSIZE_4,
45 DW_DMA_MSIZE_8,
46 DW_DMA_MSIZE_16,
47 DW_DMA_MSIZE_32,
48 DW_DMA_MSIZE_64,
49 DW_DMA_MSIZE_128,
50 DW_DMA_MSIZE_256,
51};
52
53
54
55
56
57
58
59
60
61
62struct dw_dma_slave {
63 struct device *dma_dev;
64 u32 cfg_hi;
65 u32 cfg_lo;
66 u8 src_master;
67 u8 dst_master;
68};
69
70
71#define DWC_CFGH_FCMODE (1 << 0)
72#define DWC_CFGH_FIFO_MODE (1 << 1)
73#define DWC_CFGH_PROTCTL(x) ((x) << 2)
74#define DWC_CFGH_SRC_PER(x) ((x) << 7)
75#define DWC_CFGH_DST_PER(x) ((x) << 11)
76
77
78#define DWC_CFGL_LOCK_CH_XFER (0 << 12)
79#define DWC_CFGL_LOCK_CH_BLOCK (1 << 12)
80#define DWC_CFGL_LOCK_CH_XACT (2 << 12)
81#define DWC_CFGL_LOCK_BUS_XFER (0 << 14)
82#define DWC_CFGL_LOCK_BUS_BLOCK (1 << 14)
83#define DWC_CFGL_LOCK_BUS_XACT (2 << 14)
84#define DWC_CFGL_LOCK_CH (1 << 15)
85#define DWC_CFGL_LOCK_BUS (1 << 16)
86#define DWC_CFGL_HS_DST_POL (1 << 18)
87#define DWC_CFGL_HS_SRC_POL (1 << 19)
88
89
90struct dw_cyclic_desc {
91 struct dw_desc **desc;
92 unsigned long periods;
93 void (*period_callback)(void *param);
94 void *period_callback_param;
95};
96
97struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
98 dma_addr_t buf_addr, size_t buf_len, size_t period_len,
99 enum dma_transfer_direction direction);
100void dw_dma_cyclic_free(struct dma_chan *chan);
101int dw_dma_cyclic_start(struct dma_chan *chan);
102void dw_dma_cyclic_stop(struct dma_chan *chan);
103
104dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
105
106dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
107
108#endif
109