.. | .. |
---|
62 | 62 | DMA_ASYNC_TX, |
---|
63 | 63 | DMA_SLAVE, |
---|
64 | 64 | DMA_CYCLIC, |
---|
| 65 | + DMA_OOB, |
---|
65 | 66 | DMA_INTERLEAVE, |
---|
66 | 67 | DMA_COMPLETION_NO_ORDER, |
---|
67 | 68 | DMA_REPEAT, |
---|
.. | .. |
---|
191 | 192 | * transaction is marked with DMA_PREP_REPEAT will cause the new transaction |
---|
192 | 193 | * to never be processed and stay in the issued queue forever. The flag is |
---|
193 | 194 | * ignored if the previous transaction is not a repeated transaction. |
---|
| 195 | + * @DMA_OOB_INTERRUPT - if DMA_OOB is supported, handle the completion |
---|
| 196 | + * interrupt for this transaction from the out-of-band stage (implies |
---|
| 197 | + * DMA_PREP_INTERRUPT). This includes calling the completion callback routine |
---|
| 198 | + * from such context if defined for the transaction. |
---|
| 199 | + * @DMA_OOB_PULSE - if DMA_OOB is supported, (slave) transactions on the |
---|
| 200 | + * out-of-band channel should be triggered manually by a call to |
---|
| 201 | + * dma_pulse_oob() (implies DMA_OOB_INTERRUPT). |
---|
194 | 202 | */ |
---|
195 | 203 | enum dma_ctrl_flags { |
---|
196 | 204 | DMA_PREP_INTERRUPT = (1 << 0), |
---|
.. | .. |
---|
203 | 211 | DMA_PREP_CMD = (1 << 7), |
---|
204 | 212 | DMA_PREP_REPEAT = (1 << 8), |
---|
205 | 213 | DMA_PREP_LOAD_EOT = (1 << 9), |
---|
| 214 | + DMA_OOB_INTERRUPT = (1 << 10), |
---|
| 215 | + DMA_OOB_PULSE = (1 << 11), |
---|
206 | 216 | }; |
---|
207 | 217 | |
---|
208 | 218 | /** |
---|
.. | .. |
---|
940 | 950 | dma_cookie_t cookie, |
---|
941 | 951 | struct dma_tx_state *txstate); |
---|
942 | 952 | void (*device_issue_pending)(struct dma_chan *chan); |
---|
| 953 | + int (*device_pulse_oob)(struct dma_chan *chan); |
---|
943 | 954 | void (*device_release)(struct dma_device *dev); |
---|
944 | 955 | /* debugfs support */ |
---|
945 | 956 | #ifdef CONFIG_DEBUG_FS |
---|
.. | .. |
---|
983 | 994 | dir, flags, NULL); |
---|
984 | 995 | } |
---|
985 | 996 | |
---|
| 997 | +static inline bool dmaengine_oob_valid(struct dma_chan *chan, |
---|
| 998 | + unsigned long flags) |
---|
| 999 | +{ |
---|
| 1000 | + return !(dovetailing() && |
---|
| 1001 | + flags & (DMA_OOB_INTERRUPT|DMA_OOB_PULSE) && |
---|
| 1002 | + !test_bit(DMA_OOB, chan->device->cap_mask.bits)); |
---|
| 1003 | +} |
---|
| 1004 | + |
---|
986 | 1005 | static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg( |
---|
987 | 1006 | struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len, |
---|
988 | 1007 | enum dma_transfer_direction dir, unsigned long flags) |
---|
989 | 1008 | { |
---|
990 | 1009 | if (!chan || !chan->device || !chan->device->device_prep_slave_sg) |
---|
| 1010 | + return NULL; |
---|
| 1011 | + |
---|
| 1012 | + if (!dmaengine_oob_valid(chan, flags)) |
---|
991 | 1013 | return NULL; |
---|
992 | 1014 | |
---|
993 | 1015 | return chan->device->device_prep_slave_sg(chan, sgl, sg_len, |
---|
.. | .. |
---|
1015 | 1037 | unsigned long flags) |
---|
1016 | 1038 | { |
---|
1017 | 1039 | if (!chan || !chan->device || !chan->device->device_prep_dma_cyclic) |
---|
| 1040 | + return NULL; |
---|
| 1041 | + |
---|
| 1042 | + if (!dmaengine_oob_valid(chan, flags)) |
---|
1018 | 1043 | return NULL; |
---|
1019 | 1044 | |
---|
1020 | 1045 | return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len, |
---|
.. | .. |
---|
1422 | 1447 | } |
---|
1423 | 1448 | |
---|
1424 | 1449 | /** |
---|
| 1450 | + * dma_pulse_oob - manual trigger of an out-of-band transaction |
---|
| 1451 | + * @chan: target DMA channel |
---|
| 1452 | + * |
---|
| 1453 | + * Trigger the next out-of-band transaction immediately. |
---|
| 1454 | + */ |
---|
| 1455 | +static inline int dma_pulse_oob(struct dma_chan *chan) |
---|
| 1456 | +{ |
---|
| 1457 | + int ret = -ENOTSUPP; |
---|
| 1458 | + |
---|
| 1459 | + if (chan->device->device_pulse_oob) |
---|
| 1460 | + ret = chan->device->device_pulse_oob(chan); |
---|
| 1461 | + |
---|
| 1462 | + return ret; |
---|
| 1463 | +} |
---|
| 1464 | + |
---|
| 1465 | +/** |
---|
1425 | 1466 | * dma_async_is_tx_complete - poll for transaction completion |
---|
1426 | 1467 | * @chan: DMA channel |
---|
1427 | 1468 | * @cookie: transaction identifier to check status of |
---|