mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
Merge branch 'pci/controller/xilinx-cpm'
- Free IRQ domain in probe error path to avoid leaking it (Thippeswamy Havalige) - Add DT .compatible "xlnx,versal-cpm5nc-host" and driver support for Versal Net CPM5NC Root Port controller (Thippeswamy Havalige) - Add driver support for CPM5_HOST1 (Thippeswamy Havalige) * pci/controller/xilinx-cpm: PCI: xilinx-cpm: Add cpm_csr register mapping for CPM5_HOST1 variant PCI: xilinx-cpm: Add support for Versal Net CPM5NC Root Port controller dt-bindings: PCI: xilinx-cpm: Add compatible string for CPM5NC Versal Net host PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe
This commit is contained in:
commit
79e08f8d4e
|
|
@ -18,6 +18,7 @@ properties:
|
|||
- xlnx,versal-cpm-host-1.00
|
||||
- xlnx,versal-cpm5-host
|
||||
- xlnx,versal-cpm5-host1
|
||||
- xlnx,versal-cpm5nc-host
|
||||
|
||||
reg:
|
||||
items:
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ enum xilinx_cpm_version {
|
|||
CPM,
|
||||
CPM5,
|
||||
CPM5_HOST1,
|
||||
CPM5NC_HOST,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -478,6 +479,9 @@ static void xilinx_cpm_pcie_init_port(struct xilinx_cpm_pcie *port)
|
|||
{
|
||||
const struct xilinx_cpm_variant *variant = port->variant;
|
||||
|
||||
if (variant->version == CPM5NC_HOST)
|
||||
return;
|
||||
|
||||
if (cpm_pcie_link_up(port))
|
||||
dev_info(port->dev, "PCIe Link is UP\n");
|
||||
else
|
||||
|
|
@ -538,7 +542,8 @@ static int xilinx_cpm_pcie_parse_dt(struct xilinx_cpm_pcie *port,
|
|||
if (IS_ERR(port->cfg))
|
||||
return PTR_ERR(port->cfg);
|
||||
|
||||
if (port->variant->version == CPM5) {
|
||||
if (port->variant->version == CPM5 ||
|
||||
port->variant->version == CPM5_HOST1) {
|
||||
port->reg_base = devm_platform_ioremap_resource_byname(pdev,
|
||||
"cpm_csr");
|
||||
if (IS_ERR(port->reg_base))
|
||||
|
|
@ -578,28 +583,34 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
|
|||
|
||||
port->dev = dev;
|
||||
|
||||
err = xilinx_cpm_pcie_init_irq_domain(port);
|
||||
if (err)
|
||||
return err;
|
||||
port->variant = of_device_get_match_data(dev);
|
||||
|
||||
if (port->variant->version != CPM5NC_HOST) {
|
||||
err = xilinx_cpm_pcie_init_irq_domain(port);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
|
||||
if (!bus)
|
||||
return -ENODEV;
|
||||
|
||||
port->variant = of_device_get_match_data(dev);
|
||||
if (!bus) {
|
||||
err = -ENODEV;
|
||||
goto err_free_irq_domains;
|
||||
}
|
||||
|
||||
err = xilinx_cpm_pcie_parse_dt(port, bus->res);
|
||||
if (err) {
|
||||
dev_err(dev, "Parsing DT failed\n");
|
||||
goto err_parse_dt;
|
||||
goto err_free_irq_domains;
|
||||
}
|
||||
|
||||
xilinx_cpm_pcie_init_port(port);
|
||||
|
||||
err = xilinx_cpm_setup_irq(port);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to set up interrupts\n");
|
||||
goto err_setup_irq;
|
||||
if (port->variant->version != CPM5NC_HOST) {
|
||||
err = xilinx_cpm_setup_irq(port);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to set up interrupts\n");
|
||||
goto err_setup_irq;
|
||||
}
|
||||
}
|
||||
|
||||
bridge->sysdata = port->cfg;
|
||||
|
|
@ -612,11 +623,13 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
|
||||
err_host_bridge:
|
||||
xilinx_cpm_free_interrupts(port);
|
||||
if (port->variant->version != CPM5NC_HOST)
|
||||
xilinx_cpm_free_interrupts(port);
|
||||
err_setup_irq:
|
||||
pci_ecam_free(port->cfg);
|
||||
err_parse_dt:
|
||||
xilinx_cpm_free_irq_domains(port);
|
||||
err_free_irq_domains:
|
||||
if (port->variant->version != CPM5NC_HOST)
|
||||
xilinx_cpm_free_irq_domains(port);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -639,6 +652,10 @@ static const struct xilinx_cpm_variant cpm5_host1 = {
|
|||
.ir_enable = XILINX_CPM_PCIE1_IR_ENABLE,
|
||||
};
|
||||
|
||||
static const struct xilinx_cpm_variant cpm5n_host = {
|
||||
.version = CPM5NC_HOST,
|
||||
};
|
||||
|
||||
static const struct of_device_id xilinx_cpm_pcie_of_match[] = {
|
||||
{
|
||||
.compatible = "xlnx,versal-cpm-host-1.00",
|
||||
|
|
@ -652,6 +669,10 @@ static const struct of_device_id xilinx_cpm_pcie_of_match[] = {
|
|||
.compatible = "xlnx,versal-cpm5-host1",
|
||||
.data = &cpm5_host1,
|
||||
},
|
||||
{
|
||||
.compatible = "xlnx,versal-cpm5nc-host",
|
||||
.data = &cpm5n_host,
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user