Message ID | uskkdh0oz.wl%morimoto.kuninori@renesas.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Paul Mundt |
Headers | show |
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. -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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"); } }