aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/most/dim2
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2018-05-08 11:45:03 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-08 13:41:50 +0200
commit3598cec585f8d54ece41edeb123ce1c97a4516d3 (patch)
tree026a53b486adef409cf544b2f190ab2d6ed22120 /drivers/staging/most/dim2
parent7e6e228873945ccb46895f1f5e29187814ea1d8d (diff)
staging: most: make interface drivers allocate coherent memory
On arm64/aarch64 architectures the allocation of coherent memory needs a device that has the dma_ops properly set. That's why the core module of the MOST driver is no longer able to allocate this type or memory. This patch moves the allocation process down to the interface drivers where the proper devices exist (e.g. platform device or USB system software). Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most/dim2')
-rw-r--r--drivers/staging/most/dim2/dim2.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index d15867a1ba2d..3c385b3fabec 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -703,6 +703,16 @@ static int poison_channel(struct most_interface *most_iface, int ch_idx)
return ret;
}
+static void *dma_alloc(struct mbo *mbo, u32 size)
+{
+ return dma_alloc_coherent(NULL, size, &mbo->bus_address, GFP_KERNEL);
+}
+
+static void dma_free(struct mbo *mbo, u32 size)
+{
+ dma_free_coherent(NULL, size, mbo->virt_address, mbo->bus_address);
+}
+
/*
* dim2_probe - dim2 probe handler
* @pdev: platform device structure
@@ -800,6 +810,8 @@ static int dim2_probe(struct platform_device *pdev)
dev->most_iface.channel_vector = dev->capabilities;
dev->most_iface.configure = configure_channel;
dev->most_iface.enqueue = enqueue;
+ dev->most_iface.dma_alloc = dma_alloc;
+ dev->most_iface.dma_free = dma_free;
dev->most_iface.poison_channel = poison_channel;
dev->most_iface.request_netinfo = request_netinfo;
dev->dev.init_name = "dim2_state";