Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Bhaumik Bhatt <bbhatt@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org,
	jhugo@codeaurora.org, linux-kernel@vger.kernel.org,
	carl.yin@quectel.com, naveen.kumar@quectel.com,
	loic.poulain@linaro.org, abickett@codeaurora.org
Subject: Re: [PATCH v1 4/7] bus: mhi: core: Add support for Flash Programmer execution environment
Date: Wed, 31 Mar 2021 16:41:20 +0530
Message-ID: <20210331111120.GC15610@work> (raw)
In-Reply-To: <1617067704-28850-5-git-send-email-bbhatt@codeaurora.org>

On Mon, Mar 29, 2021 at 06:28:21PM -0700, Bhaumik Bhatt wrote:
> From: Carl Yin <carl.yin@quectel.com>
> 
> MHI WWAN modems support downloading firmware to NAND or eMMC
> using Firehose protocol with process as follows:
> 1. Modem boots up, enters AMSS execution environment and the
> device later enters EDL (Emergency Download) mode through any
> mechanism host can use such as a diag command.
> 2. Modem enters SYS_ERROR, MHI host handles SYS_ERROR transition.
> 3. EDL image for device to enter 'Flash Programmer' execution
> environment is then flashed via BHI interface from host.
> 4. Modem enters MHI READY -> M0 and sends the Flash Programmer
> execution environment change to host.
> 5. Following that, EDL/FIREHOSE channels (34, 35) are made
> available from the host.
> 6. User space tool for downloading firmware image to modem over
> the EDL channels using Firehose protocol. Link to USB flashing
> tool: https://git.linaro.org/landing-teams/working/qualcomm/qdl.git/
> 
> Make the necessary changes to allow for this sequence to occur and
> allow using the Flash Programmer execution environment.
> 
> Signed-off-by: Carl Yin <carl.yin@quectel.com>
> Co-developed-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> ---
>  drivers/bus/mhi/core/init.c     | 2 ++
>  drivers/bus/mhi/core/internal.h | 1 +
>  drivers/bus/mhi/core/main.c     | 3 +++
>  drivers/bus/mhi/core/pm.c       | 6 ++++++
>  include/linux/mhi.h             | 4 +++-
>  5 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index 706484f..ee67712 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -29,6 +29,7 @@ const char * const mhi_ee_str[MHI_EE_MAX] = {
>  	[MHI_EE_WFW] = "WFW",
>  	[MHI_EE_PTHRU] = "PASS THRU",
>  	[MHI_EE_EDL] = "EDL",
> +	[MHI_EE_FP] = "FLASH PROGRAMMER",
>  	[MHI_EE_DISABLE_TRANSITION] = "DISABLE",
>  	[MHI_EE_NOT_SUPPORTED] = "NOT SUPPORTED",
>  };
> @@ -38,6 +39,7 @@ const char * const dev_state_tran_str[DEV_ST_TRANSITION_MAX] = {
>  	[DEV_ST_TRANSITION_READY] = "READY",
>  	[DEV_ST_TRANSITION_SBL] = "SBL",
>  	[DEV_ST_TRANSITION_MISSION_MODE] = "MISSION_MODE",
> +	[DEV_ST_TRANSITION_FP] = "FLASH_PROGRAMMER",
>  	[DEV_ST_TRANSITION_SYS_ERR] = "SYS_ERR",
>  	[DEV_ST_TRANSITION_DISABLE] = "DISABLE",
>  };
> diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
> index 6f37439..b1b5f2b 100644
> --- a/drivers/bus/mhi/core/internal.h
> +++ b/drivers/bus/mhi/core/internal.h
> @@ -386,6 +386,7 @@ enum dev_st_transition {
>  	DEV_ST_TRANSITION_READY,
>  	DEV_ST_TRANSITION_SBL,
>  	DEV_ST_TRANSITION_MISSION_MODE,
> +	DEV_ST_TRANSITION_FP,
>  	DEV_ST_TRANSITION_SYS_ERR,
>  	DEV_ST_TRANSITION_DISABLE,
>  	DEV_ST_TRANSITION_MAX,
> diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
> index d377d07..8b68657 100644
> --- a/drivers/bus/mhi/core/main.c
> +++ b/drivers/bus/mhi/core/main.c
> @@ -831,6 +831,9 @@ int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl,
>  			case MHI_EE_AMSS:
>  				st = DEV_ST_TRANSITION_MISSION_MODE;
>  				break;
> +			case MHI_EE_FP:
> +				st = DEV_ST_TRANSITION_FP;
> +				break;
>  			case MHI_EE_RDDM:
>  				mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_EE_RDDM);
>  				write_lock_irq(&mhi_cntrl->pm_lock);
> diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
> index b65222e..7ac9dfe 100644
> --- a/drivers/bus/mhi/core/pm.c
> +++ b/drivers/bus/mhi/core/pm.c
> @@ -782,6 +782,12 @@ void mhi_pm_st_worker(struct work_struct *work)
>  		case DEV_ST_TRANSITION_MISSION_MODE:
>  			mhi_pm_mission_mode_transition(mhi_cntrl);
>  			break;
> +		case DEV_ST_TRANSITION_FP:
> +			write_lock_irq(&mhi_cntrl->pm_lock);
> +			mhi_cntrl->ee = MHI_EE_FP;
> +			write_unlock_irq(&mhi_cntrl->pm_lock);
> +			mhi_create_devices(mhi_cntrl);
> +			break;
>  		case DEV_ST_TRANSITION_READY:
>  			mhi_ready_state_transition(mhi_cntrl);
>  			break;
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index 8f5bf40..b16afd3 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -117,6 +117,7 @@ struct mhi_link_info {
>   * @MHI_EE_WFW: WLAN firmware mode
>   * @MHI_EE_PTHRU: Passthrough
>   * @MHI_EE_EDL: Embedded downloader
> + * @MHI_EE_FP: Flash Programmer Environment
>   */
>  enum mhi_ee_type {
>  	MHI_EE_PBL,
> @@ -126,7 +127,8 @@ enum mhi_ee_type {
>  	MHI_EE_WFW,
>  	MHI_EE_PTHRU,
>  	MHI_EE_EDL,
> -	MHI_EE_MAX_SUPPORTED = MHI_EE_EDL,
> +	MHI_EE_FP,
> +	MHI_EE_MAX_SUPPORTED = MHI_EE_FP,
>  	MHI_EE_DISABLE_TRANSITION, /* local EE, not related to mhi spec */
>  	MHI_EE_NOT_SUPPORTED,
>  	MHI_EE_MAX,
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

  parent reply index

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30  1:28 [PATCH v1 0/7] MHI Emergency download and flash programmer support Bhaumik Bhatt
2021-03-30  1:28 ` [PATCH v1 1/7] bus: mhi: core: Rely on accurate method to determine EDL mode Bhaumik Bhatt
2021-03-30  8:00   ` Loic Poulain
2021-03-30  1:28 ` [PATCH v1 2/7] bus: mhi: core: Wait for ready after an EDL firmware download Bhaumik Bhatt
2021-03-30  8:01   ` Loic Poulain
2021-03-30  1:28 ` [PATCH v1 3/7] bus: mhi: core: Handle EDL mode entry appropriately Bhaumik Bhatt
2021-03-30  8:01   ` Loic Poulain
2021-03-31 10:59   ` Manivannan Sadhasivam
2021-03-30  1:28 ` [PATCH v1 4/7] bus: mhi: core: Add support for Flash Programmer execution environment Bhaumik Bhatt
2021-03-30  8:02   ` Loic Poulain
2021-03-31 11:11   ` Manivannan Sadhasivam [this message]
2021-03-30  1:28 ` [PATCH v1 5/7] bus: mhi: core: Identify Flash Programmer as a mission mode use case Bhaumik Bhatt
2021-03-30  8:02   ` Loic Poulain
2021-03-30  1:28 ` [PATCH v1 6/7] bus: mhi: core: Wait for MHI READY state in most scenarios Bhaumik Bhatt
2021-03-30  8:03   ` Loic Poulain
2021-03-31 11:13   ` Manivannan Sadhasivam
2021-03-30  1:28 ` [PATCH v1 7/7] bus: mhi: core: Improve state strings for debug messages Bhaumik Bhatt
2021-03-30  8:03   ` Loic Poulain
2021-03-31 11:16 ` [PATCH v1 0/7] MHI Emergency download and flash programmer support Manivannan Sadhasivam
2021-03-31 17:01   ` Bhaumik Bhatt
2021-03-31 11:24 ` Manivannan Sadhasivam
2021-05-26 19:03 ` patchwork-bot+linux-arm-msm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210331111120.GC15610@work \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=abickett@codeaurora.org \
    --cc=bbhatt@codeaurora.org \
    --cc=carl.yin@quectel.com \
    --cc=hemantk@codeaurora.org \
    --cc=jhugo@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=naveen.kumar@quectel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org
	public-inbox-index linux-arm-msm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git