usb: dwc3-meson-g12a: add power-on/off of the PHYs
PATCH v2 1/1 usb: dwc3-meson-g12a: add power-on/off of the PHYs
In reply to a message not in the archiveQuoted 48 lines · Neil Armstrong via groups.io
Power on/off the PHYs to enable power to the USB ports, fixing USB support on Khadas VIM3/VIM3L boards.
The G12A USB complex has at least 2 USB2 PHYs, but one is muxed between the DWC2 and DWC3 controller and the other one directly connected to the DWC3 controller. The USB3+PCIe combo PHY is muxed between the DWC3 controller and a DW-PCIE controller.
All PHYs are optional, but it's type (usb2/usb3) and position are important to determine it's capabilities, thus they are stored in a fixed size array and the phy-name determines it's position, it's position determining it's type and functionnalities.
This is why we need to loop over the array to power on all the DT provided PHYs.Signed-off-by Neil Armstrong <[email protected]>---
Changes since v1:
- removed extra space before semicolon
- added clarification in commit messagedrivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/usb/dwc3/dwc3-meson-g12a.c +9
-0@@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev) goto err_phy_init; } +for (i =0 ; i <PHY_COUNT ; ++i) { +if (!priv->phys[i].dev) +continue ; + + ret =generic_phy_power_on (&priv->phys[i]); +if (ret) + goto err_phy_init; + } +return 0 ; err_phy_init:@@ -430,6 +439,13 @@ static int dwc3_meson_g12a_remove(struct udevice *dev)clk_release_all (&priv->clk,1 );
drivers/usb/dwc3/dwc3-meson-g12a.c static int dwc3_meson_g12a_remove(struct udevice *dev) · line 451
Quoted 10 lines
drivers/usb/dwc3/dwc3-meson-g12a.c +7
-0+for (i =0 ; i <PHY_COUNT ; ++i) { +if (!priv->phys[i].dev) +continue ; + +generic_phy_power_off (&priv->phys[i]); + } +for (i =0 ; i <PHY_COUNT ; ++i) {if (!priv->phys[i].dev)continue ;
Applied to u-boot-amlogic
PATCH v2 1/1 usb: dwc3-meson-g12a: add power-on/off of the PHYs
Quoted 48 lines · Neil Armstrong
Quoted 47 lines · Neil Armstrong via groups.io
Power on/off the PHYs to enable power to the USB ports, fixing USB support on Khadas VIM3/VIM3L boards.
The G12A USB complex has at least 2 USB2 PHYs, but one is muxed between the DWC2 and DWC3 controller and the other one directly connected to the DWC3 controller. The USB3+PCIe combo PHY is muxed between the DWC3 controller and a DW-PCIE controller.
All PHYs are optional, but it's type (usb2/usb3) and position are important to determine it's capabilities, thus they are stored in a fixed size array and the phy-name determines it's position, it's position determining it's type and functionnalities.
This is why we need to loop over the array to power on all the DT provided PHYs.Signed-off-by Neil Armstrong <[email protected]>---
Changes since v1:
- removed extra space before semicolon
- added clarification in commit messagedrivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/usb/dwc3/dwc3-meson-g12a.c +9
-0@@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev) goto err_phy_init; } +for (i =0 ; i <PHY_COUNT ; ++i) { +if (!priv->phys[i].dev) +continue ; + + ret =generic_phy_power_on (&priv->phys[i]); +if (ret) + goto err_phy_init; + } +return 0 ; err_phy_init:@@ -430,6 +439,13 @@ static int dwc3_meson_g12a_remove(struct udevice *dev)clk_release_all (&priv->clk,1 );
Quoted 13 lines
drivers/usb/dwc3/dwc3-meson-g12a.c static int dwc3_meson_g12a_remove(struct udevice *dev) · line 451
Quoted 11 lines
drivers/usb/dwc3/dwc3-meson-g12a.c +7
-0+for (i =0 ; i <PHY_COUNT ; ++i) { +if (!priv->phys[i].dev) +continue ; + +generic_phy_power_off (&priv->phys[i]); + } +for (i =0 ; i <PHY_COUNT ; ++i) {if (!priv->phys[i].dev)continue ;Applied to u-boot-amlogic
Did you apply V1 or V2 ?
PATCH v2 1/1 usb: dwc3-meson-g12a: add power-on/off of the PHYs
Quoted 63 lines · Marek Vasut
Quoted 48 lines · Neil Armstrong
Quoted 47 lines · Neil Armstrong via groups.io
Power on/off the PHYs to enable power to the USB ports, fixing USB support on Khadas VIM3/VIM3L boards.
The G12A USB complex has at least 2 USB2 PHYs, but one is muxed between the DWC2 and DWC3 controller and the other one directly connected to the DWC3 controller. The USB3+PCIe combo PHY is muxed between the DWC3 controller and a DW-PCIE controller.
All PHYs are optional, but it's type (usb2/usb3) and position are important to determine it's capabilities, thus they are stored in a fixed size array and the phy-name determines it's position, it's position determining it's type and functionnalities.
This is why we need to loop over the array to power on all the DT provided PHYs.Signed-off-by Neil Armstrong <[email protected]>---
Changes since v1:
- removed extra space before semicolon
- added clarification in commit messagedrivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/usb/dwc3/dwc3-meson-g12a.c +9
-0@@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev) goto err_phy_init; } +for (i =0 ; i <PHY_COUNT ; ++i) { +if (!priv->phys[i].dev) +continue ; + + ret =generic_phy_power_on (&priv->phys[i]); +if (ret) + goto err_phy_init; + } +return 0 ; err_phy_init:@@ -430,6 +439,13 @@ static int dwc3_meson_g12a_remove(struct udevice *dev)clk_release_all (&priv->clk,1 );Quoted 13 lines
drivers/usb/dwc3/dwc3-meson-g12a.c static int dwc3_meson_g12a_remove(struct udevice *dev) · line 451
Quoted 11 lines
drivers/usb/dwc3/dwc3-meson-g12a.c +7
-0+for (i =0 ; i <PHY_COUNT ; ++i) { +if (!priv->phys[i].dev) +continue ; + +generic_phy_power_off (&priv->phys[i]); + } +for (i =0 ; i <PHY_COUNT ; ++i) {if (!priv->phys[i].dev)continue ;Applied to u-boot-amlogic
Quoted 2 lines
Did you apply V1 or V2 ?
v2
Neil