Skip to content

Commit a01e721

Browse files
Mani-Sadhasivamkwilczynski
authored andcommitted
PCI: endpoint: Remove "core_init_notifier" flag
"core_init_notifier" flag is set by the glue drivers requiring refclk from the host to complete the DWC core initialization. Also, those drivers will send a notification to the EPF drivers once the initialization is fully completed using the pci_epc_init_notify() API. Only then, the EPF drivers will start functioning. For the rest of the drivers generating refclk locally, EPF drivers will start functioning post binding with them. EPF drivers rely on the 'core_init_notifier' flag to differentiate between the drivers. Unfortunately, this creates two different flows for the EPF drivers. So to avoid that, let's get rid of the "core_init_notifier" flag and follow a single initialization flow for the EPF drivers. This is done by calling the dw_pcie_ep_init_notify() from all glue drivers after the completion of dw_pcie_ep_init_registers() API. This will allow all the glue drivers to send the notification to the EPF drivers once the initialization is fully completed. Only difference here is that, the drivers requiring refclk from host will send the notification once refclk is received, while others will send it during probe time itself. But this also requires the EPC core driver to deliver the notification after EPF driver bind. Because, the glue driver can send the notification before the EPF drivers bind() and in those cases the EPF drivers will miss the event. To accommodate this, EPC core is now caching the state of the EPC initialization in 'init_complete' flag and pci-ep-cfs driver sends the notification to EPF drivers based on that after each EPF driver bind. Link: https://lore.kernel.org/linux-pci/[email protected] Tested-by: Niklas Cassel <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Reviewed-by: Frank Li <[email protected]> Reviewed-by: Niklas Cassel <[email protected]>
1 parent df69e17 commit a01e721

19 files changed

+65
-18
lines changed

drivers/pci/controller/cadence/pcie-cadence-ep.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep)
746746

747747
spin_lock_init(&ep->lock);
748748

749+
pci_epc_init_notify(epc);
750+
749751
return 0;
750752

751753
free_epc_mem:

drivers/pci/controller/dwc/pci-dra7xx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,8 @@ static int dra7xx_add_pcie_ep(struct dra7xx_pcie *dra7xx,
474474
return ret;
475475
}
476476

477+
dw_pcie_ep_init_notify(ep);
478+
477479
return 0;
478480
}
479481

drivers/pci/controller/dwc/pci-imx6.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,8 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie,
11311131
return ret;
11321132
}
11331133

1134+
dw_pcie_ep_init_notify(ep);
1135+
11341136
/* Start LTSSM. */
11351137
imx6_pcie_ltssm_enable(dev);
11361138

drivers/pci/controller/dwc/pci-keystone.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,8 @@ static int ks_pcie_probe(struct platform_device *pdev)
12931293
goto err_ep_init;
12941294
}
12951295

1296+
dw_pcie_ep_init_notify(&pci->ep);
1297+
12961298
break;
12971299
default:
12981300
dev_err(dev, "INVALID device type %d\n", mode);

drivers/pci/controller/dwc/pci-layerscape-ep.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ static int __init ls_pcie_ep_probe(struct platform_device *pdev)
286286
return ret;
287287
}
288288

289+
dw_pcie_ep_init_notify(&pci->ep);
290+
289291
return ls_pcie_ep_interrupt_init(pcie, pdev);
290292
}
291293

drivers/pci/controller/dwc/pcie-artpec6.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ static int artpec6_pcie_probe(struct platform_device *pdev)
452452
return ret;
453453
}
454454

455+
dw_pcie_ep_init_notify(&pci->ep);
456+
455457
break;
456458
default:
457459
dev_err(dev, "INVALID device type %d\n", artpec6_pcie->mode);

drivers/pci/controller/dwc/pcie-designware-ep.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ void dw_pcie_ep_cleanup(struct dw_pcie_ep *ep)
632632
struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
633633

634634
dw_pcie_edma_remove(pci);
635+
ep->epc->init_complete = false;
635636
}
636637
EXPORT_SYMBOL_GPL(dw_pcie_ep_cleanup);
637638

drivers/pci/controller/dwc/pcie-designware-plat.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ static int dw_plat_pcie_probe(struct platform_device *pdev)
154154
dw_pcie_ep_deinit(&pci->ep);
155155
}
156156

157+
dw_pcie_ep_init_notify(&pci->ep);
158+
157159
break;
158160
default:
159161
dev_err(dev, "INVALID device type %d\n", dw_plat_pcie->mode);

drivers/pci/controller/dwc/pcie-keembay.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ static int keembay_pcie_probe(struct platform_device *pdev)
442442
return ret;
443443
}
444444

445+
dw_pcie_ep_init_notify(&pci->ep);
446+
445447
break;
446448
default:
447449
dev_err(dev, "Invalid device type %d\n", pcie->mode);

drivers/pci/controller/dwc/pcie-qcom-ep.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,6 @@ static void qcom_pcie_ep_init_debugfs(struct qcom_pcie_ep *pcie_ep)
775775

776776
static const struct pci_epc_features qcom_pcie_epc_features = {
777777
.linkup_notifier = true,
778-
.core_init_notifier = true,
779778
.msi_capable = true,
780779
.msix_capable = false,
781780
.align = SZ_4K,

0 commit comments

Comments
 (0)