linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiaowei Song <songxiaowei@hisilicon.com>
To: <wangbinghui@hisilicon.com>, <bhelgaas@google.com>,
	<robh+dt@kernel.org>, <linux-pci@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <dimitrysh@google.com>
Cc: <chenyao11@huawei.com>, <songxiaowei@hisilicon.com>
Subject: [PATCH v5 1/1] PCI: kirin: Add MSI support
Date: Thu, 28 Jun 2018 20:48:03 +0800	[thread overview]
Message-ID: <20180628124803.110315-2-songxiaowei@hisilicon.com> (raw)
In-Reply-To: <20180628124803.110315-1-songxiaowei@hisilicon.com>

Add support for MSI.

Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.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


  reply	other threads:[~2018-06-28 12:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 12:48 [PATCH v5 0/1] *** PCI: kirin: Add MSI support *** Xiaowei Song
2018-06-28 12:48 ` Xiaowei Song [this message]
2018-07-09  1:54   ` 答复: [PATCH v5 1/1] PCI: kirin: Add MSI support Songxiaowei (Kirin_DRV)
2018-07-10 15:40     ` Lorenzo Pieralisi
2018-07-11  2:22       ` 答复: " Songxiaowei (Kirin_DRV)
  -- strict thread matches above, loose matches on Subject: below --
2018-05-31  9:06 [PATCH v5 0/1] *** PCI: kirin: Add MSI support *** Xiaowei Song
2018-05-31  9:06 ` [PATCH v5 1/1] PCI: kirin: Add MSI support Xiaowei Song
2018-05-25  3:58 [PATCH v5 0/1] *** PCI: kirin: Add MSI support *** Xiaowei Song
2018-05-25  3:58 ` [PATCH v5 1/1] PCI: kirin: Add MSI support Xiaowei Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180628124803.110315-2-songxiaowei@hisilicon.com \
    --to=songxiaowei@hisilicon.com \
    --cc=bhelgaas@google.com \
    --cc=chenyao11@huawei.com \
    --cc=dimitrysh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=wangbinghui@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).