diff options
| author | Andrei Danaila <adanaila@codeaurora.org> | 2015-05-04 14:25:41 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:24:41 -0700 |
| commit | f688e16bf59fe323d83c4067125f9eaeebfb7906 (patch) | |
| tree | d7a2f70247a7b55b447c6bec4a0fa194b843cfb1 | |
| parent | 74c1e7710f2e488ecadec71315e4fda0a2589027 (diff) | |
mhi: core: Enable queueing of virtual buffers
Enable clients to queue virtual buffers, thus leaving
all the DMA operations to MHI.
Change-Id: I824d2f387b1a21d322ca0628963995824227bd76
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
| -rw-r--r-- | drivers/platform/msm/mhi/mhi_main.c | 16 | ||||
| -rw-r--r-- | include/linux/msm_mhi.h | 12 |
2 files changed, 16 insertions, 12 deletions
diff --git a/drivers/platform/msm/mhi/mhi_main.c b/drivers/platform/msm/mhi/mhi_main.c index 1b818312a16f..2e0192c4e78f 100644 --- a/drivers/platform/msm/mhi/mhi_main.c +++ b/drivers/platform/msm/mhi/mhi_main.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -546,7 +546,8 @@ void reset_bb_ctxt(struct mhi_device_ctxt *mhi_dev_ctxt, mhi_log(MHI_MSG_VERBOSE, "Exited\n"); } -static enum MHI_STATUS mhi_queue_xfer(struct mhi_client_handle *client_handle, +static enum MHI_STATUS mhi_queue_dma_xfer( + struct mhi_client_handle *client_handle, dma_addr_t buf, size_t buf_len, enum MHI_FLAGS mhi_flags) { union mhi_xfer_pkt *pkt_loc; @@ -609,9 +610,8 @@ error: pm_runtime_put_noidle(&mhi_dev_ctxt->dev_info->plat_dev->dev); return ret_val; } -EXPORT_SYMBOL(mhi_queue_xfer); -int mhi_queue_virt_xfer(struct mhi_client_handle *client_handle, +int mhi_queue_xfer(struct mhi_client_handle *client_handle, void *buf, size_t buf_len, enum MHI_FLAGS mhi_flags) { int r; @@ -640,18 +640,20 @@ int mhi_queue_virt_xfer(struct mhi_client_handle *client_handle, "Queueing to HW: Client Buf 0x%p, size 0x%zx, DMA %llx, chan %d\n", buf, buf_len, (u64)bb->bb_p_addr, client_handle->chan_info.chan_nr); - r = mhi_queue_xfer(client_handle, + r = mhi_queue_dma_xfer(client_handle, bb->bb_p_addr, bb->buf_len, mhi_flags); - /* Assumption: If create_bb did not fail, we do not - * expect mhi_queue_xfer to fail, if it does, the bb list will be + /* + * Assumption: If create_bounce_buffer did not fail, we do not + * expect mhi_queue_dma_xfer to fail, if it does, the bb list will be * out of sync with the descriptor list which is problematic. */ BUG_ON(r); return r; } +EXPORT_SYMBOL(mhi_queue_xfer); enum MHI_STATUS mhi_send_cmd(struct mhi_device_ctxt *mhi_dev_ctxt, enum MHI_COMMAND cmd, u32 chan) diff --git a/include/linux/msm_mhi.h b/include/linux/msm_mhi.h index 947c369b5b9a..d9ddf3ac9795 100644 --- a/include/linux/msm_mhi.h +++ b/include/linux/msm_mhi.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -113,8 +113,8 @@ enum MHI_FLAGS { struct mhi_result { void *user_data; - dma_addr_t payload_buf; - u32 bytes_xferd; + void *buf_addr; + size_t bytes_xferd; enum MHI_STATUS transaction_status; enum MHI_FLAGS flags; }; @@ -180,12 +180,14 @@ enum MHI_STATUS mhi_open_channel(struct mhi_client_handle *client_handle); * @chain Specify whether to set the chain bit on this buffer * @eob Specify whether this buffer should trigger EOB interrupt * + * NOTE: * Not thread safe, caller must ensure concurrency protection. + * User buffer must be physically contiguous. * * @Return MHI_STATUS */ -enum MHI_STATUS mhi_queue_xfer(struct mhi_client_handle *client_handle, - dma_addr_t buf, size_t buf_len, enum MHI_FLAGS flags); +int mhi_queue_xfer(struct mhi_client_handle *client_handle, + void *buf, size_t buf_len, enum MHI_FLAGS mhi_flags); /** * mhi_close_channel - Client can request channel to be closed and handle freed |
