linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: otg: OMAP4430: Fix omap4430_phy_init function
@ 2011-03-24 11:06 Hema HK
  2011-03-24 11:08 ` Felipe Balbi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Hema HK @ 2011-03-24 11:06 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, Hema HK

omap4430_phy_init() function can be called with no device pointer
to powerdown the UTMI PHY during board init when USB is disabled.
Fix the function accordingly.

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
---
 arch/arm/mach-omap2/omap_phy_internal.c |   44 ++++++++++++++++--------------
 1 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index e2e605f..a959e2f 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -50,34 +50,36 @@ int omap4430_phy_init(struct device *dev)
 {
 	ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
 	if (!ctrl_base) {
-		dev_err(dev, "control module ioremap failed\n");
+		printk(KERN_ERR "control module ioremap failed\n");
 		return -ENOMEM;
 	}
 	/* Power down the phy */
 	__raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
-	phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
 
-	if (IS_ERR(phyclk)) {
-		dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n");
-		iounmap(ctrl_base);
-		return PTR_ERR(phyclk);
-	}
+	if (dev) {
+		phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
+		if (IS_ERR(phyclk)) {
+			dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n");
+			iounmap(ctrl_base);
+			return PTR_ERR(phyclk);
+		}
 
-	clk48m = clk_get(dev, "ocp2scp_usb_phy_phy_48m");
-	if (IS_ERR(clk48m)) {
-		dev_err(dev, "cannot clk_get ocp2scp_usb_phy_phy_48m\n");
-		clk_put(phyclk);
-		iounmap(ctrl_base);
-		return PTR_ERR(clk48m);
-	}
+		clk48m = clk_get(dev, "ocp2scp_usb_phy_phy_48m");
+		if (IS_ERR(clk48m)) {
+			dev_err(dev, "cannot clk_get ocp2scp_usb_phy_phy_48m\n");
+			clk_put(phyclk);
+			iounmap(ctrl_base);
+			return PTR_ERR(clk48m);
+		}
 
-	clk32k = clk_get(dev, "usb_phy_cm_clk32k");
-	if (IS_ERR(clk32k)) {
-		dev_err(dev, "cannot clk_get usb_phy_cm_clk32k\n");
-		clk_put(phyclk);
-		clk_put(clk48m);
-		iounmap(ctrl_base);
-		return PTR_ERR(clk32k);
+		clk32k = clk_get(dev, "usb_phy_cm_clk32k");
+		if (IS_ERR(clk32k)) {
+			dev_err(dev, "cannot clk_get usb_phy_cm_clk32k\n");
+			clk_put(phyclk);
+			clk_put(clk48m);
+			iounmap(ctrl_base);
+			return PTR_ERR(clk32k);
+		}
 	}
 	return 0;
 }
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/2] usb: otg: OMAP4430: Fix omap4430_phy_init function
  2011-03-24 11:06 [PATCH 1/2] usb: otg: OMAP4430: Fix omap4430_phy_init function Hema HK
@ 2011-03-24 11:08 ` Felipe Balbi
       [not found]   ` <20110324110824.GH14602-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
  2011-03-24 13:17 ` Sergei Shtylyov
       [not found] ` <1300964764-6794-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
  2 siblings, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2011-03-24 11:08 UTC (permalink / raw)
  To: Hema HK; +Cc: linux-usb, linux-omap

On Thu, Mar 24, 2011 at 04:36:04PM +0530, Hema HK wrote:
> omap4430_phy_init() function can be called with no device pointer
> to powerdown the UTMI PHY during board init when USB is disabled.
> Fix the function accordingly.
> 
> Signed-off-by: Hema HK <hemahk@ti.com>
> ---
>  arch/arm/mach-omap2/omap_phy_internal.c |   44 ++++++++++++++++--------------
>  1 files changed, 23 insertions(+), 21 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
> index e2e605f..a959e2f 100644
> --- a/arch/arm/mach-omap2/omap_phy_internal.c
> +++ b/arch/arm/mach-omap2/omap_phy_internal.c
> @@ -50,34 +50,36 @@ int omap4430_phy_init(struct device *dev)
>  {
>  	ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
>  	if (!ctrl_base) {
> -		dev_err(dev, "control module ioremap failed\n");
> +		printk(KERN_ERR "control module ioremap failed\n");

use pr_err()

>  		return -ENOMEM;
>  	}
>  	/* Power down the phy */
>  	__raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
> -	phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
>  
> -	if (IS_ERR(phyclk)) {
> -		dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n");
> -		iounmap(ctrl_base);
> -		return PTR_ERR(phyclk);
> -	}
> +	if (dev) {

you can avoid this nesting level:

if (!dev)
	return;

-- 
balbi

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

* RE: [PATCH 1/2] usb: otg: OMAP4430: Fix omap4430_phy_init function
       [not found]   ` <20110324110824.GH14602-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
@ 2011-03-24 11:15     ` Hema Kalliguddi
  0 siblings, 0 replies; 6+ messages in thread
From: Hema Kalliguddi @ 2011-03-24 11:15 UTC (permalink / raw)
  To: balbi-l0cyMroinI0
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

>-----Original Message-----
>From: Felipe Balbi [mailto:balbi-l0cyMroinI0@public.gmane.org]
>Sent: Thursday, March 24, 2011 4:38 PM
>To: Hema HK
>Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>Subject: Re: [PATCH 1/2] usb: otg: OMAP4430: Fix
>omap4430_phy_init function
>
>On Thu, Mar 24, 2011 at 04:36:04PM +0530, Hema HK wrote:
>> omap4430_phy_init() function can be called with no device pointer
>> to powerdown the UTMI PHY during board init when USB is disabled.
>> Fix the function accordingly.
>>
>> Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
>> ---
>>  arch/arm/mach-omap2/omap_phy_internal.c |   44
>++++++++++++++++--------------
>>  1 files changed, 23 insertions(+), 21 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/omap_phy_internal.c
>b/arch/arm/mach-omap2/omap_phy_internal.c
>> index e2e605f..a959e2f 100644
>> --- a/arch/arm/mach-omap2/omap_phy_internal.c
>> +++ b/arch/arm/mach-omap2/omap_phy_internal.c
>> @@ -50,34 +50,36 @@ int omap4430_phy_init(struct device *dev)
>>  {
>>  	ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
>>  	if (!ctrl_base) {
>> -		dev_err(dev, "control module ioremap failed\n");
>> +		printk(KERN_ERR "control module ioremap failed\n");
>
>use pr_err()

OK.
>
>>  		return -ENOMEM;
>>  	}
>>  	/* Power down the phy */
>>  	__raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
>> -	phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
>>
>> -	if (IS_ERR(phyclk)) {
>> -		dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n");
>> -		iounmap(ctrl_base);
>> -		return PTR_ERR(phyclk);
>> -	}
>> +	if (dev) {
>
>you can avoid this nesting level:
>
>if (!dev)
>	return;

:-) Yes.

Regards,
Hema
>
>--
>balbi
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/2] usb: otg: OMAP4430: Fix omap4430_phy_init function
  2011-03-24 11:06 [PATCH 1/2] usb: otg: OMAP4430: Fix omap4430_phy_init function Hema HK
  2011-03-24 11:08 ` Felipe Balbi
@ 2011-03-24 13:17 ` Sergei Shtylyov
       [not found]   ` <4D8B4482.4040506-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
       [not found] ` <1300964764-6794-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
  2 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2011-03-24 13:17 UTC (permalink / raw)
  To: Hema HK; +Cc: linux-usb, linux-omap

Hello.

On 24-03-2011 14:06, Hema HK wrote:

> omap4430_phy_init() function can be called with no device pointer
> to powerdown the UTMI PHY during board init when USB is disabled.
> Fix the function accordingly.

> Signed-off-by: Hema HK<hemahk@ti.com>
> ---
>   arch/arm/mach-omap2/omap_phy_internal.c |   44 ++++++++++++++++--------------
>   1 files changed, 23 insertions(+), 21 deletions(-)

> diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
> index e2e605f..a959e2f 100644
> --- a/arch/arm/mach-omap2/omap_phy_internal.c
> +++ b/arch/arm/mach-omap2/omap_phy_internal.c
> @@ -50,34 +50,36 @@ int omap4430_phy_init(struct device *dev)
>   {
>   	ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
>   	if (!ctrl_base) {
> -		dev_err(dev, "control module ioremap failed\n");
> +		printk(KERN_ERR "control module ioremap failed\n");

    Use pr_err().

>   		return -ENOMEM;
>   	}
>   	/* Power down the phy */
>   	__raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
> -	phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
>
> -	if (IS_ERR(phyclk)) {
> -		dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n");
> -		iounmap(ctrl_base);
> -		return PTR_ERR(phyclk);
> -	}
> +	if (dev) {
> +		phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");

    Couldn't clk_get() be called with NULL device ptr?

WBR, Sergei

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

* RE: [PATCH 1/2] usb: otg: OMAP4430: Fix omap4430_phy_init function
       [not found]   ` <4D8B4482.4040506-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
@ 2011-03-25  7:18     ` Hema Kalliguddi
  0 siblings, 0 replies; 6+ messages in thread
From: Hema Kalliguddi @ 2011-03-25  7:18 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

Hi,

>-----Original Message-----
>From: Sergei Shtylyov [mailto:sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org]
>Sent: Thursday, March 24, 2011 6:48 PM
>To: Hema HK
>Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>Subject: Re: [PATCH 1/2] usb: otg: OMAP4430: Fix
>omap4430_phy_init function
>
>Hello.
>
>On 24-03-2011 14:06, Hema HK wrote:
>
>> omap4430_phy_init() function can be called with no device pointer
>> to powerdown the UTMI PHY during board init when USB is disabled.
>> Fix the function accordingly.
>
>> Signed-off-by: Hema HK<hemahk-l0cyMroinI0@public.gmane.org>
>> ---
>>   arch/arm/mach-omap2/omap_phy_internal.c |   44
>++++++++++++++++--------------
>>   1 files changed, 23 insertions(+), 21 deletions(-)
>
>> diff --git a/arch/arm/mach-omap2/omap_phy_internal.c
>b/arch/arm/mach-omap2/omap_phy_internal.c
>> index e2e605f..a959e2f 100644
>> --- a/arch/arm/mach-omap2/omap_phy_internal.c
>> +++ b/arch/arm/mach-omap2/omap_phy_internal.c
>> @@ -50,34 +50,36 @@ int omap4430_phy_init(struct device *dev)
>>   {
>>   	ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
>>   	if (!ctrl_base) {
>> -		dev_err(dev, "control module ioremap failed\n");
>> +		printk(KERN_ERR "control module ioremap failed\n");
>
>    Use pr_err().

This is fixed in the next version of the patch submitted yesterday.

>
>>   		return -ENOMEM;
>>   	}
>>   	/* Power down the phy */
>>   	__raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
>> -	phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
>>
>> -	if (IS_ERR(phyclk)) {
>> -		dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n");
>> -		iounmap(ctrl_base);
>> -		return PTR_ERR(phyclk);
>> -	}
>> +	if (dev) {
>> +		phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
>
>    Couldn't clk_get() be called with NULL device ptr?

Can be called with NULL pointer, but there will be issue with dev_err.
And moreover, when there is no device built, there is no point in getting
the clocks.

This function is called with NULL dev pointer only when there is no
device built but has to powerdown the PHY.

Regards,
Hema
>
>WBR, Sergei
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/2] usb: otg: OMAP4430: Fix omap4430_phy_init function
       [not found] ` <1300964764-6794-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
@ 2011-03-28 21:19   ` Tony Lindgren
  0 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2011-03-28 21:19 UTC (permalink / raw)
  To: Hema HK; +Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

* Hema HK <hemahk-l0cyMroinI0@public.gmane.org> [110324 04:03]:
> omap4430_phy_init() function can be called with no device pointer
> to powerdown the UTMI PHY during board init when USB is disabled.
> Fix the function accordingly.

I don't think this is the case any longer, see merge commit
0df0914d414a504b975f3cc66ace0c16ef55b7f3.

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-03-28 21:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-24 11:06 [PATCH 1/2] usb: otg: OMAP4430: Fix omap4430_phy_init function Hema HK
2011-03-24 11:08 ` Felipe Balbi
     [not found]   ` <20110324110824.GH14602-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-03-24 11:15     ` Hema Kalliguddi
2011-03-24 13:17 ` Sergei Shtylyov
     [not found]   ` <4D8B4482.4040506-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2011-03-25  7:18     ` Hema Kalliguddi
     [not found] ` <1300964764-6794-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
2011-03-28 21:19   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).