* [PATCH 1/1] usb: gadget: s3c-hsotg: fix core reset timeout failure
@ 2012-07-03 2:03 Du, Changbin
2012-07-03 6:44 ` ABRAHAM, KISHON VIJAY
2012-07-03 17:20 ` Sergei Shtylyov
0 siblings, 2 replies; 5+ messages in thread
From: Du, Changbin @ 2012-07-03 2:03 UTC (permalink / raw)
To: balbi; +Cc: gregkh, ben, linux-usb, linux-kernel
The timeout values were 1000 and timeout issue occured many times on my
s3c6410 Soc based board (mostly when booting whith USB cable not
connected). This patch increase the values to 10000 to guarantee the
success of reset.
Having set timeout to 10000, I printed the remained timeout values
which can cause timeout issue before this change (tested several times):
the first timeout value remained:
timeout = 8079
timeout = 8079
timeout = 8078
timeout = 8081
the second timeout value remained:
timeout = 7940
timeout = 7945
timeout = 7940
timeout = 7938
Seeing from above values, I think 10000 is big enough.
Signed-off-by: Du, Changbin <changbin.du@gmail.com>
---
drivers/usb/gadget/s3c-hsotg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index f4abb0e..f3e2234 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -2215,7 +2215,7 @@ static int s3c_hsotg_corereset(struct s3c_hsotg
*hsotg)
/* issue soft reset */
writel(GRSTCTL_CSftRst, hsotg->regs + GRSTCTL);
- timeout = 1000;
+ timeout = 10000;
do {
grstctl = readl(hsotg->regs + GRSTCTL);
} while ((grstctl & GRSTCTL_CSftRst) && timeout-- > 0);
@@ -2225,7 +2225,7 @@ static int s3c_hsotg_corereset(struct s3c_hsotg
*hsotg)
return -EINVAL;
}
- timeout = 1000;
+ timeout = 10000;
while (1) {
u32 grstctl = readl(hsotg->regs + GRSTCTL);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] usb: gadget: s3c-hsotg: fix core reset timeout failure
2012-07-03 2:03 [PATCH 1/1] usb: gadget: s3c-hsotg: fix core reset timeout failure Du, Changbin
@ 2012-07-03 6:44 ` ABRAHAM, KISHON VIJAY
2012-07-03 10:00 ` Du, Changbin
2012-07-03 17:20 ` Sergei Shtylyov
1 sibling, 1 reply; 5+ messages in thread
From: ABRAHAM, KISHON VIJAY @ 2012-07-03 6:44 UTC (permalink / raw)
To: Du, Changbin; +Cc: balbi, gregkh, ben, linux-usb, linux-kernel
Hi,
On Tue, Jul 3, 2012 at 7:33 AM, Du, Changbin <changbin.du@gmail.com> wrote:
> The timeout values were 1000 and timeout issue occured many times on my
> s3c6410 Soc based board (mostly when booting whith USB cable not
> connected). This patch increase the values to 10000 to guarantee the
> success of reset.
>
> Having set timeout to 10000, I printed the remained timeout values
> which can cause timeout issue before this change (tested several times):
> the first timeout value remained:
> timeout = 8079
> timeout = 8079
> timeout = 8078
> timeout = 8081
> the second timeout value remained:
> timeout = 7940
> timeout = 7945
> timeout = 7940
> timeout = 7938
> Seeing from above values, I think 10000 is big enough.
>
> Signed-off-by: Du, Changbin <changbin.du@gmail.com>
> ---
> drivers/usb/gadget/s3c-hsotg.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
> index f4abb0e..f3e2234 100644
> --- a/drivers/usb/gadget/s3c-hsotg.c
> +++ b/drivers/usb/gadget/s3c-hsotg.c
> @@ -2215,7 +2215,7 @@ static int s3c_hsotg_corereset(struct s3c_hsotg
> *hsotg)
> /* issue soft reset */
> writel(GRSTCTL_CSftRst, hsotg->regs + GRSTCTL);
>
> - timeout = 1000;
> + timeout = 10000;
> do {
> grstctl = readl(hsotg->regs + GRSTCTL);
> } while ((grstctl & GRSTCTL_CSftRst) && timeout-- > 0);
how about msleep inside the loop?
Thanks
Kishon
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 1/1] usb: gadget: s3c-hsotg: fix core reset timeout failure
2012-07-03 6:44 ` ABRAHAM, KISHON VIJAY
@ 2012-07-03 10:00 ` Du, Changbin
0 siblings, 0 replies; 5+ messages in thread
From: Du, Changbin @ 2012-07-03 10:00 UTC (permalink / raw)
To: 'ABRAHAM, KISHON VIJAY'
Cc: balbi, gregkh, ben, linux-usb, linux-kernel
> Hi,
>
> On Tue, Jul 3, 2012 at 7:33 AM, Du, Changbin <changbin.du@gmail.com>
> wrote:
> > The timeout values were 1000 and timeout issue occured many times on my
> > s3c6410 Soc based board (mostly when booting whith USB cable not
> > connected). This patch increase the values to 10000 to guarantee the
> > success of reset.
> >
> > Having set timeout to 10000, I printed the remained timeout values
> > which can cause timeout issue before this change (tested several times):
> > the first timeout value remained:
> > timeout = 8079
> > timeout = 8079
> > timeout = 8078
> > timeout = 8081
> > the second timeout value remained:
> > timeout = 7940
> > timeout = 7945
> > timeout = 7940
> > timeout = 7938
> > Seeing from above values, I think 10000 is big enough.
> >
> > Signed-off-by: Du, Changbin <changbin.du@gmail.com>
> > ---
> > drivers/usb/gadget/s3c-hsotg.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/gadget/s3c-hsotg.c
b/drivers/usb/gadget/s3c-hsotg.c
> > index f4abb0e..f3e2234 100644
> > --- a/drivers/usb/gadget/s3c-hsotg.c
> > +++ b/drivers/usb/gadget/s3c-hsotg.c
> > @@ -2215,7 +2215,7 @@ static int s3c_hsotg_corereset(struct s3c_hsotg
> > *hsotg)
> > /* issue soft reset */
> > writel(GRSTCTL_CSftRst, hsotg->regs + GRSTCTL);
> >
> > - timeout = 1000;
> > + timeout = 10000;
> > do {
> > grstctl = readl(hsotg->regs + GRSTCTL);
> > } while ((grstctl & GRSTCTL_CSftRst) && timeout-- > 0);
>
> how about msleep inside the loop?
I don't know if that's ok! The datasheet just says:
Once this bit is cleared software must wait at least 3 PHY clocks before
doing any access to the PHY domain.
Software must also check that bit 31 of this register is 1 (AHB Master is
IDLE) before starting any operation.
But it doesn't say how long to wait. I don't know if it can sleep for a
while and then check the register's value.
In fact, sometimes the AHB Master will be IDLE quickly(even only need read
once), but sometimes may need
Much more time. To reduce the risk, keeping it in original way may be
better.
Thanks!
Du, Changbin
>
> Thanks
> Kishon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] usb: gadget: s3c-hsotg: fix core reset timeout failure
2012-07-03 2:03 [PATCH 1/1] usb: gadget: s3c-hsotg: fix core reset timeout failure Du, Changbin
2012-07-03 6:44 ` ABRAHAM, KISHON VIJAY
@ 2012-07-03 17:20 ` Sergei Shtylyov
2012-07-04 1:48 ` Du, Changbin
1 sibling, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2012-07-03 17:20 UTC (permalink / raw)
To: Du, Changbin; +Cc: balbi, gregkh, ben, linux-usb, linux-kernel
Hello.
On 07/03/2012 06:03 AM, Du, Changbin wrote:
> The timeout values were 1000 and timeout issue occured many times on my
> s3c6410 Soc based board (mostly when booting whith USB cable not
> connected). This patch increase the values to 10000 to guarantee the
> success of reset.
> Having set timeout to 10000, I printed the remained timeout values
> which can cause timeout issue before this change (tested several times):
> the first timeout value remained:
> timeout = 8079
> timeout = 8079
> timeout = 8078
> timeout = 8081
> the second timeout value remained:
> timeout = 7940
> timeout = 7945
> timeout = 7940
> timeout = 7938
> Seeing from above values, I think 10000 is big enough.
> Signed-off-by: Du, Changbin <changbin.du@gmail.com>
> ---
> drivers/usb/gadget/s3c-hsotg.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
> index f4abb0e..f3e2234 100644
> --- a/drivers/usb/gadget/s3c-hsotg.c
> +++ b/drivers/usb/gadget/s3c-hsotg.c
> @@ -2215,7 +2215,7 @@ static int s3c_hsotg_corereset(struct s3c_hsotg
> *hsotg)
Your patch is line wrapped; seems easy to fix manually while applying though...
WBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 1/1] usb: gadget: s3c-hsotg: fix core reset timeout failure
2012-07-03 17:20 ` Sergei Shtylyov
@ 2012-07-04 1:48 ` Du, Changbin
0 siblings, 0 replies; 5+ messages in thread
From: Du, Changbin @ 2012-07-04 1:48 UTC (permalink / raw)
To: 'Sergei Shtylyov'; +Cc: balbi, gregkh, ben, linux-usb, linux-kernel
> > Seeing from above values, I think 10000 is big enough.
>
> > Signed-off-by: Du, Changbin <changbin.du@gmail.com>
> > ---
> > drivers/usb/gadget/s3c-hsotg.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
>
> > diff --git a/drivers/usb/gadget/s3c-hsotg.c
b/drivers/usb/gadget/s3c-hsotg.c
> > index f4abb0e..f3e2234 100644
> > --- a/drivers/usb/gadget/s3c-hsotg.c
> > +++ b/drivers/usb/gadget/s3c-hsotg.c
> > @@ -2215,7 +2215,7 @@ static int s3c_hsotg_corereset(struct s3c_hsotg
> > *hsotg)
>
> Your patch is line wrapped; seems easy to fix manually while applying
> though...
Sorry, it's done by my mail client. I will send a new one soon. Thanks for
pointing out it.
Du, Changbin
>
> WBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-04 1:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-03 2:03 [PATCH 1/1] usb: gadget: s3c-hsotg: fix core reset timeout failure Du, Changbin
2012-07-03 6:44 ` ABRAHAM, KISHON VIJAY
2012-07-03 10:00 ` Du, Changbin
2012-07-03 17:20 ` Sergei Shtylyov
2012-07-04 1:48 ` Du, Changbin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox