mirror of https://gitee.com/openkylin/linux.git
PCI: keystone: Cleanup error_irq configuration
pci-keystone driver uses irq_of_parse_and_map() to get irq number of error_irq. Use platform_get_irq() instead and move platform_get_irq() and request_irq() of error_irq from ks_pcie_add_pcie_port to ks_pcie_probe since error_irq is common to both RC mode and EP mode. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
This commit is contained in:
parent
9afb20d600
commit
0790eb175e
|
@ -98,8 +98,6 @@ struct keystone_pcie {
|
||||||
struct irq_domain *legacy_irq_domain;
|
struct irq_domain *legacy_irq_domain;
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
|
|
||||||
int error_irq;
|
|
||||||
|
|
||||||
/* Application register space */
|
/* Application register space */
|
||||||
void __iomem *va_app_base; /* DT 1st resource */
|
void __iomem *va_app_base; /* DT 1st resource */
|
||||||
struct resource app;
|
struct resource app;
|
||||||
|
@ -743,12 +741,6 @@ static int ks_pcie_config_legacy_irq(struct keystone_pcie *ks_pcie)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ks_pcie_setup_interrupts(struct keystone_pcie *ks_pcie)
|
|
||||||
{
|
|
||||||
if (ks_pcie->error_irq > 0)
|
|
||||||
ks_pcie_enable_error_irq(ks_pcie);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When a PCI device does not exist during config cycles, keystone host gets a
|
* When a PCI device does not exist during config cycles, keystone host gets a
|
||||||
* bus error instead of returning 0xffffffff. This handler always returns 0
|
* bus error instead of returning 0xffffffff. This handler always returns 0
|
||||||
|
@ -810,7 +802,6 @@ static int __init ks_pcie_host_init(struct pcie_port *pp)
|
||||||
|
|
||||||
ks_pcie_stop_link(pci);
|
ks_pcie_stop_link(pci);
|
||||||
ks_pcie_setup_rc_app_regs(ks_pcie);
|
ks_pcie_setup_rc_app_regs(ks_pcie);
|
||||||
ks_pcie_setup_interrupts(ks_pcie);
|
|
||||||
writew(PCI_IO_RANGE_TYPE_32 | (PCI_IO_RANGE_TYPE_32 << 8),
|
writew(PCI_IO_RANGE_TYPE_32 | (PCI_IO_RANGE_TYPE_32 << 8),
|
||||||
pci->dbi_base + PCI_IO_BASE);
|
pci->dbi_base + PCI_IO_BASE);
|
||||||
|
|
||||||
|
@ -854,23 +845,6 @@ static int __init ks_pcie_add_pcie_port(struct keystone_pcie *ks_pcie,
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
|
||||||
* Index 0 is the platform interrupt for error interrupt
|
|
||||||
* from RC. This is optional.
|
|
||||||
*/
|
|
||||||
ks_pcie->error_irq = irq_of_parse_and_map(ks_pcie->np, 0);
|
|
||||||
if (ks_pcie->error_irq <= 0)
|
|
||||||
dev_info(dev, "no error IRQ defined\n");
|
|
||||||
else {
|
|
||||||
ret = request_irq(ks_pcie->error_irq, ks_pcie_err_irq_handler,
|
|
||||||
IRQF_SHARED, "pcie-error-irq", ks_pcie);
|
|
||||||
if (ret < 0) {
|
|
||||||
dev_err(dev, "failed to request error IRQ %d\n",
|
|
||||||
ks_pcie->error_irq);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pp->ops = &ks_pcie_host_ops;
|
pp->ops = &ks_pcie_host_ops;
|
||||||
ret = ks_pcie_dw_host_init(ks_pcie);
|
ret = ks_pcie_dw_host_init(ks_pcie);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -946,6 +920,7 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
|
||||||
u32 num_lanes;
|
u32 num_lanes;
|
||||||
char name[10];
|
char name[10];
|
||||||
int ret;
|
int ret;
|
||||||
|
int irq;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ks_pcie = devm_kzalloc(dev, sizeof(*ks_pcie), GFP_KERNEL);
|
ks_pcie = devm_kzalloc(dev, sizeof(*ks_pcie), GFP_KERNEL);
|
||||||
|
@ -965,6 +940,20 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
irq = platform_get_irq(pdev, 0);
|
||||||
|
if (irq < 0) {
|
||||||
|
dev_err(dev, "missing IRQ resource: %d\n", irq);
|
||||||
|
return irq;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = request_irq(irq, ks_pcie_err_irq_handler, IRQF_SHARED,
|
||||||
|
"ks-pcie-error-irq", ks_pcie);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(dev, "failed to request error IRQ %d\n",
|
||||||
|
irq);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
ret = of_property_read_u32(np, "num-lanes", &num_lanes);
|
ret = of_property_read_u32(np, "num-lanes", &num_lanes);
|
||||||
if (ret)
|
if (ret)
|
||||||
num_lanes = 1;
|
num_lanes = 1;
|
||||||
|
@ -1020,6 +1009,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err_get_sync;
|
goto err_get_sync;
|
||||||
|
|
||||||
|
ks_pcie_enable_error_irq(ks_pcie);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_get_sync:
|
err_get_sync:
|
||||||
|
|
Loading…
Reference in New Issue