Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp808804ybh; Tue, 21 Jul 2020 08:23:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMRmPqtBwr3pg4IVpRSyDAUgo82OJaK+ypd2smRauF3uVd6s/XTiX8nWR0RxElq8BC8mN5 X-Received: by 2002:a17:906:160f:: with SMTP id m15mr27113856ejd.423.1595345024866; Tue, 21 Jul 2020 08:23:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1595345024; cv=pass; d=google.com; s=arc-20160816; b=s0xrqVusv1N/KTKfvyfzo4dshvk8XmXvRAH55CHPFNDA0ILXL8aLt6tFUCL65emb/b zBodwKP5swSQV11bqSiOeoawglCE/YkK43XnAhtgnXPS/DYS975PhgTKvUa2F9SnSAvS DEoFA1LH6tRPinByxcb7VY4QHGMJirtIMDbcY6cADw3R9SmlbqntKR+boadqeXJIF2vy Pwi+LMbPdmUDDzjm7bPpWzoyqHVeGgCoIr2SXmkkXG11FIHju4cYJA6keikA6t4WFxG5 JvYlaVovzqGR5CpAM0GeqcDUx3PTq6xpj10Jk5xniEd3trO6DwwdBbzJwKsqMcDNbZsv /5jQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Ajs6yQuOneFx93R2iCmlcyF8vfv3RlN+QzGOvp0UJD0=; b=n8q/BzXlD6mr8/bvoUlQSe9870x/WZkxQ+cUUhOtbj6oHKSGwwXY8kmHFwT1C0fcqO ufsNy1Hmu3jbdHY5POodsneHDLuhBpVn2AvDBd1wewH1/iTcWJVdsSUqIq2GW/CXnhq3 wjqfCtLfunYMRKbMKRmgRAXQw+qSWl/NKfB98icQA7eWpp/XvOgjgSU9/cJ1H67wtPmj mg9xEmOn8NswiwPbx/jNCaa52c/ZUuBH6J82KihXhfh2ZmwATZCKuiP2CyhKQpoNsEPa kUFYYCFcargirxj+qp7tI8wbqCjRkknr/7Uhi9ti1NxDic47vc+db91kY3dQEzYK3L0W Cw4A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=k7BJmxtJ; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 60si12939403edp.566.2020.07.21.08.23.22; Tue, 21 Jul 2020 08:23:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=k7BJmxtJ; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730013AbgGUPUt (ORCPT + 99 others); Tue, 21 Jul 2020 11:20:49 -0400 Received: from mail-eopbgr60056.outbound.protection.outlook.com ([40.107.6.56]:28932 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729956AbgGUPUs (ORCPT ); Tue, 21 Jul 2020 11:20:48 -0400 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 Cc: franck.lenormand@oss.nxp.com, kernel@pengutronix.de, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, aisheng.dong@nxp.com, abel.vesa@nxp.com, Anson.Huang@nxp.com, linux@rempel-privat.de, leonard.crestez@nxp.com, daniel.baluta@nxp.com, qiangqing.zhang@nxp.com, peng.fan@nxp.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> Content-Type: text/plain 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 */ -- 2.7.4