Commit dc9d1677 authored by Ansuel Smith's avatar Ansuel Smith Committed by Vinod Koul

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: default avatarAnsuel Smith <ansuelsmth@gmail.com>
Link: https://lore.kernel.org/r/20220117002641.26773-2-ansuelsmth@gmail.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 260f9959
...@@ -112,6 +112,9 @@ ...@@ -112,6 +112,9 @@
#define SS_CR_READ_REG BIT(0) #define SS_CR_READ_REG BIT(0)
#define SS_CR_WRITE_REG BIT(0) #define SS_CR_WRITE_REG BIT(0)
#define LATCH_SLEEP 40
#define LATCH_TIMEOUT 100
struct usb_phy { struct usb_phy {
void __iomem *base; void __iomem *base;
struct device *dev; struct device *dev;
...@@ -157,19 +160,9 @@ static inline void usb_phy_write_readback(struct usb_phy *phy_dwc3, ...@@ -157,19 +160,9 @@ static inline void usb_phy_write_readback(struct usb_phy *phy_dwc3,
static int wait_for_latch(void __iomem *addr) static int wait_for_latch(void __iomem *addr)
{ {
u32 retry = 10; u32 val;
while (true) {
if (!readl(addr))
break;
if (--retry == 0)
return -ETIMEDOUT;
usleep_range(10, 20);
}
return 0; return readl_poll_timeout(addr, val, !val, LATCH_SLEEP, LATCH_TIMEOUT);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment