public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] sh7786: modify usb setup timeout judgment bug.
@ 2009-04-10  0:54 Kuninori Morimoto
  2009-04-13 22:10 ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Kuninori Morimoto @ 2009-04-10  0:54 UTC (permalink / raw)
  To: linux-sh

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 and Iwamatsu-san 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 ?

>> Michael
I will try to create patch which skip setup if bootloader is already done.
please wait.

v1 -> v2

o Set the PHY RST bit in "while loop".
  Thank you Iwamatsu-san
o Add Iwamatsu-san's name in patch explanation area

 arch/sh/kernel/cpu/sh4a/setup-sh7786.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
index 5a47e1c..90e8cff 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
@@ -143,14 +143,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--) {
+		if (ACT_PLL_STATUS = (__raw_readl(USBST) & ACT_PLL_STATUS)) {
+			/* Set the PHY RST bit */
+			__raw_writel(PHY_ENB | PLL_ENB | PHY_RST, USBPCTL1);
+			printk(KERN_INFO "sh7786 usb setup done\n");
+			break;
+		}
 		cpu_relax();
-
-	if (i) {
-		/* Set the PHY RST bit */
-		__raw_writel(PHY_ENB | PLL_ENB | PHY_RST, USBPCTL1);
-		printk(KERN_INFO "sh7786 usb setup done\n");
 	}
 }
 
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] sh7786: modify usb setup timeout judgment bug.
  2009-04-10  0:54 [PATCH v2] sh7786: modify usb setup timeout judgment bug Kuninori Morimoto
@ 2009-04-13 22:10 ` Paul Mundt
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2009-04-13 22:10 UTC (permalink / raw)
  To: linux-sh

On Fri, Apr 10, 2009 at 09:54:07AM +0900, 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 and Iwamatsu-san 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 ?
> 
Ok, back in the office now. Yes, this works fine. I'll add a Reviewed-by
for Iwamatsu-san.

> >> Michael
> I will try to create patch which skip setup if bootloader is already done.
> please wait.
> 
Since this current patches addresses a bug, I'll check this in as it is.
If you want to post an incremental patch implementing Michael's
suggestion on top of this, we can roll that in to a later update.

You might want to make sure you aren't stepping on anything Shimoda-san
is doing though with his fix aimed at the host controller drivers.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-13 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-10  0:54 [PATCH v2] sh7786: modify usb setup timeout judgment bug Kuninori Morimoto
2009-04-13 22:10 ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox