From: Vinod Koul <vkoul@kernel.org> To: Ansuel Smith <ansuelsmth@gmail.com> Cc: Andy Gross <agross@kernel.org>, Bjorn Andersson <bjorn.andersson@linaro.org>, Kishon Vijay Abraham I <kishon@ti.com>, linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] drivers: phy: qcom: ipq806x-usb: conver latch function to pool macro Date: Sun, 23 Jan 2022 17:22:18 +0530 [thread overview] Message-ID: <Ye1BcvaneH0sWeQV@matsya> (raw) In-Reply-To: <20220117002641.26773-2-ansuelsmth@gmail.com> 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
WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vkoul@kernel.org> To: Ansuel Smith <ansuelsmth@gmail.com> Cc: Andy Gross <agross@kernel.org>, Bjorn Andersson <bjorn.andersson@linaro.org>, Kishon Vijay Abraham I <kishon@ti.com>, linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] drivers: phy: qcom: ipq806x-usb: conver latch function to pool macro Date: Sun, 23 Jan 2022 17:22:18 +0530 [thread overview] Message-ID: <Ye1BcvaneH0sWeQV@matsya> (raw) In-Reply-To: <20220117002641.26773-2-ansuelsmth@gmail.com> 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 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2022-01-23 11:52 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-17 0:26 [PATCH 1/2] drivers: phy: qcom: ipq806x-usb: convert to BITFIELD macro Ansuel Smith 2022-01-17 0:26 ` Ansuel Smith 2022-01-17 0:26 ` [PATCH 2/2] drivers: phy: qcom: ipq806x-usb: conver latch function to pool macro Ansuel Smith 2022-01-17 0:26 ` Ansuel Smith 2022-01-23 11:52 ` Vinod Koul [this message] 2022-01-23 11:52 ` Vinod Koul 2022-01-23 14:46 ` Ansuel Smith 2022-01-23 14:46 ` Ansuel Smith 2022-01-24 4:27 ` Vinod Koul 2022-01-24 4:27 ` Vinod Koul 2022-01-24 4:28 ` [PATCH 1/2] drivers: phy: qcom: ipq806x-usb: convert to BITFIELD macro Vinod Koul 2022-01-24 4:28 ` Vinod Koul
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=Ye1BcvaneH0sWeQV@matsya \ --to=vkoul@kernel.org \ --cc=agross@kernel.org \ --cc=ansuelsmth@gmail.com \ --cc=bjorn.andersson@linaro.org \ --cc=kishon@ti.com \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-phy@lists.infradead.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.