aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuninori Morimoto <[email protected]>2009-04-10 00:54:07 +0000
committerPaul Mundt <[email protected]>2009-04-14 07:25:35 +0900
commit0ee50254dfe0c96f9eef4fc9fdf47a18d6a12df3 (patch)
treee5dd3e586d13e3aa4b454152ad4606eff81c57b7
parent066069e14f6b4651293ae0865c121bcb2b360666 (diff)
sh: sh7786: modify usb setup timeout judgment bug.
This corrects a race with the PHY RST bit not being set properly if the PLL status changes right before timeout. This resulted in it potentially failing even if the device came up in time. Special thanks to Mr. Juha Leppanen and Iwamatsu-san for reporting this out and reviewing it. Reported-by: Juha Leppanen <[email protected]> Reviewed-by: Nobuhiro Iwamatsu <[email protected]> Tested-by: Paul Mundt <[email protected]> Signed-off-by: Kuninori Morimoto <[email protected]> Signed-off-by: Paul Mundt <[email protected]>
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7786.c14
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 5a47e1cf442e..90e8cfff55fd 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");
}
}