Re: [PATCH 2/7] bus: mhi: host: Add a policy to enable image transfer via BHIe in PBL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/7/2025 10:42 PM, Manivannan Sadhasivam wrote:
On Fri, Dec 13, 2024 at 02:33:35PM -0700, Jeffrey Hugo wrote:
From: Matthew Leung <quic_mattleun@xxxxxxxxxxx>

Currently, mhi host only performs firmware transfer via BHI in PBL and

s/mhi/MHI here and below.

Done


BHIe from SBL. To support BHIe transfer directly from PBL, a policy
needs to be added.

With this policy, BHIe will be used to transfer firmware in PBL if the
mhi controller has bhie regs, sets seg_len, and does not set

s/bhie/BHIe

Done


fbc_download. The intention is to transfer firmware using BHIe in PBL
without further BHIe transfers in SBL.

Signed-off-by: Matthew Leung <quic_mattleun@xxxxxxxxxxx>
Reviewed-by: Youssef Samir <quic_yabdulra@xxxxxxxxxxx>
Reviewed-by: Jeffrey Hugo <quic_jhugo@xxxxxxxxxxx>
Signed-off-by: Jeffrey Hugo <quic_jhugo@xxxxxxxxxxx>
---
  drivers/bus/mhi/host/boot.c     | 80 +++++++++++++++++++++++++++------
  drivers/bus/mhi/host/init.c     |  2 +-
  drivers/bus/mhi/host/internal.h |  8 ++++
  3 files changed, 75 insertions(+), 15 deletions(-)

diff --git a/drivers/bus/mhi/host/boot.c b/drivers/bus/mhi/host/boot.c
index e3f3c07166ad..c9ecb6427209 100644
--- a/drivers/bus/mhi/host/boot.c
+++ b/drivers/bus/mhi/host/boot.c
@@ -452,12 +452,62 @@ static void mhi_firmware_copy_bhie(struct mhi_controller *mhi_cntrl,
  	}
  }
+static enum mhi_fw_load_type mhi_fw_load_type_get(const struct mhi_controller *mhi_cntrl)
+{
+	enum mhi_fw_load_type ret = MHI_FW_LOAD_UNKNOWN;

You can directly return the enum without a local variable.

Done


+
+	if (mhi_cntrl->fbc_download) {
+		if (mhi_cntrl->bhie && mhi_cntrl->seg_len)

I don't think this condition can fail. If 'mhi_cntrl->bhie' is NULL,
mhi_prepare_for_power_up() will fail. So I think MHI_FW_LOAD_UNKNOWN is not
needed.

Also, all the validation should be performed early, not while loading fw.

You are right. That will not fail. I've simplified this, relying on the existing validation.


+			ret = MHI_FW_LOAD_FBC;
+	} else {
+		if (mhi_cntrl->bhie && mhi_cntrl->seg_len)
+			ret = MHI_FW_LOAD_BHIE;
+		else
+			ret = MHI_FW_LOAD_BHI;
+	}
+	return ret;
+}
+
+static int mhi_send_image_bhi(struct mhi_controller *mhi_cntrl, const u8 *fw_data, size_t size)

mhi_load_image_bhi?

Done


+{
+	struct image_info *image;
+	int ret;
+
+	ret = mhi_alloc_bhi_buffer(mhi_cntrl, &image, size);
+	if (ret)
+		return ret;
+
+	mhi_firmware_copy_bhi(mhi_cntrl, fw_data, size, image);
+
+	ret = mhi_fw_load_bhi(mhi_cntrl, &image->mhi_buf[image->entries - 1]);
+	mhi_free_bhi_buffer(mhi_cntrl, image);
+
+	return ret;
+}
+
+static int mhi_send_image_bhie(struct mhi_controller *mhi_cntrl, const u8 *fw_data, size_t size)

mhi_load_image_bhie?

Done





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux