From patchwork Tue Jul 21 15:20:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Franck Lenormand (OSS)" X-Patchwork-Id: 11675863 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9047613B1 for ; Tue, 21 Jul 2020 15:22:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6917D2065F for ; Tue, 21 Jul 2020 15:22:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0+GdDVeo"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="k7BJmxtJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6917D2065F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0WguF2g5+A++Ea5e/jDCpPBzivN5HZ18YNEBtqfhubQ=; b=0+GdDVeo/g4+vtXfQymMrONNa WEB04N9nvnggGoJSyzwaPXgeK6kZHziyyVw/m15SKav4x03p6ymbagIqHpcVyPXzUFMrYoo0CUDQN yYQYg2l7atJHtMw+Hh8viKan57ClS6J39zvU6CJI6BX2LPwUfniXqoRcaU6irgy7h44W6y1laliWQ l4QU40TWW//7cU2f2WOK+a7hnez+QNW65SY7e98rUYovESXI4zZw6/cERLD+fbG8eDCe4TDkVQ7Qs ii/vdILk8EZVBSg0mmZcVcF8atwkKQIY1P3V2Kg33W9WDfm4dTYTSiosuiuDLtEbfcTsM80RprVb8 8PzGfOBGA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxu4j-0001m2-Hw; Tue, 21 Jul 2020 15:21:01 +0000 Received: from mail-eopbgr60050.outbound.protection.outlook.com ([40.107.6.50] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxu4T-0001fm-8s for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2020 15:20:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VhJSuvQzAQQwOp0I6qJOjjjiKfQKm1fGLZSJBb/MLf8gDKaIvHjKYSffPlsNNzZYqIeRQbBbWi5zZlxaB/t3JdUI2kBN8tT3G/7s8udfkLtKL8bVl3OqSSgXgjYbDS4m5I9rYAl9Y3ZepJeAZAzkv1s1P2BzPRB+HjzD87oqtJV5DH9tsv+Rgk7mEdgBN9kSz3fK0GiUw7+hjCmRxSwJxwOVbByksdc1r6RW2DRioP0J1y+E628XkwpDAwikOZKUC+Ilf/PNCtziu6Z6K2JUBWgUaxZ1L5tnma3fquJSvuDwEi3sT7H3NsbvS0vvf4ueluHxKwQRBqxruhxAxnP29A== 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-SenderADCheck; bh=Ajs6yQuOneFx93R2iCmlcyF8vfv3RlN+QzGOvp0UJD0=; b=U7gbDc6y8Wb5BQnmW9aEdLAbnOM4j7HHBTtfmOyIlcfmReYjr0rG2RaM/IJp7UZegDz1ClaoL5zOQUMtbo0HpvoEZTBdpEsmt17lIL9JgRbO/k4YPtLGCVGeytFzGRlqTKD4eZgwNjlvfbH/twLQJSVaiog9hKKUtUMOhp4jd5RDVSJfMqh908oeTw3Jd4I0lpxSQsACB1sNYWWhHgtBlz3tedXlid6w8yCOJXEwtN3gf0BVkQT/11IQFuEm9geQV1Pnzvy2Ff8C9lH1WFFQGcIv9WmeiPTHHSMxQ5eJG+CynJi4+hngcvmyV8UW92Wjf5q+q5CO4NEB7YN+iMDLtA== 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=Ajs6yQuOneFx93R2iCmlcyF8vfv3RlN+QzGOvp0UJD0=; b=k7BJmxtJzeo5jQp5Yz8+wDaPxaulIdAidmRQtKz7bv6aqYilSTcdiBLCWCcWWKM41I6/YVTdm5AEQt3/7qmK6/R6BKwALovfYYjIIqHsBi6UO3dA5AEKmaxHIq0Jj0xX1s/CiN3Ol2Rau8dlU7nbwQyKxgjaauRZOwPO2wsY7to= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from AM4PR0401MB2401.eurprd04.prod.outlook.com (2603:10a6:200:47::26) by AM0PR04MB6212.eurprd04.prod.outlook.com (2603:10a6:208:148::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.23; Tue, 21 Jul 2020 15:20:39 +0000 Received: from AM4PR0401MB2401.eurprd04.prod.outlook.com ([fe80::d0eb:f746:90e:44b3]) by AM4PR0401MB2401.eurprd04.prod.outlook.com ([fe80::d0eb:f746:90e:44b3%12]) with mapi id 15.20.3195.026; Tue, 21 Jul 2020 15:20:39 +0000 From: franck.lenormand@oss.nxp.com To: shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Subject: [PATCH v2 2/5] firmware: imx: scu-irq: Add API to retrieve status of IRQ Date: Tue, 21 Jul 2020 17:20:32 +0200 Message-Id: <1595344835-67746-3-git-send-email-franck.lenormand@oss.nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595344835-67746-1-git-send-email-franck.lenormand@oss.nxp.com> References: <1595344835-67746-1-git-send-email-franck.lenormand@oss.nxp.com> X-ClientProxiedBy: AM0PR10CA0100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::17) To AM4PR0401MB2401.eurprd04.prod.outlook.com (2603:10a6:200:47::26) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from SOPDPUATS05.ea.freescale.net (81.1.10.98) by AM0PR10CA0100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3216.21 via Frontend Transport; Tue, 21 Jul 2020 15:20:38 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [81.1.10.98] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: affcb39f-3f6d-4aae-65f8-08d82d89a029 X-MS-TrafficTypeDiagnostic: AM0PR04MB6212: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:363; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AJMoTBcjdzis6JnQ57yk4xdFZDbfao2BVwEUyuuNG3YMWvN3YopxUVzYZqO4yNocGs+ORKNuyr2C5RnTT8sD6x36DtC6R/NkKoeda2KHE/lkzbKHNIquyNsWq80R5fx2aWSz0WpEzkUuexyWT09zn47Tb19JasCxk50O4KaB9nYzVXDBthDibWCi1yb3CgXEkajSqIBa9pku1+SpvJor/g9b2s5ta5JZquqhMWMNe/MQD4UAPRcCVObuKg7nuS1d0i3u4T4V0toqMP37SVrcdksJ96y1wx/gCDk6bQkzNDc0h6MpeFIRhgpvyHkRRuO1h2TK7PteDnOh038GT4QvnQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM4PR0401MB2401.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(396003)(346002)(366004)(136003)(39840400004)(2906002)(8936002)(8676002)(86362001)(66476007)(66556008)(316002)(6506007)(66946007)(52116002)(186003)(26005)(6486002)(4326008)(2616005)(956004)(6666004)(9686003)(6512007)(478600001)(83380400001)(16526019)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: PzY/h5EZjQS8TFX4SxQR1SoUhOsVGbrq6ubY+SWG9mGHIgB2HRA2MtPlGuHJS1ksosecGqmeyjdEj7O/9NYAf+qW4aRi+8F5gEaCROSnzxbD2E7VV/NGEzT6JQ/xe7SIK1w2BzIzK7FJrov+i+csIJw3/LMpTVC6Dh4S/qWcV9I0SE4hCm7PL6uwo94k3/BOsV1qhmuiOz4TA96dXt47kPq+wlWh83QSEpy21zVL8KpTA1LqlqI1lHnXj8T/db6rYTX6yYgQddxBJpaGCzEmIqDvu0N0bQHmvge+fWX/H34kcJbDNHcMbFe5lWc9iuw+ZnV96hzUv1zat0idIEYRa4Ud7sADinpcYYp6d5e7++N/k2FOV7GgUVSo2BD6XrjYErHnEKTcgcKEYGZETF6kL2GXDFxXIPiEXGhOmLgAhgZYkAxnrSjsVxugCxwgTwEssZP9rr6PB4HFOwvHbYvsTkMWza5FfrKJB9BYIJce4X4= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: affcb39f-3f6d-4aae-65f8-08d82d89a029 X-MS-Exchange-CrossTenant-AuthSource: AM4PR0401MB2401.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2020 15:20:39.5871 (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: UeguVWufMgbJa3wKl3CSeJwZQgKu8ZhQKiK0okKne65HwdmkC16vFmdESJkS33vz9IDHEuNfzyVaybqcSHSgA7IojKlaJBAgEVR99frihrA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6212 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_112045_408750_5DBE3850 X-CRM114-Status: GOOD ( 16.37 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [40.107.6.50 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.6.50 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aisheng.dong@nxp.com, peng.fan@nxp.com, leonard.crestez@nxp.com, abel.vesa@nxp.com, Anson.Huang@nxp.com, linux-kernel@vger.kernel.org, linux@rempel-privat.de, linux-imx@nxp.com, kernel@pengutronix.de, qiangqing.zhang@nxp.com, franck.lenormand@oss.nxp.com, daniel.baluta@nxp.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Franck LENORMAND This patch adds the API to retrieve the status of an IRQ. It also adds values used to process SECVIO IRQ from the SCU. Signed-off-by: Franck LENORMAND --- drivers/firmware/imx/imx-scu-irq.c | 37 ++++++++++++++++++++++++++++++++++++- include/linux/firmware/imx/sci.h | 4 ++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/imx/imx-scu-irq.c b/drivers/firmware/imx/imx-scu-irq.c index d9dcc20..d31d600 100644 --- a/drivers/firmware/imx/imx-scu-irq.c +++ b/drivers/firmware/imx/imx-scu-irq.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright 2019 NXP + * Copyright 2019-2020 NXP * * Implementation of the SCU IRQ functions using MU. * @@ -97,6 +97,41 @@ static void imx_scu_irq_work_handler(struct work_struct *work) } } +/** + * imx_scu_irq_get_status() - Get the status of the IRQs of a group + * + * @group: The group of IRQ to retrieve status + * @irq_status: Status of the IRQs retrieved + * + * Return: + * 0 - OK + * < 0 - error. + */ +int imx_scu_irq_get_status(u8 group, u32 *irq_status) +{ + struct imx_sc_msg_irq_get_status msg; + struct imx_sc_rpc_msg *hdr = &msg.hdr; + int ret; + + hdr->ver = IMX_SC_RPC_VERSION; + hdr->svc = IMX_SC_RPC_SVC_IRQ; + hdr->func = IMX_SC_IRQ_FUNC_STATUS; + hdr->size = 2; + + msg.data.req.resource = mu_resource_id; + msg.data.req.group = group; + + ret = imx_scu_call_rpc(imx_sc_irq_ipc_handle, &msg, true); + if (ret) + return ret; + + if (irq_status) + *irq_status = msg.data.resp.status; + + return 0; +} +EXPORT_SYMBOL(imx_scu_irq_get_status); + int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable) { struct imx_sc_msg_irq_enable msg; diff --git a/include/linux/firmware/imx/sci.h b/include/linux/firmware/imx/sci.h index 914dce1..20a16a7 100644 --- a/include/linux/firmware/imx/sci.h +++ b/include/linux/firmware/imx/sci.h @@ -17,9 +17,13 @@ #include #include +#define IMX_SC_IRQ_GROUP_WAKE 3U /* Wakeup interrupts */ +#define IMX_SC_IRQ_SECVIO BIT(6) /* Security violation */ + int imx_scu_enable_general_irq_channel(struct device *dev); int imx_scu_irq_register_notifier(struct notifier_block *nb); int imx_scu_irq_unregister_notifier(struct notifier_block *nb); int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable); int imx_scu_soc_init(struct device *dev); +int imx_scu_irq_get_status(u8 group, u32 *irq_status); #endif /* _SC_SCI_H */