Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1713353 > unrolled thread

[PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver

Started byFranklin S Cooper Jr <fcooper@ti.com>
First post2017-08-17 00:00 +0200
Last post2017-08-17 14:40 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver Franklin S Cooper Jr <fcooper@ti.com> - 2017-08-17 00:00 +0200
    Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to  DWC3 Keystone USB driver Roger Quadros <rogerq@ti.com> - 2017-08-17 09:20 +0200
    Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver Felipe Balbi <balbi@kernel.org> - 2017-08-17 14:10 +0200
      Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to  DWC3 Keystone USB driver Franklin S Cooper Jr <fcooper@ti.com> - 2017-08-17 14:30 +0200
        Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver Felipe Balbi <balbi@kernel.org> - 2017-08-17 14:40 +0200

#1713353 — [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver

FromFranklin S Cooper Jr <fcooper@ti.com>
Date2017-08-17 00:00 +0200
Subject[PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
Message-ID<ufew1-3ZQ-3@gated-at.bofh.it>
For 66AK2Gx there is a requirement to use PM Runtime to properly manage
clocks and the power domains. Therefore, add PM runtime support. Remove
legacy clock api's calls since other users of this driver worked without
these clock apis calls.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
---
 drivers/usb/dwc3/dwc3-keystone.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c
index 12ee23f..d2ed952 100644
--- a/drivers/usb/dwc3/dwc3-keystone.c
+++ b/drivers/usb/dwc3/dwc3-keystone.c
@@ -15,7 +15,6 @@
  * GNU General Public License for more details.
  */
 
-#include <linux/clk.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
@@ -23,6 +22,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/of_platform.h>
+#include <linux/pm_runtime.h>
 
 /* USBSS register offsets */
 #define USBSS_REVISION		0x0000
@@ -41,7 +41,6 @@
 
 struct dwc3_keystone {
 	struct device			*dev;
-	struct clk			*clk;
 	void __iomem			*usbss;
 };
 
@@ -106,17 +105,13 @@ static int kdwc3_probe(struct platform_device *pdev)
 	if (IS_ERR(kdwc->usbss))
 		return PTR_ERR(kdwc->usbss);
 
-	kdwc->clk = devm_clk_get(kdwc->dev, "usb");
-	if (IS_ERR(kdwc->clk)) {
-		dev_err(kdwc->dev, "unable to get usb clock\n");
-		return PTR_ERR(kdwc->clk);
-	}
+	pm_runtime_enable(kdwc->dev);
 
-	error = clk_prepare_enable(kdwc->clk);
+	error = pm_runtime_get_sync(kdwc->dev);
 	if (error < 0) {
-		dev_err(kdwc->dev, "unable to enable usb clock, error %d\n",
+		dev_err(kdwc->dev, "pm_runtime_get_sync failed, error %d\n",
 			error);
-		return error;
+		goto err_irq;
 	}
 
 	irq = platform_get_irq(pdev, 0);
@@ -147,7 +142,8 @@ static int kdwc3_probe(struct platform_device *pdev)
 err_core:
 	kdwc3_disable_irqs(kdwc);
 err_irq:
-	clk_disable_unprepare(kdwc->clk);
+	pm_runtime_put_sync(kdwc->dev);
+	pm_runtime_disable(kdwc->dev);
 
 	return error;
 }
@@ -167,7 +163,9 @@ static int kdwc3_remove(struct platform_device *pdev)
 
 	kdwc3_disable_irqs(kdwc);
 	device_for_each_child(&pdev->dev, NULL, kdwc3_remove_core);
-	clk_disable_unprepare(kdwc->clk);
+	pm_runtime_put_sync(kdwc->dev);
+	pm_runtime_disable(kdwc->dev);
+
 	platform_set_drvdata(pdev, NULL);
 
 	return 0;
-- 
2.9.4.dirty

[toc] | [next] | [standalone]


#1713583 — Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver

FromRoger Quadros <rogerq@ti.com>
Date2017-08-17 09:20 +0200
SubjectRe: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
Message-ID<ufnfY-1uW-13@gated-at.bofh.it>
In reply to#1713353

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

On 17/08/17 00:54, Franklin S Cooper Jr wrote:
> For 66AK2Gx there is a requirement to use PM Runtime to properly manage
> clocks and the power domains. Therefore, add PM runtime support. Remove
> legacy clock api's calls since other users of this driver worked without
> these clock apis calls.
> 
> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>

Acked-by: Roger Quadros <rogerq@ti.com>

> ---
>  drivers/usb/dwc3/dwc3-keystone.c | 22 ++++++++++------------
>  1 file changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c
> index 12ee23f..d2ed952 100644
> --- a/drivers/usb/dwc3/dwc3-keystone.c
> +++ b/drivers/usb/dwc3/dwc3-keystone.c
> @@ -15,7 +15,6 @@
>   * GNU General Public License for more details.
>   */
>  
> -#include <linux/clk.h>
>  #include <linux/module.h>
>  #include <linux/kernel.h>
>  #include <linux/interrupt.h>
> @@ -23,6 +22,7 @@
>  #include <linux/dma-mapping.h>
>  #include <linux/io.h>
>  #include <linux/of_platform.h>
> +#include <linux/pm_runtime.h>
>  
>  /* USBSS register offsets */
>  #define USBSS_REVISION		0x0000
> @@ -41,7 +41,6 @@
>  
>  struct dwc3_keystone {
>  	struct device			*dev;
> -	struct clk			*clk;
>  	void __iomem			*usbss;
>  };
>  
> @@ -106,17 +105,13 @@ static int kdwc3_probe(struct platform_device *pdev)
>  	if (IS_ERR(kdwc->usbss))
>  		return PTR_ERR(kdwc->usbss);
>  
> -	kdwc->clk = devm_clk_get(kdwc->dev, "usb");
> -	if (IS_ERR(kdwc->clk)) {
> -		dev_err(kdwc->dev, "unable to get usb clock\n");
> -		return PTR_ERR(kdwc->clk);
> -	}
> +	pm_runtime_enable(kdwc->dev);
>  
> -	error = clk_prepare_enable(kdwc->clk);
> +	error = pm_runtime_get_sync(kdwc->dev);
>  	if (error < 0) {
> -		dev_err(kdwc->dev, "unable to enable usb clock, error %d\n",
> +		dev_err(kdwc->dev, "pm_runtime_get_sync failed, error %d\n",
>  			error);
> -		return error;
> +		goto err_irq;
>  	}
>  
>  	irq = platform_get_irq(pdev, 0);
> @@ -147,7 +142,8 @@ static int kdwc3_probe(struct platform_device *pdev)
>  err_core:
>  	kdwc3_disable_irqs(kdwc);
>  err_irq:
> -	clk_disable_unprepare(kdwc->clk);
> +	pm_runtime_put_sync(kdwc->dev);
> +	pm_runtime_disable(kdwc->dev);
>  
>  	return error;
>  }
> @@ -167,7 +163,9 @@ static int kdwc3_remove(struct platform_device *pdev)
>  
>  	kdwc3_disable_irqs(kdwc);
>  	device_for_each_child(&pdev->dev, NULL, kdwc3_remove_core);
> -	clk_disable_unprepare(kdwc->clk);
> +	pm_runtime_put_sync(kdwc->dev);
> +	pm_runtime_disable(kdwc->dev);
> +
>  	platform_set_drvdata(pdev, NULL);
>  
>  	return 0;
> 

-- 
cheers,
-roger

[toc] | [prev] | [next] | [standalone]


#1713907

FromFelipe Balbi <balbi@kernel.org>
Date2017-08-17 14:10 +0200
Message-ID<ufrMC-4Ff-25@gated-at.bofh.it>
In reply to#1713353
Hi,

Franklin S Cooper Jr <fcooper@ti.com> writes:
> For 66AK2Gx there is a requirement to use PM Runtime to properly manage
> clocks and the power domains. Therefore, add PM runtime support. Remove
> legacy clock api's calls since other users of this driver worked without
> these clock apis calls.
>
> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
> ---

I already have the previous version of this in my tree. Seems like the
only difference was on binding document, right? Do I need to change
anything in my 'next' and/or 'testing/next' branches?

-- 
balbi

[toc] | [prev] | [next] | [standalone]


#1713944 — Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver

FromFranklin S Cooper Jr <fcooper@ti.com>
Date2017-08-17 14:30 +0200
SubjectRe: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
Message-ID<ufs5Y-4Nj-23@gated-at.bofh.it>
In reply to#1713907

On 08/17/2017 07:04 AM, Felipe Balbi wrote:
> 
> Hi,
> 
> Franklin S Cooper Jr <fcooper@ti.com> writes:
>> For 66AK2Gx there is a requirement to use PM Runtime to properly manage
>> clocks and the power domains. Therefore, add PM runtime support. Remove
>> legacy clock api's calls since other users of this driver worked without
>> these clock apis calls.
>>
>> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
>> ---
> 
> I already have the previous version of this in my tree. Seems like the
> only difference was on binding document, right? Do I need to change
> anything in my 'next' and/or 'testing/next' branches?

Correct the binding document is the only difference. Both of your
branches looks good.

> 

[toc] | [prev] | [next] | [standalone]


#1713961

FromFelipe Balbi <balbi@kernel.org>
Date2017-08-17 14:40 +0200
Message-ID<ufsfD-4R7-17@gated-at.bofh.it>
In reply to#1713944
Hi,

Franklin S Cooper Jr <fcooper@ti.com> writes:
>> Franklin S Cooper Jr <fcooper@ti.com> writes:
>>> For 66AK2Gx there is a requirement to use PM Runtime to properly manage
>>> clocks and the power domains. Therefore, add PM runtime support. Remove
>>> legacy clock api's calls since other users of this driver worked without
>>> these clock apis calls.
>>>
>>> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
>>> ---
>> 
>> I already have the previous version of this in my tree. Seems like the
>> only difference was on binding document, right? Do I need to change
>> anything in my 'next' and/or 'testing/next' branches?
>
> Correct the binding document is the only difference. Both of your
> branches looks good.

cool, thanks :-)

-- 
balbi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web