From patchwork Wed Jun 26 06:58:39 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: 13712347 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 60F3EC27C4F for ; Wed, 26 Jun 2024 07:04:18 +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=vXwT7pcoPs4gUA7C/cu1HMPajA9byoLEk5jLA8tUv7Y=; b=zt+mPbe9q0vvsOnZ6oPoWKdBMG MrUZBQ/NJj6SCxlrEtMfbzLMnz6f6D1/1VZGHbHNSRMY8ifUo8QTdaKHs0fw1FUMeOh4TKF1TaaeW U0/FSwT4+EG2ctkQi1jV7ReCWpKj62vYvVds/y0olS9kCCVOH8CUvFgfCEYaAj7w1KOadMIVMVBk6 vILvkpbzPHuV/tsFH33LfSkKiq9BO4/WENmdv9aU+ST6a6hUHomzGKB/NH57lq3IJOaBnakni4gsr 1ioUGeMd7KXucPd3xhGHTd00eR67ClAFAoALyPHw+cIf0oc3N6VTGkBIEnWhoxgwMz2BPU/3mzkpf JfmC1LXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMMhF-00000005fwE-1Lea; Wed, 26 Jun 2024 07:04:01 +0000 Received: from mail-vi1eur05on20601.outbound.protection.outlook.com ([2a01:111:f403:2613::601] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMMh9-00000005fvA-0EeT for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2024 07:03:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E0rQVld5PZPQlJ/ckaYZjF5T3hyb97BCT/cFyYCsoM1dsilxwbEzdBtYuUwNtJhd6OKm6dFJocP4K27hT1rkl5pXjLy6lqTN/QCo0LAvsrF/Sn8+I9Wgm8ZGIIHSC68tq9vTz9+iIyas95cX9JypFE3pyMNcn6Gp5ApVd1/pY7NnsJO8JPIGDcymoZbSWPW1wsXi4+ajYdhwyvJDws3SS4/CJrXsw26Ew87V3hY9m9b3CI82eFAT25X5lOWddpSMHzQ9RtJYQWCYE9vJIWUYNnGw6JskOInQeIifF/j6BiRGBRhYRbEg7Aw+Y7mm5hlfK1VNJPvvoOcyfPSHvaomdQ== 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=vXwT7pcoPs4gUA7C/cu1HMPajA9byoLEk5jLA8tUv7Y=; b=bFi2eMq8BIM37lWqlk+8kBDa1c7X5ERFWUiY9m2huELRlbWk/WKd8XE2yj+VUY0pBBLTKTQ3fdFXx4Z1dNLVgSixJntVaXcz5Nb+Mgs2yE5dn+5tXRjfDoTGIKsXUL6tDlLoABvdjDGa+k7jeptlyZt8K6L4ELvLlCOO+JB0fLrmQ+/Fx9t0a/SPi9RSDR1ypRScv8SI1uBOCuUgavXSwbAjMpBSjvxr9Go6+zxm289hchZeR6/+ZFJTCyIiM0hZMhhZGywtshTo4esEdi3ZCpK8zVLoMYaPbXwmjGg7Lou0Nc+AekEY0aNScU3HAw2Z9xlbLOjM5qEAXML3vxSvag== 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=vXwT7pcoPs4gUA7C/cu1HMPajA9byoLEk5jLA8tUv7Y=; b=cWxjNMhfbekrQia5tMiBKo707fzH7w/yUcv7rECvsXmwq6ar0++fIezdq8pALDoTeY3AGfBGTYpTU3p/NJDFAvNjFn1DcqkVgQ3pSVePNVJLxGzdzXga8ISR5XoZe+n3wwKvr2bOJjXiuVomou/Lm2dejUaLIG443c/p+EoIye0= 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 PR3PR04MB7449.eurprd04.prod.outlook.com (2603:10a6:102:86::7) 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 06:49:38 +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 06:49:38 +0000 From: "Peng Fan (OSS)" Date: Wed, 26 Jun 2024 14:58:39 +0800 Subject: [PATCH 1/2] firmware: arm_scmi: channel unavailable if no of_node Message-Id: <20240626-scmi-driver-v1-1-f16d777e004a@nxp.com> References: <20240626-scmi-driver-v1-0-f16d777e004a@nxp.com> In-Reply-To: <20240626-scmi-driver-v1-0-f16d777e004a@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=1719385128; l=2477; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=RNHjX3icUu5Fa3quGe1D5sfhXIBG5EyoXdwa6hawOCk=; b=g5aclVtPfp6pWAMKhn54fSIHpidP4x6TUuFQI9AUuyXHpSYhGjTyv0A+xhAO9HyJfbQhfjV8J JHT3/Xj/QQXDLCkmj/FjMGsGpPbyWgyrkmfA1XDa06bI5kfHlXBAv4w X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0051.apcprd02.prod.outlook.com (2603:1096:4:1f5::6) 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_|PR3PR04MB7449:EE_ X-MS-Office365-Filtering-Correlation-Id: ee522686-3e92-4abd-c4a3-08dc95ac25dc 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?L4rlDT3nllwqsQO7KCZ2PCtisPO7wxW?= =?utf-8?q?hv99TicVxIGaYkKs1vVj16GDEdo0jDcZjsTED7i2f1BvjLHbA95hvYPWYzDHL2W9F?= =?utf-8?q?/QeKPLp2sY9FDRgsj1qoOf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WoltZUTZ0DO2Gqlc9cjLueMWi6CSiWkiWSlzw?= =?utf-8?q?mWnFIE0cDX9ziZE7Y2HXx0kYkpjJSFXT5gUfC88k2iwN9zNZl3GUjRWHG6KrKW976?= =?utf-8?q?Q+O11Ts77quxRzlgprGkV3Xl0e3P01XIC0zga7IfE7W6Z1zUGUCEkzyYFYLhcoRQ/?= =?utf-8?q?cNLsTMG7rLKO0w3ZdFeQ6fEOvZw0casm7dLZmyurE8kg8X8AYHCknsxMoGuG148aH?= =?utf-8?q?EDC8cDCrVFRYchbE4K82LHWvAHv/5OCp4UImf8Ldbda6JpeWA4Zea6r63cwMcaJS2?= =?utf-8?q?m6skhxC4wBXLtz/dIOKVsxXWJoVxo9Zoqt/EYUakZcIMOzwiN2Dg9I/00WcboDL1O?= =?utf-8?q?uK+Ze0Uu6O/WpJ/sTLIyHbQww4JIn0B6Fw=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?UzzeILAmwHJ7ndArKhVgDJNtx5Xc?= =?utf-8?q?RcLBB0YkjZ7ndjDa+lQxCGk8hf9I0Rm87FSBv1RNoUxVb/5x1OA4M34wWJsQ9SGaC?= =?utf-8?q?RLUkZCBbLxl5yE9Qih4ZIpNH1hTYsyxHzykUqpNjAeJHg+vmcdx8L7e5i48nzGB48?= =?utf-8?q?bZCe0+EvpMLxb9EthWF7VBN0dJBUy+ZbjSLhzY1N4+FRFyjjQlIbg6GjNZ9IDMHXa?= =?utf-8?q?kHyELteuU6GEmyqgWMHi7prBa+y4kQaiEJeEcYaexSI/X14y2n/RWqcRlUIgojCNd?= =?utf-8?q?fIcppm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e3ShGdAuVKN+pD4J6HrfWkTnLLE9lNsDsPaL8QANeM7bSEHAA2TBA+Hm9+?= =?utf-8?q?fB93tgnGMKusK8aEiDIK8ABwhSoCclC3hna7vRrp4U1Y46DSWTLkIsynoLoQ9VmDr?= =?utf-8?q?CiWKN3oRs5DIF0r9rQ7mbWwSfHJ0cbPH6Bm4Fe0SFHDvhvctaczl9c2up9rE8ef5v?= =?utf-8?q?wKMe7QiBxzq0wIOPRogShdU0duWaFTvz0kJSR3/PkS0ml0ThrQe1UVKOnCYhVpuvP?= =?utf-8?q?eaL40Y2Umxfzq8SIp+0AtzVoZYaRrIipLb8iElom9K00wzVjq3YD9kdxbau/aktHZ?= =?utf-8?q?AoqrlTUX5Gwb+vqGmLpLmXChvtWdeHJuXRRmdaFvGrunOpPSyXrNhwLg6o9spzRGe?= =?utf-8?q?QubTRZ4wEWLM?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee522686-3e92-4abd-c4a3-08dc95ac25dc X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5941.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 06:49:38.3499 (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: MANfo4IKdSZFoIahUzy87GRh7LnmklVzBxxnOll/o7+qO8gHADXcREODXeJ11WqlQE/nvc91KZmNhXJeSRbKsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7449 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240626_000355_114533_C21E1AD5 X-CRM114-Status: GOOD ( 11.89 ) 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 If there is no of_node for the protocol, there is no per protocol channel, so return false. Then it will reuse the base protocol channel per `scmi_chan_setup`. Signed-off-by: Peng Fan --- drivers/firmware/arm_scmi/mailbox.c | 2 ++ drivers/firmware/arm_scmi/optee.c | 3 +++ drivers/firmware/arm_scmi/smc.c | 7 ++++++- drivers/firmware/arm_scmi/virtio.c | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c index 0219a12e3209..4f3abc933315 100644 --- a/drivers/firmware/arm_scmi/mailbox.c +++ b/drivers/firmware/arm_scmi/mailbox.c @@ -71,6 +71,8 @@ static bool mailbox_chan_available(struct device_node *of_node, int idx) { int num_mb; + if (!of_node) + return false; /* * Just check if bidirrectional channels are involved, and check the * index accordingly; proper full validation will be made later diff --git a/drivers/firmware/arm_scmi/optee.c b/drivers/firmware/arm_scmi/optee.c index 4e7944b91e38..c0a198baa706 100644 --- a/drivers/firmware/arm_scmi/optee.c +++ b/drivers/firmware/arm_scmi/optee.c @@ -334,6 +334,9 @@ static bool scmi_optee_chan_available(struct device_node *of_node, int idx) { u32 channel_id; + if (!of_node) + return false; + return !of_property_read_u32_index(of_node, "linaro,optee-channel-id", idx, &channel_id); } diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c index 39936e1dd30e..5af1f781fa10 100644 --- a/drivers/firmware/arm_scmi/smc.c +++ b/drivers/firmware/arm_scmi/smc.c @@ -81,7 +81,12 @@ static irqreturn_t smc_msg_done_isr(int irq, void *data) static bool smc_chan_available(struct device_node *of_node, int idx) { - struct device_node *np = of_parse_phandle(of_node, "shmem", 0); + struct device_node *np; + + if (!of_node) + return false; + + np = of_parse_phandle(of_node, "shmem", 0) if (!np) return false; diff --git a/drivers/firmware/arm_scmi/virtio.c b/drivers/firmware/arm_scmi/virtio.c index 4892058445ce..4d8d6ad3ab5b 100644 --- a/drivers/firmware/arm_scmi/virtio.c +++ b/drivers/firmware/arm_scmi/virtio.c @@ -389,6 +389,9 @@ static bool virtio_chan_available(struct device_node *of_node, int idx) { struct scmi_vio_channel *channels, *vioch = NULL; + if (!of_node) + return false; + if (WARN_ON_ONCE(!scmi_vdev)) return false; From patchwork Wed Jun 26 06:58:40 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: 13712348 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 58F48C27C4F for ; Wed, 26 Jun 2024 07:06:04 +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=yfaWCLzA2jLdddaj7QK5X0wpdDcKI+14W2K1MW/wPPM=; b=UpeG1xjB3lDYFxaL7KWos7yKEs vk0SubZMlZCs02JgkXReQbMD8jR7zkhF3vDd8pPP+Jz1MilwahdoJmxdH++TBdzTHdV75ke8XUpqG ZoDARZvS5uf/EtRdRUVwPAZKLTXSdw1MlOU9nbBmTLZ7mGwHyq+uhgQZnvm7jS396cSsyoOrIBk7B nfiAKIg/dV3hNbRUgN9q3wyGIv2z6GjDmQvF85wZX+9MgVn/Ln5ElQ3xkD6IqxlmqeRvaY/6zI6zH iOA8NUHbkAluH/H/8697IHhL0OODcqCC9Mv102lUcQ6k1QqoQ3x3fqKlTC92c44+bNr8GNrAkagBJ VeEQHSdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMMiz-00000005gDA-3Aus; Wed, 26 Jun 2024 07:05:49 +0000 Received: from mail-vi1eur05on20601.outbound.protection.outlook.com ([2a01:111:f403:2613::601] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMMip-00000005gCD-2n1a for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2024 07:05:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JvgfuZizAkqruKWOsKCPj8GLyQQI52retfek5tPMta1z6uRfOZJxlSwQb/0YPphofnqG5Wdzqkk5xgBxTqRyGd8AQDhfmLS42AYPKrO+RhDsE++v2yWcnV3d4kS3yJ25RtvApID5bR0WCbGtmA9VkNZqe4Rer+Lu8ykt+EMU659QIundMRZpTccpvdVIDwn38ZwdJGvOe691qarHXLsF7aYNGn2hUPODQ1j3xdMRZ+Z1R6i86nghHLdn+8HfU+73s28h8YwwdCZ/1ZV6ou8IPHREbEyjSbhZjJxTuqz2VI6dJixNnPwR1YjUM5Iet/73kupplmQIU74V9OuMtPXphg== 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=yfaWCLzA2jLdddaj7QK5X0wpdDcKI+14W2K1MW/wPPM=; b=mCqrBJSRCPRjb+P2G47eaZ73sIA6YW37jXq9s63Hx5qjsGQJPVMgbCULucl5Po3Ub8rStl2nmS6GzXgzESE7OnKiR6frAInfCNqW41m1cOAVpGexX0mPUNzrC91+4+OxTh/uxzD03IlEGIjfARIofInAzzNip3w2oeyXAmxSe2WOgScJysA1p3j3fdHRu19PazMUOn8kNPcSlAknPnUXzbe3y8AtV7NALFCLzix41O3/K1O2PQpiFaUN8SmNWYdDCOfQrxk5hutSwsYnjXmjBqDTwFIRBG4wWzQHmWGb1wAdcolS4ovSVS628N3dquqCv+ig0l5DAzapoKePxpoqzQ== 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=yfaWCLzA2jLdddaj7QK5X0wpdDcKI+14W2K1MW/wPPM=; b=KS75edXI8GHIzkPg/vDwVAGjAiRaoKyhzcXyyfVKsaSquWN7rnfzDp982PCToatoHaC16X36PSs8sfvEUiHa1g9ibAOiVXSu3Inv0ZmkRycGJfstly6QgHJrQayyOxjF6ToT/LxE2QSonP2G7tVDUgLxWnz7Vu8FvAXJnm7YuQs= 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 PR3PR04MB7449.eurprd04.prod.outlook.com (2603:10a6:102:86::7) 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 06:49:41 +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 06:49:41 +0000 From: "Peng Fan (OSS)" Date: Wed, 26 Jun 2024 14:58:40 +0800 Subject: [PATCH 2/2] firmware: arm_scmi: create scmi_devices that not have of_node Message-Id: <20240626-scmi-driver-v1-2-f16d777e004a@nxp.com> References: <20240626-scmi-driver-v1-0-f16d777e004a@nxp.com> In-Reply-To: <20240626-scmi-driver-v1-0-f16d777e004a@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=1719385128; l=2429; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=KX7Kdgf9QfsnuWYcJzLQxwAzaDusfFPpuNBhRr96mX0=; b=ColW6ui3H7Px19Y6qIHqIQNVqLnk4O07qiKCRzu4mobRmXyUKwNr80t8DuTLz67bQdNxOjc+O X310O2vPZT+A5sJvY506fQdC6pfMKkqC+gI+QxU3jLdz2tJSxzGRWv4 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0051.apcprd02.prod.outlook.com (2603:1096:4:1f5::6) 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_|PR3PR04MB7449:EE_ X-MS-Office365-Filtering-Correlation-Id: f0de233c-fe47-47b7-1a3f-08dc95ac27e4 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?uGH69VUP3w4VfRWjwxF4ClALZCPjwz6?= =?utf-8?q?bv7E2ivc6PVl62cbxdivFNozneIAxSc0v0ZOTy1ru5SVfxwIR4Y3Gdv+XUGrxguYU?= =?utf-8?q?TgZpJZx59d19Nx7RTxmH27Y4+mIRDpKmeDVLy8ZRzrlyK7izeTLxgYMgdq1Nx/o+K?= =?utf-8?q?Dfq3ZRv6HbRvUdF90au6uP6LNoyLXhmBDq/nD+i6IpzAEHjHJnk5HbHgp+q0Okggf?= =?utf-8?q?m6HbUEz3usRQD41WWRzblzS4CqVimFogvt04fDPxJ3DngraLCaior+t0hoSZBlYuz?= =?utf-8?q?yZuMoKZQMTWF/7g0TOObsXB2hX0lXWFAXPZPYmPx8u5UezNdrFlGM4+sQ1pzODFn4?= =?utf-8?q?CmBDC4i3lzG9dvxQKXm3KkC9vqgqaEG5abKtwVPJxJ2hkbw3BXR4GWEKK2rwcXu3s?= =?utf-8?q?rMJw9d3kdLU2Shv3uf6Ymz/wl1QjBtiQoIxlV3m0LiJiV0lYPWJXoIKCxTduTUifN?= =?utf-8?q?ut7QzfY1NtZ9tVvP6wNXwOBMmNDkUzl7YypKtGMCdgCXlffvZeNs3aOwMUWkcq2kE?= =?utf-8?q?X8u/HBMPdHn+FF7G9eGdG1m8pE3ZuDvMEH8v2L8MEHxUzyrlcMUQCIKISjPrMvUa1?= =?utf-8?q?CK7bQzdD+MCH8aavKe9OR3s/qaGHBpxScstQEl7M8sc2bZBK3wJJLYz6f2hAUF236?= =?utf-8?q?tWoAkFykA1Os4g2P7j8KpgFhVM889JRK+ravGfWAUAniYd/IKxMx69ATV5z91hxM5?= =?utf-8?q?92u7338LrO0Gj5K1+eEpL0TnxjR0sGi2ZpFUf3xgdkeFmm4bdu8wlZPO+6dQlhyp9?= =?utf-8?q?kXmdUSM7XE2gZJo8GYr4XZ++Z0bsYSAf0sSOMftnEUyMXofOT59AFcqFN8OMUdtji?= =?utf-8?q?Bo5DsrFy7cy+TfUUfBlEqA/FC8tAYPr75qPebKd10DiJXLrzC87v32GIu6DYyJs0J?= =?utf-8?q?mfBP2G1mtcJdaXGhUNJ9pzfLGm+4uyDsEDa8lgoI55NzEp4/S0soe4vckh29+LG8T?= =?utf-8?q?zVQkZpaKjVEbcmuy5zikR9OGFK0pHa+Z2JP4svcWd2/yhDpKd+lmwDnOS5NnLq0tK?= =?utf-8?q?7t9KRYlijprgXCVzS31jpPN29eyqOBLxLU7baLLizl/AdiB6Uc47cNILgyF+JKkrB?= =?utf-8?q?yx/iwe3iPp1SjLRdmncHxWzftLTcqOoUEbN4xO6fKoYp0oMG+H/LvFVwGgHe7yD0I?= =?utf-8?q?XX7DACbk92Er2riM9L4Jq2Ur2plyIDtEMzwSdK0tyDCUbVp8M+xi02geGXifISVy7?= =?utf-8?q?WNn/9UKJ3O5dPkn661H+gjCSlduKHvsFw4z52hocr0DRE0CFgyClDN+15vUL5+DRY?= =?utf-8?q?ateIGHsUhKMcl2TpSSD72+3J2bNyPEAwrfhe7Ij7UuDOIbVT01ODopVULPZQh9GYT?= =?utf-8?q?sxRwdGQoULdcpjZn/JhiOlmi5uuPTxvmPg=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?7LG7aFbEWt9fjPpS0ICuuFzpKKYA?= =?utf-8?q?hpvHQ0ZPhLgHjGDKl6yeVsX25gfYIJ1SDWWShrJ25m4MRrgujWQFDOFeTept8RqAQ?= =?utf-8?q?1xbN5IGrK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+BQF3vqKKDRRfZ9Cg8rm7uIHvUsA2BZqipdf1yjKxvgyMfGm6vQk?= =?utf-8?q?ZzMBaA8SKUD9FyD288aYn+d/0DYAQBWSWx8dlEYA3HuMmSJ49Y27e3jgNtb+l2/RJ?= =?utf-8?q?O1MKYw4ieyO95dHmEHu1wfrLA3KAvEPeEa90+CKhHT+kgAra4mQwE1XF+vIgtMc2K?= =?utf-8?q?cHs/7mlzSkG8bKfFzKLWTjaHgWhUb831VylehEIHZVM6ZvhZ5dpNGpMX0kXqS2orJ?= =?utf-8?q?2eJ8XZMt/P1BFIlAZrGN1KLMUG0sMB2todO9R0MMN0karlyfnP8L5fIbQOaXUt5Ik?= =?utf-8?q?2BXsoaNvM8Zwd85OEb3xWHjDELl7LvT/k6nnJLxfbts99Vm4sfgcOK/hVNeOd0cco?= =?utf-8?q?tkwUEZCw3qGYqOke22We0AuaT9VEJFlaECOgF9+TTCs4t6XX8079CmLmlW0iBD7F+?= =?utf-8?q?1UZ/bghvM+VWk1tDvkhswn31Yg7bj/izHGBrCmFO+ep5zE20SYprVjQr8k08p3TN/?= =?utf-8?q?ObGrc9SW6GgGxdUHCfpjB/n1ZGxHelbDQv8bIVjbk8g9I/EO0FLuqt9AH18fSGg0T?= =?utf-8?q?a/3AIgP75QhD?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0de233c-fe47-47b7-1a3f-08dc95ac27e4 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5941.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 06:49:41.6623 (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: F8fbxM+0+Ihqc6wLT3LajC6enufvtkV/br0BqT26LHsHRD+efHpqExN+DoV578n4vM+MTn1+pZBf3/M18XLpHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7449 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240626_000543_570584_9B171820 X-CRM114-Status: GOOD ( 15.59 ) 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..eac4dab979c2 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 %d not implemented\n", + protocols[i]); + continue; + } + + ret = scmi_txrx_setup(info, NULL, prot_id); + if (ret) { + dev_err(dev, "SCMI protocol %d 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: