From: Trilok Soni <quic_tsoni@quicinc.com>
To: Kathiravan T <quic_kathirav@quicinc.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
"Elliot Berman" <quic_eberman@quicinc.com>,
Mukesh Ojha <quic_mojha@quicinc.com>,
Kalle Valo <kvalo@kernel.org>,
Loic Poulain <loic.poulain@linaro.org>,
<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-gpio@vger.kernel.org>
Cc: <quic_srichara@quicinc.com>, <quic_sjaganat@quicinc.com>,
<quic_anusha@quicinc.com>, <quic_saahtoma@quicinc.com>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: Re: [PATCH V5 1/3] firmware: qcom_scm: provide a read-modify-write function
Date: Fri, 21 Jul 2023 18:17:23 -0700 [thread overview]
Message-ID: <fdd4bc8b-1349-485d-18c5-c6d69cd415a1@quicinc.com> (raw)
In-Reply-To: <20230720070408.1093698-2-quic_kathirav@quicinc.com>
On 7/20/2023 12:04 AM, Kathiravan T wrote:
> From: Mukesh Ojha <quic_mojha@quicinc.com>
>
> It was realized by Srinivas K. that there is a need of read-modify-write
> scm exported function so that it can be used by multiple clients.
>
> Let's introduce qcom_scm_io_update_field() which masks out the bits and
> write the passed value to that bit-offset.
>
> Suggested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
> Signed-off-by: Kathiravan T <quic_kathirav@quicinc.com>
> ---
> Changes in V5:
> - No changes
>
> drivers/firmware/qcom_scm.c | 15 +++++++++++++++
> include/linux/firmware/qcom/qcom_scm.h | 2 ++
> 2 files changed, 17 insertions(+)
>
> diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
> index fde33acd46b7..104d86e49b97 100644
> --- a/drivers/firmware/qcom_scm.c
> +++ b/drivers/firmware/qcom_scm.c
> @@ -407,6 +407,21 @@ int qcom_scm_set_remote_state(u32 state, u32 id)
> }
> EXPORT_SYMBOL(qcom_scm_set_remote_state);
>
> +int qcom_scm_io_update_field(phys_addr_t addr, unsigned int mask, unsigned int val)
> +{
> + unsigned int old, new;
> + int ret;
> +
> + ret = qcom_scm_io_readl(addr, &old);
> + if (ret)
> + return ret;
> +
> + new = (old & ~mask) | (val & mask);
> +
> + return qcom_scm_io_writel(addr, new);
> +}
> +EXPORT_SYMBOL(qcom_scm_io_update_field);
EXPORT_SYMBO_GPL please.
> +
> static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
> {
> struct qcom_scm_desc desc = {
> diff --git a/include/linux/firmware/qcom/qcom_scm.h b/include/linux/firmware/qcom/qcom_scm.h
> index 250ea4efb7cb..ca41e4eb33ad 100644
> --- a/include/linux/firmware/qcom/qcom_scm.h
> +++ b/include/linux/firmware/qcom/qcom_scm.h
> @@ -84,6 +84,8 @@ extern bool qcom_scm_pas_supported(u32 peripheral);
>
> extern int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val);
> extern int qcom_scm_io_writel(phys_addr_t addr, unsigned int val);
> +extern int qcom_scm_io_update_field(phys_addr_t addr, unsigned int mask,
> + unsigned int val);
>
> extern bool qcom_scm_restore_sec_cfg_available(void);
> extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare);
next prev parent reply other threads:[~2023-07-22 1:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-20 7:04 [PATCH V5 0/3] Introduce the read-modify-write API to collect Kathiravan T
2023-07-20 7:04 ` [PATCH V5 1/3] firmware: qcom_scm: provide a read-modify-write function Kathiravan T
2023-07-22 1:17 ` Trilok Soni [this message]
2023-07-23 13:55 ` Kathiravan T
2023-07-29 0:34 ` Guru Das Srinagesh
2023-07-24 19:05 ` Elliot Berman
2023-07-20 7:04 ` [PATCH V5 2/3] pinctrl: qcom: Use qcom_scm_io_update_field() Kathiravan T
2023-07-22 3:09 ` Bjorn Andersson
2023-07-23 13:48 ` Kathiravan T
2023-07-20 7:04 ` [PATCH V5 3/3] firmware: scm: Modify only the download bits in TCSR register Kathiravan T
2023-07-21 23:15 ` kernel test robot
2023-07-24 19:05 ` Elliot Berman
2023-07-25 10:24 ` Kathiravan T
2023-07-20 7:08 ` [PATCH V5 0/3] Introduce the read-modify-write API to collect Kathiravan T
2023-07-24 19:05 ` Elliot Berman
2023-07-25 9:55 ` Kathiravan T
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=fdd4bc8b-1349-485d-18c5-c6d69cd415a1@quicinc.com \
--to=quic_tsoni@quicinc.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=kvalo@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=quic_anusha@quicinc.com \
--cc=quic_eberman@quicinc.com \
--cc=quic_kathirav@quicinc.com \
--cc=quic_mojha@quicinc.com \
--cc=quic_saahtoma@quicinc.com \
--cc=quic_sjaganat@quicinc.com \
--cc=quic_srichara@quicinc.com \
--cc=srinivas.kandagatla@linaro.org \
/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