All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ARM: dts: k2g: Add support for USB instances on 66AK2G
@ 2017-08-16 21:54 ` Franklin S Cooper Jr
  0 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-16 21:54 UTC (permalink / raw)
  To: gregkh, robh+dt, ssantosh, linux, balbi, linux-usb, devicetree,
	linux-kernel, linux-arm-kernel, nsekhar, rogerq
  Cc: Franklin S Cooper Jr

Add support for 66AK2G usb instances. However, the driver needs to be updated
to support PM_RUNTIME. This update has been validated to work on K2L and boot
tested on K2HK and K2E.

Version 2:
Clarify clock properties requirements in binding document

Franklin S Cooper Jr (2):
  usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB
    driver
  dt-bindings: usb: keystone-usb: Update bindings pm and clocks
    properties

 .../devicetree/bindings/usb/keystone-usb.txt       | 17 +++++++++++++++--
 drivers/usb/dwc3/dwc3-keystone.c                   | 22 ++++++++++------------
 2 files changed, 25 insertions(+), 14 deletions(-)

-- 
2.9.4.dirty

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

* [PATCH v2 0/2] ARM: dts: k2g: Add support for USB instances on 66AK2G
@ 2017-08-16 21:54 ` Franklin S Cooper Jr
  0 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-16 21:54 UTC (permalink / raw)
  To: gregkh, robh+dt, ssantosh, linux, balbi, linux-usb, devicetree,
	linux-kernel, linux-arm-kernel, nsekhar, rogerq
  Cc: Franklin S Cooper Jr

Add support for 66AK2G usb instances. However, the driver needs to be updated
to support PM_RUNTIME. This update has been validated to work on K2L and boot
tested on K2HK and K2E.

Version 2:
Clarify clock properties requirements in binding document

Franklin S Cooper Jr (2):
  usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB
    driver
  dt-bindings: usb: keystone-usb: Update bindings pm and clocks
    properties

 .../devicetree/bindings/usb/keystone-usb.txt       | 17 +++++++++++++++--
 drivers/usb/dwc3/dwc3-keystone.c                   | 22 ++++++++++------------
 2 files changed, 25 insertions(+), 14 deletions(-)

-- 
2.9.4.dirty

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

* [PATCH v2 0/2] ARM: dts: k2g: Add support for USB instances on 66AK2G
@ 2017-08-16 21:54 ` Franklin S Cooper Jr
  0 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-16 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Add support for 66AK2G usb instances. However, the driver needs to be updated
to support PM_RUNTIME. This update has been validated to work on K2L and boot
tested on K2HK and K2E.

Version 2:
Clarify clock properties requirements in binding document

Franklin S Cooper Jr (2):
  usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB
    driver
  dt-bindings: usb: keystone-usb: Update bindings pm and clocks
    properties

 .../devicetree/bindings/usb/keystone-usb.txt       | 17 +++++++++++++++--
 drivers/usb/dwc3/dwc3-keystone.c                   | 22 ++++++++++------------
 2 files changed, 25 insertions(+), 14 deletions(-)

-- 
2.9.4.dirty

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

* [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
  2017-08-16 21:54 ` Franklin S Cooper Jr
  (?)
@ 2017-08-16 21:54   ` Franklin S Cooper Jr
  -1 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-16 21:54 UTC (permalink / raw)
  To: gregkh, robh+dt, ssantosh, linux, balbi, linux-usb, devicetree,
	linux-kernel, linux-arm-kernel, nsekhar, rogerq
  Cc: Franklin S Cooper Jr

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

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

* [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
@ 2017-08-16 21:54   ` Franklin S Cooper Jr
  0 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-16 21:54 UTC (permalink / raw)
  To: gregkh, robh+dt, ssantosh, linux, balbi, linux-usb, devicetree,
	linux-kernel, linux-arm-kernel, nsekhar, rogerq
  Cc: Franklin S Cooper Jr

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

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

* [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
@ 2017-08-16 21:54   ` Franklin S Cooper Jr
  0 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-16 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH v2 2/2] dt-bindings: usb: keystone-usb: Update bindings pm and clocks properties
  2017-08-16 21:54 ` Franklin S Cooper Jr
  (?)
@ 2017-08-16 21:54   ` Franklin S Cooper Jr
  -1 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-16 21:54 UTC (permalink / raw)
  To: gregkh, robh+dt, ssantosh, linux, balbi, linux-usb, devicetree,
	linux-kernel, linux-arm-kernel, nsekhar, rogerq
  Cc: Franklin S Cooper Jr

Update various properties to properly indicate their requirement depending
on the SoC.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
---
Version 2:
Clarify clock requirements in binding document

 Documentation/devicetree/bindings/usb/keystone-usb.txt | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/keystone-usb.txt b/Documentation/devicetree/bindings/usb/keystone-usb.txt
index 60527d3..2d1bef1 100644
--- a/Documentation/devicetree/bindings/usb/keystone-usb.txt
+++ b/Documentation/devicetree/bindings/usb/keystone-usb.txt
@@ -12,8 +12,21 @@ Required properties:
    MPU.
  - ranges: allows valid 1:1 translation between child's address space and
    parent's address space.
- - clocks: Clock IDs array as required by the controller.
- - clock-names: names of clocks correseponding to IDs in the clock property.
+
+SoC-specific Required Properties:
+The following are mandatory properties for Keystone 2 66AK2HK, 66AK2L and 66AK2E
+SoCs only:
+
+- clocks:		Clock ID for USB functional clock.
+- clock-names:		Must be "usb".
+
+
+The following are mandatory properties for Keystone 2 66AK2G SoCs only:
+
+- power-domains:	Should contain a phandle to a PM domain provider node
+			and an args specifier containing the USB device id
+			value. This property is as per the binding,
+			Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
 
 Sub-nodes:
 The dwc3 core should be added as subnode to Keystone DWC3 glue.
-- 
2.9.4.dirty

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

* [PATCH v2 2/2] dt-bindings: usb: keystone-usb: Update bindings pm and clocks properties
@ 2017-08-16 21:54   ` Franklin S Cooper Jr
  0 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-16 21:54 UTC (permalink / raw)
  To: gregkh, robh+dt, ssantosh, linux, balbi, linux-usb, devicetree,
	linux-kernel, linux-arm-kernel, nsekhar, rogerq
  Cc: Franklin S Cooper Jr

Update various properties to properly indicate their requirement depending
on the SoC.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
---
Version 2:
Clarify clock requirements in binding document

 Documentation/devicetree/bindings/usb/keystone-usb.txt | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/keystone-usb.txt b/Documentation/devicetree/bindings/usb/keystone-usb.txt
index 60527d3..2d1bef1 100644
--- a/Documentation/devicetree/bindings/usb/keystone-usb.txt
+++ b/Documentation/devicetree/bindings/usb/keystone-usb.txt
@@ -12,8 +12,21 @@ Required properties:
    MPU.
  - ranges: allows valid 1:1 translation between child's address space and
    parent's address space.
- - clocks: Clock IDs array as required by the controller.
- - clock-names: names of clocks correseponding to IDs in the clock property.
+
+SoC-specific Required Properties:
+The following are mandatory properties for Keystone 2 66AK2HK, 66AK2L and 66AK2E
+SoCs only:
+
+- clocks:		Clock ID for USB functional clock.
+- clock-names:		Must be "usb".
+
+
+The following are mandatory properties for Keystone 2 66AK2G SoCs only:
+
+- power-domains:	Should contain a phandle to a PM domain provider node
+			and an args specifier containing the USB device id
+			value. This property is as per the binding,
+			Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
 
 Sub-nodes:
 The dwc3 core should be added as subnode to Keystone DWC3 glue.
-- 
2.9.4.dirty

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

* [PATCH v2 2/2] dt-bindings: usb: keystone-usb: Update bindings pm and clocks properties
@ 2017-08-16 21:54   ` Franklin S Cooper Jr
  0 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-16 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Update various properties to properly indicate their requirement depending
on the SoC.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
---
Version 2:
Clarify clock requirements in binding document

 Documentation/devicetree/bindings/usb/keystone-usb.txt | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/keystone-usb.txt b/Documentation/devicetree/bindings/usb/keystone-usb.txt
index 60527d3..2d1bef1 100644
--- a/Documentation/devicetree/bindings/usb/keystone-usb.txt
+++ b/Documentation/devicetree/bindings/usb/keystone-usb.txt
@@ -12,8 +12,21 @@ Required properties:
    MPU.
  - ranges: allows valid 1:1 translation between child's address space and
    parent's address space.
- - clocks: Clock IDs array as required by the controller.
- - clock-names: names of clocks correseponding to IDs in the clock property.
+
+SoC-specific Required Properties:
+The following are mandatory properties for Keystone 2 66AK2HK, 66AK2L and 66AK2E
+SoCs only:
+
+- clocks:		Clock ID for USB functional clock.
+- clock-names:		Must be "usb".
+
+
+The following are mandatory properties for Keystone 2 66AK2G SoCs only:
+
+- power-domains:	Should contain a phandle to a PM domain provider node
+			and an args specifier containing the USB device id
+			value. This property is as per the binding,
+			Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
 
 Sub-nodes:
 The dwc3 core should be added as subnode to Keystone DWC3 glue.
-- 
2.9.4.dirty

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

* Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
  2017-08-16 21:54   ` Franklin S Cooper Jr
  (?)
@ 2017-08-17  7:08     ` Roger Quadros
  -1 siblings, 0 replies; 22+ messages in thread
From: Roger Quadros @ 2017-08-17  7:08 UTC (permalink / raw)
  To: Franklin S Cooper Jr, gregkh, robh+dt, ssantosh, linux, balbi,
	linux-usb, devicetree, linux-kernel, linux-arm-kernel, nsekhar


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

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

* Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
@ 2017-08-17  7:08     ` Roger Quadros
  0 siblings, 0 replies; 22+ messages in thread
From: Roger Quadros @ 2017-08-17  7:08 UTC (permalink / raw)
  To: Franklin S Cooper Jr, gregkh, robh+dt, ssantosh, linux, balbi,
	linux-usb, devicetree, linux-kernel, linux-arm-kernel, nsekhar


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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
@ 2017-08-17  7:08     ` Roger Quadros
  0 siblings, 0 replies; 22+ messages in thread
From: Roger Quadros @ 2017-08-17  7:08 UTC (permalink / raw)
  To: linux-arm-kernel

?
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

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

* Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
  2017-08-16 21:54   ` Franklin S Cooper Jr
  (?)
@ 2017-08-17 12:04     ` Felipe Balbi
  -1 siblings, 0 replies; 22+ messages in thread
From: Felipe Balbi @ 2017-08-17 12:04 UTC (permalink / raw)
  To: Franklin S Cooper Jr, gregkh, robh+dt, ssantosh, linux,
	linux-usb, devicetree, linux-kernel, linux-arm-kernel, nsekhar,
	rogerq
  Cc: Franklin S Cooper Jr


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

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

* Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
@ 2017-08-17 12:04     ` Felipe Balbi
  0 siblings, 0 replies; 22+ messages in thread
From: Felipe Balbi @ 2017-08-17 12:04 UTC (permalink / raw)
  To: gregkh, robh+dt, ssantosh, linux, linux-usb, devicetree,
	linux-kernel, linux-arm-kernel, nsekhar, rogerq
  Cc: Franklin S Cooper Jr


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

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

* [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
@ 2017-08-17 12:04     ` Felipe Balbi
  0 siblings, 0 replies; 22+ messages in thread
From: Felipe Balbi @ 2017-08-17 12:04 UTC (permalink / raw)
  To: linux-arm-kernel


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

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

* Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
  2017-08-17 12:04     ` Felipe Balbi
  (?)
@ 2017-08-17 12:28       ` Franklin S Cooper Jr
  -1 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-17 12:28 UTC (permalink / raw)
  To: Felipe Balbi, gregkh, robh+dt, ssantosh, linux, linux-usb,
	devicetree, linux-kernel, linux-arm-kernel, nsekhar, rogerq



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.

> 

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

* Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
@ 2017-08-17 12:28       ` Franklin S Cooper Jr
  0 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-17 12:28 UTC (permalink / raw)
  To: Felipe Balbi, gregkh, robh+dt, ssantosh, linux, linux-usb,
	devicetree, linux-kernel, linux-arm-kernel, nsekhar, rogerq



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.

> 

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

* [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
@ 2017-08-17 12:28       ` Franklin S Cooper Jr
  0 siblings, 0 replies; 22+ messages in thread
From: Franklin S Cooper Jr @ 2017-08-17 12:28 UTC (permalink / raw)
  To: linux-arm-kernel



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.

> 

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

* Re: [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
  2017-08-17 12:28       ` Franklin S Cooper Jr
@ 2017-08-17 12:31         ` Felipe Balbi
  -1 siblings, 0 replies; 22+ messages in thread
From: Felipe Balbi @ 2017-08-17 12:31 UTC (permalink / raw)
  To: Franklin S Cooper Jr, gregkh, robh+dt, ssantosh, linux,
	linux-usb, devicetree, linux-kernel, linux-arm-kernel, nsekhar,
	rogerq


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

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

* [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver
@ 2017-08-17 12:31         ` Felipe Balbi
  0 siblings, 0 replies; 22+ messages in thread
From: Felipe Balbi @ 2017-08-17 12:31 UTC (permalink / raw)
  To: linux-arm-kernel


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

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

* Re: [PATCH v2 2/2] dt-bindings: usb: keystone-usb: Update bindings pm and clocks properties
  2017-08-16 21:54   ` Franklin S Cooper Jr
@ 2017-08-17 22:18     ` Rob Herring
  -1 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2017-08-17 22:18 UTC (permalink / raw)
  To: Franklin S Cooper Jr
  Cc: gregkh, ssantosh, linux, balbi, linux-usb, devicetree,
	linux-kernel, linux-arm-kernel, nsekhar, rogerq

On Wed, Aug 16, 2017 at 04:54:08PM -0500, Franklin S Cooper Jr wrote:
> Update various properties to properly indicate their requirement depending
> on the SoC.
> 
> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
> ---
> Version 2:
> Clarify clock requirements in binding document
> 
>  Documentation/devicetree/bindings/usb/keystone-usb.txt | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

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

* [PATCH v2 2/2] dt-bindings: usb: keystone-usb: Update bindings pm and clocks properties
@ 2017-08-17 22:18     ` Rob Herring
  0 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2017-08-17 22:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 16, 2017 at 04:54:08PM -0500, Franklin S Cooper Jr wrote:
> Update various properties to properly indicate their requirement depending
> on the SoC.
> 
> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
> ---
> Version 2:
> Clarify clock requirements in binding document
> 
>  Documentation/devicetree/bindings/usb/keystone-usb.txt | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

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

end of thread, other threads:[~2017-08-17 22:19 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-16 21:54 [PATCH v2 0/2] ARM: dts: k2g: Add support for USB instances on 66AK2G Franklin S Cooper Jr
2017-08-16 21:54 ` Franklin S Cooper Jr
2017-08-16 21:54 ` Franklin S Cooper Jr
2017-08-16 21:54 ` [PATCH v2 1/2] usb: dwc3: keystone: Add PM_RUNTIME Support to DWC3 Keystone USB driver Franklin S Cooper Jr
2017-08-16 21:54   ` Franklin S Cooper Jr
2017-08-16 21:54   ` Franklin S Cooper Jr
2017-08-17  7:08   ` Roger Quadros
2017-08-17  7:08     ` Roger Quadros
2017-08-17  7:08     ` Roger Quadros
2017-08-17 12:04   ` Felipe Balbi
2017-08-17 12:04     ` Felipe Balbi
2017-08-17 12:04     ` Felipe Balbi
2017-08-17 12:28     ` Franklin S Cooper Jr
2017-08-17 12:28       ` Franklin S Cooper Jr
2017-08-17 12:28       ` Franklin S Cooper Jr
2017-08-17 12:31       ` Felipe Balbi
2017-08-17 12:31         ` Felipe Balbi
2017-08-16 21:54 ` [PATCH v2 2/2] dt-bindings: usb: keystone-usb: Update bindings pm and clocks properties Franklin S Cooper Jr
2017-08-16 21:54   ` Franklin S Cooper Jr
2017-08-16 21:54   ` Franklin S Cooper Jr
2017-08-17 22:18   ` Rob Herring
2017-08-17 22:18     ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.