On Fri, Dec 13, 2024 at 02:33:35PM -0700, Jeffrey Hugo wrote:
> From: Matthew Leung <quic_mattl...@quicinc.com>
> 
> Currently, mhi host only performs firmware transfer via BHI in PBL and

s/mhi/MHI here and below.

> 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

> fbc_download. The intention is to transfer firmware using BHIe in PBL
> without further BHIe transfers in SBL.
> 
> Signed-off-by: Matthew Leung <quic_mattl...@quicinc.com>
> Reviewed-by: Youssef Samir <quic_yabdu...@quicinc.com>
> Reviewed-by: Jeffrey Hugo <quic_jh...@quicinc.com>
> Signed-off-by: Jeffrey Hugo <quic_jh...@quicinc.com>
> ---
>  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.

> +
> +     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.

> +                     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?

> +{
> +     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?

- Mani

-- 
மணிவண்ணன் சதாசிவம்

Reply via email to