From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Etienne CARRIERE <etienne.carriere@st.com>
Cc: "trini@konsulko.com" <trini@konsulko.com>,
"sjg@chromium.org" <sjg@chromium.org>,
"u-boot@lists.denx.de" <u-boot@lists.denx.de>,
Etienne CARRIERE - foss <etienne.carriere@foss.st.com>
Subject: Re: [PATCH v3 04/13] firmware: scmi: framework for installing additional protocols
Date: Mon, 11 Sep 2023 15:56:20 +0900 [thread overview]
Message-ID: <ZP66FEs/M1taoEMK@octopus> (raw)
In-Reply-To: <PAXPR10MB4687A7E0331B9FD9206F1E8AFDEDA@PAXPR10MB4687.EURPRD10.PROD.OUTLOOK.COM>
On Fri, Sep 08, 2023 at 02:01:52PM +0000, Etienne CARRIERE wrote:
>
> > From: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > Sent: Friday, September 8, 2023 04:51
> >
> > This framework allows SCMI protocols to be installed and bound to the agent
> > so that the agent can manage and utilize them later.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> > Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
> > ---
> > v3
> > * move "per_device_plat_auto" from a earlier patch
> > * fix comments in "scmi_agent_priv"
> > * modify an order of include files in scmi_agent.h
> > v2
> > * check for availability of protocols
> > ---
> > drivers/firmware/scmi/scmi_agent-uclass.c | 101 +++++++++++++++++++++-
> > include/scmi_agent-uclass.h | 15 +++-
> > include/scmi_agent.h | 14 +++
> > 3 files changed, 126 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c
> > index 94e54eeb066b..e823d105a3eb 100644
> > --- a/drivers/firmware/scmi/scmi_agent-uclass.c
> > +++ b/drivers/firmware/scmi/scmi_agent-uclass.c
> > @@ -38,6 +38,86 @@ static const struct error_code scmi_linux_errmap[] = {
> > { .scmi = SCMI_PROTOCOL_ERROR, .errno = -EPROTO, },
> > };
> >
> > +/*
> > + * NOTE: The only one instance should exist according to
> > + * the current specification and device tree bindings.
> > + */
> > +struct udevice *scmi_agent;
> > +
> > +struct udevice *scmi_get_protocol(struct udevice *dev,
> > + enum scmi_std_protocol id)
> > +{
> > + struct scmi_agent_priv *priv;
> > + struct udevice *proto;
> > +
> > + priv = dev_get_uclass_plat(dev);
> > + if (!priv) {
> > + dev_err(dev, "No priv data found\n");
> > + return NULL;
> > + }
> > +
> > + switch (id) {
> > + case SCMI_PROTOCOL_ID_CLOCK:
> > + proto = priv->clock_dev;
> > + break;
> > + case SCMI_PROTOCOL_ID_RESET_DOMAIN:
> > + proto = priv->resetdom_dev;
> > + break;
> > + case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
> > + proto = priv->voltagedom_dev;
> > + break;
> > + default:
> > + dev_err(dev, "Protocol not supported\n");
> > + proto = NULL;
> > + break;
> > + }
> > + if (proto && device_probe(proto))
> > + dev_err(dev, "Probe failed\n");
> > +
> > + return proto;
> > +}
> > +
> > +/**
> > + * scmi_add_protocol - add protocol to agent
> > + * @dev: SCMI agent device
> > + * @proto_id: SCMI protocol ID
> > + * @proto: SCMI protocol device
> > + *
> > + * Associate the protocol instance, @proto, to the agent, @dev,
> > + * for later use.
> > + *
> > + * Return: 0 on success, error code otherwise
> > + */
> > +static int scmi_add_protocol(struct udevice *dev,
> > + enum scmi_std_protocol proto_id,
> > + struct udevice *proto)
> > +{
> > + struct scmi_agent_priv *priv;
> > +
> > + priv = dev_get_uclass_plat(dev);
> > + if (!priv) {
> > + dev_err(dev, "No priv data found\n");
> > + return -ENODEV;
> > + }
> > +
> > + switch (proto_id) {
> > + case SCMI_PROTOCOL_ID_CLOCK:
> > + priv->clock_dev = proto;
> > + break;
> > + case SCMI_PROTOCOL_ID_RESET_DOMAIN:
> > + priv->resetdom_dev = proto;
> > + break;
> > + case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
> > + priv->voltagedom_dev = proto;
> > + break;
> > + default:
> > + dev_err(dev, "Protocol not supported\n");
> > + return -EPROTO;
> > + }
> > +
> > + return 0;
> > +}
> > +
> > int scmi_to_linux_errno(s32 scmi_code)
> > {
> > int n;
> > @@ -164,12 +244,14 @@ int devm_scmi_process_msg(struct udevice *dev, struct scmi_msg *msg)
> > */
> > static int scmi_bind_protocols(struct udevice *dev)
> > {
> > + struct udevice *agent;
>
> nit: my build reported 'agent' here is not used in the scope of this patch.
> Strictly speaking, it should be brought by patch v3 05/13.
> ("firmware: scmi: install base protocol to SCMI agent")
You're right.
I will move this variable declaration to patch#5.
-Takahiro Akashi
> BR,
> etienne
>
> > (snip)
next prev parent reply other threads:[~2023-09-11 6:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 2:51 [PATCH v3 00/13] firmware: scmi: add SCMI base protocol support AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 01/13] scmi: refactor the code to hide a channel from devices AKASHI Takahiro
2023-09-08 14:01 ` Etienne CARRIERE
2023-09-11 6:43 ` AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 02/13] firmware: scmi: implement SCMI base protocol AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 03/13] firmware: scmi: move scmi_bind_protocols() backward AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 04/13] firmware: scmi: framework for installing additional protocols AKASHI Takahiro
2023-09-08 14:01 ` Etienne CARRIERE
2023-09-11 6:56 ` AKASHI Takahiro [this message]
2023-09-08 2:51 ` [PATCH v3 05/13] firmware: scmi: install base protocol to SCMI agent AKASHI Takahiro
2023-09-08 14:02 ` Etienne CARRIERE
2023-09-11 7:07 ` AKASHI Takahiro
2023-09-08 14:19 ` Etienne CARRIERE
2023-09-12 5:18 ` AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 06/13] firmware: scmi: add a check against availability of protocols AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 07/13] sandbox: remove SCMI base node definition from test.dts AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 08/13] firmware: scmi: fake base protocol commands on sandbox AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 09/13] test: dm: simplify SCMI unit test " AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 10/13] test: dm: add SCMI base protocol test AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 11/13] cmd: add scmi command for SCMI firmware AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 12/13] doc: cmd: add documentation for scmi AKASHI Takahiro
2023-09-08 2:51 ` [PATCH v3 13/13] test: dm: add scmi command test AKASHI Takahiro
2023-09-08 14:27 ` Etienne CARRIERE
2023-09-11 7:22 ` AKASHI Takahiro
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=ZP66FEs/M1taoEMK@octopus \
--to=takahiro.akashi@linaro.org \
--cc=etienne.carriere@foss.st.com \
--cc=etienne.carriere@st.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.