Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp929517lqb; Fri, 15 Mar 2024 10:07:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMYb7xMyP+LVnT16yjIq9MVoqgN6xFg0fmWMldWI/TG3iHacf1I1JHiJnoHre+khHX03o/4+NfZstVQxQxHW9KA3utQlN2c+C9W4O8Fg== X-Google-Smtp-Source: AGHT+IFeURGgOpIcgKyNs7f5q/n555aZEwJaSl78HG4jfsvwJDQLyUyJAY5JA9LQq1945Hm/E+uO X-Received: by 2002:a17:906:b28c:b0:a46:7373:cb25 with SMTP id q12-20020a170906b28c00b00a467373cb25mr1609101ejz.59.1710522447287; Fri, 15 Mar 2024 10:07:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710522447; cv=pass; d=google.com; s=arc-20160816; b=zi3O6JU9IYh6GyLe0nNYcrC99/l9RBNK7bQhbKkDPiZJgS8qx/0HcSZWtISgJVcN88 7kF8/6zumxPWCh/3lvw/voxo6jG3+tSItVNZS2l967eIXJMcP4TylX5//dNtlDz4rDkG U2PqPlKR9fEA8/sj5n6tEHp1DD6KgctmQPXmyad+TOyNwKf/Bz/b6JC+VTZLW8xcPyAc xhu751STRHfRC1MjF5Qg4K6jKyiRpEs6I3hzH9yiLcZFlKJsUrhLzuyKcW4e3hPe4Lbs n3lO+FSPz57g+EPvQY2P/GUaGvIxSSCPHX5bE5sKzlw+Xn/VvE6L8EdZlOAzHxOXeh/L xopg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=K0hahqm2uQk/UUEjtlAIxx9mAOTGcxFBuP80cRIU2ko=; fh=wlAXj1IN4hBIcEudKEXhh1cYZQcIJ7EUBAG1KL/zeZU=; b=fQ4YBkyaJIujayr1p9V6EYqrT/HlSoRoReLjgzrNW+e9ui2sR4omvZA3Qu2lxGyz0x nCtDaQy6SM6BhxoV01wyNpMA++Frv3isHHiUlV+TBa4lTW4pFsLicTDC0E2wiE8I9jpT oeDWIeX9Z6tsLSSw5vVCKDrMGqDXD4wtmUt1SEGnppl1cgUeDAd7SIJZMhVUpV0x1jZ7 vwyOF7HvhjpcagC3J5XjTSlFawVTS9owrl17C0UtY2AE52ESiZfLsMLVgKTzzqjRYxKU ABEXv3fOdOVUfe8Gt82NHN+0JMMUt6g9tHgr9yu8+aTsBIJ+sUTMw5oeX6NGbZKzZcHI zcXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-104686-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104686-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gg15-20020a170906e28f00b00a462fa148ddsi1816931ejb.544.2024.03.15.10.07.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 10:07:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104686-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-104686-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104686-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 059EE1F22632 for ; Fri, 15 Mar 2024 17:07:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69E2E537F8; Fri, 15 Mar 2024 16:58:16 +0000 (UTC) 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: linux-kernel@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