linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] phy: omap-usb2: Fixes for v4.9
@ 2016-08-23  8:57 Roger Quadros
  2016-08-23  8:57 ` [PATCH 1/3] phy: omap-usb2: support suspend/resume Roger Quadros
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Roger Quadros @ 2016-08-23  8:57 UTC (permalink / raw)
  To: kishon, tony
  Cc: robh+dt, nsekhar, linux-omap, devicetree, linux-kernel, Roger Quadros

Hi Kishon & Tony,

Here are some fixes found in the TI vendor tree for omap-usb2 PHY
and are important for upstream. Please queue for -next if OK. Thanks.

The 3rd patch should probably go via Tony's SoC DT tree.

cheers,
-roger

Sekhar Nori (3):
  phy: omap-usb2: support suspend/resume
  dt-bindings: phy: ti: add documentation for ti,dra7x-usb2
  ARM: dts: dra7: workaround silicon limitation i845

 Documentation/devicetree/bindings/phy/ti-phy.txt |   2 +
 arch/arm/boot/dts/dra7.dtsi                      |   2 +-
 drivers/phy/phy-omap-usb2.c                      | 100 +++++++++++------------
 3 files changed, 49 insertions(+), 55 deletions(-)

-- 
2.7.4

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

* [PATCH 1/3] phy: omap-usb2: support suspend/resume
  2016-08-23  8:57 [PATCH 0/3] phy: omap-usb2: Fixes for v4.9 Roger Quadros
@ 2016-08-23  8:57 ` Roger Quadros
  2016-08-23  8:57 ` [PATCH 2/3] dt-bindings: phy: ti: add documentation for ti,dra7x-usb2 Roger Quadros
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2016-08-23  8:57 UTC (permalink / raw)
  To: kishon, tony
  Cc: robh+dt, nsekhar, linux-omap, devicetree, linux-kernel, Roger Quadros

From: Sekhar Nori <nsekhar@ti.com>

Relying on PM-ops for shutting down PHY clocks was a
bad idea since the users (e.g. USB DWC3) might not
have been suspended by then.

Get rid of all PM-ops. It is the sole responsibility
of the PHY user to properly turn OFF and de-initialize
the PHY as part of its suspend routine.

Enable/disable PHY clock as part of ->init()/->exit()
call respectively. With this phy_init() and phy_exit()
can be called by PHY user during suspend/resume.

This is similar to what is done for ti-pipe3 driver.
See 31c8954efb1b ("phy: ti-pipe3: fix suspend")

The pm_runtime_enable() call in omap_usb2_probe()
is still required because without it, phy_create()
will not enable runtime PM on the phy device it
creates and phy_init() will not call
pm_runtime_get_sync().

Without pm_runtime_get_sync(), ocp2scp hwmod will
_not_ enable the IP and, thus, we will have abort
exceptions.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/phy/phy-omap-usb2.c | 100 ++++++++++++++++++++------------------------
 1 file changed, 46 insertions(+), 54 deletions(-)

diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index c134989..fe909fd 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -133,11 +133,49 @@ static int omap_usb_power_on(struct phy *x)
 	return omap_usb_phy_power(phy, true);
 }
 
+static int omap_usb2_disable_clocks(struct omap_usb *phy)
+{
+	clk_disable(phy->wkupclk);
+	if (!IS_ERR(phy->optclk))
+		clk_disable(phy->optclk);
+
+	return 0;
+}
+
+static int omap_usb2_enable_clocks(struct omap_usb *phy)
+{
+	int ret;
+
+	ret = clk_enable(phy->wkupclk);
+	if (ret < 0) {
+		dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret);
+		goto err0;
+	}
+
+	if (!IS_ERR(phy->optclk)) {
+		ret = clk_enable(phy->optclk);
+		if (ret < 0) {
+			dev_err(phy->dev, "Failed to enable optclk %d\n", ret);
+			goto err1;
+		}
+	}
+
+	return 0;
+
+err1:
+	clk_disable(phy->wkupclk);
+
+err0:
+	return ret;
+}
+
 static int omap_usb_init(struct phy *x)
 {
 	struct omap_usb *phy = phy_get_drvdata(x);
 	u32 val;
 
+	omap_usb2_enable_clocks(phy);
+
 	if (phy->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) {
 		/*
 		 *
@@ -155,8 +193,16 @@ static int omap_usb_init(struct phy *x)
 	return 0;
 }
 
+static int omap_usb_exit(struct phy *x)
+{
+	struct omap_usb *phy = phy_get_drvdata(x);
+
+	return omap_usb2_disable_clocks(phy);
+}
+
 static const struct phy_ops ops = {
 	.init		= omap_usb_init,
+	.exit		= omap_usb_exit,
 	.power_on	= omap_usb_power_on,
 	.power_off	= omap_usb_power_off,
 	.owner		= THIS_MODULE,
@@ -376,65 +422,11 @@ static int omap_usb2_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-
-static int omap_usb2_runtime_suspend(struct device *dev)
-{
-	struct platform_device	*pdev = to_platform_device(dev);
-	struct omap_usb	*phy = platform_get_drvdata(pdev);
-
-	clk_disable(phy->wkupclk);
-	if (!IS_ERR(phy->optclk))
-		clk_disable(phy->optclk);
-
-	return 0;
-}
-
-static int omap_usb2_runtime_resume(struct device *dev)
-{
-	struct platform_device	*pdev = to_platform_device(dev);
-	struct omap_usb	*phy = platform_get_drvdata(pdev);
-	int ret;
-
-	ret = clk_enable(phy->wkupclk);
-	if (ret < 0) {
-		dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret);
-		goto err0;
-	}
-
-	if (!IS_ERR(phy->optclk)) {
-		ret = clk_enable(phy->optclk);
-		if (ret < 0) {
-			dev_err(phy->dev, "Failed to enable optclk %d\n", ret);
-			goto err1;
-		}
-	}
-
-	return 0;
-
-err1:
-	clk_disable(phy->wkupclk);
-
-err0:
-	return ret;
-}
-
-static const struct dev_pm_ops omap_usb2_pm_ops = {
-	SET_RUNTIME_PM_OPS(omap_usb2_runtime_suspend, omap_usb2_runtime_resume,
-		NULL)
-};
-
-#define DEV_PM_OPS     (&omap_usb2_pm_ops)
-#else
-#define DEV_PM_OPS     NULL
-#endif
-
 static struct platform_driver omap_usb2_driver = {
 	.probe		= omap_usb2_probe,
 	.remove		= omap_usb2_remove,
 	.driver		= {
 		.name	= "omap-usb2",
-		.pm	= DEV_PM_OPS,
 		.of_match_table = omap_usb2_id_table,
 	},
 };
-- 
2.7.4

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

* [PATCH 2/3] dt-bindings: phy: ti: add documentation for ti,dra7x-usb2
  2016-08-23  8:57 [PATCH 0/3] phy: omap-usb2: Fixes for v4.9 Roger Quadros
  2016-08-23  8:57 ` [PATCH 1/3] phy: omap-usb2: support suspend/resume Roger Quadros
@ 2016-08-23  8:57 ` Roger Quadros
  2016-08-23 20:03   ` Rob Herring
  2016-08-23  8:57 ` [PATCH 3/3] ARM: dts: dra7: workaround silicon limitation i845 Roger Quadros
  2016-09-02 12:17 ` [PATCH 0/3] phy: omap-usb2: Fixes for v4.9 Kishon Vijay Abraham I
  3 siblings, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2016-08-23  8:57 UTC (permalink / raw)
  To: kishon, tony
  Cc: robh+dt, nsekhar, linux-omap, devicetree, linux-kernel, Roger Quadros

From: Sekhar Nori <nsekhar@ti.com>

Commit 7e472402ca30 ("phy: omap-usb2: Provide workaround for
USB2PHY false disconnect") added a new binding for USB2 PHYs
on DRA7x. But it has remained undocumented so far.

Add documentation for the binding.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index a3b3945..cd13e615 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -31,6 +31,8 @@ OMAP USB2 PHY
 
 Required properties:
  - compatible: Should be "ti,omap-usb2"
+	       Should be "ti,dra7x-usb2" for the 1st instance of USB2 PHY on
+	       DRA7x
 	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
 	       in DRA7x
  - reg : Address and length of the register set for the device.
-- 
2.7.4

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

* [PATCH 3/3] ARM: dts: dra7: workaround silicon limitation i845
  2016-08-23  8:57 [PATCH 0/3] phy: omap-usb2: Fixes for v4.9 Roger Quadros
  2016-08-23  8:57 ` [PATCH 1/3] phy: omap-usb2: support suspend/resume Roger Quadros
  2016-08-23  8:57 ` [PATCH 2/3] dt-bindings: phy: ti: add documentation for ti,dra7x-usb2 Roger Quadros
@ 2016-08-23  8:57 ` Roger Quadros
  2016-08-26 15:28   ` Tony Lindgren
  2016-09-02 12:17 ` [PATCH 0/3] phy: omap-usb2: Fixes for v4.9 Kishon Vijay Abraham I
  3 siblings, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2016-08-23  8:57 UTC (permalink / raw)
  To: kishon, tony
  Cc: robh+dt, nsekhar, linux-omap, devicetree, linux-kernel, Roger Quadros

From: Sekhar Nori <nsekhar@ti.com>

Silicon limitation i845 documents how to cope with false
disconnection condition on USB2 PHY. Reference: AM572x
silicon errata document SPRZ429H, revised January 2016.

Using compatible "ti,dra7x-usb2" enables the recommended
software workaround for this issue. Use it for USB1 PHY.

The workaround is already in place for USB2 PHY.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index d9bfb94..df0dcbc 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1413,7 +1413,7 @@
 			ti,hwmods = "ocp2scp1";
 
 			usb2_phy1: phy@4a084000 {
-				compatible = "ti,omap-usb2";
+				compatible = "ti,dra7x-usb2", "ti,omap-usb2";
 				reg = <0x4a084000 0x400>;
 				syscon-phy-power = <&scm_conf 0x300>;
 				clocks = <&usb_phy1_always_on_clk32k>,
-- 
2.7.4

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

* Re: [PATCH 2/3] dt-bindings: phy: ti: add documentation for ti,dra7x-usb2
  2016-08-23  8:57 ` [PATCH 2/3] dt-bindings: phy: ti: add documentation for ti,dra7x-usb2 Roger Quadros
@ 2016-08-23 20:03   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2016-08-23 20:03 UTC (permalink / raw)
  To: Roger Quadros; +Cc: kishon, tony, nsekhar, linux-omap, devicetree, linux-kernel

On Tue, Aug 23, 2016 at 11:57:40AM +0300, Roger Quadros wrote:
> From: Sekhar Nori <nsekhar@ti.com>
> 
> Commit 7e472402ca30 ("phy: omap-usb2: Provide workaround for
> USB2PHY false disconnect") added a new binding for USB2 PHYs
> on DRA7x. But it has remained undocumented so far.
> 
> Add documentation for the binding.
> 
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt | 2 ++
>  1 file changed, 2 insertions(+)

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

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

* Re: [PATCH 3/3] ARM: dts: dra7: workaround silicon limitation i845
  2016-08-23  8:57 ` [PATCH 3/3] ARM: dts: dra7: workaround silicon limitation i845 Roger Quadros
@ 2016-08-26 15:28   ` Tony Lindgren
  0 siblings, 0 replies; 7+ messages in thread
From: Tony Lindgren @ 2016-08-26 15:28 UTC (permalink / raw)
  To: Roger Quadros
  Cc: kishon, robh+dt, nsekhar, linux-omap, devicetree, linux-kernel

* Roger Quadros <rogerq@ti.com> [160823 01:58]:
> From: Sekhar Nori <nsekhar@ti.com>
> 
> Silicon limitation i845 documents how to cope with false
> disconnection condition on USB2 PHY. Reference: AM572x
> silicon errata document SPRZ429H, revised January 2016.
> 
> Using compatible "ti,dra7x-usb2" enables the recommended
> software workaround for this issue. Use it for USB1 PHY.
> 
> The workaround is already in place for USB2 PHY.

Picking this patch into omap-for-v4.9/dt branch.

Regards,

Tony

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

* Re: [PATCH 0/3] phy: omap-usb2: Fixes for v4.9
  2016-08-23  8:57 [PATCH 0/3] phy: omap-usb2: Fixes for v4.9 Roger Quadros
                   ` (2 preceding siblings ...)
  2016-08-23  8:57 ` [PATCH 3/3] ARM: dts: dra7: workaround silicon limitation i845 Roger Quadros
@ 2016-09-02 12:17 ` Kishon Vijay Abraham I
  3 siblings, 0 replies; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2016-09-02 12:17 UTC (permalink / raw)
  To: Roger Quadros, tony
  Cc: robh+dt, nsekhar, linux-omap, devicetree, linux-kernel



On Tuesday 23 August 2016 02:27 PM, Roger Quadros wrote:
> Hi Kishon & Tony,
> 
> Here are some fixes found in the TI vendor tree for omap-usb2 PHY
> and are important for upstream. Please queue for -next if OK. Thanks.

merged the phy patches to linux-phy -next

Thanks
Kishon
> 
> The 3rd patch should probably go via Tony's SoC DT tree.
> 
> cheers,
> -roger
> 
> Sekhar Nori (3):
>   phy: omap-usb2: support suspend/resume
>   dt-bindings: phy: ti: add documentation for ti,dra7x-usb2
>   ARM: dts: dra7: workaround silicon limitation i845
> 
>  Documentation/devicetree/bindings/phy/ti-phy.txt |   2 +
>  arch/arm/boot/dts/dra7.dtsi                      |   2 +-
>  drivers/phy/phy-omap-usb2.c                      | 100 +++++++++++------------
>  3 files changed, 49 insertions(+), 55 deletions(-)
> 

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

end of thread, other threads:[~2016-09-02 12:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-23  8:57 [PATCH 0/3] phy: omap-usb2: Fixes for v4.9 Roger Quadros
2016-08-23  8:57 ` [PATCH 1/3] phy: omap-usb2: support suspend/resume Roger Quadros
2016-08-23  8:57 ` [PATCH 2/3] dt-bindings: phy: ti: add documentation for ti,dra7x-usb2 Roger Quadros
2016-08-23 20:03   ` Rob Herring
2016-08-23  8:57 ` [PATCH 3/3] ARM: dts: dra7: workaround silicon limitation i845 Roger Quadros
2016-08-26 15:28   ` Tony Lindgren
2016-09-02 12:17 ` [PATCH 0/3] phy: omap-usb2: Fixes for v4.9 Kishon Vijay Abraham I

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).