diff --git a/drivers/bus/mhi/core/mhi_boot.c b/drivers/bus/mhi/core/mhi_boot.c index d5864a28548c..cfc37c975b26 100644 --- a/drivers/bus/mhi/core/mhi_boot.c +++ b/drivers/bus/mhi/core/mhi_boot.c @@ -278,6 +278,10 @@ int mhi_download_rddm_img(struct mhi_controller *mhi_cntrl, bool in_panic) void __iomem *base = mhi_cntrl->bhie; u32 rx_status; + /* device supports RDDM but controller wants to skip ramdumps */ + if (!mhi_cntrl->rddm_supported || !mhi_cntrl->rddm_image) + return -EINVAL; + if (in_panic) return __mhi_download_rddm_in_panic(mhi_cntrl); diff --git a/drivers/bus/mhi/core/mhi_init.c b/drivers/bus/mhi/core/mhi_init.c index 0dd29368d2f6..6f07329d19a5 100644 --- a/drivers/bus/mhi/core/mhi_init.c +++ b/drivers/bus/mhi/core/mhi_init.c @@ -1780,7 +1780,7 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl) * allocate rddm table if specified, this table is for debug purpose * so we'll ignore erros */ - if (mhi_cntrl->rddm_size) { + if (mhi_cntrl->rddm_supported && mhi_cntrl->rddm_size) { mhi_alloc_bhie_table(mhi_cntrl, &mhi_cntrl->rddm_image, mhi_cntrl->rddm_size); diff --git a/drivers/bus/mhi/core/mhi_main.c b/drivers/bus/mhi/core/mhi_main.c index 510867b8857a..191b5f707ec1 100644 --- a/drivers/bus/mhi/core/mhi_main.c +++ b/drivers/bus/mhi/core/mhi_main.c @@ -1212,7 +1212,7 @@ int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl, * event instead of sys error state change event */ if (mhi_cntrl->ee == MHI_EE_RDDM || - mhi_cntrl->rddm_image) + mhi_cntrl->rddm_supported) break; MHI_ERR("MHI system error detected\n"); diff --git a/drivers/bus/mhi/core/mhi_pm.c b/drivers/bus/mhi/core/mhi_pm.c index 819ea9442f21..d8e3c2154d86 100644 --- a/drivers/bus/mhi/core/mhi_pm.c +++ b/drivers/bus/mhi/core/mhi_pm.c @@ -859,7 +859,7 @@ void mhi_process_sys_err(struct mhi_controller *mhi_cntrl) * if controller supports rddm, we do not process sys error state, * instead we will jump directly to rddm state */ - if (mhi_cntrl->rddm_image) { + if (mhi_cntrl->rddm_supported) { MHI_CNTRL_LOG( "Controller supports RDDM, skipping SYS_ERR_PROCESS\n"); return; @@ -1714,6 +1714,10 @@ int mhi_force_rddm_mode(struct mhi_controller *mhi_cntrl) to_mhi_pm_state_str(mhi_cntrl->pm_state), TO_MHI_EXEC_STR(mhi_cntrl->ee)); + /* device does not support RDDM */ + if (!mhi_cntrl->rddm_supported) + return -EINVAL; + /* device already in rddm */ if (mhi_cntrl->ee == MHI_EE_RDDM) return 0; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index f6b8ffe30fc0..2f1d02f75d77 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -295,6 +295,7 @@ struct mhi_controller { /* mhi host manages downloading entire fbc images */ bool fbc_download; + bool rddm_supported; size_t rddm_size; size_t sbl_size; size_t seg_len;