From patchwork Tue Aug 8 18:25:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Moisieiev X-Patchwork-Id: 13346733 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 A2A94C04E69 for ; Tue, 8 Aug 2023 18:26:29 +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=qc85Q87sm+llF6MVNkltD7Z0vLnNbCHL+BPMCdj4Yzs=; b=AGNfnI0XavLbHj 4pDt7MaZHkQWltEwWEA1hNyL/ogz4ZjucuwmQA5IA++7jbwLxfJMcgJxmKH+8kRsGqhR7e/j9dH5s IhkDiYyFCHQC5QkVyYw8fPdT1YUPSmEj+2BA6psLJ0+YixjRzqyDSugaXq+u2+BwyN7NlDPxXWNEM cgElFMHCDRSJofsvplXjTk6xWy45QVi7FDfv4icNTigtpOjvIooJeNJjsVI6jX63NQ/+2jUM/bXfu mXtWQotKk6MB65lgFEIBYK4qrb5V2nnWykoNvXbLuJVuYweUkRjB/lykfym39LSsIz2bvBLHwi9kq YIY4TPLjZ+mrFhqBIosQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTRP6-003Dkz-30; Tue, 08 Aug 2023 18:26:00 +0000 Received: from mx0b-0039f301.pphosted.com ([148.163.137.242]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTRP0-003Diy-1n for linux-arm-kernel@lists.infradead.org; Tue, 08 Aug 2023 18:25:57 +0000 Received: from pps.filterd (m0174683.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 378E6eOx003021; Tue, 8 Aug 2023 18:25:40 GMT Received: from eur01-ve1-obe.outbound.protection.outlook.com (mail-ve1eur01lp2057.outbound.protection.outlook.com [104.47.1.57]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3sbpek1ayb-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Aug 2023 18:25:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VB+UT3jkHqur7UgD2/mHA2jlK3mskdpnq8MN99nECYkE5+0uUEE+dIQ7h0t2R9Ii0Xi1AUknpUwB6UqRLnm8rfSK7ZdWMWXfdJ5wNzn0Km59+wjq/qOX4m8WOqbUve66GdwVVvZ8Y3B0lTVed5N4PTAmXCSYkl04THp28F5I4Lu3ReX7Cqd8LzM8X5364kWB1qRdupPrL+31Dunsd5OxePejTQGC5Uk01+a1vjKOTtG8F0jSOQ4lHeACL30c9R95DyqQ20jyRByehUrCiLSLDAc2iKWxLWgwQ2BUcpZzDICPa775INfYgM4A+oec3VWSZjdd92egWQb5pHcItiWmew== 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=OMfte9DhB08hbs2PmBiEDR00GZEeLX85flz/q2FrBY0=; b=SGNbvW5ATS+SYPLOMgSWxIyMK+GJCWufJFPLz6RkKLylLUGRnA1t4yrWg7wQZhfAcTxdHO/VnslDugQUVi7txXwnCrRjSLvsAzzpf1vcI5JxKKeEWDnj1itM88L/WTqGt0mjMWwvEw/h0lpAaM13zgm5hPeNLdhBlpLubMwWuC8cmrFS41uFDkbyapkTt3/c/VkabYuybNUrjSSkPa7ZeYX5Bqe/EUMuMaDph4Wpqc0dGIffEl4qifie20L8FUlbwMeLYON0Knr9shA8SMQndctNTFaVyZs+ZGL45bQ/SjipFpTvtOejW1JUd6cxp/xVLDbxHof/0v3eLCStmV4zrA== 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=OMfte9DhB08hbs2PmBiEDR00GZEeLX85flz/q2FrBY0=; b=SRJ7FS/AnM/p0NepImFTh5Gsht71gSUbJUXEHJyXjzzj5IapFmrwuCHT5nNFDJ4ywusKOUxlRK4/hsbz1KZ8s6e2vh27z9cmDIyjakySAIQvYmfmjkBpkJn48ozRGHqt/HXy0bo07+HxlUzFJptFFAg2nmAnIe5Zr4jHd2G9mgN4RlZ5qIXdUFYutyFA13tFFSgqPBcWB/3kxBiDTVNYszUoRz+sbflOOUQ8IVZ/x8sxozc9M9W/ZfKPDPAuLE1JRDicmv2+S2ZA7o/QOmoBrkU01L/kS+FtL79HbJGAnY4HUqUZ3H3ePIQ4epjfqcFDDZI1wSyx63it9xTA1j/iMA== Received: from PA4PR03MB7136.eurprd03.prod.outlook.com (2603:10a6:102:ea::23) by AS4PR03MB8458.eurprd03.prod.outlook.com (2603:10a6:20b:519::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27; Tue, 8 Aug 2023 18:25:35 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::ccb5:5aee:f10d:ab26]) by PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::ccb5:5aee:f10d:ab26%4]) with mapi id 15.20.6652.026; Tue, 8 Aug 2023 18:25:34 +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 v4 0/4] firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support Thread-Topic: [PATCH v4 0/4] firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support Thread-Index: AQHZyiW4JT1gPXk7akOBuyCkkIz0Cw== Date: Tue, 8 Aug 2023 18:25:34 +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_|AS4PR03MB8458:EE_ x-ms-office365-filtering-correlation-id: b0d9789d-62c9-4fdd-68a2-08db983cdb48 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QUGJLazb8+7b5r7EhVbMw5xx0IczQwBvOZCnmeiVWFBUPQxSlqFmEIOxhYr/RMASWeB2D95dzvdGH7SwX5Dr5fPwNV0+w1gDoDSCGV+4N0ctzgSsw85dsUFsrK+/mSV5ZfNzo/GgpKKviq1CrsSw10TATSqzBKtWV2wrpb/qTjs4/sLeCsqUkIoLj++/s/eU83JBxHAjCaClEetTZeduYSNouxSuO06QCB8ZcRFtdWENK0d0W5eWIV5b++f8VedyhajsYd6sJa6jZQn0wWa283tSv6SselH9DqY1nNQYdmGlBvEHxAGfJe7tSl5U0xZQ3lGHYDbm/nJBraz7c+erAn91Z/uB7hw8j5gZ7iDX67CT+KahwxHxBwKW8I+dRICHJCVUxP5BTEeCIAnnIzybs4IKwYnIiiCAkqoa0/HW0g9TZnkX3+keHvHKEgz+jhGuLktKbyiHRzsHteuQJb6/cGMIyjvPlsSoi7CQ6vMc1xGsFaBB1gfciuuNTI6ulyp2FY6Wu7axO0ENx0z2SQF0C/GY7MvM/XwoxbP0stLJhiNiDkbM9X3yIxxfSVAADHhLqup0Mytd0VjE6dzokYHOxNlD2CnjHbvlCrKtJpazVEU= 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)(39860400002)(396003)(376002)(366004)(346002)(136003)(451199021)(1800799003)(186006)(7416002)(38070700005)(8936002)(8676002)(5660300002)(64756008)(4326008)(6916009)(41300700001)(316002)(83380400001)(86362001)(2906002)(6512007)(6486002)(71200400001)(966005)(2616005)(6506007)(26005)(36756003)(76116006)(66476007)(91956017)(66556008)(66946007)(66446008)(478600001)(122000001)(54906003)(38100700002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?tjwQmSLAX5NNgZVRbaTNov1?= =?iso-8859-1?q?SEOusjDmpF4FvZxN8DrID0V3bvaO6Bqwptf72Zan2v+VQcPY0xvXcP0acVPi?= =?iso-8859-1?q?JU/2EKlZnsmR5U9cerOUXoqP1JGEqyZ5CDAr7iS9poNJAiJYofevIqwtYX45?= =?iso-8859-1?q?/osioxg1tIS6PCwtlWgn7K1y2WadhnwMX+E7d/aLny4n/qGqnXrPmPGNgHBb?= =?iso-8859-1?q?arTx6ySTfad606aRfH0FraevZj57k7vxzB/1IkQAQ5l5VfK68DdMkJ+gIoH9?= =?iso-8859-1?q?wMksjH2xnAqMIXqVn1roZ5p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ktnMM?= =?iso-8859-1?q?qYHpU55o3+VDzLYpSr65MGABk5VDfyGzFGwYR2Gmjr6PnAzCuN1RhzNvD7/1?= =?iso-8859-1?q?Ltlbs/pdD0hNrjzydthzJ8qU9K4FyKma3okisTEMHDM/s+ZR2M6r2Q4nj/v/?= =?iso-8859-1?q?hsa1CVYZ5P9Bj0F0yeVCik2P9NtD5+lfiIQqXG0bpmvqdASw+BBETHrjl91u?= =?iso-8859-1?q?efB5nQEaPeq2OADaHuqBpbr6G23w7uxZa3uzYlYzwC/V0+YHlXDcnxjcjRg1?= =?iso-8859-1?q?gMgOOAYOk/iTbd9SOfJu2YoxNOSy/jkJ9fUrSfMkAe/SlF362uEc3i4cQvYr?= =?iso-8859-1?q?M9uu12pBwm4sy2ygu3AY5feDyyjHUrV/lL1BTFltVu5mxz1Rm9D0dsBRrI/m?= =?iso-8859-1?q?M/6Jaj+cVX4Nom2m6T+rYthh1A77VYjPSCGqv6pUcDcXzL3BOItGhxhZx+oA?= =?iso-8859-1?q?E3wQ4q3mJHc2cuATHzLBUOPXFq7+HLBVbDYy5jA=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: b0d9789d-62c9-4fdd-68a2-08db983cdb48 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Aug 2023 18:25:34.7146 (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: Z2EumVU+SVekyF40Hwd2+yEN0pn3gGgdAjqm/ptg0opiffJiYSQlaIUX4RmcJf4GYDTz5pq9gKfNqUIU8CMNlCgZPrjzkS1a/pWqOkZw1L0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR03MB8458 X-Proofpoint-ORIG-GUID: O1GjMCwLO89JzjOUSJ9itAbBLffveSyM X-Proofpoint-GUID: O1GjMCwLO89JzjOUSJ9itAbBLffveSyM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-08_15,2023-08-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=0 clxscore=1015 priorityscore=1501 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308080163 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230808_112554_708812_09F46265 X-CRM114-Status: GOOD ( 20.12 ) 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 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 v3 -> v4: - Fixed MAINTAINERS file description - adjusted pinctrl ops position and callback names - add trailing coma in scmi_protocol list - removed unneeded pi checks - corrected selector check - resource allocation refactoring - scmi_*_info swap params to generate better code - style, add trailing coma in definitions - reworked protocol@19 format in device-tree bindings - ordered config option and object file alphabetically - rephrased PINCTRL_SCMI config description - formatting fixes, removed blank lines after get_drvdata call - code style adjustments - add set_drvdata call - removed goto label - refactoring of the devm resource management - removed pctldev != NULL check - fix parameter name in pinconf-group-get - probe function refactoring - removed unneeded pmx checks 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 --- Cristian Marussi (1): firmware: arm_scmi: Add optional flags to extended names helper Oleksii Moisieiev (3): 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 | 9 +- drivers/firmware/arm_scmi/perf.c | 3 +- drivers/firmware/arm_scmi/pinctrl.c | 791 ++++++++++++++++++ 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 | 442 ++++++++++ include/linux/scmi_protocol.h | 42 + 17 files changed, 1367 insertions(+), 11 deletions(-) create mode 100644 drivers/firmware/arm_scmi/pinctrl.c create mode 100644 drivers/pinctrl/pinctrl-scmi.c