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