From patchwork Tue Jun 6 16:22:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Moisieiev X-Patchwork-Id: 13269439 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 54D68C7EE29 for ; Tue, 6 Jun 2023 16:23:12 +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:Message-ID:Date:Subject:CC :To: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=IebiT6zFttQzJBVcph9+0RRZg6HHawyi8k0c1s3/yOU=; b=JqaNT8onzyn9w2 ax4Junn3w5reQl+yqBeWFBqfDdsCCJWsu5vdcQvwnpBGvA5z0lXLp0HjDwT10mQVQ8gaEW68QF8LS rGG5lsxx6qPyy9Z+DKDuxPCP3eo1b+XfYwth2cT9vpmlwHDv0y7fl6K9bfIIOrfgKEiiiqgg3nuwm 4Rk+jyM4XQhAhd587/apdpk6w+jo8QuHteB3EESRzYmnowHva96/ciFmpWBBm0q3+0ZOJWbA4yCoC GPhF3Jq54DgHj9FXmvQICcfK6t7Zy6vf0eTEjq7RF8NnuhOy3ZY8J6Sq5QJXH4Hl1KDk3u5haYtad u2T2bv7aNiXxeun06wmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6ZSL-002PJf-03; Tue, 06 Jun 2023 16:22:49 +0000 Received: from mx0a-0039f301.pphosted.com ([148.163.133.242]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q6ZSH-002PHO-2t for linux-arm-kernel@lists.infradead.org; Tue, 06 Jun 2023 16:22:47 +0000 Received: from pps.filterd (m0174676.ppops.net [127.0.0.1]) by mx0a-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 356F1eiD030721; Tue, 6 Jun 2023 16:22:32 GMT Received: from eur04-he1-obe.outbound.protection.outlook.com (mail-he1eur04lp2057.outbound.protection.outlook.com [104.47.13.57]) by mx0a-0039f301.pphosted.com (PPS) with ESMTPS id 3r229jsu66-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jun 2023 16:22:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UDFOvp2TChNX8bmqlg40j8WiGQkg77WASrnvks0pOZylGX5t9lmpFiI+fYDxAcmdloyWBaAtroSngMJY1HJJx89JBRQyoFu4hPWdkJowpZU3ulPhcw0QVHzPpMyKmJXwa4oNRnVnVa7c4rIlkEu5vXUssQYCLLriBG9OA4DqzXRpuhl0o6ft7i7ONa3Rg4YvDBMM8chjCEWObyNoqIIf39MKStPJ8yaE0S8gyncEJzMf8Q375ssdCGUHR1AgU4v/AMt2GYz7Quy66iPCGqaJ5fKMWt3RAM+3wVLHLIblpLGVi4CKYuBql57uDQsNnv4956gOU7WBoJpeKv3EHOKNhA== 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=IhKwUeWaEixCcsDny+ro3G7Tt8KymGi3OEteRLsq8tw=; b=hAHxX28Ksq5VH531dU7lbTGeAzAj26B0v3VeRruSsSCjdQLteQxALZHk562di8cIKRZzf0A9WT5JpHa8NGmtC6phzyHPJvgk45MyIsqn4nb7HTXC1U9EIVBJejeZ2Tl8jAnvG3bJ72sGeGZk2HQ1A1o2Y2JkVOucudZQpikklfpcf9zgzLNNvR1LH6M2d6BZ3p9L0lM2i4Goiuq0gxXldYN7QPhmX1Bq/oKuWl4CeExQgMojKmj71K1vCX40dkeHAxo6XlErJNaoLOVWOUghAS3MSJOF3Na44l0raISiiN4xtp89qck9zqijydFAgr2wj3thou76jz4UpXlt2RT3eQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IhKwUeWaEixCcsDny+ro3G7Tt8KymGi3OEteRLsq8tw=; b=nvSJIz+xCS7IMaZ+Uj9ihaovBTKIYc6txpabU9FZBa00NGh7MCOy10iYc9q3S0tDd94FSTyHI4oKaylk8uSFR67Gy7p6HDa1Xec1S7SBnSeYtO2JnPGWY3Y3UWdkMqwnVTw+x74hNj4mO1bz6bQh+pWwM3EiAqUjGdauj8DHc/Y9E2mdCCEWeA5aOMm7oIQMO6+4bsu6K7nNboZlZiKc9UFtbzzbnEJy9EOzqvOjD9j2Ivld3hwENBAmeHmHFtMhBD15wE5Eg/8TgnJN9BNTz3msL8DMCdS7OZQXnCRPy4sVOQyVKfzPphwYalTDGfCXx1oLyEldVkRJS/PVaxhscg== Received: from PA4PR03MB7136.eurprd03.prod.outlook.com (2603:10a6:102:ea::23) by DB4PR03MB8708.eurprd03.prod.outlook.com (2603:10a6:10:380::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 16:22:27 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::528d:e0b6:ecc6:25e5]) by PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::528d:e0b6:ecc6:25e5%4]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 16:22:26 +0000 From: Oleksii Moisieiev To: "sudeep.holla@arm.com" CC: Oleksii Moisieiev , Cristian Marussi , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Linus Walleij , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" Subject: [PATCH v3 0/4] firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support Thread-Topic: [PATCH v3 0/4] firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support Thread-Index: AQHZmJMVbH1082dFzEWEKtwTiutfEw== Date: Tue, 6 Jun 2023 16:22:26 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PA4PR03MB7136:EE_|DB4PR03MB8708:EE_ x-ms-office365-filtering-correlation-id: c5473357-8a86-4ffb-e1c4-08db66aa37ad x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: g+rFgkpSd5EjNYgOl+RIvFyofeq8p6/aGyTDM9WprdAa3Ki2CFgLxppOzh+3DS8+iCwKQZ39IWlozDxGJEr5eijAMMV2b8W4TbJHK2A3jvCtuTrUa/nx8b3E8ZWQJ4+C0rFqI//cz4vN0kdJIwC7MECFE3EMdZaNotnfjgFBjth1nnftsi5DbppAz1WWjiYlz0pQ/tMbsbnON0wXLpIlGoRdyG3BjNzx2VdXFhaC3AYr4DZsv2qs7OW4WCYB9sAVBPVXQe58LmxK9VAgjKCCa2DS08sxg2zFBvCO/YEC1umwVyxH/KlPaowV+qHSnAiVn1qpndsZ0nBvulBulPJVS8xi3+3jK8LTB1simoDjutYyaOerPMaYyw6GZBGMdUUytVfqpYBmX8zkWxYPjlHeNiGdIFx6ZFN19k8Keqfh8EfhqS8/S2qrZD1XJKhLnFFnAVgHHIXDsr6lqcaSXufiHdy2DKx6A4JCyEkXN/m4bLTtfETXjff/4lfbXagEJdlwoiXRGIBne5P1zRgxRCTno7NEaoYdB+fmBZs9RvNJWrlvUSrWehMFWPW61xoUK4ptveDYAgesuW71p3veGvf509BNS7ZEO8YOocv/JNciTT8= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR03MB7136.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(366004)(39860400002)(396003)(346002)(376002)(451199021)(6512007)(6506007)(26005)(2616005)(966005)(83380400001)(186003)(66476007)(66446008)(122000001)(66556008)(66946007)(64756008)(76116006)(2906002)(6486002)(71200400001)(8936002)(38100700002)(7416002)(38070700005)(86362001)(5660300002)(36756003)(54906003)(8676002)(91956017)(478600001)(6916009)(316002)(4326008)(41300700001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?fg7jPNHw85QMLefyLQ/ThFR?= =?iso-8859-1?q?BsGfJZgzDA1FvA7feUAivDmsBUJU7u32YFwkBbm4yIaNM4FBkGeOwR/74M3t?= =?iso-8859-1?q?Defyr0m/zdV15wtTPkfp3mNaoiOlKAYizCs9ugMy8TmrrEJd4ZO51PwNcEgy?= =?iso-8859-1?q?o74hJK2+xQYFnOb2dSyGN6qAB2jrKqsQQ0hkPICFnDh+Dmu1LVuCaTsAM/q+?= =?iso-8859-1?q?PkjFh9ArSi3PQBeAYkcMX2V7axmkwe3Tc5gXXd6aTtmPz9WMyiDdAerD9uBS?= =?iso-8859-1?q?IeBnXmHHcFbSPlC91WnjPvoBR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rAJlan?= =?iso-8859-1?q?lZD8bYfRGuI0wbeqtKF1FaT0CjfL9UXRULkiT4qyhgJsqNFKkkLkwAsElObA?= =?iso-8859-1?q?kd6DjbKRyBPI9K7kdnN+0NY3hN2qMl7WTylI3J/P4v+8hsZ4ssRlkzOqrOqI?= =?iso-8859-1?q?7m3xu8wlnH298qpanrDjVAbD79vSSvhXclKzXoZ6qrpr9seErEtsa3l+VAW9?= =?iso-8859-1?q?ylf6Xz73qpwXntWvnc5gL7flytKOGdVIEKqzSnOiEtH7bufXQp0EyXuogwXW?= =?iso-8859-1?q?dtZMQCRXZ2qgPwyx0eRIOdVHlr3aiAXZ/4hW2DgeXx2kF3LPto0yMAyAW2Jr?= =?iso-8859-1?q?nSHyPcv4qUKhHpLfudz4wcdliARFI6Mkhb4oFAVaojeL7INZoiVjHV/eBJ4n?= =?iso-8859-1?q?QgXeciEClxGa9F0ef7Gc8D8QMWjoV1PonSXvjjN+8moGw34hSktNXqb7bjOV?= =?iso-8859-1?q?h7NKYjCEXOW6XA9XRzivBD/OcSN5CYRo5usL7pQ=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR03MB7136.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5473357-8a86-4ffb-e1c4-08db66aa37ad X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jun 2023 16:22:26.7665 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: UaygiOUzVy05/8O2bc3Bpynx1UNX745EWSgdNz51fbuVLlndroc1I5+BxgWttzLuuQDnk48sGll409EtBhbT/KLWhPDVb44SLlSTAh3Gslc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR03MB8708 X-Proofpoint-GUID: RFMnEgtMefOGSjPO6Et3TNmK4SFe8XD3 X-Proofpoint-ORIG-GUID: RFMnEgtMefOGSjPO6Et3TNmK4SFe8XD3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-06_12,2023-06-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 clxscore=1011 lowpriorityscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306060140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230606_092246_144551_CDA8BBEB X-CRM114-Status: GOOD ( 19.87 ) 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 Patch series is intended to introduce the potential generic driver for pin controls over SCMI protocol, provided in the latest beta version of DEN0056 [0]. 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. In this case, kernel should use one of the possible transports, described in [0] to access SCP and control clocks/power-domains etc. This driver is using SMC transport to communicate with SCP via SCMI protocol and access to the Pin Control Subsystem. The provided driver consists of 2 parts: - firmware/arm_scmi/pinctrl.c - the SCMI pinctrl protocol inmplementation responsible for the communication with SCP firmware. - drivers/pinctrl/pinctrl-scmi.c - pinctrl driver, which is using pinctrl protocol implementation to access all necessary data. Configuration: The scmi-pinctrl driver can be configured using DT bindings. For example: / { cpu_scp_shm: scp-shmem@0x53FF0000 { compatible = "arm,scmi-shmem"; reg = <0x0 0x53FF0000 0x0 0x1000>; }; firmware { scmi { compatible = "arm,scmi-smc"; arm,smc-id = <0x82000002>; shmem = <&cpu_scp_shm>; #address-cells = <1>; #size-cells = <0>; scmi_pinctrl: protocol@19 { reg = <0x18>; #pinctrl-cells = <0>; i2c2_pins: i2c2 { groups = "i2c2_a"; function = "i2c2"; }; }; }; }; }; &pfc { /delete-node/i2c2; }; So basically, it's enough to move pfc subnode, which configures pin group that should work through SCMI protocol to scmi_pinctrl node. The current driver implementation is using generic pinctrl dt_node format. I've tested this driver on the Renesas H3ULCB Kingfisher board with pinctrl driver ported to the Arm-trusted-firmware. Unfortunately, not all hardware was possible to test because the Renesas pinctrl driver has gaps in pins and groups numeration, when Spec [0] requires pins, groups and functions numerations to be 0..n without gaps. Also, sharing link to the ATF pinctrl driver I used for testing: https://github.com/oleksiimoisieiev/arm-trusted-firmware/tree/pinctrl_rcar_m3_up [0] https://developer.arm.com/documentation/den0056/latest --- Changes v2 -> v3: - update get_name calls as suggested by Cristian Marussi - fixing comments - refactoring of the dt_bindings according to the comments Changes v1 -> v2: - rebase patches to the latest kernel version - use protocol helpers in the pinctrl scmi protocol driver implementation - reworked pinctrl_ops. Removed similar calls to simplify the interface - implementation of the .instance_deinit callback to properly clean resources - add description of the pinctrl protocol to the device-tree schema --- Oleksii Moisieiev (4): firmware: arm_scmi: Add optional flags to extended names helper firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support pinctrl: Implementation of the generic scmi-pinctrl driver dt-bindings: firmware: arm,scmi: Add support for pinctrl protocol .../bindings/firmware/arm,scmi.yaml | 53 ++ MAINTAINERS | 7 + drivers/firmware/arm_scmi/Makefile | 2 +- drivers/firmware/arm_scmi/clock.c | 2 +- drivers/firmware/arm_scmi/driver.c | 10 +- drivers/firmware/arm_scmi/perf.c | 3 +- drivers/firmware/arm_scmi/pinctrl.c | 836 ++++++++++++++++++ drivers/firmware/arm_scmi/power.c | 2 +- drivers/firmware/arm_scmi/powercap.c | 2 +- drivers/firmware/arm_scmi/protocols.h | 4 +- drivers/firmware/arm_scmi/reset.c | 3 +- drivers/firmware/arm_scmi/sensors.c | 2 +- drivers/firmware/arm_scmi/voltage.c | 2 +- drivers/pinctrl/Kconfig | 11 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-scmi.c | 554 ++++++++++++ include/linux/scmi_protocol.h | 47 + 17 files changed, 1530 insertions(+), 11 deletions(-) create mode 100644 drivers/firmware/arm_scmi/pinctrl.c create mode 100644 drivers/pinctrl/pinctrl-scmi.c