diff options
| author | Tony Lindgren <tony@atomide.com> | 2015-02-04 09:28:49 -0500 |
|---|---|---|
| committer | Felipe Balbi <balbi@ti.com> | 2015-02-23 10:15:25 -0500 |
| commit | bb90600d5cdd3a59053e0843f165e2ee49009c54 (patch) | |
| tree | 556e2ef0b9c215e83caac82996ee90bcaec1464c | |
| parent | eed97ef39a30e3301c5a7f0c94db63130bbe785b (diff) | |
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>
| -rw-r--r-- | drivers/usb/musb/musb_dsps.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 5872accb0fd3..a900c9877195 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
| @@ -457,12 +457,27 @@ static int dsps_musb_init(struct musb *musb) | |||
| 457 | if (IS_ERR(musb->xceiv)) | 457 | if (IS_ERR(musb->xceiv)) |
| 458 | return PTR_ERR(musb->xceiv); | 458 | return PTR_ERR(musb->xceiv); |
| 459 | 459 | ||
| 460 | musb->phy = devm_phy_get(dev->parent, "usb2-phy"); | ||
| 461 | |||
| 460 | /* Returns zero if e.g. not clocked */ | 462 | /* Returns zero if e.g. not clocked */ |
| 461 | rev = dsps_readl(reg_base, wrp->revision); | 463 | rev = dsps_readl(reg_base, wrp->revision); |
| 462 | if (!rev) | 464 | if (!rev) |
| 463 | return -ENODEV; | 465 | return -ENODEV; |
| 464 | 466 | ||
| 465 | usb_phy_init(musb->xceiv); | 467 | usb_phy_init(musb->xceiv); |
| 468 | if (IS_ERR(musb->phy)) { | ||
| 469 | musb->phy = NULL; | ||
| 470 | } else { | ||
| 471 | ret = phy_init(musb->phy); | ||
| 472 | if (ret < 0) | ||
| 473 | return ret; | ||
| 474 | ret = phy_power_on(musb->phy); | ||
| 475 | if (ret) { | ||
| 476 | phy_exit(musb->phy); | ||
| 477 | return ret; | ||
| 478 | } | ||
| 479 | } | ||
| 480 | |||
| 466 | setup_timer(&glue->timer, otg_timer, (unsigned long) musb); | 481 | setup_timer(&glue->timer, otg_timer, (unsigned long) musb); |
| 467 | 482 | ||
| 468 | /* Reset the musb */ | 483 | /* Reset the musb */ |
| @@ -502,6 +517,8 @@ static int dsps_musb_exit(struct musb *musb) | |||
| 502 | 517 | ||
| 503 | del_timer_sync(&glue->timer); | 518 | del_timer_sync(&glue->timer); |
| 504 | usb_phy_shutdown(musb->xceiv); | 519 | usb_phy_shutdown(musb->xceiv); |
| 520 | phy_power_off(musb->phy); | ||
| 521 | phy_exit(musb->phy); | ||
| 505 | debugfs_remove_recursive(glue->dbgfs_root); | 522 | debugfs_remove_recursive(glue->dbgfs_root); |
| 506 | 523 | ||
| 507 | return 0; | 524 | return 0; |
| @@ -610,7 +627,7 @@ static int dsps_musb_reset(struct musb *musb) | |||
| 610 | struct device *dev = musb->controller; | 627 | struct device *dev = musb->controller; |
| 611 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); | 628 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); |
| 612 | const struct dsps_musb_wrapper *wrp = glue->wrp; | 629 | const struct dsps_musb_wrapper *wrp = glue->wrp; |
| 613 | int session_restart = 0; | 630 | int session_restart = 0, error; |
| 614 | 631 | ||
| 615 | if (glue->sw_babble_enabled) | 632 | if (glue->sw_babble_enabled) |
| 616 | session_restart = sw_babble_control(musb); | 633 | session_restart = sw_babble_control(musb); |
| @@ -624,8 +641,14 @@ static int dsps_musb_reset(struct musb *musb) | |||
| 624 | dsps_writel(musb->ctrl_base, wrp->control, (1 << wrp->reset)); | 641 | dsps_writel(musb->ctrl_base, wrp->control, (1 << wrp->reset)); |
| 625 | usleep_range(100, 200); | 642 | usleep_range(100, 200); |
| 626 | usb_phy_shutdown(musb->xceiv); | 643 | usb_phy_shutdown(musb->xceiv); |
| 644 | error = phy_power_off(musb->phy); | ||
| 645 | if (error) | ||
| 646 | dev_err(dev, "phy shutdown failed: %i\n", error); | ||
| 627 | usleep_range(100, 200); | 647 | usleep_range(100, 200); |
| 628 | usb_phy_init(musb->xceiv); | 648 | usb_phy_init(musb->xceiv); |
| 649 | error = phy_power_on(musb->phy); | ||
| 650 | if (error) | ||
| 651 | dev_err(dev, "phy powerup failed: %i\n", error); | ||
| 629 | session_restart = 1; | 652 | session_restart = 1; |
| 630 | } | 653 | } |
| 631 | 654 | ||
