lkml.org 
[lkml]   [2022]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] drivers: phy: qcom: ipq806x-usb: conver latch function to pool macro
On 17-01-22, 01:26, Ansuel Smith wrote:
> Convert latch function to readl pool macro to tidy things up.
>
> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> ---
> drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c | 17 +++++------------
> 1 file 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 6788e0e8272a..ab2d1431546d 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;
> @@ -156,19 +159,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;

we break if read returns non zero value...

Do you know what is the value expected?

> -
> - if (--retry == 0)
> - return -ETIMEDOUT;
> -
> - usleep_range(10, 20);
> - }
> + u32 val;

Okay this contains garbage..
>
> - return 0;
> + return readl_poll_timeout(addr, val, !val, LATCH_SLEEP, LATCH_TIMEOUT);

and we are waiting for it read a garbage value!


--
~Vinod

\
 
 \ /
  Last update: 2022-01-23 12:53    [W:0.059 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site