From 0768eeafd5a6299e4c8d88af87dacad9d9582dc4 Mon Sep 17 00:00:00 2001 From: Harro Haan Date: Thu, 5 Dec 2013 14:06:37 +0100 Subject: [PATCH 2/2] PCI: imx6: add support for MSI This patch adds support for Message Signaled Interrupt in the imx6q-pcie driver. It is done in a similar way as for the Exynos PCIe driver (commit f342d940ee0e3a2b5197fd4fbade1cb6bbc960b7), which is also using the Synopsys designware PCIe IP core. Signed-off-by: Harro Haan --- drivers/pci/host/pci-imx6.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index bd70af8..b548d38 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -328,6 +329,9 @@ static void imx6_pcie_host_init(struct pcie_port *pp) } } + if (IS_ENABLED(CONFIG_PCI_MSI)) + dw_pcie_msi_init(pp); + return; } @@ -382,6 +386,15 @@ static struct pcie_host_ops imx6_pcie_host_ops = { .host_init = imx6_pcie_host_init, }; +static irqreturn_t imx6_pcie_msi_irq_handler(int irq, void *arg) +{ + struct pcie_port *pp = arg; + + dw_handle_msi_irq(pp); + + return IRQ_HANDLED; +} + static int imx6_add_pcie_port(struct pcie_port *pp, struct platform_device *pdev) { @@ -393,6 +406,22 @@ static int imx6_add_pcie_port(struct pcie_port *pp, return -ENODEV; } + if (IS_ENABLED(CONFIG_PCI_MSI)) { + pp->msi_irq = platform_get_irq(pdev, 1); + if (!pp->msi_irq) { + dev_err(&pdev->dev, "failed to get msi irq\n"); + return -ENODEV; + } + + ret = devm_request_irq(&pdev->dev, pp->msi_irq, + imx6_pcie_msi_irq_handler, + IRQF_SHARED, "imx6q-pcie", pp); + if (ret) { + dev_err(&pdev->dev, "failed to request msi irq\n"); + return ret; + } + } + pp->root_bus_nr = -1; pp->ops = &imx6_pcie_host_ops; -- 1.7.9.5