summaryrefslogtreecommitdiffstats
path: root/drivers/staging/most/usb
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/usb
parent7e6e228873945ccb46895f1f5e29187814ea1d8d (diff)
downloadlinux-3598cec585f8d54ece41edeb123ce1c97a4516d3.tar.gz
linux-3598cec585f8d54ece41edeb123ce1c97a4516d3.tar.bz2
linux-3598cec585f8d54ece41edeb123ce1c97a4516d3.zip
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/usb')
-rw-r--r--drivers/staging/most/usb/usb.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 31f184cfcd69..5ed1dccc0839 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -618,6 +618,22 @@ _error:
return retval;
}
+static void *hdm_dma_alloc(struct mbo *mbo, u32 size)
+{
+ struct most_dev *mdev = to_mdev(mbo->ifp);
+
+ return usb_alloc_coherent(mdev->usb_device, size, GFP_KERNEL,
+ &mbo->bus_address);
+}
+
+static void hdm_dma_free(struct mbo *mbo, u32 size)
+{
+ struct most_dev *mdev = to_mdev(mbo->ifp);
+
+ usb_free_coherent(mdev->usb_device, size, mbo->virt_address,
+ mbo->bus_address);
+}
+
/**
* hdm_configure_channel - receive channel configuration from core
* @iface: interface
@@ -1032,6 +1048,8 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
mdev->iface.request_netinfo = hdm_request_netinfo;
mdev->iface.enqueue = hdm_enqueue;
mdev->iface.poison_channel = hdm_poison_channel;
+ mdev->iface.dma_alloc = hdm_dma_alloc;
+ mdev->iface.dma_free = hdm_dma_free;
mdev->iface.description = mdev->description;
mdev->iface.num_channels = num_endpoints;