mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Andersson <andersson@kernel.org>
To: Hiren Gohel <quic_vhiren@quicinc.com>
Cc: Andy Gross <agross@kernel.org>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	linux-kernel@vger.kernel.org,
	Udipto Goswami <quic_ugoswami@quicinc.com>,
	Pratham Pratap <quic_ppratap@quicinc.com>,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] usb: phy: qusb: Use scm call to update value in register
Date: Thu, 15 Sep 2022 12:21:18 -0500	[thread overview]
Message-ID: <20220915172118.q2bsjlfcau33z6pa@builder.lan> (raw)
In-Reply-To: <1663249627-21151-1-git-send-email-quic_vhiren@quicinc.com>

On Thu, Sep 15, 2022 at 07:17:07PM +0530, Hiren Gohel wrote:
> Registers used by vendors to control any functionality could be
> implemented by making the register secured. In such cases the
> register cannot be updated with a new value since the normal
> write ops will fail.
> 
> Hence, use the scm_call to do a secure write to the register.
> 

This looks reasonable, but we need a caller of this API in order to
merge this patch.

> Signed-off-by: Hiren Gohel <quic_vhiren@quicinc.com>
> ---
>  drivers/firmware/qcom_scm.c | 19 +++++++++++++++++++
>  drivers/firmware/qcom_scm.h |  1 +
>  include/linux/qcom_scm.h    |  2 ++
>  3 files changed, 22 insertions(+)
> 
> diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
> index cdbfe54..7131df8 100644
> --- a/drivers/firmware/qcom_scm.c
> +++ b/drivers/firmware/qcom_scm.c
> @@ -400,6 +400,25 @@ int qcom_scm_set_remote_state(u32 state, u32 id)
>  }
>  EXPORT_SYMBOL(qcom_scm_set_remote_state);
>  
> +void qcom_scm_phy_update_scm_level_shifter(u32 val)

That second "scm" doesn't seem necessary.

> +{
> +	int ret;
> +	struct qcom_scm_desc desc = {
> +		.svc = QCOM_SCM_SVC_BOOT,
> +		.cmd = QCOM_SCM_QUSB2PHY_LVL_SHIFTER_CMD_ID,
> +		.owner = ARM_SMCCC_OWNER_SIP
> +	};
> +
> +	desc.args[0] = val;
> +	desc.args[1] = 0;
> +	desc.arginfo = QCOM_SCM_ARGS(2);
> +
> +	ret = qcom_scm_call(__scm->dev, &desc, NULL);

Would it not make sense to return this error to the caller?

Regards,
Bjorn

> +	if (ret)
> +		pr_err("Failed to update scm level shifter=0x%x\n", ret);
> +}
> +EXPORT_SYMBOL(qcom_scm_phy_update_scm_level_shifter);
> +
>  static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
>  {
>  	struct qcom_scm_desc desc = {
> diff --git a/drivers/firmware/qcom_scm.h b/drivers/firmware/qcom_scm.h
> index 0d51eef..0a8c25b 100644
> --- a/drivers/firmware/qcom_scm.h
> +++ b/drivers/firmware/qcom_scm.h
> @@ -81,6 +81,7 @@ extern int scm_legacy_call(struct device *dev, const struct qcom_scm_desc *desc,
>  #define QCOM_SCM_BOOT_SET_ADDR_MC	0x11
>  #define QCOM_SCM_BOOT_SET_REMOTE_STATE	0x0a
>  #define QCOM_SCM_FLUSH_FLAG_MASK	0x3
> +#define QCOM_SCM_QUSB2PHY_LVL_SHIFTER_CMD_ID	0x1B
>  #define QCOM_SCM_BOOT_MAX_CPUS		4
>  #define QCOM_SCM_BOOT_MC_FLAG_AARCH64	BIT(0)
>  #define QCOM_SCM_BOOT_MC_FLAG_COLDBOOT	BIT(1)
> diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h
> index f8335644..3e5cbe9 100644
> --- a/include/linux/qcom_scm.h
> +++ b/include/linux/qcom_scm.h
> @@ -124,4 +124,6 @@ extern int qcom_scm_lmh_dcvsh(u32 payload_fn, u32 payload_reg, u32 payload_val,
>  extern int qcom_scm_lmh_profile_change(u32 profile_id);
>  extern bool qcom_scm_lmh_dcvsh_available(void);
>  
> +extern void qcom_scm_phy_update_scm_level_shifter(u32 val);
> +
>  #endif
> -- 
> 2.7.4
> 

      reply	other threads:[~2022-09-15 17:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15 13:47 Hiren Gohel
2022-09-15 17:21 ` Bjorn Andersson [this message]

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=20220915172118.q2bsjlfcau33z6pa@builder.lan \
    --to=andersson@kernel.org \
    --cc=agross@kernel.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=quic_ppratap@quicinc.com \
    --cc=quic_ugoswami@quicinc.com \
    --cc=quic_vhiren@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®