public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Hema Kalliguddi <hemahk@ti.com>
To: balbi@ti.com
Cc: linux-omap@vger.kernel.org, linux-usb@vger.kernel.org,
	Tony Lindgren <tony@atomide.com>,
	Kevin Hilman <khilman@deeprootsystems.com>,
	Benoit Cousson <b-cousson@ti.com>, Paul Walmsley <paul@pwsan.com>
Subject: RE: [PATCH 5/5 v6] usb: musb: Using runtime pm APIs for musb.
Date: Thu, 10 Feb 2011 22:09:45 +0530	[thread overview]
Message-ID: <98ff144ea4e715250c54712ebbfb494f@mail.gmail.com> (raw)
In-Reply-To: <20110210142605.GR3580@legolas.emea.dhcp.ti.com>

 Hi,

>-----Original Message-----
>From: Felipe Balbi [mailto:balbi@ti.com]
>Sent: Thursday, February 10, 2011 7:56 PM
>To: Hema HK
>Cc: linux-omap@vger.kernel.org; linux-usb@vger.kernel.org;
>Felipe Balbi; Tony Lindgren; Kevin Hilman; Cousson, Benoit;
>Paul Walmsley
>Subject: Re: [PATCH 5/5 v6] usb: musb: Using runtime pm APIs for musb.
>
>Hi,
>
>On Thu, Feb 10, 2011 at 07:38:01PM +0530, Hema HK wrote:
>> Calling runtime pm APIs pm_runtime_put_sync() and
>pm_runtime_get_sync()
>> for enabling/disabling the clocks, sysconfig settings.
>>
>> Enable clock, configure no-idle/standby when active and
>configure force idle/standby
>> and disable clock when idled. This is taken care by the
>runtime framework when
>> driver calls the pm_runtime_get_sync and pm_runtime_put_sync APIs.
>
>does it have to be the _sync() ??
Yes. Because immediately after this I access the registers.

>
>> Index: linux-2.6/drivers/usb/musb/omap2430.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/usb/musb/omap2430.c
>> +++ linux-2.6/drivers/usb/musb/omap2430.c
>> @@ -33,6 +33,8 @@
>>  #include <linux/io.h>
>>  #include <linux/platform_device.h>
>>  #include <linux/dma-mapping.h>
>> +#include <linux/pm_runtime.h>
>> +#include <linux/err.h>
>>
>>  #include "musb_core.h"
>>  #include "omap2430.h"
>> @@ -40,7 +42,6 @@
>>  struct omap2430_glue {
>>  	struct device		*dev;
>>  	struct platform_device	*musb;
>> -	struct clk		*clk;
>>  };
>>  #define glue_to_musb(g)		platform_get_drvdata(g->musb)
>>
>> @@ -216,20 +217,12 @@ static inline void omap2430_low_level_ex
>>  	l = musb_readl(musb->mregs, OTG_FORCESTDBY);
>>  	l |= ENABLEFORCE;	/* enable MSTANDBY */
>>  	musb_writel(musb->mregs, OTG_FORCESTDBY, l);
>> -
>> -	l = musb_readl(musb->mregs, OTG_SYSCONFIG);
>> -	l |= ENABLEWAKEUP;	/* enable wakeup */
>> -	musb_writel(musb->mregs, OTG_SYSCONFIG, l);
>>  }
>>
>>  static inline void omap2430_low_level_init(struct musb *musb)
>>  {
>>  	u32 l;
>>
>> -	l = musb_readl(musb->mregs, OTG_SYSCONFIG);
>> -	l &= ~ENABLEWAKEUP;	/* disable wakeup */
>> -	musb_writel(musb->mregs, OTG_SYSCONFIG, l);
>> -
>>  	l = musb_readl(musb->mregs, OTG_FORCESTDBY);
>>  	l &= ~ENABLEFORCE;	/* disable MSTANDBY */
>>  	musb_writel(musb->mregs, OTG_FORCESTDBY, l);
>> @@ -309,21 +302,6 @@ static int omap2430_musb_init(struct mus
>>
>>  	omap2430_low_level_init(musb);
>>
>> -	l = musb_readl(musb->mregs, OTG_SYSCONFIG);
>> -	l &= ~ENABLEWAKEUP;	/* disable wakeup */
>> -	l &= ~NOSTDBY;		/* remove possible nostdby */
>> -	l |= SMARTSTDBY;	/* enable smart standby */
>> -	l &= ~AUTOIDLE;		/* disable auto idle */
>> -	l &= ~NOIDLE;		/* remove possible noidle */
>> -	l |= SMARTIDLE;		/* enable smart idle */
>> -	/*
>> -	 * MUSB AUTOIDLE don't work in 3430.
>> -	 * Workaround by Richard Woodruff/TI
>> -	 */
>> -	if (!cpu_is_omap3430())
>> -		l |= AUTOIDLE;		/* enable auto idle */
>
>is this taken care somewhere else ?

Yes. In HWMOD data structure, there is a flag defined.
>
>> @@ -431,28 +395,30 @@ static int __init omap2430_probe(struct
>>  			pdev->num_resources);
>>  	if (ret) {
>>  		dev_err(&pdev->dev, "failed to add resources\n");
>> -		goto err4;
>> +		goto err2;
>>  	}
>>
>>  	ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
>>  	if (ret) {
>>  		dev_err(&pdev->dev, "failed to add platform_data\n");
>> -		goto err4;
>> +		goto err2;
>>  	}
>>
>>  	ret = platform_device_add(musb);
>>  	if (ret) {
>>  		dev_err(&pdev->dev, "failed to register musb device\n");
>> -		goto err4;
>> +		goto err2;
>>  	}
>>
>> -	return 0;
>> +	pm_runtime_enable(&pdev->dev);
>> +	if (pm_runtime_get_sync(&pdev->dev) < 0) {
>
>you have the status variable, so how about:
>
>status = pm_runtime_get_sync(&pdev->dev);
>if (status < 0) {

>
>??
>
Can be done.

>> +		dev_err(&pdev->dev, "pm_runtime_get_sync FAILED");
>> +		pm_runtime_disable(&pdev->dev);
>
>move the pm_runtime_disable() to err3, maybe. Then just call goto err3
>here.

Yes.

Regards,
Hema
>
>--
>balbi
>

  reply	other threads:[~2011-02-10 16:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10 14:07 Subject: [PATCH 0/5 v6]usb: musb: hwmod and runtime pm support for musb Hema HK
     [not found] ` <1297346881-13438-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
2011-02-10 14:07   ` [PATCH 1/5 v6] OMAP2430: hwmod data: Add USBOTG Hema HK
2011-02-10 14:08   ` [PATCH 4/5 v6] OMAP2+: musb: HWMOD adaptation for musb. registration Hema HK
     [not found]     ` <1297346881-13438-5-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
2011-02-15  0:15       ` Kevin Hilman
     [not found]         ` <87vd0mw3u9.fsf-l0cyMroinI0@public.gmane.org>
2011-02-15  6:30           ` Hema Kalliguddi
2011-02-15  8:32         ` Felipe Balbi
2011-02-15 16:12           ` Kevin Hilman
     [not found]             ` <87r5b9uvj8.fsf-l0cyMroinI0@public.gmane.org>
2011-02-16 10:57               ` Hema Kalliguddi
2011-02-10 14:08   ` [PATCH 5/5 v6] usb: musb: Using runtime pm APIs for musb Hema HK
2011-02-10 14:26     ` Felipe Balbi
2011-02-10 16:39       ` Hema Kalliguddi [this message]
2011-02-15  0:42         ` Kevin Hilman
     [not found]           ` <87oc6ew2lh.fsf-l0cyMroinI0@public.gmane.org>
2011-02-15  4:01             ` Kalliguddi, Hema
2011-02-10 14:07 ` [PATCH 2/5 v6] OMAP3xxx: hwmod data: Add USBOTG Hema HK
2011-02-10 14:07 ` [PATCH 3/5 v6] OMAP4430: hwmod data: Adding USBOTG Hema HK

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98ff144ea4e715250c54712ebbfb494f@mail.gmail.com \
    --to=hemahk@ti.com \
    --cc=b-cousson@ti.com \
    --cc=balbi@ti.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox