From patchwork Wed Jun 26 08:32:11 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: 13712404 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 34652C30653 for ; Wed, 26 Jun 2024 08:38: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:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rtIACtbITX8rBk+33i9Vg+kIjEAJfifW6x8hGRN3SGs=; b=v9+rG9w5RvIX7s8uJmeHwPwJEe hcQHN3LTwcbZ8jmt3x6KQXTRFCaDNLmmfJ8RYrRHo/d8N8HsLAAJi+q+EVyWaZV/uyBKVORjDphFo OReXIWZo81tjXUMxcNScO1H3jFDt7LML0viyHgIESGWrQKYSkf+6I5HHtlhjaidHz0CBywVnRqxjQ DnG36Xb2JqYAZH7QxbGF4flcki+Wd4hONIAs4KtyTjWR+1cBJM+BS137auYlYZS8xhdURcqG/CkTb BiypGCHO1skWPxkTXEWB3s/NrjlUDijq8MnG7f2IZ0zwy+SKsTRcOBIgMC8DtrxuGdyB4Mfxsr57A XNKBImPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMOAJ-00000005xBZ-2hiF; Wed, 26 Jun 2024 08:38:07 +0000 Received: from mail-vi1eur03on20630.outbound.protection.outlook.com ([2a01:111:f403:260c::630] helo=EUR03-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMOA8-00000005x7N-0pOH for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2024 08:37:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H/HK77+vNiFwJ4npdpMtHArRprBZR6n6BMa4igsMR+MSw4sXr1HHKdW2bZoeZluwTh900fzV6fDQo+nfFLFsB3TVSpnjsA2lYOBLVnIblzO7gJu6HGp7dv7lo9S173R8F6ouURWQI78umHWCu57g2OL+eSZLsgfj7QdeAhXcr+ZQAwlG6FkfiKKQSd9E6pkYPpxqtHF2i0VYzZyqKzA3hfk/BfZpwwXZokqR0+dtViIZn/G89zxFQx99u+oTEoiiB8u2yx3c0mxCRfWFfbYrKNciF81tGTXI9e+PdKFk/DS2RTrpQ/OmtElBIzix3ayXGKNWgKde5a/JGOmyKlHxsQ== 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=rtIACtbITX8rBk+33i9Vg+kIjEAJfifW6x8hGRN3SGs=; b=h/3TTB42Z1bQJapcTVhuMVCIxf88M8XLarWEzv3YcnQhCL9sGtrSWepZy3sewVt6OVG0jL1yICG9M0VCYsnYIcB4M2HtMY1zlwIWF3Z+wFN2XyP/eQ+lYZNRG5ESqyab5Ll5HwV/gx6zWEaWDUEIL6Nx3rDJQbw/PPfh3mqnArWhlSrZo97slkUIL0DcZfJ/MrGCeWz+hgvSs9T/EAXq4xPqGgFmjTSJDgu+hu7x3ILAyQlsX7V/OyO6eMSG4QvuspB4XcwuqxsRlHueMh0jgNxMj+3I0Elmaejv0ZJQPW3Pt5GTome9rcFSrMxRyoXVFamaCBc89ZppeX653AAzqg== 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=rtIACtbITX8rBk+33i9Vg+kIjEAJfifW6x8hGRN3SGs=; b=Q+c+tj4k46TlVKazNp8cjNa/zS6Mk9nswxRDG7lIsUh0I3gzijB360pzu8n7+05tNdefG/28OPtfcDzowCsImw/4wt+4FGwzc9LgKOAF+T/NsFl9MR+m/8BW0sDNz5np6EWZT6GVqaYCuYeKHipDP32LO9T+mcRxGDPTaBsRLMY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AM6PR04MB5941.eurprd04.prod.outlook.com (2603:10a6:20b:9e::16) by VI1PR04MB7165.eurprd04.prod.outlook.com (2603:10a6:800:125::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.30; Wed, 26 Jun 2024 08:23:12 +0000 Received: from AM6PR04MB5941.eurprd04.prod.outlook.com ([fe80::9f4e:b695:f5f0:5256]) by AM6PR04MB5941.eurprd04.prod.outlook.com ([fe80::9f4e:b695:f5f0:5256%4]) with mapi id 15.20.7698.025; Wed, 26 Jun 2024 08:23:12 +0000 From: "Peng Fan (OSS)" Date: Wed, 26 Jun 2024 16:32:11 +0800 Subject: [PATCH v2 2/2] firmware: arm_scmi: create scmi_devices that not have of_node Message-Id: <20240626-scmi-driver-v2-2-8f2f85b87760@nxp.com> References: <20240626-scmi-driver-v2-0-8f2f85b87760@nxp.com> In-Reply-To: <20240626-scmi-driver-v2-0-8f2f85b87760@nxp.com> To: Sudeep Holla , Cristian Marussi Cc: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1719390738; l=2433; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=uIz5E+KxA+WSlZpU5jkPzIV4/vUMnMoR0lxYv9gMsRU=; b=khrM68AbMN+IwacMZCcUSmElW6CyPoHXWhw8/N08MHxBf/+fDaWm5nXhQ5xMQS+1bs9WQ68mz eCJ1CqUd9OeDLBgD/VOSI4QX2RuFIUT8AqlthDGlE1x62PQiS/unGF4 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SGBP274CA0015.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::27) To AM6PR04MB5941.eurprd04.prod.outlook.com (2603:10a6:20b:9e::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB5941:EE_|VI1PR04MB7165:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d08e378-51ad-4aa1-3307-08dc95b9381f X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230038|366014|52116012|376012|1800799022|38350700012; X-Microsoft-Antispam-Message-Info: =?utf-8?q?8D5ABo8NXYJ8dF7zxJdC8EvSHQMmvW0?= =?utf-8?q?+XfZFxK4dUymsMLI//z1ZVj91A/2Ifb+0AZ5wS1xeUAdT+19oVOZpBj4IghkX0kkx?= =?utf-8?q?9c34yEum8ZoI/ArrUOITfMS5Bu4PJG7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vf8tZED8KQfNs8lpA5+v+7EusdnHqDjqIcvqlrNAytL/qV7AYS?= =?utf-8?q?OpfaXvGcoXkPe9vS/ky7AyO0RFtXdgl7B7Krvj5NqqorbZXkfmb4/IXxxgQAcSTAd?= =?utf-8?q?pKrCx6Q58gbPJ+c+B6eYwMoZ0Nd41A9jcmpICdYZZ7pFzxf+ZhsjBZtxG4KKcEP6Z?= =?utf-8?q?eo7kQbXD5n06LxdTRJg6ZkwkSyrS2kwlSX7o/5w+Im7hhefrwjehmmucdKOz9WSaU?= =?utf-8?q?J30lippm8qb7UcnfgVMNkRACe9vqHw7WRu/PFXHcyf9w+SeL6NSGNZzQuEDHcSI0I?= =?utf-8?q?fYSH/3/VIPGcVk3t6Frmn6ZX7MNbeMMVHcDCFPAJI2YcLTCfwBevb5CEiWMC/IHJp?= =?utf-8?q?kNvjO35DBuZ+KVMIjZ1EsXzcrX/ZMF298w=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB5941.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230038)(366014)(52116012)(376012)(1800799022)(38350700012);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?o5FPT0pFzkeHgw4JMzeBYUnts4DX?= =?utf-8?q?7tSlZafQBNIOkCbJCloNxYNsEQfLV4pOGOoXyUeUdXsRkKxi+BUAOvcbDeX+Tm1Gy?= =?utf-8?q?AkYg6t8Aubin0Z5wMApNmsg1qNcRc7hSCAXjeEdx/7Xv1LSOb9E+VhueKdmaozyB4?= =?utf-8?q?Ro8uWZBiA3Ii13vEmrMufHHLHQvGptW2Wm3zT/TQ0zQo15Y15dS9E4hAQqOwZyZVI?= =?utf-8?q?jD4NczylG1ju00UiXQ9ChBYheUkKBx6O3Dj317VutFpYLCS5oucIWcV0xF0rF5USz?= =?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TEd04DT03Cq9cRCaAgpHugdjgSbVM+8uLVy6f4ON6i51FCYsawEqvWl3VJB/tkN3Y?= =?utf-8?q?vgjDAnnow3VieaxcTUMEilVURDGY9N39A/j8kVCDOPYsWeDNHDpkr035RXsd2su11?= =?utf-8?q?WNN9fjY+nIgRyALsW89JkES7smPgMTlvKNu9a6UKUf3P3OfLyHChMNUoJl+9Ft+7e?= =?utf-8?q?2Wb4mBXN7cjLfOsWO5dY64bkuYjdg/fcOGzCMrX/PLbf9vce7vYzTASOx02ud5LFb?= =?utf-8?q?/e7rSkBE5SCaBsVVOzIDgndG0NfzZN8/MHmvaumz7LnBa1h2yjsIPeCk+eJVCrMid?= =?utf-8?q?aj5Lm2/VRNqf2h/zbPvfc5ukrvsizVDFbpP8fiEFJeKqg7DB6gKhlG4k6ueX+9QRW?= =?utf-8?q?VakT0RxKOoVe?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d08e378-51ad-4aa1-3307-08dc95b9381f X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5941.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 08:23:12.3784 (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: UoiO8tMRdWkinBb8OyTUh6aU6xJQ+aCWyMwKdNg48aVtFMENJzr0V0ND4cZu/dCvF0DWPgdMMJJStgELOiS57Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7165 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240626_013756_250487_173F2FC8 X-CRM114-Status: GOOD ( 15.70 ) 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 From: Peng Fan The scmi protocol device tree node is expected to have consumers or per node properties expect `reg`. For System power management protocol, if no per node channel information, no need to add it in device tree, and it will also trigger dtbs_check error "scmi: 'protocol@12' does not match any of the regexes: 'pinctrl-[0-9]+'". To enable system power protocol, need to explictily create the scmi device and bind with protocol driver. Signed-off-by: Peng Fan --- drivers/firmware/arm_scmi/driver.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 6b6957f4743f..44a6e64eb78e 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2952,7 +2952,7 @@ static int scmi_debugfs_raw_mode_setup(struct scmi_info *info) static int scmi_probe(struct platform_device *pdev) { - int ret; + int i, ret; char *err_str = "probe failure\n"; struct scmi_handle *handle; const struct scmi_desc *desc; @@ -2960,6 +2960,7 @@ static int scmi_probe(struct platform_device *pdev) bool coex = IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT_COEX); struct device *dev = &pdev->dev; struct device_node *child, *np = dev->of_node; + uint32_t protocols[] = { SCMI_PROTOCOL_SYSTEM, SCMI_PROTOCOL_POWERCAP }; desc = of_device_get_match_data(dev); if (!desc) @@ -3114,6 +3115,36 @@ static int scmi_probe(struct platform_device *pdev) scmi_create_protocol_devices(child, info, prot_id, NULL); } + /* Create devices that not have a device node */ + for (i = 0; i < ARRAY_SIZE(protocols); i++) { + void *p; + u32 prot_id = protocols[i]; + + p = idr_find(&info->active_protocols, prot_id); + if (p) + continue; + + if (!scmi_is_protocol_implemented(handle, prot_id)) { + dev_info(dev, "SCMI protocol 0x%x not implemented\n", + protocols[i]); + continue; + } + + ret = scmi_txrx_setup(info, NULL, prot_id); + if (ret) { + dev_err(dev, "SCMI protocol 0x%x txrx setup fail(%d)\n", + prot_id, ret); + continue; + } + + ret = idr_alloc(&info->active_protocols, NULL, + prot_id, prot_id + 1, GFP_KERNEL); + if (ret != prot_id) + continue; + + scmi_create_protocol_devices(NULL, info, prot_id, NULL); + } + return 0; notification_exit: