Re: [PATCH 3/3] usb: dwc3: keystone: Turn on USB3 PHY before controller

From: Roger Quadros
Date: Mon May 25 2020 - 02:41:32 EST




On 25/05/2020 09:39, Roger Quadros wrote:
Felipe,

On 14/05/2020 13:21, Felipe Balbi wrote:
Roger Quadros <rogerq@xxxxxx> writes:

On 14/05/2020 04:37, Chunfeng Yun wrote:
On Wed, 2020-05-13 at 16:07 +0300, Roger Quadros wrote:
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@xxxxxx>
---
ÂÂ drivers/usb/dwc3/dwc3-keystone.c | 47 +++++++++++++++++++++++++++++++-
ÂÂ 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c
index 1e14a6f4884b..46d46f3507fc 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,44 @@ 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_get(dev, "usb3-phy");
Use devm_phy_optional_get() instead?

Indeed, it seems better suited.

patches 1 and 2 are in testing/next


Could you please drop them as I need to make changes to make the PHY optional.
I will send v2 of entire series.

Actually only patch 2 and 3 need to be revised. Patch 1 is fine.

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