From patchwork Fri Feb 23 01:16:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13568444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06CAFC47DD9 for ; Fri, 23 Feb 2024 01:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:Message-Id:Date: Subject:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=sGQckWVtqO4qD8f5Tuisb5jqrCws9ZAsOq3dPZbo6NM=; b=MX5x5e90ouVMxr /MOc+7K7+sJdYi4HCegKcPXulOo9oCgp9ErpQBDcTgFC66aSXchLlv/8uslZRBSvcqHUEZUOXJBgN 66TgR6wD+RwF3m2mNSaExUCBVm7Z6I1/bwFJrUABwKO5kTj45iNNVv4CU1aYcFgINLMbcJHYmtg4v l4xqYPlBWCozLbQAa8zhytjMFHi8dee98RQg8fuOTV+Z5XsT5xRP/lUBjqLJSuUKIi7yPW9pvFglk 2ZMmaqJSmIZF2e3pwyEOMJSOy/oGZfsC6q7yXvu3UqIWyglBU0uTdnhbRlr3wesBfsKG2OaxWJIVh EJG+bdzSm8tOdMM5Uw6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdK3d-00000007Ivi-3Q7y; Fri, 23 Feb 2024 01:08:57 +0000 Received: from mail-vi1eur04on20600.outbound.protection.outlook.com ([2a01:111:f403:2611::600] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdK3a-00000007IuQ-2et3 for linux-arm-kernel@lists.infradead.org; Fri, 23 Feb 2024 01:08:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FBkoZSrzwdbjclqrnhba8n02j1hKx1qSAy6DgXHJxrUCbt2AF3a3dMv1lhwnZt6+yQgRDykjPpEjD3hmqI348GMCvb+gftrbKOIQsRh3I+3cxsgR2Te2IbnlXYsICIMI6FP8KfhdD5BZ/rlMqj7kmMs3ZNjPUrG25P5E46DbueKY3To/kvGmLeF7ZANQd10boEwf32EJ78RY24/aYFSKyaAjISP+BlwQxhuRtSe4N9vgCkAYyz7XOH6LkzE+TsfkYHCMOm4w0AhxNmcX77n/xKGiQkouNlcSfL8XGd+qPjvk74HvgGAz/iIaWzbNpGOwROh/jwfvW7FRNh38RsGaBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Pc9X5Ef4BsMQeAE5mYloiGCj4ZG5D8rMwgOtMkmGmw8=; b=JX+2dy6cLbcn2iM5Dxr1+HhS9b3QxQ3We+0wI1jUfMSzQCK40SMZrYC3faHN7r7kVaug0i58N/e/LPr9ISNJ6flWRvjxc7Ij1xkwxI+ga35bjK8xl3TQPCJN8Roy4T6U/kPhL7bJsnvrg4smGgRDHo5TmwYOuc4MW20TuRN2Q6PEL5GgZS3uEjpD/cds5CHmYZcbhL7pgIoHkfYSpr4uH5IAidZ4sa9Ar1QFBt78CByef39x60Rcb/DO71rHQKzkaX5k7BPwGYeLzFPNQ7myFIsnCz8PQ+gAbWuzkNA68rsPE8iNazzZyVonBYiNhEvgJQZGKnOYQ55MxLu1zZDpag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Pc9X5Ef4BsMQeAE5mYloiGCj4ZG5D8rMwgOtMkmGmw8=; b=YqcwPi4Ca97rQMtM7lPzclXl8qiUnh6O25/Pxfjod/fk6rkqhXj9rxo5gXm/uOmRR6bPBv+k1LPBQP4FrdgM+RDmTP/WlfmiurVyXtGxMuMtJH2F1XOy3DrkivBIs+g8uXpS4LJzlXOITMx4HEPV1JOn6RCCUmWtcv5hWw94jYY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AS8PR04MB8418.eurprd04.prod.outlook.com (2603:10a6:20b:3fa::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.24; Fri, 23 Feb 2024 01:08:39 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::4ac3:3559:4200:38e1]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::4ac3:3559:4200:38e1%4]) with mapi id 15.20.7292.036; Fri, 23 Feb 2024 01:08:38 +0000 From: "Peng Fan (OSS)" Subject: [PATCH v4 0/4] firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support Date: Fri, 23 Feb 2024 09:16:37 +0800 Message-Id: <20240223-pinctrl-scmi-v4-0-10eb5a379274@nxp.com> X-B4-Tracking: v=1; b=H4sIAPXx12UC/3XMyQrCMBSF4VeRrI1kuOngyvcQF2ma2At2ICmhU vrupgVRCy7Pge+fSbAebSDnw0y8jRiw79KA44GYRnd3S7FOmwgmJBdc0QE7M/oHDaZFCkZVTOb gwGQkkcFbh9OWu97SbjCMvX9u9cjX908ocsooc1YqCxnnLr9003AyfUvWTBRvCowz2FGRqC6ru sh0pXQBv1R+UcF3VCZa1CVUOi9ro4sPXZblBeeI+nccAQAA To: Sudeep Holla , Cristian Marussi , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Oleksii Moisieiev , Linus Walleij , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, AKASHI Takahiro , Peng Fan , Rob Herring X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708651021; l=5069; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=YHkwtVh+esDQfZ1ExIdMXWgwOrS7JqItjZP+s9+y5fg=; b=YQk3XOJaLeMI2sNwSTJqmDYCN/gs4PQye0P7eISVgjV0Znug0oiXYK4SqL065KKo2gkeE1zLF OouBWMiC5x6Arj3cTn9++oy6w0o8IvUuI3B6d6gXrssMSYQYrJ3k7+M X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:4:197::8) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|AS8PR04MB8418:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ced592d-4b3f-4570-a8f7-08dc340bf7c0 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tO/RX9EOvHjZEDfFo2g55/6Eb5rs4KyERrIEFjIF02paoSCyxOF1L1Z4tlz0BLGO5OzFSy8P5x7tme8M5P1nt5dGaiydhCHrL58B1VlGvPqBqisvMsK/qZjkcvv/2/i65DjfPnXQ9VVBXa6tAEUyS7I/J+5av+U3b38sl1Qy4OH+hczfQboYJxH+ErAQulZumsGpFZW5uaAp/vCrDPSDSgzv9+4eTCPDZve50qu1YqK2urO3pbxb+2h3Kp6uiW/AdY8XbW0f6PYgjnpUDWgQiWfhdjacJkw1+zU6d+yrFtO4g04S8Gr6Td5rE9YaNFICEfQz7OFIlU7Zy2RawHi8qJNt3syg1zDNIOgTcARVy+rFvysfcRa37bynWwcrrkc2cqpSptyb7gj9pU/58VKwxVi8tRJfQSi9BA2nCUeN1E/I4iavLdQouJic3NO7XOZQlWACtYX9wr89q5JnMYuWs2o5J1EHZTQtEGc2kQGFPUX4JYCmWLQaEW4n/XEppeH2ZH0mv+gUJnrEHaMAJ04RPhDRQkBllASLjxKPzrCLexeTa5RfZ79mMkoOTGd8AV4dKSOjTTDCcsN2xx5gBh/jek6yTO3cdCEpsF//12aEjCUKS16nn9BF6RDYJNUvYswm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?G9aLWqJCXrmKXCmQpwCxVfVxrFpH?= =?utf-8?q?aR20AjlyzlwLfZHe5gKI9ADUfs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CM8A26mEOlM0/7nQcsljWFI+GNRAAL?= =?utf-8?q?vNnbbFantAMPSsXV8z3mu/+JUMZmbfp8TsXkON2eRmQK1vLkNnWM9/DqG15tSmO5t?= =?utf-8?q?E+xdKsGUcpqtnSWSesv6Ei0XqPnfGvt6NUnZjWnUoWrUZOLIANSimFJwuYqfMa7ml?= =?utf-8?q?FwO6NO7BrX0bFtI9wG20G2HB8k/fPxNPb70lEnVHJLc2CCgvIdQmMF3cETa0yiyKq?= =?utf-8?q?V96wkD3I7BYpVxq/iwzycCnPodCHO8RE8PmECiEwp/yv0jTO7bHQsUaXKiz4gfg7P?= =?utf-8?q?0/3NLzyf6vOvDMNgG37A+YLvwf7yq4WPgQDZeyJc8Bc16ODAofoHqsnOPQm3zGk+W?= =?utf-8?q?9ysKqRWjcpa1OOnPVI2KJXRCpGJxCJN3CthCyEV0L155RSpVTurrCCEEGnygPkVec?= =?utf-8?q?mhGMVEgXgoKziLNORX4qniyzwXseCrD56EfAuIOjrvS9VSRnVvq7AkgtaBGAm8n+G?= =?utf-8?q?saR6p/GP6r2e0D4YhXf6HEU/G/0Jj/bKrmTxDhEKxfyeDKcMTvSUbggLUHoS22sGb?= =?utf-8?q?Wa9BADAXYUXT+lCb/x6QoId8bszKbZyAJD+OKwreOSrP/7h49KXibefzuhpY5XH4b?= =?utf-8?q?EdLAjL/BzZdz?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ced592d-4b3f-4570-a8f7-08dc340bf7c0 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2024 01:08:38.9134 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A1TQHBr4IAUvrOSVzwTbiz5FbPMAcxAwFtZk7I8HH9ZmQyAJTJfyRAcitfROShJLZfxiIVGVeyd2PunumGpoqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8418 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240222_170854_689435_D6BD294F X-CRM114-Status: GOOD ( 16.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patchset is a rework from Oleksii's RFC v5 patchset https://lore.kernel.org/all/cover.1698353854.git.oleksii_moisieiev@epam.com/ This patchset introduces some changes based on RFC v5: - introduce helper get_max_msg_size - support compatible string - iterate the id_table - Support multiple configs in one command - Added i.MX support - Patch 5 firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support is almost same as RFCv5 expect multiple configs support. - Patch 4 the dt-bindings includes compatible string to support i.MX - Rebased on 2023-12-15 linux-next/master If any comments from RFC v5 are missed, I am sorry in advance. This PINCTRL Protocol is following Version 3.2 SCMI Spec Beta release. On ARM-based systems, a separate Cortex-M based System Control Processor (SCP) provides control on pins, as well as with power, clocks, reset controllers. So implement the driver to support such cases. The i.MX95 Example as below: Configuration: The scmi-pinctrl driver can be configured using DT bindings. For example: / { sram0: sram@445b1000 { compatible = "mmio-sram"; reg = <0x0 0x445b1000 0x0 0x400>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x0 0x445b1000 0x400>; scmi_buf0: scmi-sram-section@0 { compatible = "arm,scmi-shmem"; reg = <0x0 0x80>; }; scmi_buf1: scmi-sram-section@80 { compatible = "arm,scmi-shmem"; reg = <0x80 0x80>; }; }; firmware { scmi { compatible = "arm,scmi"; mboxes = <&mu2 5 0>, <&mu2 3 0>, <&mu2 3 1>; shmem = <&scmi_buf0>, <&scmi_buf1>; #address-cells = <1>; #size-cells = <0>; scmi_iomuxc: protocol@19 { compatible = "fsl,imx95-scmi-pinctrl"; reg = <0x19>; }; }; }; }; &scmi_iomuxc { pinctrl_tpm3: tpm3grp { fsl,pins = < IMX95_PAD_GPIO_IO12__TPM3_CH2 0x51e >; }; }; This patchset has been tested on i.MX95-19x19-EVK board. Signed-off-by: Peng Fan --- Changes in v4: - Rebased to next-20240222 - Drop pinctrl-scmi-imx and compatible patches in V3 - Add T-b and R-b collected from v3 - Link to v3: https://lore.kernel.org/r/20240121-pinctrl-scmi-v3-0-8d94ba79dca8@nxp.com Changes in v3: - Add R-b for dt-binding patch - Use 80 chars per line to align with other scmi drivers - Add pinctrl_scmi_alloc_configs pinctrl_scmi_free_configs to replace driver global config_value and config_type array to avoid in parrell access issue. When num_configs is larger than 4, use alloc, else use stack. - Drop the separate MAITAINERS entry for firmware scmi pinctrl - Use enum type, not u8 when referring the scmi or generic pin conf type - Drop scmi_pinctrl_config_get_all which is not used at all for now. - Update copyright year to 2024 - Move the enum scmi_pinctrl_conf_type above pinctrl_proto_ops for consistency - Link to v2: https://lore.kernel.org/r/20240104-pinctrl-scmi-v2-0-a9bd86ab5a84@nxp.com Changes in v2: Added comments, and added R-b for Patch 1 Moved the compatile string and i.MX patch to the end, marked NOT APPLY Patchset based on lore.kernel.org/all/20231221151129.325749-1-cristian.marussi@arm.com/ Addressed the binding doc issue, dropped i.MX content. For the firmware pinctrl scmi driver, addressed the comments from Cristian For the pinctrl scmi driver, addressed comments from Cristian For the i.MX95 OEM stuff, I not have good idea, expect using compatbile string. Maybe the firmware public an protocol attribute to indicate it is VENDOR stuff or NXP use a new protocol id, not 0x19. But I think current pinctrl-scmi.c not able to support OEM config, should we extend it with some method? Anyway if patch 1-4 is good enough, they could be picked up first. Since I am only able to test the patch on i.MX95 which not support geneirc pinconf, only OEM configs are tested in my side. --- Oleksii Moisieiev (1): firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support Peng Fan (3): firmware: arm_scmi: introduce helper get_max_msg_size dt-bindings: firmware: arm,scmi: support pinctrl protocol pinctrl: Implementation of the generic scmi-pinctrl driver .../devicetree/bindings/firmware/arm,scmi.yaml | 50 ++ MAINTAINERS | 1 + drivers/firmware/arm_scmi/Makefile | 1 + drivers/firmware/arm_scmi/driver.c | 17 + drivers/firmware/arm_scmi/pinctrl.c | 908 +++++++++++++++++++++ drivers/firmware/arm_scmi/protocols.h | 3 + drivers/pinctrl/Kconfig | 11 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-scmi.c | 593 ++++++++++++++ include/linux/scmi_protocol.h | 75 ++ 10 files changed, 1660 insertions(+) --- base-commit: e31185ce00a96232308300008db193416ceb9769 change-id: 20231215-pinctrl-scmi-4c5b0374f4c6 Best regards,