public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh7786: modify usb setup timeout judgment bug.
@ 2009-04-09  4:38 Kuninori Morimoto
  2009-04-09  6:09 ` Nobuhiro Iwamatsu
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2009-04-09  4:38 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 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");
-- 
1.5.6.3


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

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

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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