The msleep(5) in rcar_pcie_wait_for_phyrdy() may sleep longer than
intended due to timer granularity, which can cause unnecessary delays
in PHY ready detection. Replace it with usleep_range() for a more precise
delay of approximately 5ms.
Signed-off-by: Hans Zhang <18255117159@163.com>
---
drivers/pci/controller/pcie-rcar.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
index 7583699ef7b6..8d0f5a4a7fc0 100644
--- a/drivers/pci/controller/pcie-rcar.c
+++ b/drivers/pci/controller/pcie-rcar.c
@@ -11,6 +11,8 @@
#include "pcie-rcar.h"
+#define PCIE_PHYRDY_CHECK_US 5000
+
void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, unsigned int reg)
{
writel(val, pcie->base + reg);
@@ -39,7 +41,7 @@ int rcar_pcie_wait_for_phyrdy(struct rcar_pcie *pcie)
if (rcar_pci_read_reg(pcie, PCIEPHYSR) & PHYRDY)
return 0;
- msleep(5);
+ usleep_range(PCIE_PHYRDY_CHECK_US, PCIE_PHYRDY_CHECK_US + 100);
}
return -ETIMEDOUT;
--
2.25.1