usb: musb: Fix getting a generic phy for musb_dsps
We still have a combination of legacy phys and generic phys in use so we need to support both types of phy for musb_dsps.c. Cc: Brian Hutchinson <b.hutchman@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
eed97ef39a
commit
bb90600d5c
1 changed files with 24 additions and 1 deletions
|
@ -457,12 +457,27 @@ static int dsps_musb_init(struct musb *musb)
|
||||||
if (IS_ERR(musb->xceiv))
|
if (IS_ERR(musb->xceiv))
|
||||||
return PTR_ERR(musb->xceiv);
|
return PTR_ERR(musb->xceiv);
|
||||||
|
|
||||||
|
musb->phy = devm_phy_get(dev->parent, "usb2-phy");
|
||||||
|
|
||||||
/* Returns zero if e.g. not clocked */
|
/* Returns zero if e.g. not clocked */
|
||||||
rev = dsps_readl(reg_base, wrp->revision);
|
rev = dsps_readl(reg_base, wrp->revision);
|
||||||
if (!rev)
|
if (!rev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
usb_phy_init(musb->xceiv);
|
usb_phy_init(musb->xceiv);
|
||||||
|
if (IS_ERR(musb->phy)) {
|
||||||
|
musb->phy = NULL;
|
||||||
|
} else {
|
||||||
|
ret = phy_init(musb->phy);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
ret = phy_power_on(musb->phy);
|
||||||
|
if (ret) {
|
||||||
|
phy_exit(musb->phy);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setup_timer(&glue->timer, otg_timer, (unsigned long) musb);
|
setup_timer(&glue->timer, otg_timer, (unsigned long) musb);
|
||||||
|
|
||||||
/* Reset the musb */
|
/* Reset the musb */
|
||||||
|
@ -502,6 +517,8 @@ static int dsps_musb_exit(struct musb *musb)
|
||||||
|
|
||||||
del_timer_sync(&glue->timer);
|
del_timer_sync(&glue->timer);
|
||||||
usb_phy_shutdown(musb->xceiv);
|
usb_phy_shutdown(musb->xceiv);
|
||||||
|
phy_power_off(musb->phy);
|
||||||
|
phy_exit(musb->phy);
|
||||||
debugfs_remove_recursive(glue->dbgfs_root);
|
debugfs_remove_recursive(glue->dbgfs_root);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -610,7 +627,7 @@ static int dsps_musb_reset(struct musb *musb)
|
||||||
struct device *dev = musb->controller;
|
struct device *dev = musb->controller;
|
||||||
struct dsps_glue *glue = dev_get_drvdata(dev->parent);
|
struct dsps_glue *glue = dev_get_drvdata(dev->parent);
|
||||||
const struct dsps_musb_wrapper *wrp = glue->wrp;
|
const struct dsps_musb_wrapper *wrp = glue->wrp;
|
||||||
int session_restart = 0;
|
int session_restart = 0, error;
|
||||||
|
|
||||||
if (glue->sw_babble_enabled)
|
if (glue->sw_babble_enabled)
|
||||||
session_restart = sw_babble_control(musb);
|
session_restart = sw_babble_control(musb);
|
||||||
|
@ -624,8 +641,14 @@ static int dsps_musb_reset(struct musb *musb)
|
||||||
dsps_writel(musb->ctrl_base, wrp->control, (1 << wrp->reset));
|
dsps_writel(musb->ctrl_base, wrp->control, (1 << wrp->reset));
|
||||||
usleep_range(100, 200);
|
usleep_range(100, 200);
|
||||||
usb_phy_shutdown(musb->xceiv);
|
usb_phy_shutdown(musb->xceiv);
|
||||||
|
error = phy_power_off(musb->phy);
|
||||||
|
if (error)
|
||||||
|
dev_err(dev, "phy shutdown failed: %i\n", error);
|
||||||
usleep_range(100, 200);
|
usleep_range(100, 200);
|
||||||
usb_phy_init(musb->xceiv);
|
usb_phy_init(musb->xceiv);
|
||||||
|
error = phy_power_on(musb->phy);
|
||||||
|
if (error)
|
||||||
|
dev_err(dev, "phy powerup failed: %i\n", error);
|
||||||
session_restart = 1;
|
session_restart = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue