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

Commit 978c3fac authored by Siddartha Mohanadoss's avatar Siddartha Mohanadoss
Browse files

msm: mhi_dev: Update data type to get mhi reset state



MHI reset state is a bit field in a register which could have
numeric value of either 0 or 1. Use an integer data type
instead of a boolean value.

Change-Id: I5e1d8c6c2c79e916a0b4757c6d4d846e683a3067
Signed-off-by: default avatarSiddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: default avatarSiva Kumar Akkireddi <sivaa@codeaurora.org>
parent 0aa5678c
Loading
Loading
Loading
Loading
+18 −4
Original line number Diff line number Diff line
@@ -1820,7 +1820,7 @@ static void mhi_dev_scheduler(struct work_struct *work)
	struct mhi_dev_ring *ring;
	enum mhi_dev_state state;
	enum mhi_dev_event event = 0;
	bool mhi_reset = false;
	u32 mhi_reset;
	uint32_t bhi_imgtxdb = 0;

	mutex_lock(&mhi_ctx->mhi_lock);
@@ -2679,7 +2679,7 @@ static int mhi_dev_recover(struct mhi_dev *mhi)
{
	int rc = 0;
	uint32_t syserr, max_cnt = 0, bhi_intvec = 0;
	bool mhi_reset;
	u32 mhi_reset;
	enum mhi_dev_state state;

	/* Check if MHI is in syserr */
@@ -2689,6 +2689,16 @@ static int mhi_dev_recover(struct mhi_dev *mhi)

	mhi_log(MHI_MSG_VERBOSE, "mhi_syserr = 0x%X\n", syserr);
	if (syserr) {
		/* Poll for the host to set the reset bit */
		rc = mhi_dev_mmio_get_mhi_state(mhi, &state, &mhi_reset);
		if (rc) {
			pr_err("%s: get mhi state failed\n", __func__);
			return rc;
		}

		mhi_log(MHI_MSG_VERBOSE, "mhi_state = 0x%X, reset = %d\n",
				state, mhi_reset);

		rc = mhi_dev_mmio_read(mhi, BHI_INTVEC, &bhi_intvec);
		if (rc)
			return rc;
@@ -2708,7 +2718,11 @@ static int mhi_dev_recover(struct mhi_dev *mhi)
			pr_err("%s: get mhi state failed\n", __func__);
			return rc;
		}
		while (mhi_reset != true && max_cnt < MHI_SUSPEND_TIMEOUT) {

		mhi_log(MHI_MSG_VERBOSE, "mhi_state = 0x%X, reset = %d\n",
				state, mhi_reset);

		while (mhi_reset != 0x1 && max_cnt < MHI_SUSPEND_TIMEOUT) {
			/* Wait for Host to set the reset */
			msleep(MHI_SUSPEND_MIN);
			rc = mhi_dev_mmio_get_mhi_state(mhi, &state,
@@ -2739,7 +2753,7 @@ static void mhi_dev_enable(struct work_struct *work)
	struct ep_pcie_msi_config msi_cfg;
	struct mhi_dev *mhi = container_of(work,
				struct mhi_dev, ring_init_cb_work);
	bool mhi_reset;
	u32 mhi_reset;
	enum mhi_dev_state state;
	uint32_t max_cnt = 0, bhi_intvec = 0;

+1 −1
Original line number Diff line number Diff line
@@ -962,7 +962,7 @@ int mhi_dev_get_mhi_addr(struct mhi_dev *dev);
 * @mhi_reset:	MHI device reset from host.
 */
int mhi_dev_mmio_get_mhi_state(struct mhi_dev *dev, enum mhi_dev_state *state,
						bool *mhi_reset);
						u32 *mhi_reset);

/**
 * mhi_dev_mmio_init() - Initializes the MMIO and reads the Number of event
+6 −3
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ int mhi_dev_mmio_disable_erdb_a7(struct mhi_dev *dev, uint32_t erdb_id)
EXPORT_SYMBOL(mhi_dev_mmio_disable_erdb_a7);

int mhi_dev_mmio_get_mhi_state(struct mhi_dev *dev, enum mhi_dev_state *state,
						bool *mhi_reset)
						u32 *mhi_reset)
{
	uint32_t reg_value = 0;

@@ -203,9 +203,12 @@ int mhi_dev_mmio_get_mhi_state(struct mhi_dev *dev, enum mhi_dev_state *state,
	mhi_dev_mmio_read(dev, MHICTRL, &reg_value);

	if (reg_value & MHICTRL_RESET_MASK)
		*mhi_reset = true;
		*mhi_reset = 1;
	else
		*mhi_reset = 0;

	pr_debug("MHICTRL is 0x%x\n", reg_value);
	mhi_log(MHI_MSG_VERBOSE, "MHICTRL is 0x%x, reset:%d\n",
			reg_value, *mhi_reset);

	return 0;
}