[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220601112201.15510-9-tinghan.shen@mediatek.com>
Date: Wed, 1 Jun 2022 19:21:54 +0800
From: Tinghan Shen <tinghan.shen@...iatek.com>
To: Bjorn Andersson <bjorn.andersson@...aro.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@...aro.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Lee Jones <lee.jones@...aro.org>,
Benson Leung <bleung@...omium.org>,
Guenter Roeck <groeck@...omium.org>,
Daisuke Nojiri <dnojiri@...omium.org>,
Sebastian Reichel <sebastian.reichel@...labora.com>,
"Dustin L. Howett" <dustin@...ett.net>,
Tzung-Bi Shih <tzungbi@...nel.org>,
Tinghan Shen <tinghan.shen@...iatek.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Prashant Malani <pmalani@...omium.org>,
"Enric Balletbo i Serra" <enric.balletbo@...labora.com>,
Brian Norris <briannorris@...omium.org>
CC: <linux-remoteproc@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <chrome-platform@...ts.linux.dev>,
<Project_Global_Chrome_Upstream_Group@...iatek.com>,
<weishunc@...gle.com>
Subject: [PATCH v1 08/15] remoteproc: mediatek: Add SCP core 1 interrupt support
Reuse the interrupt handling API of SCP core 0 on SCP core 1.
Signed-off-by: Tinghan Shen <tinghan.shen@...iatek.com>
---
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)
--
2.18.0
Powered by blists - more mailing lists