msm: mhi: Check ERRDBG registers for device status

Add support to check RDDM cookie in ERRDBG1,ERRDBG2 and ERRDBG3
registers to debug the the bootup failure when device
failed to enter MISSION mode.

Change-Id: Idaf00c082ffda97805e958ae083a331d9f0909e9
Signed-off-by: Vivek Pernamitta <vpernami@codeaurora.org>
Signed-off-by: Ramya SR <rsr@codeaurora.org>
This commit is contained in:
Vivek Pernamitta 2021-09-01 19:00:21 +05:30 committed by Gerrit - the friendly Code Review server
parent f89c40b130
commit 66a25bec60

View File

@ -143,6 +143,17 @@ bool mhi_scan_rddm_cookie(struct mhi_controller *mhi_cntrl, u32 cookie)
{
int ret;
u32 val;
int i;
bool result = false;
struct {
char *name;
u32 offset;
} error_reg[] = {
{ "ERROR_DBG1", BHI_ERRDBG1 },
{ "ERROR_DBG2", BHI_ERRDBG2 },
{ "ERROR_DBG3", BHI_ERRDBG3 },
{ NULL },
};
if (!mhi_cntrl->rddm_supported || !cookie)
return false;
@ -152,15 +163,23 @@ bool mhi_scan_rddm_cookie(struct mhi_controller *mhi_cntrl, u32 cookie)
if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state))
return false;
ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_ERRDBG2, &val);
if (ret)
return false;
/* look for an RDDM cookie match in any of the error debug registers */
for (i = 0; error_reg[i].name; i++) {
ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi,
error_reg[i].offset, &val);
if (ret)
break;
MHI_CNTRL_LOG("reg:%s value:0x%x\n", error_reg[i].name, val);
MHI_CNTRL_LOG("BHI_ERRDBG2 value:0x%x\n", val);
if (val == cookie)
return true;
if (!(val ^ cookie)) {
MHI_CNTRL_ERR("RDDM cookie found in %s\n",
error_reg[i].name);
return true;
}
}
return false;
MHI_CNTRL_ERR("RDDM cookie not found\n");
return result;
}
EXPORT_SYMBOL(mhi_scan_rddm_cookie);