linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] usb: dwc3: keystone: Turn on USB3 PHY before controller
@ 2020-05-25  7:10 Roger Quadros
  2020-05-25  7:10 ` [PATCH v2 1/2] dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property Roger Quadros
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Roger Quadros @ 2020-05-25  7:10 UTC (permalink / raw)
  To: balbi; +Cc: linux-usb, vigneshr, chunfeng.yun, linux-kernel, Roger Quadros

Hi Felipe,

This series prepares for Super-Speed support for AM654 SoC.

Patch 1 is already in your testing/next as commit d47b0062a8ad6c5060c84439745c3ce7d21d6bb9.
Please revert that and apply the revised version in which we make
the USB3.0 PHY optional. Thanks.

cheers,
-roger

Changelog:
v2:
- make USB3 PHY optional

Roger Quadros (2):
  dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property
  usb: dwc3: keystone: Turn on USB3 PHY before controller

 .../bindings/usb/ti,keystone-dwc3.yaml        | 10 +++++
 drivers/usb/dwc3/dwc3-keystone.c              | 41 ++++++++++++++++++-
 2 files changed, 50 insertions(+), 1 deletion(-)

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


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

* [PATCH v2 1/2] dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property
  2020-05-25  7:10 [PATCH v2 0/2] usb: dwc3: keystone: Turn on USB3 PHY before controller Roger Quadros
@ 2020-05-25  7:10 ` Roger Quadros
  2020-05-25  7:10 ` [PATCH v2 2/2] usb: dwc3: keystone: Turn on USB3 PHY before controller Roger Quadros
  2020-05-25  8:23 ` [PATCH v2 0/2] " Felipe Balbi
  2 siblings, 0 replies; 4+ messages in thread
From: Roger Quadros @ 2020-05-25  7:10 UTC (permalink / raw)
  To: balbi; +Cc: linux-usb, vigneshr, chunfeng.yun, linux-kernel, Roger Quadros

AM654 SoC requires USB3.0 PHY to be turned on before the USB controller.
For this SoC, the 'phys' property is used to provide the USB3.0
reference.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 .../devicetree/bindings/usb/ti,keystone-dwc3.yaml      | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml b/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml
index 14d2fe329b93..f127535feb0b 100644
--- a/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml
@@ -34,6 +34,16 @@ properties:
       value. This property is as per the binding,
       Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
 
+  phys:
+    description:
+      PHY specifier for the USB3.0 PHY. Some SoCs need the USB3.0 PHY
+      to be turned on before the controller.
+      Documentation/devicetree/bindings/phy/phy-bindings.txt
+
+  phy-names:
+    items:
+      - const: "usb3-phy"
+
   dwc3:
     description: This is the node representing the DWC3 controller instance
       Documentation/devicetree/bindings/usb/dwc3.txt
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v2 2/2] usb: dwc3: keystone: Turn on USB3 PHY before controller
  2020-05-25  7:10 [PATCH v2 0/2] usb: dwc3: keystone: Turn on USB3 PHY before controller Roger Quadros
  2020-05-25  7:10 ` [PATCH v2 1/2] dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property Roger Quadros
@ 2020-05-25  7:10 ` Roger Quadros
  2020-05-25  8:23 ` [PATCH v2 0/2] " Felipe Balbi
  2 siblings, 0 replies; 4+ messages in thread
From: Roger Quadros @ 2020-05-25  7:10 UTC (permalink / raw)
  To: balbi; +Cc: linux-usb, vigneshr, chunfeng.yun, linux-kernel, Roger Quadros

The Local Power Sleep Controller (LPSC) dependency on AM65
requires SERDES0 to be powered on before USB.

We need to power up SERDES0 power domain and hold it on
throughout the reset, init, power on sequence.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/dwc3/dwc3-keystone.c | 41 +++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c
index 1e14a6f4884b..6505f7bd69e2 100644
--- a/drivers/usb/dwc3/dwc3-keystone.c
+++ b/drivers/usb/dwc3/dwc3-keystone.c
@@ -14,6 +14,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/of_platform.h>
+#include <linux/phy/phy.h>
 #include <linux/pm_runtime.h>
 
 /* USBSS register offsets */
@@ -34,6 +35,7 @@
 struct dwc3_keystone {
 	struct device			*dev;
 	void __iomem			*usbss;
+	struct phy			*usb3_phy;
 };
 
 static inline u32 kdwc3_readl(void __iomem *base, u32 offset)
@@ -95,8 +97,38 @@ static int kdwc3_probe(struct platform_device *pdev)
 	if (IS_ERR(kdwc->usbss))
 		return PTR_ERR(kdwc->usbss);
 
-	pm_runtime_enable(kdwc->dev);
+	/* PSC dependency on AM65 needs SERDES0 to be powered before USB0 */
+	kdwc->usb3_phy = devm_phy_optional_get(dev, "usb3-phy");
+	if (IS_ERR(kdwc->usb3_phy)) {
+		error = PTR_ERR(kdwc->usb3_phy);
+		if (error != -EPROBE_DEFER)
+			dev_err(dev, "couldn't get usb3 phy: %d\n", error);
+
+		return error;
+	}
+
+	phy_pm_runtime_get_sync(kdwc->usb3_phy);
 
+	error = phy_reset(kdwc->usb3_phy);
+	if (error < 0) {
+		dev_err(dev, "usb3 phy reset failed: %d\n", error);
+		return error;
+	}
+
+	error = phy_init(kdwc->usb3_phy);
+	if (error < 0) {
+		dev_err(dev, "usb3 phy init failed: %d\n", error);
+		return error;
+	}
+
+	error = phy_power_on(kdwc->usb3_phy);
+	if (error < 0) {
+		dev_err(dev, "usb3 phy power on failed: %d\n", error);
+		phy_exit(kdwc->usb3_phy);
+		return error;
+	}
+
+	pm_runtime_enable(kdwc->dev);
 	error = pm_runtime_get_sync(kdwc->dev);
 	if (error < 0) {
 		dev_err(kdwc->dev, "pm_runtime_get_sync failed, error %d\n",
@@ -138,6 +170,9 @@ static int kdwc3_probe(struct platform_device *pdev)
 err_irq:
 	pm_runtime_put_sync(kdwc->dev);
 	pm_runtime_disable(kdwc->dev);
+	phy_power_off(kdwc->usb3_phy);
+	phy_exit(kdwc->usb3_phy);
+	phy_pm_runtime_put_sync(kdwc->usb3_phy);
 
 	return error;
 }
@@ -163,6 +198,10 @@ static int kdwc3_remove(struct platform_device *pdev)
 	pm_runtime_put_sync(kdwc->dev);
 	pm_runtime_disable(kdwc->dev);
 
+	phy_power_off(kdwc->usb3_phy);
+	phy_exit(kdwc->usb3_phy);
+	phy_pm_runtime_put_sync(kdwc->usb3_phy);
+
 	platform_set_drvdata(pdev, NULL);
 
 	return 0;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* Re: [PATCH v2 0/2] usb: dwc3: keystone: Turn on USB3 PHY before controller
  2020-05-25  7:10 [PATCH v2 0/2] usb: dwc3: keystone: Turn on USB3 PHY before controller Roger Quadros
  2020-05-25  7:10 ` [PATCH v2 1/2] dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property Roger Quadros
  2020-05-25  7:10 ` [PATCH v2 2/2] usb: dwc3: keystone: Turn on USB3 PHY before controller Roger Quadros
@ 2020-05-25  8:23 ` Felipe Balbi
  2 siblings, 0 replies; 4+ messages in thread
From: Felipe Balbi @ 2020-05-25  8:23 UTC (permalink / raw)
  To: Roger Quadros
  Cc: linux-usb, vigneshr, chunfeng.yun, linux-kernel, Roger Quadros

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]


Hi,

Roger Quadros <rogerq@ti.com> writes:
> This series prepares for Super-Speed support for AM654 SoC.
>
> Patch 1 is already in your testing/next as commit d47b0062a8ad6c5060c84439745c3ce7d21d6bb9.
> Please revert that and apply the revised version in which we make
> the USB3.0 PHY optional. Thanks.
>
> cheers,
> -roger
>
> Changelog:
> v2:
> - make USB3 PHY optional
>
> Roger Quadros (2):
>   dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property
>   usb: dwc3: keystone: Turn on USB3 PHY before controller

should reach testing/next shortly.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2020-05-25  8:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25  7:10 [PATCH v2 0/2] usb: dwc3: keystone: Turn on USB3 PHY before controller Roger Quadros
2020-05-25  7:10 ` [PATCH v2 1/2] dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property Roger Quadros
2020-05-25  7:10 ` [PATCH v2 2/2] usb: dwc3: keystone: Turn on USB3 PHY before controller Roger Quadros
2020-05-25  8:23 ` [PATCH v2 0/2] " Felipe Balbi

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