Skip to content

Commit

Permalink
Merge branch 'pci/controller/dwc'
Browse files Browse the repository at this point in the history
- Move DBI accesses from dw_pcie_ep_init() to dw_pcie_ep_init_complete() so
  drivers for endpoints that require Refclk for DBI access, e.g., qcom and
  tegra194, can control when this happens (Manivannan Sadhasivam)

- Add endpoint API kernel-doc (Manivannan Sadhasivam)

- Remove .deinit() callback and instead call rcar_gen4_pcie_ep_deinit()
  explicitly from rcar-gen4, which was the only user (Manivannan
  Sadhasivam)

- Rename dw_pcie_ep_exit() to dw_pcie_ep_deinit() to correspond with
  dw_pcie_ep_init() (Manivannan Sadhasivam)

- Add dw_pcie_ep_cleanup() for drivers that need to clean up eDMA resources
  when PERST# is asserted, e.g., qcom, tegra194 (Manivannan Sadhasivam)

- Rename dw_pcie_ep_init_complete() to dw_pcie_ep_init_registers() to
  better reflect the functionality (Manivannan Sadhasivam)

- Call dw_pcie_ep_init_registers() directly from drivers instead of from
  dw_pcie_ep_init() so drivers, e.g., qcom and tegra194, can do it when
  Refclk is available (Manivannan Sadhasivam)

- Remove the "core_init_notifier" flag, which previously identified drivers
  that required Refclk before DBI access, because it's now unnecessary
  (Manivannan Sadhasivam)

* pci/controller/dwc:
  PCI: endpoint: Remove "core_init_notifier" flag
  PCI: dwc: ep: Call dw_pcie_ep_init_registers() API directly from all glue drivers
  PCI: dwc: ep: Rename dw_pcie_ep_init_complete() to dw_pcie_ep_init_registers()
  PCI: dwc: ep: Introduce dw_pcie_ep_cleanup() API for drivers supporting PERST#
  PCI: dwc: ep: Rename dw_pcie_ep_exit() to dw_pcie_ep_deinit()
  PCI: dwc: ep: Remove deinit() callback from struct dw_pcie_ep_ops
  PCI: dwc: ep: Add Kernel-doc comments for APIs
  PCI: dwc: ep: Fix DBI access failure for drivers requiring refclk from host
  • Loading branch information
bjorn-helgaas committed May 16, 2024
2 parents ec54985 + a01e721 commit 08f3890
Show file tree
Hide file tree
Showing 20 changed files with 338 additions and 111 deletions.
2 changes: 2 additions & 0 deletions drivers/pci/controller/cadence/pcie-cadence-ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,8 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep)

spin_lock_init(&ep->lock);

pci_epc_init_notify(epc);

return 0;

free_epc_mem:
Expand Down
9 changes: 9 additions & 0 deletions drivers/pci/controller/dwc/pci-dra7xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,15 @@ static int dra7xx_add_pcie_ep(struct dra7xx_pcie *dra7xx,
return ret;
}

ret = dw_pcie_ep_init_registers(ep);
if (ret) {
dev_err(dev, "Failed to initialize DWC endpoint registers\n");
dw_pcie_ep_deinit(ep);
return ret;
}

dw_pcie_ep_init_notify(ep);

return 0;
}

Expand Down
10 changes: 10 additions & 0 deletions drivers/pci/controller/dwc/pci-imx6.c
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,16 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie,
dev_err(dev, "failed to initialize endpoint\n");
return ret;
}

ret = dw_pcie_ep_init_registers(ep);
if (ret) {
dev_err(dev, "Failed to initialize DWC endpoint registers\n");
dw_pcie_ep_deinit(ep);
return ret;
}

dw_pcie_ep_init_notify(ep);

/* Start LTSSM. */
imx6_pcie_ltssm_enable(dev);

Expand Down
11 changes: 11 additions & 0 deletions drivers/pci/controller/dwc/pci-keystone.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,15 @@ static int ks_pcie_probe(struct platform_device *pdev)
ret = dw_pcie_ep_init(&pci->ep);
if (ret < 0)
goto err_get_sync;

ret = dw_pcie_ep_init_registers(&pci->ep);
if (ret) {
dev_err(dev, "Failed to initialize DWC endpoint registers\n");
goto err_ep_init;
}

dw_pcie_ep_init_notify(&pci->ep);

break;
default:
dev_err(dev, "INVALID device type %d\n", mode);
Expand All @@ -1295,6 +1304,8 @@ static int ks_pcie_probe(struct platform_device *pdev)

return 0;

err_ep_init:
dw_pcie_ep_deinit(&pci->ep);
err_get_sync:
pm_runtime_put(dev);
pm_runtime_disable(dev);
Expand Down
9 changes: 9 additions & 0 deletions drivers/pci/controller/dwc/pci-layerscape-ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,15 @@ static int __init ls_pcie_ep_probe(struct platform_device *pdev)
if (ret)
return ret;

ret = dw_pcie_ep_init_registers(&pci->ep);
if (ret) {
dev_err(dev, "Failed to initialize DWC endpoint registers\n");
dw_pcie_ep_deinit(&pci->ep);
return ret;
}

dw_pcie_ep_init_notify(&pci->ep);

return ls_pcie_ep_interrupt_init(pcie, pdev);
}

Expand Down
15 changes: 14 additions & 1 deletion drivers/pci/controller/dwc/pcie-artpec6.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,20 @@ static int artpec6_pcie_probe(struct platform_device *pdev)

pci->ep.ops = &pcie_ep_ops;

return dw_pcie_ep_init(&pci->ep);
ret = dw_pcie_ep_init(&pci->ep);
if (ret)
return ret;

ret = dw_pcie_ep_init_registers(&pci->ep);
if (ret) {
dev_err(dev, "Failed to initialize DWC endpoint registers\n");
dw_pcie_ep_deinit(&pci->ep);
return ret;
}

dw_pcie_ep_init_notify(&pci->ep);

break;
default:
dev_err(dev, "INVALID device type %d\n", artpec6_pcie->mode);
}
Expand Down
Loading

0 comments on commit 08f3890

Please sign in to comment.