summaryrefslogtreecommitdiff
path: root/drivers/phy
diff options
context:
space:
mode:
authorAnsuel Smith <ansuelsmth@gmail.com>2022-01-17 01:26:41 +0100
committerVinod Koul <vkoul@kernel.org>2022-01-24 09:58:12 +0530
commitdc9d167737a5814c8dcbdc33a298dc4b9407bba5 (patch)
treee3addebe8b321606be001bf5f8bab0d8d0f24472 /drivers/phy
parent260f99591c8c4c27e9e023287151031df97bd6d5 (diff)
drivers: phy: qcom: ipq806x-usb: conver latch function to pool macro
Convert latch function to readl pool macro to tidy things up. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> Link: https://lore.kernel.org/r/20220117002641.26773-2-ansuelsmth@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c b/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c
index 2aca0e28ff59..7bacc527fbad 100644
--- a/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c
@@ -112,6 +112,9 @@
#define SS_CR_READ_REG BIT(0)
#define SS_CR_WRITE_REG BIT(0)
+#define LATCH_SLEEP 40
+#define LATCH_TIMEOUT 100
+
struct usb_phy {
void __iomem *base;
struct device *dev;
@@ -157,19 +160,9 @@ static inline void usb_phy_write_readback(struct usb_phy *phy_dwc3,
static int wait_for_latch(void __iomem *addr)
{
- u32 retry = 10;
-
- while (true) {
- if (!readl(addr))
- break;
-
- if (--retry == 0)
- return -ETIMEDOUT;
-
- usleep_range(10, 20);
- }
+ u32 val;
- return 0;
+ return readl_poll_timeout(addr, val, !val, LATCH_SLEEP, LATCH_TIMEOUT);
}
/**