Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d97d483 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mhi: Check ERRDBG registers for device status"

parents 3035689d 66a25bec
Loading
Loading
Loading
Loading
+26 −7
Original line number Original line Diff line number Diff line
@@ -143,6 +143,17 @@ bool mhi_scan_rddm_cookie(struct mhi_controller *mhi_cntrl, u32 cookie)
{
{
	int ret;
	int ret;
	u32 val;
	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)
	if (!mhi_cntrl->rddm_supported || !cookie)
		return false;
		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))
	if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state))
		return false;
		return false;


	ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_ERRDBG2, &val);
	/* 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)
		if (ret)
		return false;
			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)) {
	if (val == cookie)
			MHI_CNTRL_ERR("RDDM cookie found in %s\n",
					error_reg[i].name);
			return true;
			return true;
		}
	}


	return false;
	MHI_CNTRL_ERR("RDDM cookie not found\n");
	return result;
}
}
EXPORT_SYMBOL(mhi_scan_rddm_cookie);
EXPORT_SYMBOL(mhi_scan_rddm_cookie);