From patchwork Wed Jun 1 11:21:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 12866826 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 8263DC433EF for ; Wed, 1 Jun 2022 11:36:35 +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:References:In-Reply-To: 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: List-Owner; bh=Dtuao6uo4P8wStXhIpFfa2fe9BKhdyfB8FrHMN8G6No=; b=RCTTFxJTi890i9 B7ktngfNKkyEfquFp7EYDO66RF18+3qKxFvCSUYtNTtvhMi2QEVe8L6X3IPx9WpbsgE63AV7brga6 6O0y9m5/EKwj3K43GoiqFORbXaGYKkYdUs7Y/UCIpkHuTVjyGNNBCn7NOZOaBplmMORIFchZYDolJ 3CAXbyQ9yzvo40JKDkm9cWsYHTUX/2btpOLSATDqvMfpqLLHmWBaR06ayKdyv0dMcYKQne/4/3WSs ZFkqlRexOkksNRpWo7G5gKrQbvZSa11mqoKaGlNshjwzInK/FmZXxq6vPD2XM7f5q5FspPqjHPnvE OShUVAZLhukeslPDeMfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwMco-00FeeV-Do; Wed, 01 Jun 2022 11:34:55 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwMaJ-00FdFG-2f; Wed, 01 Jun 2022 11:32:22 +0000 X-UUID: ba67de36c3cf4ba388d15d4fe5b16e82-20220601 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.5,REQID:e42b1290-6368-4d23-9073-4a89c94bbd0e,OB:0,LO B:0,IP:0,URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACT ION:release,TS:-5 X-CID-META: VersionHash:2a19b09,CLOUDID:c2ac8f14-f88c-475e-badf-d9ee54230b8f,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,QS:0,BEC:nil X-UUID: ba67de36c3cf4ba388d15d4fe5b16e82-20220601 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1269172104; Wed, 01 Jun 2022 04:32:09 -0700 Received: from mtkmbs10n1.mediatek.inc (172.21.101.34) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 1 Jun 2022 04:22:07 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 1 Jun 2022 19:22:05 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.3 via Frontend Transport; Wed, 1 Jun 2022 19:22:05 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , Lee Jones , Benson Leung , Guenter Roeck , Daisuke Nojiri , Sebastian Reichel , "Dustin L. Howett" , Tzung-Bi Shih , Tinghan Shen , "Gustavo A. R. Silva" , Prashant Malani , "Enric Balletbo i Serra" , Brian Norris CC: , , , , , , , Subject: [PATCH v1 08/15] remoteproc: mediatek: Add SCP core 1 interrupt support Date: Wed, 1 Jun 2022 19:21:54 +0800 Message-ID: <20220601112201.15510-9-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220601112201.15510-1-tinghan.shen@mediatek.com> References: <20220601112201.15510-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220601_043219_259293_B4BEB5C7 X-CRM114-Status: GOOD ( 17.53 ) 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 Reuse the interrupt handling API of SCP core 0 on SCP core 1. Signed-off-by: Tinghan Shen --- drivers/remoteproc/mtk_common.h | 1 + drivers/remoteproc/mtk_scp.c | 3 ++- drivers/remoteproc/mtk_scp_dual.c | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index da3ea2243678..04f7ee590f96 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -170,4 +170,5 @@ void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem); int scp_parse_fw(struct rproc *rproc, const struct firmware *fw); int scp_map_memory_region(struct mtk_scp *scp); void scp_unmap_memory_region(struct mtk_scp *scp); +irqreturn_t scp_irq_handler(int irq, void *priv); #endif diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 75d161da0f59..c67883c28a43 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -237,7 +237,7 @@ static void mt8195_scp_irq_handler(struct mtk_scp *scp) } } -static irqreturn_t scp_irq_handler(int irq, void *priv) +irqreturn_t scp_irq_handler(int irq, void *priv) { struct mtk_scp *scp = priv; int ret; @@ -254,6 +254,7 @@ static irqreturn_t scp_irq_handler(int irq, void *priv) return IRQ_HANDLED; } +EXPORT_SYMBOL_GPL(scp_irq_handler); static int scp_elf_load_segments(struct rproc *rproc, const struct firmware *fw) { diff --git a/drivers/remoteproc/mtk_scp_dual.c b/drivers/remoteproc/mtk_scp_dual.c index 0f932d26f864..7bed39722bd5 100644 --- a/drivers/remoteproc/mtk_scp_dual.c +++ b/drivers/remoteproc/mtk_scp_dual.c @@ -71,7 +71,24 @@ static int scp_dual_probe(struct platform_device *pdev) init_waitqueue_head(&scp->run.wq); init_waitqueue_head(&scp->ack_wq); + ret = devm_request_threaded_irq(dev, platform_get_irq(pdev, 0), NULL, + scp_irq_handler, IRQF_ONESHOT, + pdev->name, scp); + + if (ret) { + dev_err(dev, "failed to request irq\n"); + goto release_dev_mem; + } + return 0; + +release_dev_mem: + scp_unmap_memory_region(scp); + for (i = 0; i < SCP_IPI_MAX; i++) + mutex_destroy(&scp->ipi_desc[i].lock); + mutex_destroy(&scp->send_lock); + + return ret; } static int scp_dual_remove(struct platform_device *pdev)