Skip to content

Commit 79e08f8

Browse files
committed
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
2 parents a80b04d + 9e14192 commit 79e08f8

File tree

2 files changed

+38
-16
lines changed

2 files changed

+38
-16
lines changed

Documentation/devicetree/bindings/pci/xilinx-versal-cpm.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ properties:
1818
- xlnx,versal-cpm-host-1.00
1919
- xlnx,versal-cpm5-host
2020
- xlnx,versal-cpm5-host1
21+
- xlnx,versal-cpm5nc-host
2122

2223
reg:
2324
items:

drivers/pci/controller/pcie-xilinx-cpm.c

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ enum xilinx_cpm_version {
8484
CPM,
8585
CPM5,
8686
CPM5_HOST1,
87+
CPM5NC_HOST,
8788
};
8889

8990
/**
@@ -478,6 +479,9 @@ static void xilinx_cpm_pcie_init_port(struct xilinx_cpm_pcie *port)
478479
{
479480
const struct xilinx_cpm_variant *variant = port->variant;
480481

482+
if (variant->version == CPM5NC_HOST)
483+
return;
484+
481485
if (cpm_pcie_link_up(port))
482486
dev_info(port->dev, "PCIe Link is UP\n");
483487
else
@@ -538,7 +542,8 @@ static int xilinx_cpm_pcie_parse_dt(struct xilinx_cpm_pcie *port,
538542
if (IS_ERR(port->cfg))
539543
return PTR_ERR(port->cfg);
540544

541-
if (port->variant->version == CPM5) {
545+
if (port->variant->version == CPM5 ||
546+
port->variant->version == CPM5_HOST1) {
542547
port->reg_base = devm_platform_ioremap_resource_byname(pdev,
543548
"cpm_csr");
544549
if (IS_ERR(port->reg_base))
@@ -578,28 +583,34 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
578583

579584
port->dev = dev;
580585

581-
err = xilinx_cpm_pcie_init_irq_domain(port);
582-
if (err)
583-
return err;
586+
port->variant = of_device_get_match_data(dev);
584587

585-
bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
586-
if (!bus)
587-
return -ENODEV;
588+
if (port->variant->version != CPM5NC_HOST) {
589+
err = xilinx_cpm_pcie_init_irq_domain(port);
590+
if (err)
591+
return err;
592+
}
588593

589-
port->variant = of_device_get_match_data(dev);
594+
bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
595+
if (!bus) {
596+
err = -ENODEV;
597+
goto err_free_irq_domains;
598+
}
590599

591600
err = xilinx_cpm_pcie_parse_dt(port, bus->res);
592601
if (err) {
593602
dev_err(dev, "Parsing DT failed\n");
594-
goto err_parse_dt;
603+
goto err_free_irq_domains;
595604
}
596605

597606
xilinx_cpm_pcie_init_port(port);
598607

599-
err = xilinx_cpm_setup_irq(port);
600-
if (err) {
601-
dev_err(dev, "Failed to set up interrupts\n");
602-
goto err_setup_irq;
608+
if (port->variant->version != CPM5NC_HOST) {
609+
err = xilinx_cpm_setup_irq(port);
610+
if (err) {
611+
dev_err(dev, "Failed to set up interrupts\n");
612+
goto err_setup_irq;
613+
}
603614
}
604615

605616
bridge->sysdata = port->cfg;
@@ -612,11 +623,13 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
612623
return 0;
613624

614625
err_host_bridge:
615-
xilinx_cpm_free_interrupts(port);
626+
if (port->variant->version != CPM5NC_HOST)
627+
xilinx_cpm_free_interrupts(port);
616628
err_setup_irq:
617629
pci_ecam_free(port->cfg);
618-
err_parse_dt:
619-
xilinx_cpm_free_irq_domains(port);
630+
err_free_irq_domains:
631+
if (port->variant->version != CPM5NC_HOST)
632+
xilinx_cpm_free_irq_domains(port);
620633
return err;
621634
}
622635

@@ -639,6 +652,10 @@ static const struct xilinx_cpm_variant cpm5_host1 = {
639652
.ir_enable = XILINX_CPM_PCIE1_IR_ENABLE,
640653
};
641654

655+
static const struct xilinx_cpm_variant cpm5n_host = {
656+
.version = CPM5NC_HOST,
657+
};
658+
642659
static const struct of_device_id xilinx_cpm_pcie_of_match[] = {
643660
{
644661
.compatible = "xlnx,versal-cpm-host-1.00",
@@ -652,6 +669,10 @@ static const struct of_device_id xilinx_cpm_pcie_of_match[] = {
652669
.compatible = "xlnx,versal-cpm5-host1",
653670
.data = &cpm5_host1,
654671
},
672+
{
673+
.compatible = "xlnx,versal-cpm5nc-host",
674+
.data = &cpm5n_host,
675+
},
655676
{}
656677
};
657678

0 commit comments

Comments
 (0)