[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250822155908.625553-6-18255117159@163.com>
Date: Fri, 22 Aug 2025 23:59:06 +0800
From: Hans Zhang <18255117159@....com>
To: bhelgaas@...gle.com,
helgaas@...nel.org,
linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Hans Zhang <18255117159@....com>
Subject: [PATCH v2 5/7] PCI: rcar: Replace msleep(5) with usleep_range() for precise PHY ready checking
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@....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
Powered by blists - more mailing lists