Skip to content

Commit 0056d29

Browse files
Marek Vasutbjorn-helgaas
authored andcommitted
PCI: rcar-gen4: Assure reset occurs before DBI access
Assure the reset is latched and the core is ready for DBI access. On R-Car V4H, the PCIe reset is asynchronous and does not take effect immediately, but needs a short time to complete. In case DBI access happens in that short time, that access generates an SError. Make sure that condition can never happen, read back the state of the reset, which should turn the asynchronous reset into a synchronous one, and wait a little over 1ms to add additional safety margin. Fixes: 0d0c551 ("PCI: rcar-gen4: Add R-Car Gen4 PCIe controller support for host mode") Signed-off-by: Marek Vasut <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Tested-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 8795b70 commit 0056d29

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/pci/controller/dwc/pcie-rcar-gen4.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,19 @@ static int rcar_gen4_pcie_common_init(struct rcar_gen4_pcie *rcar)
213213
if (ret)
214214
goto err_unprepare;
215215

216+
/*
217+
* Assure the reset is latched and the core is ready for DBI access.
218+
* On R-Car V4H, the PCIe reset is asynchronous and does not take
219+
* effect immediately, but needs a short time to complete. In case
220+
* DBI access happens in that short time, that access generates an
221+
* SError. To make sure that condition can never happen, read back the
222+
* state of the reset, which should turn the asynchronous reset into
223+
* synchronous one, and wait a little over 1ms to add additional
224+
* safety margin.
225+
*/
226+
reset_control_status(dw->core_rsts[DW_PCIE_PWR_RST].rstc);
227+
fsleep(1000);
228+
216229
if (rcar->drvdata->additional_common_init)
217230
rcar->drvdata->additional_common_init(rcar);
218231

0 commit comments

Comments
 (0)