All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] bus: mhi: host: allow SBL as initial EE
@ 2023-05-30  9:13 Daniele Palmas
  2023-05-30 10:31 ` Manivannan Sadhasivam
  0 siblings, 1 reply; 8+ messages in thread
From: Daniele Palmas @ 2023-05-30  9:13 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Siddartha Mohanadoss, Sujeev Dias, Jeffrey Hugo
  Cc: mhi, linux-arm-msm, Daniele Palmas

There are situations in which SBL is a legitimate initial execution
environment (e.g. modem stuck in SBL due to a firmware failure...), but
mhi refuses to start:

mhi-pci-generic 0000:01:00.0: MHI PCI device found: foxconn-sdx55
mhi-pci-generic 0000:01:00.0: BAR 0: assigned
mhi-pci-generic 0000:01:00.0: enabling device (0000 -> 0002)
mhi mhi0: Requested to power ON
mhi mhi0: SECONDARY BOOTLOADER is not a valid EE for power on
mhi-pci-generic 0000:01:00.0: failed to power up MHI controller
mhi-pci-generic: probe of 0000:01:00.0 failed with error -5

Fix this by adding SBL as an allowed initial execution environment.

Fixes: 3000f85b8f47 ("bus: mhi: core: Add support for basic PM operations")
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
---
 drivers/bus/mhi/host/internal.h | 2 +-
 drivers/bus/mhi/host/pm.c       | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/mhi/host/internal.h b/drivers/bus/mhi/host/internal.h
index 2e139e76de4c..3bdcd2321aa5 100644
--- a/drivers/bus/mhi/host/internal.h
+++ b/drivers/bus/mhi/host/internal.h
@@ -56,7 +56,7 @@ extern const char * const mhi_ee_str[MHI_EE_MAX];
 
 #define MHI_IN_PBL(ee) (ee == MHI_EE_PBL || ee == MHI_EE_PTHRU || \
 			ee == MHI_EE_EDL)
-#define MHI_POWER_UP_CAPABLE(ee) (MHI_IN_PBL(ee) || ee == MHI_EE_AMSS)
+#define MHI_POWER_UP_CAPABLE(ee) (MHI_IN_PBL(ee) || ee == MHI_EE_AMSS || ee == MHI_EE_SBL)
 #define MHI_FW_LOAD_CAPABLE(ee) (ee == MHI_EE_PBL || ee == MHI_EE_EDL)
 #define MHI_IN_MISSION_MODE(ee) (ee == MHI_EE_AMSS || ee == MHI_EE_WFW || \
 				 ee == MHI_EE_FP)
diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c
index 083459028a4b..18872c5017be 100644
--- a/drivers/bus/mhi/host/pm.c
+++ b/drivers/bus/mhi/host/pm.c
@@ -1203,10 +1203,11 @@ int mhi_sync_power_up(struct mhi_controller *mhi_cntrl)
 
 	wait_event_timeout(mhi_cntrl->state_event,
 			   MHI_IN_MISSION_MODE(mhi_cntrl->ee) ||
+			   mhi_cntrl->ee == MHI_EE_SBL ||
 			   MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state),
 			   msecs_to_jiffies(mhi_cntrl->timeout_ms));
 
-	ret = (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -ETIMEDOUT;
+	ret = (MHI_IN_MISSION_MODE(mhi_cntrl->ee) || mhi_cntrl->ee == MHI_EE_SBL) ? 0 : -ETIMEDOUT;
 	if (ret)
 		mhi_power_down(mhi_cntrl, false);
 
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-01  9:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30  9:13 [PATCH 1/1] bus: mhi: host: allow SBL as initial EE Daniele Palmas
2023-05-30 10:31 ` Manivannan Sadhasivam
2023-05-30 11:12   ` Daniele Palmas
2023-05-30 13:56     ` Manivannan Sadhasivam
2023-05-31 11:44       ` Daniele Palmas
2023-05-31 13:01         ` Manivannan Sadhasivam
2023-05-31 13:56           ` Jeffrey Hugo
2023-06-01  9:51           ` Daniele Palmas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.