[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180525035855.32649-2-songxiaowei@hisilicon.com>
Date: Fri, 25 May 2018 11:58:55 +0800
From: Xiaowei Song <songxiaowei@...ilicon.com>
To: <wangbinghui@...ilicon.com>, <bhelgaas@...gle.com>,
<xuwei5@...wei.com>, <robh+dt@...nel.org>,
<linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<dimitrysh@...gle.com>, <guodong.xu@...aro.org>,
<suzhuangluan@...ilicon.com>, <andy.shevchenko@...il.com>
CC: <kongfei@...ilicon.com>, <chenyao11@...wei.com>
Subject: [PATCH v5 1/1] PCI: kirin: Add MSI support
Add support for MSI.
Signed-off-by: Xiaowei Song <songxiaowei@...ilicon.com>
---
drivers/pci/dwc/pcie-kirin.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
index d2970a009eb5..6997276eb69c 100644
--- a/drivers/pci/dwc/pcie-kirin.c
+++ b/drivers/pci/dwc/pcie-kirin.c
@@ -430,6 +430,9 @@ static int kirin_pcie_host_init(struct pcie_port *pp)
{
kirin_pcie_establish_link(pp);
+ if (IS_ENABLED(CONFIG_PCI_MSI))
+ dw_pcie_msi_init(pp);
+
return 0;
}
@@ -445,9 +448,34 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = {
.host_init = kirin_pcie_host_init,
};
+static int kirin_pcie_add_msi(struct dw_pcie *pci,
+ struct platform_device *pdev)
+{
+ int ret = 0;
+
+ if (IS_ENABLED(CONFIG_PCI_MSI)) {
+ ret = platform_get_irq(pdev, 0);
+ if (ret < 0) {
+ dev_err(&pdev->dev,
+ "failed to get MSI IRQ (%d)\n", ret);
+ return ret;
+ }
+
+ pci->pp.msi_irq = ret;
+ }
+
+ return ret;
+}
+
static int __init kirin_add_pcie_port(struct dw_pcie *pci,
struct platform_device *pdev)
{
+ int ret;
+
+ ret = kirin_pcie_add_msi(pci, pdev);
+ if (ret)
+ return ret;
+
pci->pp.ops = &kirin_pcie_host_ops;
return dw_pcie_host_init(&pci->pp);
--
2.11.GIT
Powered by blists - more mailing lists