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

Commit 84a55b41 authored by Gauri Joshi's avatar Gauri Joshi
Browse files

msm: mhi_dev: Clear reset while waiting for M0



On some customer platforms, resume from hibernate results in a
cold boot of the end-point. The previous mhi device state gets
cleared and this results in mhi host issuing a reset. Clear the
reset while waiting for M0 from host to enable host to proceed
with issuing M0.

Change-Id: I18aa4e760d59e37842a9f3a6dba1478a98137bb8
Signed-off-by: default avatarSiva Kumar Akkireddi <sivaa@codeaurora.org>
Signed-off-by: default avatarGauri Joshi <gaurjosh@codeaurora.org>
parent 0bc55ada
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -3349,6 +3349,11 @@ static void mhi_dev_enable(struct work_struct *work)
		pr_err("%s: get mhi state failed\n", __func__);
		return;
	}
	if (mhi_reset) {
		mhi_dev_mmio_clear_reset(mhi);
		mhi_log(MHI_MSG_VERBOSE,
			"Cleared reset before waiting for M0\n");
	}

	while (state != MHI_DEV_M0_STATE && max_cnt < MHI_SUSPEND_TIMEOUT) {
		/* Wait for Host to set the M0 state */
@@ -3358,6 +3363,11 @@ static void mhi_dev_enable(struct work_struct *work)
			pr_err("%s: get mhi state failed\n", __func__);
			return;
		}
		if (mhi_reset) {
			mhi_dev_mmio_clear_reset(mhi);
			mhi_log(MHI_MSG_VERBOSE,
				"Cleared reset while waiting for M0\n");
		}
		max_cnt++;
	}

+7 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.*/
/* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.*/

#ifndef __MHI_H
#define __MHI_H
@@ -966,6 +966,12 @@ int mhi_dev_mmio_get_cmd_db(struct mhi_dev_ring *ring, uint64_t *wr_offset);
 */
int mhi_dev_mmio_set_env(struct mhi_dev *dev, uint32_t value);

/**
 * mhi_dev_mmio_clear_reset() - Clear the reset bit
 * @dev:	MHI device structure.
 */
int mhi_dev_mmio_clear_reset(struct mhi_dev *dev);

/**
 * mhi_dev_mmio_reset() - Reset the MMIO done as part of initialization.
 * @dev:	MHI device structure.
+13 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015,2017-2020, The Linux Foundation. All rights reserved.*/
/* Copyright (c) 2015,2017-2021, The Linux Foundation. All rights reserved.*/

#include <linux/kernel.h>
#include <linux/of.h>
@@ -574,6 +574,18 @@ int mhi_dev_mmio_set_env(struct mhi_dev *dev, uint32_t value)
}
EXPORT_SYMBOL(mhi_dev_mmio_set_env);

int mhi_dev_mmio_clear_reset(struct mhi_dev *dev)
{
	if (WARN_ON(!dev))
		return -EINVAL;

	mhi_dev_mmio_masked_write(dev, MHICTRL,
		MHICTRL_RESET_MASK, MHICTRL_RESET_SHIFT, 0);

	return 0;
}
EXPORT_SYMBOL(mhi_dev_mmio_clear_reset);

int mhi_dev_mmio_reset(struct mhi_dev *dev)
{
	if (WARN_ON(!dev))