From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8100126AF2; Fri, 15 Mar 2024 16:58:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710521895; cv=none; b=PKIdMpFutzSM3kcKYg5nU9VhNoP0sqEDFmbfqq5KAk2KRdUKWV0wlomn0W56w5kzbX+NZNU27DPhZw67Or6ndV7hipcHyBuPXH7DTgERH52+KAfvfVKgsSg6zMScTpO9dZOBFCjvGex7/3Ic/7AuvB8H12prfN36pKjWggaaTzs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710521895; c=relaxed/simple; bh=h+V5x9FH3S78+aNGetznfB0xwt4NshA81QKscITTQ4Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aKkb7i6g9dGbBD74NHGETbn9TQl11Q8Nusbf5b4T2edvFhlIgDwjlSoQJpEncM/pWg5gIjP9z6C4tPC/pR86YV/AD30iEbF5gb/c6hGsCSQT3DHrmn5m3xCz8fzPjY28Sr1wIkQTdACEk9OHp9VZaVdcFzQmuLgoDUvlfR4LT3k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 112C9C15; Fri, 15 Mar 2024 09:58:48 -0700 (PDT) Received: from pluto (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 297643F762; Fri, 15 Mar 2024 09:58:10 -0700 (PDT) Date: Fri, 15 Mar 2024 16:58:07 +0000 From: Cristian Marussi To: "Peng Fan (OSS)" Cc: Sudeep Holla , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Oleksii Moisieiev , Linus Walleij , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, AKASHI Takahiro , Peng Fan Subject: Re: [PATCH v5 3/4] firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support Message-ID: References: <20240314-pinctrl-scmi-v5-0-b19576e557f2@nxp.com> <20240314-pinctrl-scmi-v5-3-b19576e557f2@nxp.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240314-pinctrl-scmi-v5-3-b19576e557f2@nxp.com> On Thu, Mar 14, 2024 at 09:35:20PM +0800, Peng Fan (OSS) wrote: > From: Oleksii Moisieiev > > Add basic implementation of the SCMI v3.2 pincontrol protocol. > > Reviewed-by: Cristian Marussi > Tested-by: Cristian Marussi > Reviewed-by: Linus Walleij > Signed-off-by: Oleksii Moisieiev > Co-developed-by: Peng Fan > Signed-off-by: Peng Fan > --- > drivers/firmware/arm_scmi/Makefile | 1 + > drivers/firmware/arm_scmi/driver.c | 2 + > drivers/firmware/arm_scmi/pinctrl.c | 908 ++++++++++++++++++++++++++++++++++ > drivers/firmware/arm_scmi/protocols.h | 1 + > include/linux/scmi_protocol.h | 75 +++ > 5 files changed, 987 insertions(+) > > diff --git a/drivers/firmware/arm_scmi/Makefile b/drivers/firmware/arm_scmi/Makefile > index a7bc4796519c..8e3874ff1544 100644 > --- a/drivers/firmware/arm_scmi/Makefile > +++ b/drivers/firmware/arm_scmi/Makefile > @@ -11,6 +11,7 @@ scmi-transport-$(CONFIG_ARM_SCMI_HAVE_MSG) += msg.o > scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_VIRTIO) += virtio.o > scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_OPTEE) += optee.o > scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o system.o voltage.o powercap.o > +scmi-protocols-y += pinctrl.o > scmi-module-objs := $(scmi-driver-y) $(scmi-protocols-y) $(scmi-transport-y) > > obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-core.o > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > index 415e6f510057..ac2d4b19727c 100644 > --- a/drivers/firmware/arm_scmi/driver.c > +++ b/drivers/firmware/arm_scmi/driver.c > @@ -3142,6 +3142,7 @@ static int __init scmi_driver_init(void) > scmi_voltage_register(); > scmi_system_register(); > scmi_powercap_register(); > + scmi_pinctrl_register(); > > return platform_driver_register(&scmi_driver); > } > @@ -3159,6 +3160,7 @@ static void __exit scmi_driver_exit(void) > scmi_voltage_unregister(); > scmi_system_unregister(); > scmi_powercap_unregister(); > + scmi_pinctrl_unregister(); > > scmi_transports_exit(); > > diff --git a/drivers/firmware/arm_scmi/pinctrl.c b/drivers/firmware/arm_scmi/pinctrl.c > new file mode 100644 > index 000000000000..0fcfa4269473 > --- /dev/null > +++ b/drivers/firmware/arm_scmi/pinctrl.c > @@ -0,0 +1,908 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * System Control and Management Interface (SCMI) Pinctrl Protocol > + * > + * Copyright (C) 2024 EPAM > + * Copyright 2024 NXP > + */ > + > +#include > +#include > +#include > + > +#include "common.h" > +#include "protocols.h" > + > +/* Updated only after ALL the mandatory features for that version are merged */ > +#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x0 > + > +#define REG_TYPE_BITS GENMASK(9, 8) > +#define REG_CONFIG GENMASK(7, 0) > + > +#define GET_GROUPS_NR(x) le32_get_bits((x), GENMASK(31, 16)) > +#define GET_PINS_NR(x) le32_get_bits((x), GENMASK(15, 0)) > +#define GET_FUNCTIONS_NR(x) le32_get_bits((x), GENMASK(15, 0)) > + > +#define EXT_NAME_FLAG(x) le32_get_bits((x), BIT(31)) > +#define NUM_ELEMS(x) le32_get_bits((x), GENMASK(15, 0)) > + > +#define REMAINING(x) le32_get_bits((x), GENMASK(31, 16)) > +#define RETURNED(x) le32_get_bits((x), GENMASK(11, 0)) > + > +enum scmi_pinctrl_protocol_cmd { > + PINCTRL_ATTRIBUTES = 0x3, > + PINCTRL_LIST_ASSOCIATIONS = 0x4, > + PINCTRL_CONFIG_GET = 0x5, > + PINCTRL_CONFIG_SET = 0x6, These are now PINCTRL_SETTINGS_GET and PINCTRL_SETTINGS_CONFIGURE with a bit of different payload and size....please also fix and rename the related msg descriptos down below. > + PINCTRL_FUNCTION_SELECT = 0x7, > + PINCTRL_REQUEST = 0x8, > + PINCTRL_RELEASE = 0x9, > + PINCTRL_NAME_GET = 0xa, > + PINCTRL_SET_PERMISSIONS = 0xb > +}; > + > +struct scmi_msg_conf_set { > + __le32 identifier; new field: __le32 function_id; > + __le32 attributes; > + __le32 configs[]; > +}; > + > +struct scmi_msg_conf_get { > + __le32 identifier; > + __le32 attributes; > +}; > + > +struct scmi_resp_conf_get { new field __le32 function_selected; > + __le32 num_configs; > + __le32 configs[]; > +}; > + Thanks, Cristian