xhci-dwc3: Couple of fixes for USB3 support
Subsystems (2)
cover xhci-dwc3: Couple of fixes for USB3 support
This series has couple of fixes needed to get DWC3 USB3 controller to talk to USB3 devices on AM57xx SoCs.
Vignesh R (2):
usb: xhci-dwc3: Power on USB PHY before using
usb: xhci-dwc3: Enable USB3 PHY when available
drivers/usb/host/xhci-dwc3.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
Signature · 1 line
2.16.2
PATCH 1/2 usb: xhci-dwc3: Power on USB PHY before using
It is wrong that expect phy init to also power on the PHY. Therefore, explicitly, call generic_phy_power_on() after generic_phy_power_init() in order to power on PHY before using it.
--- drivers/usb/host/xhci-dwc3.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/host/xhci-dwc3.c +12 -0
@@ -137,6 +137,12 @@ static int xhci_dwc3_probe(struct udevice *dev)pr_err ("Can't init USB PHY for %s\n" , dev->name);return ret; } + + ret =generic_phy_power_on (&plat->usb_phy); +if (ret) { +pr_err ("Can't power on USB PHY for %s\n" , dev->name); +return ret; + } } dwc3_reg = (struct dwc3 *)((char *)(hccr) +DWC3_REG_OFFSET );
@@ -159,6 +165,12 @@ static int xhci_dwc3_remove(struct udevice *dev)int ret;if (generic_phy_valid (&plat->usb_phy)) { + ret =generic_phy_power_off (&plat->usb_phy); +if (ret) { +pr_err ("Can't poweroff USB PHY for %s\n" , dev->name); +return ret; + } + ret =generic_phy_exit (&plat->usb_phy);if (ret) {pr_err ("Can't deinit USB PHY for %s\n" , dev->name);
Signature · 1 line
2.16.2
PATCH 1/2 usb: xhci-dwc3: Power on USB PHY before using
Quoted 9 lines · Vignesh R
It is wrong that expect phy init to also power on the PHY. Therefore, explicitly, call
generic_phy_power_on()aftergeneric_phy_power_init()in order to power on PHY before using it.Signed-off-by Vignesh R <[email protected]>--- drivers/usb/host/xhci-dwc3.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
PATCH 2/2 usb: xhci-dwc3: Enable USB3 PHY when available
In reply to Vignesh RDWC3 USB3 controllers will need USB3 PHY to be enabled, in addition to USB2 PHY, to be functional. Therefore enable USB3 PHY when available.
--- drivers/usb/host/xhci-dwc3.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/usb/host/xhci-dwc3.c +35 -0
@@ -23,6 +23,7 @@ DECLARE_GLOBAL_DATA_PTR;struct xhci_dwc3_platdata {struct phy usb_phy; +struct phy usb3_phy; };void dwc3_set_mode (struct dwc3 *dwc3_reg,u32 mode)
@@ -145,6 +146,26 @@ static int xhci_dwc3_probe(struct udevice *dev) } } + ret =generic_phy_get_by_index (dev,1 , &plat->usb3_phy); +if (ret) { +if (ret != -ENOENT ) { +pr_err ("Failed to get USB3 PHY for %s\n" , dev->name); +return ret; + } + }else { + ret =generic_phy_init (&plat->usb3_phy); +if (ret) { +pr_err ("Can't init USB3 PHY for %s\n" , dev->name); +return ret; + } + + ret =generic_phy_power_on (&plat->usb3_phy); +if (ret) { +pr_err ("Can't power on USB3 PHY for %s\n" , dev->name); +return ret; + } + } + dwc3_reg = (struct dwc3 *)((char *)(hccr) +DWC3_REG_OFFSET );dwc3_core_init (dwc3_reg);
@@ -178,6 +199,20 @@ static int xhci_dwc3_remove(struct udevice *dev) } } +if (generic_phy_valid (&plat->usb3_phy)) { + ret =generic_phy_power_off (&plat->usb3_phy); +if (ret) { +pr_err ("Can't poweroff USB3 PHY for %s\n" , dev->name); +return ret; + } + + ret =generic_phy_exit (&plat->usb3_phy); +if (ret) { +pr_err ("Can't deinit USB3 PHY for %s\n" , dev->name); +return ret; + } + } +return xhci_deregister (dev); }
Signature · 1 line
2.16.2
PATCH 2/2 usb: xhci-dwc3: Enable USB3 PHY when available
Hi Vignesh,
Quoted 33 lines · Vignesh R
DWC3 USB3 controllers will need USB3 PHY to be enabled, in addition to USB2 PHY, to be functional. Therefore enable USB3 PHY when available.
Signed-off-by Vignesh R <[email protected]>--- drivers/usb/host/xhci-dwc3.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)drivers/usb/host/xhci-dwc3.c +10
-0@@ -23,6 +23,7 @@ DECLARE_GLOBAL_DATA_PTR;struct xhci_dwc3_platdata {struct phy usb_phy; +struct phy usb3_phy; };void dwc3_set_mode (struct dwc3 *dwc3_reg,u32 mode)@@ -145,6 +146,26 @@ static int xhci_dwc3_probe(struct udevice *dev) } } + ret =generic_phy_get_by_index (dev,1 , &plat->usb3_phy); +if (ret) { +if (ret != -ENOENT ) { +pr_err ("Failed to get USB3 PHY for %s\n" , dev->name); +return ret; + } + }else { + ret =generic_phy_init (&plat->usb3_phy); +if (ret) {
drivers/usb/host/xhci-dwc3.c static int xhci_dwc3_probe(struct udevice *dev) · line 167
Quoted 10 lines
drivers/usb/host/xhci-dwc3.c +10
-0+pr_err ("Can't init USB3 PHY for %s\n" , dev->name); +return ret; + } + + ret =generic_phy_power_on (&plat->usb3_phy); +if (ret) { +pr_err ("Can't power on USB3 PHY for %s\n" , dev->name); +return ret; + } + }
This looks superfluous. Can we abstract the PHY operation to a new function, and pass the phy pointer and index in?
Quoted 12 lines
drivers/usb/host/xhci-dwc3.c +5
-0+ dwc3_reg = (struct dwc3 *)((char *)(hccr) +DWC3_REG_OFFSET );dwc3_core_init (dwc3_reg);@@ -178,6 +199,20 @@ static int xhci_dwc3_remove(struct udevice *dev) } } +if (generic_phy_valid (&plat->usb3_phy)) { + ret =generic_phy_power_off (&plat->usb3_phy); +if (ret) { +pr_err ("Can't poweroff USB3 PHY for %s\n" , dev->name);
drivers/usb/host/xhci-dwc3.c static int xhci_dwc3_remove(struct udevice *dev) · line 215
Quoted 10 lines
drivers/usb/host/xhci-dwc3.c +10
-0+return ret; + } + + ret =generic_phy_exit (&plat->usb3_phy); +if (ret) { +pr_err ("Can't deinit USB3 PHY for %s\n" , dev->name); +return ret; + } + } +
ditto
drivers/usb/host/xhci-dwc3.c static int xhci_dwc3_remove(struct udevice *dev) · line 218
Quoted 3 lines
drivers/usb/host/xhci-dwc3.c +0
-0return xhci_deregister (dev); }
Regards,
Bin
PATCH 2/2 usb: xhci-dwc3: Enable USB3 PHY when available
Hi Bin,
Quoted 41 lines · Bin Meng
Hi Vignesh,
Quoted 38 lines · Vignesh R
DWC3 USB3 controllers will need USB3 PHY to be enabled, in addition to USB2 PHY, to be functional. Therefore enable USB3 PHY when available.
Signed-off-by Vignesh R <[email protected]>--- drivers/usb/host/xhci-dwc3.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)drivers/usb/host/xhci-dwc3.c +15
-0@@ -23,6 +23,7 @@ DECLARE_GLOBAL_DATA_PTR;struct xhci_dwc3_platdata {struct phy usb_phy; +struct phy usb3_phy; };void dwc3_set_mode (struct dwc3 *dwc3_reg,u32 mode)@@ -145,6 +146,26 @@ static int xhci_dwc3_probe(struct udevice *dev) } } + ret =generic_phy_get_by_index (dev,1 , &plat->usb3_phy); +if (ret) { +if (ret != -ENOENT ) { +pr_err ("Failed to get USB3 PHY for %s\n" , dev->name); +return ret; + } + }else { + ret =generic_phy_init (&plat->usb3_phy); +if (ret) { +pr_err ("Can't init USB3 PHY for %s\n" , dev->name); +return ret; + } + + ret =generic_phy_power_on (&plat->usb3_phy);
Quoted 8 lines
drivers/usb/host/xhci-dwc3.c static int xhci_dwc3_probe(struct udevice *dev) · line 167
Quoted 5 lines
drivers/usb/host/xhci-dwc3.c +5
-0+if (ret) { +pr_err ("Can't power on USB3 PHY for %s\n" , dev->name); +return ret; + } + }This looks superfluous. Can we abstract the PHY operation to a new function, and pass the phy pointer and index in?
Okay, will extract this into a separate function here.
Quoted 9 lines
Quoted 9 lines
drivers/usb/host/xhci-dwc3.c +1
-0+ dwc3_reg = (struct dwc3 *)((char *)(hccr) +DWC3_REG_OFFSET );dwc3_core_init (dwc3_reg);@@ -178,6 +199,20 @@ static int xhci_dwc3_remove(struct udevice *dev) } }
Quoted 16 lines
Quoted 4 lines
drivers/usb/host/xhci-dwc3.c +4
-0+if (generic_phy_valid (&plat->usb3_phy)) { + ret =generic_phy_power_off (&plat->usb3_phy); +if (ret) { +pr_err ("Can't poweroff USB3 PHY for %s\n" , dev->name);drivers/usb/host/xhci-dwc3.c static int xhci_dwc3_remove(struct udevice *dev) · line 215
Quoted 10 lines
drivers/usb/host/xhci-dwc3.c +10
-0+return ret; + } + + ret =generic_phy_exit (&plat->usb3_phy); +if (ret) { +pr_err ("Can't deinit USB3 PHY for %s\n" , dev->name); +return ret; + } + } +ditto
okay, thanks for the review!
Signature · 2 lines
Regards Vignesh
cover xhci-dwc3: Couple of fixes for USB3 support
In reply to Vignesh RQuoted 10 lines · Vignesh R
This series has couple of fixes needed to get DWC3 USB3 controller to talk to USB3 devices on AM57xx SoCs.
Vignesh R (2):
usb: xhci-dwc3: Power on USB PHY before using
usb: xhci-dwc3: Enable USB3 PHY when availabledrivers/usb/host/xhci-dwc3.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
Bin, please give me a R-B/A-B on these. Thanks!
Signature · 2 lines
Best regards, Marek Vasut