diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 18:10:18 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 18:10:18 -0700 | 
| commit | 08615d7d85e5aa02c05bf6c4dde87d940e7f85f6 (patch) | |
| tree | 18906149d313d25914160aca21cedf54b3a7e818 /drivers/rapidio/rio.c | |
| parent | 9fdadb2cbaf4b482dfd6086e8bd3d2db071a1702 (diff) | |
| parent | 0a4dd35c67b144d8ef9432120105f1aab9293ee9 (diff) | |
| download | olio-linux-3.10-08615d7d85e5aa02c05bf6c4dde87d940e7f85f6.tar.xz olio-linux-3.10-08615d7d85e5aa02c05bf6c4dde87d940e7f85f6.zip  | |
Merge branch 'akpm' (Andrew's patch-bomb)
Merge misc patches from Andrew Morton:
 - the "misc" tree - stuff from all over the map
 - checkpatch updates
 - fatfs
 - kmod changes
 - procfs
 - cpumask
 - UML
 - kexec
 - mqueue
 - rapidio
 - pidns
 - some checkpoint-restore feature work.  Reluctantly.  Most of it
   delayed a release.  I'm still rather worried that we don't have a
   clear roadmap to completion for this work.
* emailed from Andrew Morton <akpm@linux-foundation.org>: (78 patches)
  kconfig: update compression algorithm info
  c/r: prctl: add ability to set new mm_struct::exe_file
  c/r: prctl: extend PR_SET_MM to set up more mm_struct entries
  c/r: procfs: add arg_start/end, env_start/end and exit_code members to /proc/$pid/stat
  syscalls, x86: add __NR_kcmp syscall
  fs, proc: introduce /proc/<pid>/task/<tid>/children entry
  sysctl: make kernel.ns_last_pid control dependent on CHECKPOINT_RESTORE
  aio/vfs: cleanup of rw_copy_check_uvector() and compat_rw_copy_check_uvector()
  eventfd: change int to __u64 in eventfd_signal()
  fs/nls: add Apple NLS
  pidns: make killed children autoreap
  pidns: use task_active_pid_ns in do_notify_parent
  rapidio/tsi721: add DMA engine support
  rapidio: add DMA engine support for RIO data transfers
  ipc/mqueue: add rbtree node caching support
  tools/selftests: add mq_perf_tests
  ipc/mqueue: strengthen checks on mqueue creation
  ipc/mqueue: correct mq_attr_ok test
  ipc/mqueue: improve performance of send/recv
  selftests: add mq_open_tests
  ...
Diffstat (limited to 'drivers/rapidio/rio.c')
| -rw-r--r-- | drivers/rapidio/rio.c | 81 | 
1 files changed, 81 insertions, 0 deletions
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index 86c9a091a2f..c40665a4fa3 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c @@ -1121,6 +1121,87 @@ int rio_std_route_clr_table(struct rio_mport *mport, u16 destid, u8 hopcount,  	return 0;  } +#ifdef CONFIG_RAPIDIO_DMA_ENGINE + +static bool rio_chan_filter(struct dma_chan *chan, void *arg) +{ +	struct rio_dev *rdev = arg; + +	/* Check that DMA device belongs to the right MPORT */ +	return (rdev->net->hport == +		container_of(chan->device, struct rio_mport, dma)); +} + +/** + * rio_request_dma - request RapidIO capable DMA channel that supports + *   specified target RapidIO device. + * @rdev: RIO device control structure + * + * Returns pointer to allocated DMA channel or NULL if failed. + */ +struct dma_chan *rio_request_dma(struct rio_dev *rdev) +{ +	dma_cap_mask_t mask; +	struct dma_chan *dchan; + +	dma_cap_zero(mask); +	dma_cap_set(DMA_SLAVE, mask); +	dchan = dma_request_channel(mask, rio_chan_filter, rdev); + +	return dchan; +} +EXPORT_SYMBOL_GPL(rio_request_dma); + +/** + * rio_release_dma - release specified DMA channel + * @dchan: DMA channel to release + */ +void rio_release_dma(struct dma_chan *dchan) +{ +	dma_release_channel(dchan); +} +EXPORT_SYMBOL_GPL(rio_release_dma); + +/** + * rio_dma_prep_slave_sg - RapidIO specific wrapper + *   for device_prep_slave_sg callback defined by DMAENGINE. + * @rdev: RIO device control structure + * @dchan: DMA channel to configure + * @data: RIO specific data descriptor + * @direction: DMA data transfer direction (TO or FROM the device) + * @flags: dmaengine defined flags + * + * Initializes RapidIO capable DMA channel for the specified data transfer. + * Uses DMA channel private extension to pass information related to remote + * target RIO device. + * Returns pointer to DMA transaction descriptor or NULL if failed. + */ +struct dma_async_tx_descriptor *rio_dma_prep_slave_sg(struct rio_dev *rdev, +	struct dma_chan *dchan, struct rio_dma_data *data, +	enum dma_transfer_direction direction, unsigned long flags) +{ +	struct dma_async_tx_descriptor *txd = NULL; +	struct rio_dma_ext rio_ext; + +	if (dchan->device->device_prep_slave_sg == NULL) { +		pr_err("%s: prep_rio_sg == NULL\n", __func__); +		return NULL; +	} + +	rio_ext.destid = rdev->destid; +	rio_ext.rio_addr_u = data->rio_addr_u; +	rio_ext.rio_addr = data->rio_addr; +	rio_ext.wr_type = data->wr_type; + +	txd = dmaengine_prep_rio_sg(dchan, data->sg, data->sg_len, +					direction, flags, &rio_ext); + +	return txd; +} +EXPORT_SYMBOL_GPL(rio_dma_prep_slave_sg); + +#endif /* CONFIG_RAPIDIO_DMA_ENGINE */ +  static void rio_fixup_device(struct rio_dev *dev)  {  }  |