This source file includes following definitions.
- shdma_chan_filter
1
2
3
4
5
6
7
8
9
10
11
12
13 #ifndef SHDMA_BASE_H
14 #define SHDMA_BASE_H
15
16 #include <linux/dmaengine.h>
17 #include <linux/interrupt.h>
18 #include <linux/list.h>
19 #include <linux/types.h>
20
21
22
23
24
25
26
27
28 enum shdma_pm_state {
29 SHDMA_PM_ESTABLISHED,
30 SHDMA_PM_BUSY,
31 SHDMA_PM_PENDING,
32 };
33
34 struct device;
35
36
37
38
39
40
41
42 struct shdma_slave {
43 int slave_id;
44 };
45
46 struct shdma_desc {
47 struct list_head node;
48 struct dma_async_tx_descriptor async_tx;
49 enum dma_transfer_direction direction;
50 size_t partial;
51 dma_cookie_t cookie;
52 int chunks;
53 int mark;
54 bool cyclic;
55 };
56
57 struct shdma_chan {
58 spinlock_t chan_lock;
59 struct list_head ld_queue;
60 struct list_head ld_free;
61 struct dma_chan dma_chan;
62 struct device *dev;
63 void *desc;
64 int desc_num;
65 size_t max_xfer_len;
66 int id;
67 int irq;
68 int slave_id;
69 int real_slave_id;
70 int hw_req;
71
72 enum shdma_pm_state pm_state;
73 };
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 struct shdma_ops {
92 bool (*desc_completed)(struct shdma_chan *, struct shdma_desc *);
93 void (*halt_channel)(struct shdma_chan *);
94 bool (*channel_busy)(struct shdma_chan *);
95 dma_addr_t (*slave_addr)(struct shdma_chan *);
96 int (*desc_setup)(struct shdma_chan *, struct shdma_desc *,
97 dma_addr_t, dma_addr_t, size_t *);
98 int (*set_slave)(struct shdma_chan *, int, dma_addr_t, bool);
99 void (*setup_xfer)(struct shdma_chan *, int);
100 void (*start_xfer)(struct shdma_chan *, struct shdma_desc *);
101 struct shdma_desc *(*embedded_desc)(void *, int);
102 bool (*chan_irq)(struct shdma_chan *, int);
103 size_t (*get_partial)(struct shdma_chan *, struct shdma_desc *);
104 };
105
106 struct shdma_dev {
107 struct dma_device dma_dev;
108 struct shdma_chan **schan;
109 const struct shdma_ops *ops;
110 size_t desc_size;
111 };
112
113 #define shdma_for_each_chan(c, d, i) for (i = 0, c = (d)->schan[0]; \
114 i < (d)->dma_dev.chancnt; c = (d)->schan[++i])
115
116 int shdma_request_irq(struct shdma_chan *, int,
117 unsigned long, const char *);
118 bool shdma_reset(struct shdma_dev *sdev);
119 void shdma_chan_probe(struct shdma_dev *sdev,
120 struct shdma_chan *schan, int id);
121 void shdma_chan_remove(struct shdma_chan *schan);
122 int shdma_init(struct device *dev, struct shdma_dev *sdev,
123 int chan_num);
124 void shdma_cleanup(struct shdma_dev *sdev);
125 #if IS_ENABLED(CONFIG_SH_DMAE_BASE)
126 bool shdma_chan_filter(struct dma_chan *chan, void *arg);
127 #else
128 static inline bool shdma_chan_filter(struct dma_chan *chan, void *arg)
129 {
130 return false;
131 }
132 #endif
133
134 #endif