diff options
Diffstat (limited to 'include/linux/dmaengine.h')
-rw-r--r-- | include/linux/dmaengine.h | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 41cf0c399288..c5c92d59e531 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #define LINUX_DMAENGINE_H | 22 | #define LINUX_DMAENGINE_H |
23 | 23 | ||
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | #include <linux/err.h> | ||
25 | #include <linux/uio.h> | 26 | #include <linux/uio.h> |
26 | #include <linux/bug.h> | 27 | #include <linux/bug.h> |
27 | #include <linux/scatterlist.h> | 28 | #include <linux/scatterlist.h> |
@@ -256,7 +257,7 @@ struct dma_chan_percpu { | |||
256 | * @dev: class device for sysfs | 257 | * @dev: class device for sysfs |
257 | * @device_node: used to add this to the device chan list | 258 | * @device_node: used to add this to the device chan list |
258 | * @local: per-cpu pointer to a struct dma_chan_percpu | 259 | * @local: per-cpu pointer to a struct dma_chan_percpu |
259 | * @client-count: how many clients are using this channel | 260 | * @client_count: how many clients are using this channel |
260 | * @table_count: number of appearances in the mem-to-mem allocation table | 261 | * @table_count: number of appearances in the mem-to-mem allocation table |
261 | * @private: private data for certain client-channel associations | 262 | * @private: private data for certain client-channel associations |
262 | */ | 263 | */ |
@@ -278,10 +279,10 @@ struct dma_chan { | |||
278 | 279 | ||
279 | /** | 280 | /** |
280 | * struct dma_chan_dev - relate sysfs device node to backing channel device | 281 | * struct dma_chan_dev - relate sysfs device node to backing channel device |
281 | * @chan - driver channel device | 282 | * @chan: driver channel device |
282 | * @device - sysfs device | 283 | * @device: sysfs device |
283 | * @dev_id - parent dma_device dev_id | 284 | * @dev_id: parent dma_device dev_id |
284 | * @idr_ref - reference count to gate release of dma_device dev_id | 285 | * @idr_ref: reference count to gate release of dma_device dev_id |
285 | */ | 286 | */ |
286 | struct dma_chan_dev { | 287 | struct dma_chan_dev { |
287 | struct dma_chan *chan; | 288 | struct dma_chan *chan; |
@@ -305,9 +306,8 @@ enum dma_slave_buswidth { | |||
305 | /** | 306 | /** |
306 | * struct dma_slave_config - dma slave channel runtime config | 307 | * struct dma_slave_config - dma slave channel runtime config |
307 | * @direction: whether the data shall go in or out on this slave | 308 | * @direction: whether the data shall go in or out on this slave |
308 | * channel, right now. DMA_TO_DEVICE and DMA_FROM_DEVICE are | 309 | * channel, right now. DMA_MEM_TO_DEV and DMA_DEV_TO_MEM are |
309 | * legal values, DMA_BIDIRECTIONAL is not acceptable since we | 310 | * legal values. |
310 | * need to differentiate source and target addresses. | ||
311 | * @src_addr: this is the physical address where DMA slave data | 311 | * @src_addr: this is the physical address where DMA slave data |
312 | * should be read (RX), if the source is memory this argument is | 312 | * should be read (RX), if the source is memory this argument is |
313 | * ignored. | 313 | * ignored. |
@@ -363,6 +363,32 @@ struct dma_slave_config { | |||
363 | unsigned int slave_id; | 363 | unsigned int slave_id; |
364 | }; | 364 | }; |
365 | 365 | ||
366 | /** | ||
367 | * enum dma_residue_granularity - Granularity of the reported transfer residue | ||
368 | * @DMA_RESIDUE_GRANULARITY_DESCRIPTOR: Residue reporting is not support. The | ||
369 | * DMA channel is only able to tell whether a descriptor has been completed or | ||
370 | * not, which means residue reporting is not supported by this channel. The | ||
371 | * residue field of the dma_tx_state field will always be 0. | ||
372 | * @DMA_RESIDUE_GRANULARITY_SEGMENT: Residue is updated after each successfully | ||
373 | * completed segment of the transfer (For cyclic transfers this is after each | ||
374 | * period). This is typically implemented by having the hardware generate an | ||
375 | * interrupt after each transferred segment and then the drivers updates the | ||
376 | * outstanding residue by the size of the segment. Another possibility is if | ||
377 | * the hardware supports scatter-gather and the segment descriptor has a field | ||
378 | * which gets set after the segment has been completed. The driver then counts | ||
379 | * the number of segments without the flag set to compute the residue. | ||
380 | * @DMA_RESIDUE_GRANULARITY_BURST: Residue is updated after each transferred | ||
381 | * burst. This is typically only supported if the hardware has a progress | ||
382 | * register of some sort (E.g. a register with the current read/write address | ||
383 | * or a register with the amount of bursts/beats/bytes that have been | ||
384 | * transferred or still need to be transferred). | ||
385 | */ | ||
386 | enum dma_residue_granularity { | ||
387 | DMA_RESIDUE_GRANULARITY_DESCRIPTOR = 0, | ||
388 | DMA_RESIDUE_GRANULARITY_SEGMENT = 1, | ||
389 | DMA_RESIDUE_GRANULARITY_BURST = 2, | ||
390 | }; | ||
391 | |||
366 | /* struct dma_slave_caps - expose capabilities of a slave channel only | 392 | /* struct dma_slave_caps - expose capabilities of a slave channel only |
367 | * | 393 | * |
368 | * @src_addr_widths: bit mask of src addr widths the channel supports | 394 | * @src_addr_widths: bit mask of src addr widths the channel supports |
@@ -373,6 +399,7 @@ struct dma_slave_config { | |||
373 | * should be checked by controller as well | 399 | * should be checked by controller as well |
374 | * @cmd_pause: true, if pause and thereby resume is supported | 400 | * @cmd_pause: true, if pause and thereby resume is supported |
375 | * @cmd_terminate: true, if terminate cmd is supported | 401 | * @cmd_terminate: true, if terminate cmd is supported |
402 | * @residue_granularity: granularity of the reported transfer residue | ||
376 | */ | 403 | */ |
377 | struct dma_slave_caps { | 404 | struct dma_slave_caps { |
378 | u32 src_addr_widths; | 405 | u32 src_addr_widths; |
@@ -380,6 +407,7 @@ struct dma_slave_caps { | |||
380 | u32 directions; | 407 | u32 directions; |
381 | bool cmd_pause; | 408 | bool cmd_pause; |
382 | bool cmd_terminate; | 409 | bool cmd_terminate; |
410 | enum dma_residue_granularity residue_granularity; | ||
383 | }; | 411 | }; |
384 | 412 | ||
385 | static inline const char *dma_chan_name(struct dma_chan *chan) | 413 | static inline const char *dma_chan_name(struct dma_chan *chan) |
@@ -1040,6 +1068,8 @@ enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); | |||
1040 | void dma_issue_pending_all(void); | 1068 | void dma_issue_pending_all(void); |
1041 | struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, | 1069 | struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, |
1042 | dma_filter_fn fn, void *fn_param); | 1070 | dma_filter_fn fn, void *fn_param); |
1071 | struct dma_chan *dma_request_slave_channel_reason(struct device *dev, | ||
1072 | const char *name); | ||
1043 | struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name); | 1073 | struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name); |
1044 | void dma_release_channel(struct dma_chan *chan); | 1074 | void dma_release_channel(struct dma_chan *chan); |
1045 | #else | 1075 | #else |
@@ -1063,6 +1093,11 @@ static inline struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, | |||
1063 | { | 1093 | { |
1064 | return NULL; | 1094 | return NULL; |
1065 | } | 1095 | } |
1096 | static inline struct dma_chan *dma_request_slave_channel_reason( | ||
1097 | struct device *dev, const char *name) | ||
1098 | { | ||
1099 | return ERR_PTR(-ENODEV); | ||
1100 | } | ||
1066 | static inline struct dma_chan *dma_request_slave_channel(struct device *dev, | 1101 | static inline struct dma_chan *dma_request_slave_channel(struct device *dev, |
1067 | const char *name) | 1102 | const char *name) |
1068 | { | 1103 | { |
@@ -1079,6 +1114,7 @@ int dma_async_device_register(struct dma_device *device); | |||
1079 | void dma_async_device_unregister(struct dma_device *device); | 1114 | void dma_async_device_unregister(struct dma_device *device); |
1080 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); | 1115 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); |
1081 | struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); | 1116 | struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); |
1117 | struct dma_chan *dma_get_any_slave_channel(struct dma_device *device); | ||
1082 | struct dma_chan *net_dma_find_channel(void); | 1118 | struct dma_chan *net_dma_find_channel(void); |
1083 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) | 1119 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) |
1084 | #define dma_request_slave_channel_compat(mask, x, y, dev, name) \ | 1120 | #define dma_request_slave_channel_compat(mask, x, y, dev, name) \ |