public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Trimarchi <trimarchi@gandalf.sssup.it>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] sh7786: modify usb setup timeout judgment bug.
Date: Thu, 09 Apr 2009 06:17:44 +0000	[thread overview]
Message-ID: <49DD9308.4030701@gandalf.sssup.it> (raw)
In-Reply-To: <uzleql7ud.wl%morimoto.kuninori@renesas.com>

Hi,

Kuninori Morimoto wrote:
> Timeout counter "i" can reach -1 if USB setup isn't done.
> And "i" can be 0 if USB setup is done when last possible moment.
> Then it is judged to fail though setup is done.
> This patch modify this problem.
> Special thanks to Mr. Juha Leppanen for nice advice.
>
> Reported-by: "Juha Leppanen" <juha_motorsportcom@luukku.com>
> Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
> ---
>   
>> Paul
>>     
> Can you test this patch on Urquell board please ?
>
>  arch/sh/kernel/cpu/sh4a/setup-sh7786.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
> index 5a47e1c..ee30e68 100644
> --- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
> +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
> @@ -127,6 +127,7 @@ void __init sh7786_usb_use_exclock(void)
>  static void __init sh7786_usb_setup(void)
>  {
>  	int i = 1000000;
> +	u32 val;
>  
>  	/*
>  	 * USB initial settings
> @@ -143,11 +144,14 @@ static void __init sh7786_usb_setup(void)
>  	 * Set the PHY and PLL enable bit
>  	 */
>  	__raw_writel(PHY_ENB | PLL_ENB, USBPCTL1);
> -	while (i-- &&
> -	       ((__raw_readl(USBST) & ACT_PLL_STATUS) != ACT_PLL_STATUS))
> +	while (i--) {
> +		val = __raw_readl(USBST) & ACT_PLL_STATUS;
> +		if (ACT_PLL_STATUS = val)
> +			break;
>  		cpu_relax();
> +	}
>  
> -	if (i) {
> +	if (ACT_PLL_STATUS = val) {
>  		/* Set the PHY RST bit */
>  		__raw_writel(PHY_ENB | PLL_ENB | PHY_RST, USBPCTL1);
>  		printk(KERN_INFO "sh7786 usb setup done\n");
>   
I think that this initialization function maybe pass to the platform 
data of the
usb driver. Give a change to go ahead and deferrable the inizialization 
of the system.
So during the bootup we can avoid the "while loop". What is exaclty 100000?

Michael

  parent reply	other threads:[~2009-04-09  6:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-09  4:38 [PATCH] sh7786: modify usb setup timeout judgment bug Kuninori Morimoto
2009-04-09  6:09 ` Nobuhiro Iwamatsu
2009-04-09  6:17 ` Michael Trimarchi [this message]
2009-04-09  8:12 ` morimoto.kuninori
2009-04-09  8:29 ` Michael Trimarchi
2009-04-09  8:36 ` morimoto.kuninori
2009-04-09  8:41 ` Michael Trimarchi
2009-04-09  9:09 ` morimoto.kuninori
2009-04-09  9:42 ` Yoshihiro Shimoda
2009-04-09 10:04 ` Michael Trimarchi
2009-04-09 11:08 ` Yoshihiro Shimoda
2009-04-09 15:09 ` Paul Mundt
2009-04-10  0:27 ` morimoto.kuninori
2009-04-10  1:24 ` Yoshihiro Shimoda
2009-04-10  4:56 ` morimoto.kuninori
2009-04-10 22:22 ` Paul Mundt

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=49DD9308.4030701@gandalf.sssup.it \
    --to=trimarchi@gandalf.sssup.it \
    --cc=linux-sh@vger.kernel.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox