diff options
| author | Lucas Stach <l.stach@pengutronix.de> | 2014-03-28 12:52:59 -0400 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-05-30 13:27:19 -0400 |
| commit | d1dc9749a5b8239d9ae718a176b5cd39ff89f976 (patch) | |
| tree | 5dd8cfb083e29df88dccac6d22e9d8e08d469f73 | |
| parent | 7f4f16eef5aeba31bdfb7702ced06a42f2777e04 (diff) | |
PCI: imx6: Add support for MSI
This patch adds support for Message Signaled Interrupts in the imx6-pcie
driver.
Signed-off-by: Harro Haan <hrhaan@gmail.com>
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Richard Zhu <r65037@freescale.com>
| -rw-r--r-- | drivers/pci/host/pci-imx6.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index 29e77508d285..a5645ae4aef0 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/resource.h> | 25 | #include <linux/resource.h> |
| 26 | #include <linux/signal.h> | 26 | #include <linux/signal.h> |
| 27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
| 28 | #include <linux/interrupt.h> | ||
| 28 | 29 | ||
| 29 | #include "pcie-designware.h" | 30 | #include "pcie-designware.h" |
| 30 | 31 | ||
| @@ -314,6 +315,13 @@ static int imx6_pcie_wait_for_link(struct pcie_port *pp) | |||
| 314 | return 0; | 315 | return 0; |
| 315 | } | 316 | } |
| 316 | 317 | ||
| 318 | static irqreturn_t imx6_pcie_msi_handler(int irq, void *arg) | ||
| 319 | { | ||
| 320 | struct pcie_port *pp = arg; | ||
| 321 | |||
| 322 | return dw_handle_msi_irq(pp); | ||
| 323 | } | ||
| 324 | |||
| 317 | static int imx6_pcie_start_link(struct pcie_port *pp) | 325 | static int imx6_pcie_start_link(struct pcie_port *pp) |
| 318 | { | 326 | { |
| 319 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); | 327 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); |
| @@ -388,6 +396,9 @@ static void imx6_pcie_host_init(struct pcie_port *pp) | |||
| 388 | dw_pcie_setup_rc(pp); | 396 | dw_pcie_setup_rc(pp); |
| 389 | 397 | ||
| 390 | imx6_pcie_start_link(pp); | 398 | imx6_pcie_start_link(pp); |
| 399 | |||
| 400 | if (IS_ENABLED(CONFIG_PCI_MSI)) | ||
| 401 | dw_pcie_msi_init(pp); | ||
| 391 | } | 402 | } |
| 392 | 403 | ||
| 393 | static void imx6_pcie_reset_phy(struct pcie_port *pp) | 404 | static void imx6_pcie_reset_phy(struct pcie_port *pp) |
| @@ -477,6 +488,22 @@ static int __init imx6_add_pcie_port(struct pcie_port *pp, | |||
| 477 | { | 488 | { |
| 478 | int ret; | 489 | int ret; |
| 479 | 490 | ||
| 491 | if (IS_ENABLED(CONFIG_PCI_MSI)) { | ||
| 492 | pp->msi_irq = platform_get_irq_byname(pdev, "msi"); | ||
| 493 | if (pp->msi_irq <= 0) { | ||
| 494 | dev_err(&pdev->dev, "failed to get MSI irq\n"); | ||
| 495 | return -ENODEV; | ||
| 496 | } | ||
| 497 | |||
| 498 | ret = devm_request_irq(&pdev->dev, pp->msi_irq, | ||
| 499 | imx6_pcie_msi_handler, | ||
| 500 | IRQF_SHARED, "mx6-pcie-msi", pp); | ||
| 501 | if (ret) { | ||
| 502 | dev_err(&pdev->dev, "failed to request MSI irq\n"); | ||
| 503 | return -ENODEV; | ||
| 504 | } | ||
| 505 | } | ||
| 506 | |||
| 480 | pp->root_bus_nr = -1; | 507 | pp->root_bus_nr = -1; |
| 481 | pp->ops = &imx6_pcie_host_ops; | 508 | pp->ops = &imx6_pcie_host_ops; |
| 482 | 509 | ||
