summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-10-19 11:18:01 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-10-19 11:18:01 -0700
commit3946607e6217699b17eb53be2554b34e798beceb (patch)
tree57ca28e81d1c9f260f8bd239107fe9555ff01879
parent89ea7ae72689b35302af3ad100114c96bdf577d1 (diff)
parentbdb22900877bc2b6aabb8c7b19aafb9ac04963a1 (diff)
Merge "msm: ipa3: Do not wait for IPA DMA_TASK H/W ACK for GSI"
-rw-r--r--drivers/platform/msm/ipa/ipa_v3/ipa_dp.c37
-rw-r--r--drivers/platform/msm/ipa/ipa_v3/ipa_i.h1
-rw-r--r--drivers/platform/msm/ipa/ipa_v3/ipa_utils.c7
3 files changed, 41 insertions, 4 deletions
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c
index 94e8bba1fe01..09c7c1b0fd05 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c
@@ -778,10 +778,28 @@ static void ipa3_transport_irq_cmd_ack(void *user1, int user2)
*/
int ipa3_send_cmd(u16 num_desc, struct ipa3_desc *descr)
{
+ return ipa3_send_cmd_timeout(num_desc, descr, 0);
+}
+
+/**
+ * ipa3_send_cmd_timeout - send immediate commands with limited time
+ * waiting for ACK from IPA HW
+ * @num_desc: number of descriptors within the desc struct
+ * @descr: descriptor structure
+ * @timeout: millisecond to wait till get ACK from IPA HW
+ *
+ * Function will block till command gets ACK from IPA HW or timeout.
+ * Caller needs to free any resources it allocated after function returns
+ * The callback in ipa3_desc should not be set by the caller
+ * for this function.
+ */
+int ipa3_send_cmd_timeout(u16 num_desc, struct ipa3_desc *descr, u32 timeout)
+{
struct ipa3_desc *desc;
int i, result = 0;
struct ipa3_sys_context *sys;
int ep_idx;
+ int completed;
for (i = 0; i < num_desc; i++)
IPADBG("sending imm cmd %d\n", descr[i].opcode);
@@ -808,7 +826,14 @@ int ipa3_send_cmd(u16 num_desc, struct ipa3_desc *descr)
result = -EFAULT;
goto bail;
}
- wait_for_completion(&descr->xfer_done);
+ if (timeout) {
+ completed = wait_for_completion_timeout(
+ &descr->xfer_done, msecs_to_jiffies(timeout));
+ if (!completed)
+ IPADBG("timeout waiting for imm-cmd ACK\n");
+ } else {
+ wait_for_completion(&descr->xfer_done);
+ }
} else {
desc = &descr[num_desc - 1];
init_completion(&desc->xfer_done);
@@ -823,7 +848,15 @@ int ipa3_send_cmd(u16 num_desc, struct ipa3_desc *descr)
result = -EFAULT;
goto bail;
}
- wait_for_completion(&desc->xfer_done);
+ if (timeout) {
+ completed = wait_for_completion_timeout(
+ &desc->xfer_done, msecs_to_jiffies(timeout));
+ if (!completed)
+ IPADBG("timeout waiting for imm-cmd ACK\n");
+ } else {
+ wait_for_completion(&desc->xfer_done);
+ }
+
}
bail:
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
index 8e85822d9719..33be22f98b9d 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
@@ -1835,6 +1835,7 @@ int ipa3_init_mem_partition(struct device_node *dev_node);
int ipa3_controller_static_bind(struct ipa3_controller *controller,
enum ipa_hw_type ipa_hw_type);
int ipa3_cfg_route(struct ipahal_reg_route *route);
+int ipa3_send_cmd_timeout(u16 num_desc, struct ipa3_desc *descr, u32 timeout);
int ipa3_send_cmd(u16 num_desc, struct ipa3_desc *descr);
int ipa3_cfg_filter(u32 disable);
int ipa3_pipe_mem_init(u32 start_ofst, u32 size);
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
index a21eb9c1530b..c0a6e8b00d71 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
@@ -47,6 +47,8 @@
#define IPA_EOT_COAL_GRAN_MIN (1)
#define IPA_EOT_COAL_GRAN_MAX (16)
+#define IPA_DMA_TASK_FOR_GSI_TIMEOUT_MSEC (15)
+
#define IPA_AGGR_BYTE_LIMIT (\
IPA_ENDP_INIT_AGGR_N_AGGR_BYTE_LIMIT_BMSK >> \
IPA_ENDP_INIT_AGGR_N_AGGR_BYTE_LIMIT_SHFT)
@@ -101,7 +103,7 @@
#define IPA_GROUP_DPL IPA_GROUP_DL
#define IPA_GROUP_DIAG (2)
#define IPA_GROUP_DMA (3)
-#define IPA_GROUP_IMM_CMD IPA_GROUP_DMA
+#define IPA_GROUP_IMM_CMD IPA_GROUP_UL
#define IPA_GROUP_Q6ZIP (4)
#define IPA_GROUP_Q6ZIP_GENERAL IPA_GROUP_Q6ZIP
#define IPA_GROUP_UC_RX_Q (5)
@@ -3470,7 +3472,8 @@ int ipa3_inject_dma_task_for_gsi(void)
desc.type = IPA_IMM_CMD_DESC;
IPADBG("sending 1B packet to IPA\n");
- if (ipa3_send_cmd(1, &desc)) {
+ if (ipa3_send_cmd_timeout(1, &desc,
+ IPA_DMA_TASK_FOR_GSI_TIMEOUT_MSEC)) {
IPAERR("ipa3_send_cmd failed\n");
return -EFAULT;
}