bus: mhi: host: Add support for subsystem failure reason

Add support for controllers to enable retrieval of the subsystem
failure reason if an error from device is reported.

Change-Id: I27d88ceaeeb512fc578b78bcf85e7ba7cb27a4ff
Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
Signed-off-by: Lazarus Motha <quic_lmotha@quicinc.com>
This commit is contained in:
Bhaumik Bhatt 2021-01-29 01:27:47 -08:00 committed by Gerrit - the friendly Code Review server
parent bd9e89fec7
commit 141a2b8fb2
3 changed files with 16 additions and 1 deletions

View File

@ -250,6 +250,7 @@ enum mhi_cmd_type {
MHI_CMD_RESET_CHAN = 16,
MHI_CMD_STOP_CHAN = 17,
MHI_CMD_START_CHAN = 18,
MHI_CMD_SFR_CFG = 73,
};
#define EV_CTX_RESERVED_MASK GENMASK(7, 0)

View File

@ -812,6 +812,12 @@ static void mhi_process_cmd_completion(struct mhi_controller *mhi_cntrl,
cmd_pkt = mhi_to_virtual(mhi_ring, ptr);
if (MHI_TRE_GET_CMD_TYPE(cmd_pkt) == MHI_CMD_SFR_CFG) {
mhi_misc_cmd_completion(mhi_cntrl, MHI_CMD_SFR_CFG,
MHI_TRE_GET_EV_CODE(tre));
return;
}
chan = MHI_TRE_GET_CMD_CHID(cmd_pkt);
if (chan < mhi_cntrl->max_chan &&
@ -1349,6 +1355,11 @@ int mhi_send_cmd(struct mhi_controller *mhi_cntrl,
cmd_tre->dword[0] = MHI_TRE_CMD_START_DWORD0;
cmd_tre->dword[1] = MHI_TRE_CMD_START_DWORD1(chan);
break;
case MHI_CMD_SFR_CFG:
mhi_misc_cmd_configure(mhi_cntrl, MHI_CMD_SFR_CFG,
&cmd_tre->ptr, &cmd_tre->dword[0],
&cmd_tre->dword[1]);
break;
default:
dev_err(dev, "Command not supported\n");
break;

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*
*/
@ -432,6 +432,7 @@ static int mhi_pm_mission_mode_transition(struct mhi_controller *mhi_cntrl)
read_unlock_bh(&mhi_cntrl->pm_lock);
mhi_misc_mission_mode(mhi_cntrl);
mhi_process_sleeping_events(mhi_cntrl);
/*
@ -507,6 +508,7 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
/* Release lock and wait for all pending threads to complete */
mutex_unlock(&mhi_cntrl->pm_mutex);
mhi_misc_disable(mhi_cntrl);
dev_dbg(dev, "Waiting for all pending threads to complete\n");
wake_up_all(&mhi_cntrl->state_event);
@ -643,6 +645,7 @@ static void mhi_pm_sys_error_transition(struct mhi_controller *mhi_cntrl)
/* Release lock and wait for all pending threads to complete */
mutex_unlock(&mhi_cntrl->pm_mutex);
mhi_misc_disable(mhi_cntrl);
dev_dbg(dev, "Waiting for all pending threads to complete\n");
wake_up_all(&mhi_cntrl->state_event);