Merge "mhi: core: Notify controller for bootup timeouts"
This commit is contained in:
commit
e5d3519287
3 changed files with 30 additions and 7 deletions
|
@ -666,6 +666,8 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
|
|||
|
||||
if (!ret || MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) {
|
||||
MHI_CNTRL_ERR("MHI did not enter BHIE\n");
|
||||
mhi_cntrl->status_cb(mhi_cntrl, mhi_cntrl->priv_data,
|
||||
MHI_CB_BOOTUP_TIMEOUT);
|
||||
goto error_read;
|
||||
}
|
||||
|
||||
|
@ -675,6 +677,11 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
|
|||
/* last entry is vec table */
|
||||
&image_info->mhi_buf[image_info->entries - 1]);
|
||||
|
||||
if (ret) {
|
||||
mhi_cntrl->status_cb(mhi_cntrl, mhi_cntrl->priv_data,
|
||||
MHI_CB_BOOTUP_TIMEOUT);
|
||||
}
|
||||
|
||||
MHI_CNTRL_LOG("amss fw_load ret:%d\n", ret);
|
||||
|
||||
release_firmware(firmware);
|
||||
|
|
|
@ -252,7 +252,7 @@ int mhi_ready_state_transition(struct mhi_controller *mhi_cntrl)
|
|||
u32 reset = 1, ready = 0;
|
||||
struct mhi_event *mhi_event;
|
||||
enum MHI_PM_STATE cur_state;
|
||||
int ret, i;
|
||||
int ret = -EIO, i;
|
||||
|
||||
MHI_CNTRL_LOG("Waiting to enter READY state\n");
|
||||
|
||||
|
@ -270,11 +270,13 @@ int mhi_ready_state_transition(struct mhi_controller *mhi_cntrl)
|
|||
|
||||
/* device enter into error state */
|
||||
if (MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state))
|
||||
return -EIO;
|
||||
goto error_ready;
|
||||
|
||||
/* device did not transition to ready state */
|
||||
if (reset || !ready)
|
||||
return -ETIMEDOUT;
|
||||
if (reset || !ready) {
|
||||
ret = -ETIMEDOUT;
|
||||
goto error_ready;
|
||||
}
|
||||
|
||||
MHI_CNTRL_LOG("Device in READY State\n");
|
||||
write_lock_irq(&mhi_cntrl->pm_lock);
|
||||
|
@ -286,7 +288,7 @@ int mhi_ready_state_transition(struct mhi_controller *mhi_cntrl)
|
|||
MHI_CNTRL_ERR("Error moving to state %s from %s\n",
|
||||
to_mhi_pm_state_str(MHI_PM_POR),
|
||||
to_mhi_pm_state_str(cur_state));
|
||||
return -EIO;
|
||||
goto error_ready;
|
||||
}
|
||||
read_lock_bh(&mhi_cntrl->pm_lock);
|
||||
if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state))
|
||||
|
@ -295,6 +297,7 @@ int mhi_ready_state_transition(struct mhi_controller *mhi_cntrl)
|
|||
ret = mhi_init_mmio(mhi_cntrl);
|
||||
if (ret) {
|
||||
MHI_CNTRL_ERR("Error programming mmio registers\n");
|
||||
ret = -EIO;
|
||||
goto error_mmio;
|
||||
}
|
||||
|
||||
|
@ -326,7 +329,11 @@ int mhi_ready_state_transition(struct mhi_controller *mhi_cntrl)
|
|||
error_mmio:
|
||||
read_unlock_bh(&mhi_cntrl->pm_lock);
|
||||
|
||||
return -EIO;
|
||||
error_ready:
|
||||
mhi_cntrl->status_cb(mhi_cntrl, mhi_cntrl->priv_data,
|
||||
MHI_CB_BOOTUP_TIMEOUT);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mhi_pm_m0_transition(struct mhi_controller *mhi_cntrl)
|
||||
|
@ -1137,7 +1144,14 @@ int mhi_sync_power_up(struct mhi_controller *mhi_cntrl)
|
|||
MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state),
|
||||
msecs_to_jiffies(mhi_cntrl->timeout_ms));
|
||||
|
||||
return (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -ETIMEDOUT;
|
||||
if (MHI_IN_MISSION_MODE(mhi_cntrl->ee))
|
||||
return 0;
|
||||
|
||||
MHI_ERR("MHI did not reach mission mode within %d ms\n",
|
||||
mhi_cntrl->timeout_ms);
|
||||
mhi_cntrl->status_cb(mhi_cntrl, mhi_cntrl->priv_data,
|
||||
MHI_CB_BOOTUP_TIMEOUT);
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
EXPORT_SYMBOL(mhi_sync_power_up);
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ struct mhi_sfr_info;
|
|||
* @MHI_CB_EE_MISSION_MODE: MHI device entered Mission Mode ee
|
||||
* @MHI_CB_SYS_ERROR: MHI device enter error state (may recover)
|
||||
* @MHI_CB_FATAL_ERROR: MHI device entered fatal error
|
||||
* @MHI_CB_BOOTUP_TIMEOUT: MHI device did not get to a bootup state in time
|
||||
*/
|
||||
enum MHI_CB {
|
||||
MHI_CB_IDLE,
|
||||
|
@ -39,6 +40,7 @@ enum MHI_CB {
|
|||
MHI_CB_SYS_ERROR,
|
||||
MHI_CB_FATAL_ERROR,
|
||||
MHI_CB_FW_FALLBACK_IMG,
|
||||
MHI_CB_BOOTUP_TIMEOUT,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue