Commit 93ce959d authored by Kamil Debski's avatar Kamil Debski Committed by Greg Kroah-Hartman

usb: dwc2/gadget: fix phy initialization sequence

commit ca2c5ba8 upstream.

In the Generic PHY Framework a NULL phy is considered to be a valid phy
thus the "if (hsotg->phy)" check does not give us the information whether
the Generic PHY Framework is used.

In addition to the above this patch also removes phy_init from probe and
phy_exit from remove. This is not necessary when init/exit is done in the
s3c_hsotg_phy_enable/disable functions.
Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2290f236
...@@ -2748,13 +2748,14 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) ...@@ -2748,13 +2748,14 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg)
dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev);
if (hsotg->phy) { if (hsotg->uphy)
phy_init(hsotg->phy);
phy_power_on(hsotg->phy);
} else if (hsotg->uphy)
usb_phy_init(hsotg->uphy); usb_phy_init(hsotg->uphy);
else if (hsotg->plat->phy_init) else if (hsotg->plat && hsotg->plat->phy_init)
hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
else {
phy_init(hsotg->phy);
phy_power_on(hsotg->phy);
}
} }
/** /**
...@@ -2768,13 +2769,14 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) ...@@ -2768,13 +2769,14 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg)
{ {
struct platform_device *pdev = to_platform_device(hsotg->dev); struct platform_device *pdev = to_platform_device(hsotg->dev);
if (hsotg->phy) { if (hsotg->uphy)
phy_power_off(hsotg->phy);
phy_exit(hsotg->phy);
} else if (hsotg->uphy)
usb_phy_shutdown(hsotg->uphy); usb_phy_shutdown(hsotg->uphy);
else if (hsotg->plat->phy_exit) else if (hsotg->plat && hsotg->plat->phy_exit)
hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type);
else {
phy_power_off(hsotg->phy);
phy_exit(hsotg->phy);
}
} }
/** /**
...@@ -3489,9 +3491,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev) ...@@ -3489,9 +3491,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
if (hsotg->phy && (phy_get_bus_width(phy) == 8)) if (hsotg->phy && (phy_get_bus_width(phy) == 8))
hsotg->phyif = GUSBCFG_PHYIF8; hsotg->phyif = GUSBCFG_PHYIF8;
if (hsotg->phy)
phy_init(hsotg->phy);
/* usb phy enable */ /* usb phy enable */
s3c_hsotg_phy_enable(hsotg); s3c_hsotg_phy_enable(hsotg);
...@@ -3584,8 +3583,6 @@ static int s3c_hsotg_remove(struct platform_device *pdev) ...@@ -3584,8 +3583,6 @@ static int s3c_hsotg_remove(struct platform_device *pdev)
usb_gadget_unregister_driver(hsotg->driver); usb_gadget_unregister_driver(hsotg->driver);
} }
if (hsotg->phy)
phy_exit(hsotg->phy);
clk_disable_unprepare(hsotg->clk); clk_disable_unprepare(hsotg->clk);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment