msm: ipa: use timeout mechanism for holb monitoring command

When we use polling mechanism for holb monitoring command
Uc will still try to send a interrupt to notify the response.
This can result in a sync mismatch between AP and Uc and will
result in a panic. Make changes to use timeout mechanism
for holb monitoring command as well.

Change-Id: I8c74cfedff30f90dceec7f89b153018c307afa0a
Acked-by: Chaitanya Pratapa <cpratapa@qti.qualcomm.com>
Signed-off-by: Ravinder Konka <rkonka@codeaurora.org>
This commit is contained in:
Ravinder Konka 2016-03-02 21:58:53 +05:30 committed by David Keitel
parent 019f25d9e8
commit 1d7b749427

View file

@ -18,6 +18,9 @@
#define IPA_UC_POLL_SLEEP_USEC 100
#define IPA_UC_POLL_MAX_RETRY 10000
static void ipa_start_monitor_holb(struct work_struct *work);
static DECLARE_WORK(ipa_holb_work, ipa_start_monitor_holb);
/**
* enum ipa_cpu_2_hw_commands - Values that represent the commands from the CPU
* IPA_CPU_2_HW_CMD_NO_OP : No operation is required.
@ -463,8 +466,11 @@ static void ipa_uc_response_hdlr(enum ipa_irq_type interrupt,
if (uc_hdlrs[i].ipa_uc_loaded_hdlr)
uc_hdlrs[i].ipa_uc_loaded_hdlr();
}
/* Enable holb monitoring on IPA-USB Producer pipe if valid. */
ipa_uc_monitor_holb(IPA_CLIENT_USB_CONS, true);
/* Queue the work to enable holb monitoring on IPA-USB Producer
* pipe if valid.
*/
if (ipa_ctx->ipa_hw_type == IPA_HW_v2_6L)
queue_work(ipa_ctx->power_mgmt_wq, &ipa_holb_work);
} else if (ipa_ctx->uc_ctx.uc_sram_mmio->responseOp ==
IPA_HW_2_CPU_RESPONSE_CMD_COMPLETED) {
uc_rsp.raw32b = ipa_ctx->uc_ctx.uc_sram_mmio->responseParams;
@ -791,12 +797,30 @@ int ipa_uc_monitor_holb(enum ipa_client_type ipa_client, bool enable)
ret = ipa_uc_send_cmd(cmd.raw32b,
IPA_CPU_2_HW_CMD_UPDATE_HOLB_MONITORING, 0,
true, 10*HZ);
false, 10*HZ);
return ret;
}
EXPORT_SYMBOL(ipa_uc_monitor_holb);
/**
* ipa_start_monitor_holb() - Send HOLB command to monitor IPA-USB
* producer pipe.
*
* This function is called after uc is loaded to start monitoring
* IPA pipe towrds USB in case if USB is already connected.
*
* Return codes:
* None
*/
static void ipa_start_monitor_holb(struct work_struct *work)
{
IPADBG("starting holb monitoring on IPA_CLIENT_USB_CONS\n");
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
ipa_uc_monitor_holb(IPA_CLIENT_USB_CONS, true);
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
}
/**
* ipa_uc_notify_clk_state() - notify to uC of clock enable / disable