aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dmaengine.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/dmaengine.h')
-rw-r--r--include/linux/dmaengine.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 0c72b89a172c..0bc727534108 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -373,6 +373,25 @@ struct dma_slave_config {
373 unsigned int slave_id; 373 unsigned int slave_id;
374}; 374};
375 375
376/* struct dma_slave_caps - expose capabilities of a slave channel only
377 *
378 * @src_addr_widths: bit mask of src addr widths the channel supports
379 * @dstn_addr_widths: bit mask of dstn addr widths the channel supports
380 * @directions: bit mask of slave direction the channel supported
381 * since the enum dma_transfer_direction is not defined as bits for each
382 * type of direction, the dma controller should fill (1 << <TYPE>) and same
383 * should be checked by controller as well
384 * @cmd_pause: true, if pause and thereby resume is supported
385 * @cmd_terminate: true, if terminate cmd is supported
386 */
387struct dma_slave_caps {
388 u32 src_addr_widths;
389 u32 dstn_addr_widths;
390 u32 directions;
391 bool cmd_pause;
392 bool cmd_terminate;
393};
394
376static inline const char *dma_chan_name(struct dma_chan *chan) 395static inline const char *dma_chan_name(struct dma_chan *chan)
377{ 396{
378 return dev_name(&chan->dev->device); 397 return dev_name(&chan->dev->device);
@@ -535,6 +554,7 @@ struct dma_tx_state {
535 * struct with auxiliary transfer status information, otherwise the call 554 * struct with auxiliary transfer status information, otherwise the call
536 * will just return a simple status code 555 * will just return a simple status code
537 * @device_issue_pending: push pending transactions to hardware 556 * @device_issue_pending: push pending transactions to hardware
557 * @device_slave_caps: return the slave channel capabilities
538 */ 558 */
539struct dma_device { 559struct dma_device {
540 560
@@ -600,6 +620,7 @@ struct dma_device {
600 dma_cookie_t cookie, 620 dma_cookie_t cookie,
601 struct dma_tx_state *txstate); 621 struct dma_tx_state *txstate);
602 void (*device_issue_pending)(struct dma_chan *chan); 622 void (*device_issue_pending)(struct dma_chan *chan);
623 int (*device_slave_caps)(struct dma_chan *chan, struct dma_slave_caps *caps);
603}; 624};
604 625
605static inline int dmaengine_device_control(struct dma_chan *chan, 626static inline int dmaengine_device_control(struct dma_chan *chan,
@@ -673,6 +694,21 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
673 return chan->device->device_prep_interleaved_dma(chan, xt, flags); 694 return chan->device->device_prep_interleaved_dma(chan, xt, flags);
674} 695}
675 696
697static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
698{
699 if (!chan || !caps)
700 return -EINVAL;
701
702 /* check if the channel supports slave transactions */
703 if (!test_bit(DMA_SLAVE, chan->device->cap_mask.bits))
704 return -ENXIO;
705
706 if (chan->device->device_slave_caps)
707 return chan->device->device_slave_caps(chan, caps);
708
709 return -ENXIO;
710}
711
676static inline int dmaengine_terminate_all(struct dma_chan *chan) 712static inline int dmaengine_terminate_all(struct dma_chan *chan)
677{ 713{
678 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); 714 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0);
@@ -1006,6 +1042,7 @@ static inline void dma_release_channel(struct dma_chan *chan)
1006int dma_async_device_register(struct dma_device *device); 1042int dma_async_device_register(struct dma_device *device);
1007void dma_async_device_unregister(struct dma_device *device); 1043void dma_async_device_unregister(struct dma_device *device);
1008void dma_run_dependencies(struct dma_async_tx_descriptor *tx); 1044void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
1045struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
1009struct dma_chan *net_dma_find_channel(void); 1046struct dma_chan *net_dma_find_channel(void);
1010#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) 1047#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
1011#define dma_request_slave_channel_compat(mask, x, y, dev, name) \ 1048#define dma_request_slave_channel_compat(mask, x, y, dev, name) \