Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp293329pxx; Wed, 28 Oct 2020 05:12:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0Ro5p/5K94mWerTPkbXm+5ldF46WKiVZ2mSZFhW9CZb/a4QKLjanv0MdmWsupuW5ghiYr X-Received: by 2002:a17:906:11d6:: with SMTP id o22mr7436738eja.171.1603887142314; Wed, 28 Oct 2020 05:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603887142; cv=none; d=google.com; s=arc-20160816; b=ZBTCo28ABL0PGzNGIJ5RdZKS7ZhaJMlBbPvolfAfe0kkiJPzG9n52Cz0rp8ilLRiho a2PVNSeffocGbWEZLszXaPYAAqPEdYgSGZ+4MaO3VE6p5d2i/b6SvceFC1uTNi2p99Yo /2xAfPCzd4WcsRVHxENMhRG+OioVkYSyX7SHJRHKIJb7ZAG35bYqx/6l8ijb5AwDPmWy E+KMCFe15jdmaYP5E7ujw7eKAeQqJThV9iofPosN7oPlvH3gi6HgkA264/duKe5gbDSV q0X4l4os/yp3nvDNBYYHPQaQRpS+dKSPvb2VO9mqTgMmRA2pSix0NtGvOBCmGWCXxMTD HNUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=A869fPt7QTK17NiX6EP/E8Tob7OjISo9nWII+Pbb74I=; b=Ubf3WcwMfZ8jdaWSLrcBQ32VtfjNxlkAnEp7n709H1R8xbEHRNsd9QgPBXv1V7AvDr Ilum4r4inzxegZON2oVfGDwZoT7bwaE3fqUYmonE29f0gPkuy81egxkPv3vIxoaMAVjA TTZbikdT1++HVGkHtOAlo1VuYyMuI3TJcTVJnP5q4VRf9WNaF+8c7OLNbqWfH+cjJKyr 5dBsvAebRu+KYvMRAJ0yWrDO2iesG8PD3iZnQ3lCZpPe0+Igbf4eTETM+IK+q0j8HeBa G171k9fA3ofCIiJ6RuOwlsT7owSF9eg1/fXnxYAeoLHfwqpJb4/AKH5j86D+brAsvEiw 6yIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=jJXkg1J+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si2654785ede.591.2020.10.28.05.11.59; Wed, 28 Oct 2020 05:12:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=jJXkg1J+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1795819AbgJ0PPW (ORCPT + 99 others); Tue, 27 Oct 2020 11:15:22 -0400 Received: from z5.mailgun.us ([104.130.96.5]:55165 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1794562AbgJ0PMZ (ORCPT ); Tue, 27 Oct 2020 11:12:25 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1603811543; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=A869fPt7QTK17NiX6EP/E8Tob7OjISo9nWII+Pbb74I=; b=jJXkg1J+L2jO7yY65eLEXe+apEM7OsrfaUfTDIsUGhipLYubH21U/Q22tfdYWS+d4kUzsrc3 nCALG10+ow0v0lau0sl49q1VOJbJmmcL7YAkqnmajepGwplfDsDSHguoyuamy/uK9oehCszV GqdP/EIhD0ABt4gLxi0BjmFkOAE= X-Mailgun-Sending-Ip: 104.130.96.5 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 5f9838ba83cdcf4c2fbd3bde (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 27 Oct 2020 15:11:54 GMT Sender: jhugo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id B6AE2C384F7; Tue, 27 Oct 2020 15:11:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from [10.226.59.216] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jhugo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 81D56C384EF; Tue, 27 Oct 2020 15:11:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 81D56C384EF Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=jhugo@codeaurora.org Subject: Re: [PATCH] bus: mhi: core: Add support MHI EE FP for download firmware To: carl.yin@quectel.com, manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org, sfr@canb.auug.org.au Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, naveen.kumar@quectel.com References: <20201027094338.23110-1-carl.yin@quectel.com> From: Jeffrey Hugo Message-ID: <937f9236-1c07-d101-a8d7-afad68afdd2b@codeaurora.org> Date: Tue, 27 Oct 2020 09:11:50 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 MIME-Version: 1.0 In-Reply-To: <20201027094338.23110-1-carl.yin@quectel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/27/2020 3:43 AM, carl.yin@quectel.com wrote: > From: "carl.yin" > > MHI wwan modems support download firmware to nand or emmc > by firehose protocol, process as next: > 1. wwan modem normal bootup and enter EE AMSS, create mhi DIAG chan device > 2. send EDL cmd via DIAG chan, then modem enter EE EDL > 3. boot.c download 'firehose/prog_firehose_sdx55.mbn' via BHI interface > 4. modem enter EE FP, and create mhi EDL chan device > 5. user space tool download FW to modem via EDL chan by firehose protocol > > Signed-off-by: carl.yin > --- > drivers/bus/mhi/core/boot.c | 4 +++- > 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 | 16 +++++++++++++++- > include/linux/mhi.h | 4 +++- > 6 files changed, 27 insertions(+), 3 deletions(-) > > diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c > index 24422f5..ab39ad6 100644 > --- a/drivers/bus/mhi/core/boot.c > +++ b/drivers/bus/mhi/core/boot.c > @@ -460,8 +460,10 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) > return; > } > > - if (mhi_cntrl->ee == MHI_EE_EDL) > + if (mhi_cntrl->ee == MHI_EE_EDL) { > + mhi_ready_state_transition(mhi_cntrl); > return; > + } > > write_lock_irq(&mhi_cntrl->pm_lock); > mhi_cntrl->dev_state = MHI_STATE_RESET; > diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c > index ac4aa5c..9c2c2f3 100644 > --- a/drivers/bus/mhi/core/init.c > +++ b/drivers/bus/mhi/core/init.c > @@ -26,6 +26,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] = "FP", > [MHI_EE_DISABLE_TRANSITION] = "DISABLE", > [MHI_EE_NOT_SUPPORTED] = "NOT SUPPORTED", > }; > @@ -35,6 +36,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] = "FP", > [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 4abf0cf..6ae897a 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 3950792..e307b58 100644 > --- a/drivers/bus/mhi/core/main.c > +++ b/drivers/bus/mhi/core/main.c > @@ -782,6 +782,9 @@ int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl, > case MHI_EE_SBL: > st = DEV_ST_TRANSITION_SBL; > break; > + case MHI_EE_FP: > + st = DEV_ST_TRANSITION_FP; > + break; > case MHI_EE_WFW: > case MHI_EE_AMSS: > st = DEV_ST_TRANSITION_MISSION_MODE; > diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c > index 3de7b16..3c95a5d 100644 > --- a/drivers/bus/mhi/core/pm.c > +++ b/drivers/bus/mhi/core/pm.c > @@ -563,7 +563,15 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl, > } > > if (cur_state == MHI_PM_SYS_ERR_PROCESS) { > - mhi_ready_state_transition(mhi_cntrl); > + if (mhi_get_exec_env(mhi_cntrl) == MHI_EE_EDL > + && mhi_get_mhi_state(mhi_cntrl) == MHI_STATE_RESET) { > + write_lock_irq(&mhi_cntrl->pm_lock); > + cur_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_POR); > + write_unlock_irq(&mhi_cntrl->pm_lock); > + mhi_queue_state_transition(mhi_cntrl, DEV_ST_TRANSITION_PBL); > + } else { > + mhi_ready_state_transition(mhi_cntrl); > + } > } else { > /* Move to disable state */ > write_lock_irq(&mhi_cntrl->pm_lock); > @@ -658,6 +666,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 6e1122c..4620af8 100644 > --- a/include/linux/mhi.h > +++ b/include/linux/mhi.h > @@ -120,6 +120,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, > @@ -129,7 +130,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, > This gets a NACK from me. I don't see the FP_EE that this patch introduces defined in the spec. Where did it come from? -- Jeffrey Hugo Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.