Merge "msm: ipa3: Do not wait for IPA DMA_TASK H/W ACK for GSI"

This commit is contained in:
Linux Build Service Account 2016-10-19 11:18:01 -07:00 committed by Gerrit - the friendly Code Review server
commit 3946607e62
3 changed files with 41 additions and 4 deletions

View file

@ -777,11 +777,29 @@ static void ipa3_transport_irq_cmd_ack(void *user1, int user2)
* for this function.
*/
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:

View file

@ -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);

View file

@ -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;
}