usb: dwc2: fix wrong order of phy_power_on and phy_init
Subsystems (2)
PATCH v2 1/1 usb: dwc2: fix wrong order of phy_power_on and phy_init
Since 1599069a62c6 ("phy: core: Warn when phy_power_on is called before phy_init") the driver complains. In my case (Amlogic SoC) the warning
is: phy phy-fe03e000.phy.2: phy_power_on was called before phy_init So change the order of the two calls. The same change has to be done to the order of phy_exit() and phy_power_off().
---
v2:
- switch the order of phy_power_off() and phy_exit() too
--- drivers/usb/dwc2/platform.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/dwc2/platform.c +4 -4
@@ -154,9 +154,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg) }else if (hsotg->plat && hsotg->plat->phy_init) { ret = hsotg->plat->phy_init (pdev, hsotg->plat->phy_type); }else { - ret =phy_power_on (hsotg->phy); + ret =phy_init (hsotg->phy);if (ret ==0 ) - ret =phy_init (hsotg->phy); + ret =phy_power_on (hsotg->phy); }return ret;
@@ -188,9 +188,9 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg) }else if (hsotg->plat && hsotg->plat->phy_exit) { ret = hsotg->plat->phy_exit (pdev, hsotg->plat->phy_type); }else { - ret =phy_exit (hsotg->phy); + ret =phy_power_off (hsotg->phy);if (ret ==0 ) - ret =phy_power_off (hsotg->phy); + ret =phy_exit (hsotg->phy); }if (ret)return ret;
Signature · 1 line
2.37.2
Quoted 9 lines · Heiner Kallweit
Since
1599069a62c6("phy: core: Warn whenphy_power_onis called beforephy_init") the driver complains. In my case (Amlogic SoC) the warning
is: phy phy-fe03e000.phy.2:phy_power_onwas called beforephy_initSo change the order of the two calls. The same change has to be done to the order ofphy_exit()andphy_power_off().Fixes 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c")Signed-off-by Heiner Kallweit <[email protected]>
Quoted 35 lines
---
v2:
- switch the order ofphy_power_off()andphy_exit()too--- drivers/usb/dwc2/platform.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/usb/dwc2/platform.c +4
-4@@ -154,9 +154,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg) }else if (hsotg->plat && hsotg->plat->phy_init) { ret = hsotg->plat->phy_init (pdev, hsotg->plat->phy_type); }else { - ret =phy_power_on (hsotg->phy); + ret =phy_init (hsotg->phy);if (ret ==0 ) - ret =phy_init (hsotg->phy); + ret =phy_power_on (hsotg->phy); }return ret;@@ -188,9 +188,9 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg) }else if (hsotg->plat && hsotg->plat->phy_exit) { ret = hsotg->plat->phy_exit (pdev, hsotg->plat->phy_type); }else { - ret =phy_exit (hsotg->phy); + ret =phy_power_off (hsotg->phy);if (ret ==0 ) - ret =phy_power_off (hsotg->phy); + ret =phy_exit (hsotg->phy); }if (ret)return ret;
Quoted 9 lines · Heiner Kallweit
Since
1599069a62c6("phy: core: Warn whenphy_power_onis called beforephy_init") the driver complains. In my case (Amlogic SoC) the warning
is: phy phy-fe03e000.phy.2:phy_power_onwas called beforephy_initSo change the order of the two calls. The same change has to be done to the order ofphy_exit()andphy_power_off().Fixes 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c")Signed-off-by Heiner Kallweit <[email protected]>
I was about to send similar patch some time ago, but I didn't have time to check if all PHY drivers that are used by DWC2 would work fine after such change. It works fine on Exynos based SoCs though (init/exit callbacks are noop in this case), so:
Quoted 25 lines
---
v2:
- switch the order ofphy_power_off()andphy_exit()too--- drivers/usb/dwc2/platform.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/usb/dwc2/platform.c +2
-2@@ -154,9 +154,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg) }else if (hsotg->plat && hsotg->plat->phy_init) { ret = hsotg->plat->phy_init (pdev, hsotg->plat->phy_type); }else { - ret =phy_power_on (hsotg->phy); + ret =phy_init (hsotg->phy);if (ret ==0 ) - ret =phy_init (hsotg->phy); + ret =phy_power_on (hsotg->phy); }return ret;@@ -188,9 +188,9 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg) }else if (hsotg->plat && hsotg->plat->phy_exit) {
drivers/usb/dwc2/platform.c static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg) · line 196
Quoted 10 lines
drivers/usb/dwc2/platform.c +2
-2ret = hsotg->plat->phy_exit (pdev, hsotg->plat->phy_type); }else { - ret =phy_exit (hsotg->phy); + ret =phy_power_off (hsotg->phy);if (ret ==0 ) - ret =phy_power_off (hsotg->phy); + ret =phy_exit (hsotg->phy); }if (ret)return ret;
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland