summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorAndrei Danaila <adanaila@codeaurora.org>2014-10-17 11:17:57 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:10:57 -0700
commit43558e8dffd8ceb8ab1d8e86c82e3cacecbabbd0 (patch)
tree8db7cac835f118d6d875bafc60197e66b9547e6c /drivers/platform
parentdd8cffb8961e5b1f6134924b247b869442f172d0 (diff)
msm: mhi: Enable clearing outstanding acks in MHI
After a channel reset, any pending acks on that channel will not be received from the device. In this case they must be cleared in the channel reset command handling. CRs-Fixed: 733172 Change-Id: I5b7c525f7f532ed107caa020cde33ec1955ae618 Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/msm/mhi/mhi_main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/platform/msm/mhi/mhi_main.c b/drivers/platform/msm/mhi/mhi_main.c
index 7273e7dc940a..8dc8bf7bd966 100644
--- a/drivers/platform/msm/mhi/mhi_main.c
+++ b/drivers/platform/msm/mhi/mhi_main.c
@@ -1123,6 +1123,8 @@ static enum MHI_STATUS reset_chan_cmd(struct mhi_device_ctxt *mhi_dev_ctxt,
struct mhi_chan_ctxt *chan_ctxt;
struct mhi_client_handle *client_handle = NULL;
struct mutex *chan_mutex;
+ int pending_el = 0;
+ struct mhi_ring *ring;
MHI_TRB_GET_INFO(CMD_TRB_CHID, cmd_pkt, chan);
@@ -1139,6 +1141,19 @@ static enum MHI_STATUS reset_chan_cmd(struct mhi_device_ctxt *mhi_dev_ctxt,
chan_ctxt = &mhi_dev_ctxt->mhi_ctrl_seg->mhi_cc_list[chan];
mhi_log(MHI_MSG_INFO, "Processed cmd reset event\n");
+ /*
+ * If outbound elements are pending, they must be cleared since
+ * they will never be acked after a channel reset.
+ */
+ ring = &mhi_dev_ctxt->mhi_local_chan_ctxt[chan];
+ if (chan % 2 == 0)
+ get_nr_enclosed_el(ring, ring->rp, ring->wp, &pending_el);
+
+ mhi_log(MHI_MSG_INFO, "Decrementing chan %d out acks by %d.\n",
+ chan, pending_el);
+
+ atomic_sub(pending_el, &mhi_dev_ctxt->counters.outbound_acks);
+
/* Reset the local channel context */
local_chan_ctxt->rp = local_chan_ctxt->base;
local_chan_ctxt->wp = local_chan_ctxt->base;