Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eli Billauer and committed by
Greg Kroah-Hartman
cc212550 24b33c90

+20 -1
+20 -1
drivers/staging/xillybus/xillybus_of.c
··· 54 54 dma_sync_single_for_device(ep->dev, dma_handle, size, direction); 55 55 } 56 56 57 + static void xilly_dma_sync_single_nop(struct xilly_endpoint *ep, 58 + dma_addr_t dma_handle, 59 + size_t size, 60 + int direction) 61 + { 62 + } 63 + 57 64 static dma_addr_t xilly_map_single_of(struct xilly_cleanup *mem, 58 65 struct xilly_endpoint *ep, 59 66 void *ptr, ··· 109 102 .unmap_single = xilly_unmap_single_of 110 103 }; 111 104 105 + static struct xilly_endpoint_hardware of_hw_coherent = { 106 + .owner = THIS_MODULE, 107 + .hw_sync_sgl_for_cpu = xilly_dma_sync_single_nop, 108 + .hw_sync_sgl_for_device = xilly_dma_sync_single_nop, 109 + .map_single = xilly_map_single_of, 110 + .unmap_single = xilly_unmap_single_of 111 + }; 112 + 112 113 static int xilly_drv_probe(struct platform_device *op) 113 114 { 114 115 struct device *dev = &op->dev; 115 116 struct xilly_endpoint *endpoint; 116 117 int rc = 0; 117 118 int irq; 119 + struct xilly_endpoint_hardware *ephw = &of_hw; 118 120 119 - endpoint = xillybus_init_endpoint(NULL, dev, &of_hw); 121 + if (of_property_read_bool(dev->of_node, "dma-coherent")) 122 + ephw = &of_hw_coherent; 123 + 124 + endpoint = xillybus_init_endpoint(NULL, dev, ephw); 120 125 121 126 if (!endpoint) 122 127 return -ENOMEM;