mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Andersson <andersson@kernel.org>
To: Mukesh Ojha <quic_mojha@quicinc.com>
Cc: agross@kernel.org, konrad.dybcio@linaro.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] firmware: qcom_scm: modify qcom_scm_set_download_mode()
Date: Fri, 3 Feb 2023 11:02:48 -0800	[thread overview]
Message-ID: <20230203190248.ywmb54gmdd4blv46@ripper> (raw)
In-Reply-To: <1675419435-30726-1-git-send-email-quic_mojha@quicinc.com>

On Fri, Feb 03, 2023 at 03:47:15PM +0530, Mukesh Ojha wrote:
> Modify qcom_scm_set_download_mode() such that it can support
> multiple modes. There is no functional change with this change.
> 

As Dmitry said, you argue for added flexibility, but doesn't provide a
user of that flexibility. I will drop this patch from the queue for now.

Please include this together with the patch(es) that benefit from such
flexibility.

> Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
> ---
> Changes in v2:
>   - Stop changing legacy scm id for dload mode.
> 
>  drivers/firmware/qcom_scm.c | 15 +++++++--------
>  include/linux/qcom_scm.h    |  5 +++++
>  2 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
> index cdbfe54..6245b97 100644
> --- a/drivers/firmware/qcom_scm.c
> +++ b/drivers/firmware/qcom_scm.c
> @@ -400,7 +400,7 @@ int qcom_scm_set_remote_state(u32 state, u32 id)
>  }
>  EXPORT_SYMBOL(qcom_scm_set_remote_state);
>  
> -static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
> +static int __qcom_scm_set_dload_mode(struct device *dev, enum qcom_download_mode mode)
>  {
>  	struct qcom_scm_desc desc = {
>  		.svc = QCOM_SCM_SVC_BOOT,
> @@ -410,12 +410,12 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
>  		.owner = ARM_SMCCC_OWNER_SIP,
>  	};
>  
> -	desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0;
> +	desc.args[1] = mode ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0;
>  
>  	return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
>  }
>  
> -static void qcom_scm_set_download_mode(bool enable)
> +static void qcom_scm_set_download_mode(enum qcom_download_mode mode)
>  {
>  	bool avail;
>  	int ret = 0;
> @@ -424,10 +424,9 @@ static void qcom_scm_set_download_mode(bool enable)
>  					     QCOM_SCM_SVC_BOOT,
>  					     QCOM_SCM_BOOT_SET_DLOAD_MODE);
>  	if (avail) {
> -		ret = __qcom_scm_set_dload_mode(__scm->dev, enable);
> +		ret = __qcom_scm_set_dload_mode(__scm->dev, mode);
>  	} else if (__scm->dload_mode_addr) {
> -		ret = qcom_scm_io_writel(__scm->dload_mode_addr,
> -				enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0);
> +		ret = qcom_scm_io_writel(__scm->dload_mode_addr, mode);
>  	} else {
>  		dev_err(__scm->dev,
>  			"No available mechanism for setting download mode\n");
> @@ -1410,7 +1409,7 @@ static int qcom_scm_probe(struct platform_device *pdev)
>  	 * disabled below by a clean shutdown/reboot.
>  	 */
>  	if (download_mode)
> -		qcom_scm_set_download_mode(true);
> +		qcom_scm_set_download_mode(QCOM_DOWNLOAD_FULLDUMP);
>  
>  	return 0;
>  }
> @@ -1419,7 +1418,7 @@ static void qcom_scm_shutdown(struct platform_device *pdev)
>  {
>  	/* Clean shutdown, disable download mode to allow normal restart */
>  	if (download_mode)

PS. Wouldn't it make sense, if !download_mode to set NODUMP?

Regards,
Bjorn

> -		qcom_scm_set_download_mode(false);
> +		qcom_scm_set_download_mode(QCOM_DOWNLOAD_NODUMP);
>  }
>  
>  static const struct of_device_id qcom_scm_dt_match[] = {
> diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h
> index f833564..f9bc84e 100644
> --- a/include/linux/qcom_scm.h
> +++ b/include/linux/qcom_scm.h
> @@ -14,6 +14,11 @@
>  #define QCOM_SCM_CPU_PWR_DOWN_L2_OFF	0x1
>  #define QCOM_SCM_HDCP_MAX_REQ_CNT	5
>  
> +enum qcom_download_mode {
> +	QCOM_DOWNLOAD_NODUMP    = 0x00,
> +	QCOM_DOWNLOAD_FULLDUMP  = 0x10,
> +};
> +
>  struct qcom_scm_hdcp_req {
>  	u32 addr;
>  	u32 val;
> -- 
> 2.7.4
> 

  parent reply	other threads:[~2023-02-03 19:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 10:17 Mukesh Ojha
2023-02-03 14:51 ` Srinivas Kandagatla
2023-02-03 14:53   ` Mukesh Ojha
2023-02-03 15:34     ` Dmitry Baryshkov
2023-02-03 18:54     ` Bjorn Andersson
2023-02-03 19:02 ` Bjorn Andersson [this message]
2023-02-18 12:38   ` Mukesh Ojha

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=20230203190248.ywmb54gmdd4blv46@ripper \
    --to=andersson@kernel.org \
    --cc=agross@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_mojha@quicinc.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®