2023-05-10 06:07:48

by Qiang Yu

[permalink] [raw]
Subject: [PATCH] bus: mhi: host: Skip MHI reset if device is in RDDM

In RDDM EE, device can not process MHI reset
issued by host. In case of MHI power off, host
is issuing MHI reset and polls for it to get
cleared until it times out. Since this timeout
can not be avoided in case of RDDM, skip the
MHI reset in this scenarios.

Signed-off-by: Qiang Yu <[email protected]>
---
drivers/bus/mhi/host/pm.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c
index 0834590..8a4362d 100644
--- a/drivers/bus/mhi/host/pm.c
+++ b/drivers/bus/mhi/host/pm.c
@@ -470,6 +470,10 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)

/* Trigger MHI RESET so that the device will not access host memory */
if (!MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state)) {
+ /* Skip MHI RESET if in RDDM state */
+ if (mhi_cntrl->rddm_image && mhi_get_exec_env(mhi_cntrl) == MHI_EE_RDDM)
+ goto skip_mhi_reset;
+
dev_dbg(dev, "Triggering MHI Reset in device\n");
mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET);

@@ -495,6 +499,7 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
}
}

+skip_mhi_reset:
dev_dbg(dev,
"Waiting for all pending event ring processing to complete\n");
mhi_event = mhi_cntrl->mhi_event;
--
2.7.4



2023-05-10 15:01:34

by Jeffrey Hugo

[permalink] [raw]
Subject: Re: [PATCH] bus: mhi: host: Skip MHI reset if device is in RDDM

On 5/10/2023 12:04 AM, Qiang Yu wrote:
> In RDDM EE, device can not process MHI reset
> issued by host. In case of MHI power off, host
> is issuing MHI reset and polls for it to get
> cleared until it times out. Since this timeout
> can not be avoided in case of RDDM, skip the
> MHI reset in this scenarios.

Looks like you only use ~45 columns of 75 possible. Feels a little odd.
Any particular reason for that?

Fixes tag?

> Signed-off-by: Qiang Yu <[email protected]>
> ---
> drivers/bus/mhi/host/pm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c
> index 0834590..8a4362d 100644
> --- a/drivers/bus/mhi/host/pm.c
> +++ b/drivers/bus/mhi/host/pm.c
> @@ -470,6 +470,10 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
>
> /* Trigger MHI RESET so that the device will not access host memory */
> if (!MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state)) {
> + /* Skip MHI RESET if in RDDM state */
> + if (mhi_cntrl->rddm_image && mhi_get_exec_env(mhi_cntrl) == MHI_EE_RDDM)
> + goto skip_mhi_reset;
> +
> dev_dbg(dev, "Triggering MHI Reset in device\n");
> mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET);
>
> @@ -495,6 +499,7 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
> }
> }
>
> +skip_mhi_reset:
> dev_dbg(dev,
> "Waiting for all pending event ring processing to complete\n");
> mhi_event = mhi_cntrl->mhi_event;