aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/at_hdmac_regs.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/at_hdmac_regs.h')
-rw-r--r--drivers/dma/at_hdmac_regs.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index a8d3277d60b5..897a8bcaec90 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -207,8 +207,8 @@ enum atc_status {
207 * @save_cfg: configuration register that is saved on suspend/resume cycle 207 * @save_cfg: configuration register that is saved on suspend/resume cycle
208 * @save_dscr: for cyclic operations, preserve next descriptor address in 208 * @save_dscr: for cyclic operations, preserve next descriptor address in
209 * the cyclic list on suspend/resume cycle 209 * the cyclic list on suspend/resume cycle
210 * @dma_sconfig: configuration for slave transfers, passed via DMA_SLAVE_CONFIG
210 * @lock: serializes enqueue/dequeue operations to descriptors lists 211 * @lock: serializes enqueue/dequeue operations to descriptors lists
211 * @completed_cookie: identifier for the most recently completed operation
212 * @active_list: list of descriptors dmaengine is being running on 212 * @active_list: list of descriptors dmaengine is being running on
213 * @queue: list of descriptors ready to be submitted to engine 213 * @queue: list of descriptors ready to be submitted to engine
214 * @free_list: list of descriptors usable by the channel 214 * @free_list: list of descriptors usable by the channel
@@ -223,11 +223,11 @@ struct at_dma_chan {
223 struct tasklet_struct tasklet; 223 struct tasklet_struct tasklet;
224 u32 save_cfg; 224 u32 save_cfg;
225 u32 save_dscr; 225 u32 save_dscr;
226 struct dma_slave_config dma_sconfig;
226 227
227 spinlock_t lock; 228 spinlock_t lock;
228 229
229 /* these other elements are all protected by lock */ 230 /* these other elements are all protected by lock */
230 dma_cookie_t completed_cookie;
231 struct list_head active_list; 231 struct list_head active_list;
232 struct list_head queue; 232 struct list_head queue;
233 struct list_head free_list; 233 struct list_head free_list;
@@ -245,6 +245,36 @@ static inline struct at_dma_chan *to_at_dma_chan(struct dma_chan *dchan)
245 return container_of(dchan, struct at_dma_chan, chan_common); 245 return container_of(dchan, struct at_dma_chan, chan_common);
246} 246}
247 247
248/*
249 * Fix sconfig's burst size according to at_hdmac. We need to convert them as:
250 * 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3, 32 -> 4, 64 -> 5, 128 -> 6, 256 -> 7.
251 *
252 * This can be done by finding most significant bit set.
253 */
254static inline void convert_burst(u32 *maxburst)
255{
256 if (*maxburst > 1)
257 *maxburst = fls(*maxburst) - 2;
258 else
259 *maxburst = 0;
260}
261
262/*
263 * Fix sconfig's bus width according to at_hdmac.
264 * 1 byte -> 0, 2 bytes -> 1, 4 bytes -> 2.
265 */
266static inline u8 convert_buswidth(enum dma_slave_buswidth addr_width)
267{
268 switch (addr_width) {
269 case DMA_SLAVE_BUSWIDTH_2_BYTES:
270 return 1;
271 case DMA_SLAVE_BUSWIDTH_4_BYTES:
272 return 2;
273 default:
274 /* For 1 byte width or fallback */
275 return 0;
276 }
277}
248 278
249/*-- Controller ------------------------------------------------------*/ 279/*-- Controller ------------------------------------------------------*/
250 280