diff options
author | Po Liu <po.liu@nxp.com> | 2017-05-22 08:50:05 (GMT) |
---|---|---|
committer | Xie Xiaobo <xiaobo.xie@nxp.com> | 2017-07-14 10:09:09 (GMT) |
commit | 017e6e9d7a3292070873dd88d5ee3c754e279119 (patch) | |
tree | 9e5a45d8773c017bd45565f41d4de13583cf7ff9 /arch/arm64/kernel | |
parent | d33bde3c487c722541ad359e1d22090a78df0c77 (diff) | |
download | linux-017e6e9d7a3292070873dd88d5ee3c754e279119.tar.xz |
pci:add support aer/pme interrupts with none MSI/MSI-X/INTx mode
[arch part]
On some platforms, root port doesn't support MSI/MSI-X/INTx in RC mode.
When chip support the aer/pme interrupts with none MSI/MSI-X/INTx mode,
maybe there is interrupt line for aer pme etc. Search the interrupt
number in the fdt file. Then fixup the dev->irq with it.
Signed-off-by: Po Liu <po.liu@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Integrated-by: Zhao Qiang <qiang.zhao@nxp.com>
Diffstat (limited to 'arch/arm64/kernel')
-rw-r--r-- | arch/arm64/kernel/pci.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 409abc4..63815fb 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -17,6 +17,8 @@ #include <linux/mm.h> #include <linux/of_pci.h> #include <linux/of_platform.h> +#include <linux/of_irq.h> +#include <linux/pcieport_if.h> #include <linux/pci.h> #include <linux/pci-acpi.h> #include <linux/pci-ecam.h> @@ -55,6 +57,47 @@ int pcibios_alloc_irq(struct pci_dev *dev) } /* + * Check device tree if the service interrupts are there + */ +int pcibios_check_service_irqs(struct pci_dev *dev, int *irqs, int mask) +{ + int ret, count = 0; + struct device_node *np = NULL; + + if (dev->bus->dev.of_node) + np = dev->bus->dev.of_node; + + if (np == NULL) + return 0; + + if (!IS_ENABLED(CONFIG_OF_IRQ)) + return 0; + + /* If root port doesn't support MSI/MSI-X/INTx in RC mode, + * request irq for aer + */ + if (mask & PCIE_PORT_SERVICE_AER) { + ret = of_irq_get_byname(np, "aer"); + if (ret > 0) { + irqs[PCIE_PORT_SERVICE_AER_SHIFT] = ret; + count++; + } + } + + if (mask & PCIE_PORT_SERVICE_PME) { + ret = of_irq_get_byname(np, "pme"); + if (ret > 0) { + irqs[PCIE_PORT_SERVICE_PME_SHIFT] = ret; + count++; + } + } + + /* TODO: add more service interrupts if there it is in the device tree*/ + + return count; +} + +/* * raw_pci_read/write - Platform-specific PCI config space access. */ int raw_pci_read(unsigned int domain, unsigned int bus, |