From patchwork Thu Apr 9 06:09:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nobuhiro Iwamatsu X-Patchwork-Id: 17335 X-Patchwork-Delegate: lethal@linux-sh.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3969BdY002353 for ; Thu, 9 Apr 2009 06:09:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753952AbZDIGJK (ORCPT ); Thu, 9 Apr 2009 02:09:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754440AbZDIGJK (ORCPT ); Thu, 9 Apr 2009 02:09:10 -0400 Received: from mail.renesas.com ([202.234.163.13]:49152 "EHLO mail03.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753952AbZDIGJJ (ORCPT ); Thu, 9 Apr 2009 02:09:09 -0400 X-AuditID: ac140386-0000000600001aa8-e4-49dd91007f85 Received: from guardian01.idc.renesas.com ([172.20.8.200]) by mail03.idc.renesas.com (sendmail) with ESMTP id n39694hq013110; Thu, 9 Apr 2009 15:09:04 +0900 (JST) Received: (from root@localhost) by guardian01.idc.renesas.com with id n39694be026745; Thu, 9 Apr 2009 15:09:04 +0900 (JST) Received: from mta03.idc.renesas.com (localhost [127.0.0.1]) by mta03.idc.renesas.com with ESMTP id n39695co028208; Thu, 9 Apr 2009 15:09:05 +0900 (JST) Received: from [172.30.8.158] by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KHT008VIL33MS@ims05.idc.renesas.com>; Thu, 09 Apr 2009 15:09:04 +0900 (JST) Date: Thu, 09 Apr 2009 15:09:03 +0900 From: Nobuhiro Iwamatsu Subject: Re: [PATCH] sh7786: modify usb setup timeout judgment bug. In-reply-to: To: Kuninori Morimoto Cc: Paul Mundt , SH-Linux , juha_motorsportcom@luukku.com Message-id: <49DD90FF.3030906@renesas.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit User-Agent: Thunderbird 1.5.0.14 (Windows/20071210) References: X-Brightmail-Tracker: AAAAAA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 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 for nice advice. > > Reported-by: "Juha Leppanen" > Signed-off-by: Kuninori Morimoto > --- >> 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"); I think this line to be able to be in while. Best regards, Nobuhiro ----- 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..08dcec5 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,14 +144,15 @@ 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) { + /* 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"); } } -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in