From: Sudeep Holla <sudeep.holla@arm.com>
To: peng.fan@nxp.com
Cc: robh+dt@kernel.org, mark.rutland@arm.com,
viresh.kumar@linaro.org, f.fainelli@gmail.com, linux-imx@nxp.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
andre.przywara@arm.com, Sudeep Holla <sudeep.holla@arm.com>
Subject: Re: [PATCH V2 2/2] firmware: arm_scmi: add smc/hvc transports
Date: Thu, 13 Feb 2020 11:04:19 +0000 [thread overview]
Message-ID: <20200213110419.GB23374@bogus> (raw)
In-Reply-To: <1581566330-1029-3-git-send-email-peng.fan@nxp.com>
On Thu, Feb 13, 2020 at 11:58:50AM +0800, peng.fan@nxp.com wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Add SCMI smc/hvc transports support.
>
> Take smc-id as the 2nd arg, and protocol id as the 2nd arg when
> invokding SMC/HVC. Since we need protocol id, so add this parrameter
> to chan_setup, then smc transport driver could directly use it.
> There is no Rx, only Tx because of smc/hvc not support Rx.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/firmware/arm_scmi/Makefile | 2 +-
> drivers/firmware/arm_scmi/common.h | 4 +-
> drivers/firmware/arm_scmi/driver.c | 11 +-
> drivers/firmware/arm_scmi/mailbox.c | 2 +-
> drivers/firmware/arm_scmi/smc.c | 222 ++++++++++++++++++++++++++++++++++++
> 5 files changed, 234 insertions(+), 7 deletions(-)
> create mode 100644 drivers/firmware/arm_scmi/smc.c
[...]
>
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index dbec767222e9..65c56328e6d8 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -595,7 +595,7 @@ static int scmi_chan_setup(struct scmi_info *info, struct device *dev,
>
> cinfo->dev = dev;
>
> - ret = info->desc->ops->chan_setup(cinfo, info->dev, tx);
> + ret = info->desc->ops->chan_setup(cinfo, info->dev, prot_id, tx);
Why do you need this ?
> if (ret)
> return ret;
>
> @@ -826,7 +829,7 @@ ATTRIBUTE_GROUPS(versions);
>
> /* Each compatible listed below must have descriptor associated with it */
> static const struct of_device_id scmi_of_match[] = {
> - { .compatible = "arm,scmi", .data = &scmi_mailbox_desc },
> + { .compatible = "arm,scmi", },
Don't do this, get "arm,scmi-smc"
> { /* Sentinel */ },
> };
>
[...]
> +static unsigned long
> +__invoke_scmi_fn_hvc(unsigned long function_id, unsigned long arg0,
> + unsigned long arg1, unsigned long arg2,
> + unsigned long arg3, unsigned long arg4,
> + unsigned long arg5, unsigned long arg6)
> +{
> + struct arm_smccc_res res;
> +
> + arm_smccc_hvc(function_id, arg0, arg1, arg2, arg3, arg4, arg5,
> + arg6, &res);
> +
> + return res.a0;
> +}
> +
> +static unsigned long
> +__invoke_scmi_fn_smc(unsigned long function_id, unsigned long arg0,
> + unsigned long arg1, unsigned long arg2,
> + unsigned long arg3, unsigned long arg4,
> + unsigned long arg5, unsigned long arg6)
> +{
> + struct arm_smccc_res res;
> +
> + arm_smccc_smc(function_id, arg0, arg1, arg2, arg3, arg4, arg5,
> + arg6, &res);
> +
> + return res.a0;
> +}
> +
> +static int scmi_smc_conduit_method(struct device_node *np)
> +{
> + const char *method;
> +
> + if (invoke_scmi_smc_fn)
> + return 0;
> +
> + if (of_property_read_string(np, "method", &method))
> + return -ENXIO;
> +
> + if (!strcmp("hvc", method)) {
> + invoke_scmi_smc_fn = __invoke_scmi_fn_hvc;
> + } else if (!strcmp("smc", method)) {
> + invoke_scmi_smc_fn = __invoke_scmi_fn_smc;
> + } else {
> + pr_warn("invalid \"method\" property: %s\n", method);
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
You don't the above functions
[...]
> +
> + np = of_find_node_by_path("/psci");
> + if (!np) {
> + dev_err(dev, "Not able to find /psci node\n");
> + return -ENODEV;
> + }
No need for this as mentioned below.
> +
> + ret = scmi_smc_conduit_method(np);
Just use arm_smccc_1_1_get_conduit if you want to get the conduit which
I don't think you need. You can just use arm_smccc_1_1_invoke() directly.
--
Regards,
Sudeep
next prev parent reply other threads:[~2020-02-13 11:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 3:58 [PATCH V2 0/2] firmware: arm_scmi: add smc/hvc transports support peng.fan
2020-02-13 3:58 ` [PATCH V2 1/2] dt-bindings: arm: arm,scmi: add smc/hvc transports peng.fan
2020-02-13 10:54 ` Sudeep Holla
2020-02-14 0:59 ` Peng Fan
2020-02-13 3:58 ` [PATCH V2 2/2] firmware: arm_scmi: " peng.fan
2020-02-13 11:04 ` Sudeep Holla [this message]
2020-02-14 1:04 ` Peng Fan
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=20200213110419.GB23374@bogus \
--to=sudeep.holla@arm.com \
--cc=andre.przywara@arm.com \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=peng.fan@nxp.com \
--cc=robh+dt@kernel.org \
--cc=viresh.kumar@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;
as well as URLs for NNTP newsgroup(s).