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 <juha_motorsportcom@luukku.com>
Reviewed-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Tested-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>

authored by Kuninori Morimoto and committed by Paul Mundt 0ee50254 066069e1

+7 -7
+7 -7
arch/sh/kernel/cpu/sh4a/setup-sh7786.c
··· 143 143 * Set the PHY and PLL enable bit 144 144 */ 145 145 __raw_writel(PHY_ENB | PLL_ENB, USBPCTL1); 146 - while (i-- && 147 - ((__raw_readl(USBST) & ACT_PLL_STATUS) != ACT_PLL_STATUS)) 146 + while (i--) { 147 + if (ACT_PLL_STATUS == (__raw_readl(USBST) & ACT_PLL_STATUS)) { 148 + /* Set the PHY RST bit */ 149 + __raw_writel(PHY_ENB | PLL_ENB | PHY_RST, USBPCTL1); 150 + printk(KERN_INFO "sh7786 usb setup done\n"); 151 + break; 152 + } 148 153 cpu_relax(); 149 - 150 - if (i) { 151 - /* Set the PHY RST bit */ 152 - __raw_writel(PHY_ENB | PLL_ENB | PHY_RST, USBPCTL1); 153 - printk(KERN_INFO "sh7786 usb setup done\n"); 154 154 } 155 155 } 156 156