Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f723df4 authored by Martyn Welch's avatar Martyn Welch Committed by Greg Kroah-Hartman
Browse files

Staging: vme: Attribute Testing For Dma Request



Check the directions in which the DMA controller is expected to operate
before giving control of a resource.

Signed-off-by: default avatarMartyn Welch <martyn.welch@gefanuc.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 66bd8db5
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -4,28 +4,6 @@
API
===

DMA Resource Allocation incomplete
----------------------------------

The current DMA resource Allocation provides no means of selecting the
suitability of a DMA controller based on it's supported modes of operation, as
opposed to the resource allocation mechanisms for master and slave windows:

	struct vme_resource *vme_dma_request(struct device *dev);

As opposed to:

	struct vme_resource * vme_master_request(struct device *dev,
		vme_address_t aspace, vme_cycle_t cycle, vme_width_t width);

The TSI148 can perform, VME-to-PCI, PCI-to-VME, PATTERN-to-VME, PATTERN-to-PCI,
VME-to-VME and PCI-to-PCI transfers. The CA91C142 can only provide VME-to-PCI
and PCI-to-VME.

Add a mechanism to select a VME controller based on source/target type,
required aspace, cycle and width requirements.


Master window broadcast select mask
-----------------------------------

+2 −0
Original line number Diff line number Diff line
@@ -1109,6 +1109,8 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
		mutex_init(&(dma_ctrlr->mtx));
		dma_ctrlr->locked = 0;
		dma_ctrlr->number = i;
		dma_ctrlr->route_attr = VME_DMA_VME_TO_MEM |
			VME_DMA_MEM_TO_VME;
		INIT_LIST_HEAD(&(dma_ctrlr->pending));
		INIT_LIST_HEAD(&(dma_ctrlr->running));
		list_add_tail(&(dma_ctrlr->list),
+4 −0
Original line number Diff line number Diff line
@@ -2421,6 +2421,10 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
		mutex_init(&(dma_ctrlr->mtx));
		dma_ctrlr->locked = 0;
		dma_ctrlr->number = i;
		dma_ctrlr->route_attr = VME_DMA_VME_TO_MEM |
			VME_DMA_MEM_TO_VME | VME_DMA_VME_TO_VME |
			VME_DMA_MEM_TO_MEM | VME_DMA_PATTERN_TO_VME |
			VME_DMA_PATTERN_TO_MEM;
		INIT_LIST_HEAD(&(dma_ctrlr->pending));
		INIT_LIST_HEAD(&(dma_ctrlr->running));
		list_add_tail(&(dma_ctrlr->list),
+5 −3
Original line number Diff line number Diff line
@@ -643,7 +643,7 @@ EXPORT_SYMBOL(vme_master_free);
 * Request a DMA controller with specific attributes, return some unique
 * identifier.
 */
struct vme_resource *vme_dma_request(struct device *dev)
struct vme_resource *vme_dma_request(struct device *dev, vme_dma_route_t route)
{
	struct vme_bridge *bridge;
	struct list_head *dma_pos = NULL;
@@ -670,9 +670,11 @@ struct vme_resource *vme_dma_request(struct device *dev)
			continue;
		}

		/* Find an unlocked controller */
		/* Find an unlocked and compatible controller */
		mutex_lock(&(dma_ctrlr->mtx));
		if (dma_ctrlr->locked == 0) {
		if (((dma_ctrlr->route_attr & route) == route) &&
			(dma_ctrlr->locked == 0)) {

			dma_ctrlr->locked = 1;
			mutex_unlock(&(dma_ctrlr->mtx));
			allocated_ctrlr = dma_ctrlr;
+9 −1
Original line number Diff line number Diff line
@@ -68,6 +68,14 @@ typedef u32 vme_pattern_t;
#define VME_DMA_PATTERN_WORD		(1<<1)
#define VME_DMA_PATTERN_INCREMENT	(1<<2)

typedef u32 vme_dma_route_t;
#define VME_DMA_VME_TO_MEM		(1<<0)
#define VME_DMA_MEM_TO_VME		(1<<1)
#define VME_DMA_VME_TO_VME		(1<<2)
#define VME_DMA_MEM_TO_MEM		(1<<3)
#define VME_DMA_PATTERN_TO_VME		(1<<4)
#define VME_DMA_PATTERN_TO_MEM		(1<<5)

struct vme_dma_attr {
	vme_dma_t type;
	void *private;
@@ -124,7 +132,7 @@ unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int,
	unsigned int, loff_t);
void vme_master_free(struct vme_resource *);

struct vme_resource *vme_dma_request(struct device *);
struct vme_resource *vme_dma_request(struct device *, vme_dma_route_t);
struct vme_dma_list *vme_new_dma_list(struct vme_resource *);
struct vme_dma_attr *vme_dma_pattern_attribute(u32, vme_pattern_t);
struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t);
Loading