linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>
To: Cristian Marussi <cristian.marussi@arm.com>
Cc: "sudeep.holla@arm.com" <sudeep.holla@arm.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"michal.simek@amd.com" <michal.simek@amd.com>,
	"vincent.guittot@linaro.org" <vincent.guittot@linaro.org>,
	"souvik.chakravarty@arm.com" <souvik.chakravarty@arm.com>
Subject: Re: [RFC v1 1/2] scmi: Introduce pinctrl SCMI protocol driver
Date: Thu, 20 Apr 2023 17:23:05 +0000	[thread overview]
Message-ID: <e2c3eae9-4c99-43fe-abcf-4f1840c58c64@epam.com> (raw)
In-Reply-To: <ZEFw0TYs3TEHuM1D@pluto>

Hi Cristian,

On 20.04.23 20:05, Cristian Marussi wrote:
> On Wed, Apr 12, 2023 at 11:04:05PM +0100, Cristian Marussi wrote:
>> On Fri, Apr 07, 2023 at 10:18:27AM +0000, Oleksii Moisieiev wrote:
>>> Implementation of the SCMI client driver, which implements
>>> PINCTRL_PROTOCOL. This protocol has ID 19 and is described
>>> in the latest DEN0056 document.
>> Hi,
>>
> Hi Oleksii,
>
> one more thing that I missed in my previous review down below.
>
>>> This protocol is part of the feature that was designed to
>>> separate the pinctrl subsystem from the SCP firmware.
>>> The idea is to separate communication of the pin control
>>> subsystem with the hardware to SCP firmware
>>> (or a similar system, such as ATF), which provides an interface
>>> to give the OS ability to control the hardware through SCMI protocol.
>>> This is a generic driver that implements SCMI protocol,
>>> independent of the platform type.
>>>
>>> DEN0056 document:
>>> https://urldefense.com/v3/__https://developer.arm.com/documentation/den0056/latest__;!!GF_29dbcQIUBPA!0kMLQ5c3tKsMfWCqTKHp6eolY3sTZlyKmAD7B7pbiSESABUUoBzmhgrYdDgWGC_g0vgLE4zwrS4ppeTOD8KizP9fIeJkpg$ [developer[.]arm[.]com]
>>>
> [snip]
>
>>> +static int scmi_pinctrl_request_config(const struct scmi_handle *handle,
>>> +				       u32 selector,
>>> +				       enum scmi_pinctrl_selector_type type,
>>> +				       u32 *config)
>>> +{
>>> +	struct scmi_xfer *t;
>>> +	struct scmi_conf_tx *tx;
>>> +	__le32 *packed_config;
>>> +	u32 attributes = 0;
>>> +	int ret;
>>> +
>>> +	if (!handle || !config || type == FUNCTION_TYPE)
>>> +		return -EINVAL;
>>> +
>>> +	ret = scmi_pinctrl_validate_id(handle, selector, type);
>>> +	if (ret)
>>> +		return ret;
>>> +
>>> +	ret = scmi_xfer_get_init(handle, PINCTRL_CONFIG_GET,
>>> +				 SCMI_PROTOCOL_PINCTRL,
>>> +				 sizeof(*tx), sizeof(*packed_config), &t);
>>> +	if (ret)
>>> +		return ret;
>>> +
>>> +	tx = t->tx.buf;
>>> +	packed_config = t->rx.buf;
>>> +	tx->identifier = cpu_to_le32(selector);
>>> +	attributes = SET_TYPE_BITS(attributes, type);
>>> +	attributes = SET_CONFIG(attributes, *config);
>>> +
> Looking at scmi_conf_tx and these pinctrl get/set functions, you do not
> seem to consider the ConfigType field in the SCMI related messages, so
> basically using always the Default 0 Type, and as a consequence you dont
> either expose any way to choose a Different type in the related SCMI
> protocol ops; I imagine this is because the pinctrl driver currently using
> this protocol, at the end, does not need any of the other available types
> (as in Table 23 of the spec).
>
I'm not sure I've understood your point. Pinctrl subsystem pass config 
in so-called Packed format. So this means that config is both input and 
output parameter. Packed format means that u32 config has both config id 
and config value packed inside.

So I receive packed config with both id and value on config_set call and 
then just send it over SCMI, expecting error from server if config is 
invalid. On config_get call I receive config parameter with only id 
packed inside, them pass it to the server and receive packed_config with 
both id and value, which is ready to be returned to the subsystem.

> This is fine for pinctrl driver as it is now, BUT the SCMI pinctrl
> protocol implementation in the core SCMI stack and its related
> protocol_operations as exposed in scmi_protocol.h should be generic
> enough to serve any possible user of the SCMI pinctrl protocol (and there
> is already a request to extend/amend the spec somehow to send multiple pin
> setup of different types in one go as you may have seen), so I'd say it's
> better if you add also a ConfigType param to the get/set_config scmi_pinctrl_ops
> and expose the whole ConfigType enums (Table23) in scmi_protocol.h (like we do for
> sensor classes on scmi_protocol.h) to address this; the pinctrl driver
> can then anyway call such new protocol_ops with a Default type, but at
> least the SCMI protocol_ops interface will remain generic and could be
> reused iin other scenarios.
>
> This is equally true for all the other protocol messages (should I have
> miss something else for now...I'll review again you next V2 anyway).
>
> Thanks,
> Cristian
>

  reply	other threads:[~2023-04-20 17:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07 10:18 [RFC v1 0/2] Introducing generic SCMI pinctrl driver implementation Oleksii Moisieiev
2023-04-07 10:18 ` [RFC v1 2/2] pinctrl: Implementation of the generic scmi-pinctrl driver Oleksii Moisieiev
2023-04-07 10:18 ` [RFC v1 1/2] scmi: Introduce pinctrl SCMI protocol driver Oleksii Moisieiev
2023-04-12 22:04   ` Cristian Marussi
2023-04-17  2:55     ` Peng Fan
2023-04-21  8:40       ` Oleksii Moisieiev
2023-04-21  9:28         ` Linus Walleij
2023-04-21  9:47           ` Cristian Marussi
2023-04-21  9:53             ` Oleksii Moisieiev
2023-04-21  9:30         ` Cristian Marussi
2023-04-21  9:48           ` Oleksii Moisieiev
2023-04-21  9:54             ` Cristian Marussi
2023-04-24  2:12             ` Peng Fan
2023-04-24  1:52         ` Peng Fan
2023-04-24 10:33           ` Oleksii Moisieiev
2023-04-25  2:13             ` Peng Fan
2023-04-25  7:22               ` Oleksii Moisieiev
2023-04-20 17:05     ` Cristian Marussi
2023-04-20 17:23       ` Oleksii Moisieiev [this message]
2023-04-20 18:47         ` Cristian Marussi
2023-04-21  7:54           ` Oleksii Moisieiev
     [not found]     ` <71f48fcf-db04-b09f-2ab2-95e6562c8359@epam.com>
2023-04-26 11:19       ` Cristian Marussi
2023-04-26 13:28         ` Oleksii Moisieiev
2023-04-11 12:27 ` [RFC v1 0/2] Introducing generic SCMI pinctrl driver implementation Linus Walleij
2023-04-11 13:25   ` Sudeep Holla
2023-04-12 18:44 ` Cristian Marussi
2023-04-26 12:06 ` Michal Simek

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=e2c3eae9-4c99-43fe-abcf-4f1840c58c64@epam.com \
    --to=oleksii_moisieiev@epam.com \
    --cc=cristian.marussi@arm.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=souvik.chakravarty@arm.com \
    --cc=sudeep.holla@arm.com \
    --cc=vincent.guittot@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).