summaryrefslogtreecommitdiff
path: root/drivers/staging/xillybus
diff options
context:
space:
mode:
authorEli Billauer <eli.billauer@gmail.com>2013-12-30 23:16:25 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-09 10:42:36 -0800
commitcc212550eed155d99e1d4b3e0cfa3510a3d9f9af (patch)
treea48a60af69bd10009cc8664debdbd73035e44c00 /drivers/staging/xillybus
parent24b33c909ec9096c0613ae30aedd2b4ba2e89efa (diff)
staging: xillybus: Open Firmware driver supporting coherent DMA
If the "dma-coherent" property is present in the device tree, the driver will not perform cache invalidations. This feature significantly improves data throughput and reduces CPU load. Signed-off-by: Eli Billauer <eli.billauer@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/xillybus')
-rw-r--r--drivers/staging/xillybus/xillybus_of.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/staging/xillybus/xillybus_of.c b/drivers/staging/xillybus/xillybus_of.c
index be124406d711..23a609b0ab1d 100644
--- a/drivers/staging/xillybus/xillybus_of.c
+++ b/drivers/staging/xillybus/xillybus_of.c
@@ -54,6 +54,13 @@ static void xilly_dma_sync_single_for_device_of(struct xilly_endpoint *ep,
dma_sync_single_for_device(ep->dev, dma_handle, size, direction);
}
+static void xilly_dma_sync_single_nop(struct xilly_endpoint *ep,
+ dma_addr_t dma_handle,
+ size_t size,
+ int direction)
+{
+}
+
static dma_addr_t xilly_map_single_of(struct xilly_cleanup *mem,
struct xilly_endpoint *ep,
void *ptr,
@@ -102,14 +109,26 @@ static struct xilly_endpoint_hardware of_hw = {
.unmap_single = xilly_unmap_single_of
};
+static struct xilly_endpoint_hardware of_hw_coherent = {
+ .owner = THIS_MODULE,
+ .hw_sync_sgl_for_cpu = xilly_dma_sync_single_nop,
+ .hw_sync_sgl_for_device = xilly_dma_sync_single_nop,
+ .map_single = xilly_map_single_of,
+ .unmap_single = xilly_unmap_single_of
+};
+
static int xilly_drv_probe(struct platform_device *op)
{
struct device *dev = &op->dev;
struct xilly_endpoint *endpoint;
int rc = 0;
int irq;
+ struct xilly_endpoint_hardware *ephw = &of_hw;
+
+ if (of_property_read_bool(dev->of_node, "dma-coherent"))
+ ephw = &of_hw_coherent;
- endpoint = xillybus_init_endpoint(NULL, dev, &of_hw);
+ endpoint = xillybus_init_endpoint(NULL, dev, ephw);
if (!endpoint)
return -ENOMEM;