aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/phy
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2014-08-27 19:28:08 -0400
committerKishon Vijay Abraham I <kishon@ti.com>2014-09-24 05:48:32 -0400
commit62dc5769bbd9f187e2e5df64f4e3b5affd48fe7b (patch)
treea4b2bc13d11baa686ab30dd3bc82cf5778e705aa /drivers/phy
parentbb419402cc1075db508f9ee8cfff3618e111f744 (diff)
usb: phy: twl4030-usb: Simplify phy init to use runtime PM
We can now let the interrupt and delayed work do all that's needed with runtime PM. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/phy-twl4030-usb.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c
index bc28eccb029e..a292db01b503 100644
--- a/drivers/phy/phy-twl4030-usb.c
+++ b/drivers/phy/phy-twl4030-usb.c
@@ -471,16 +471,8 @@ static int twl4030_phy_power_on(struct phy *phy)
471 twl4030_usb_set_mode(twl, twl->usb_mode); 471 twl4030_usb_set_mode(twl, twl->usb_mode);
472 if (twl->usb_mode == T2_USB_MODE_ULPI) 472 if (twl->usb_mode == T2_USB_MODE_ULPI)
473 twl4030_i2c_access(twl, 0); 473 twl4030_i2c_access(twl, 0);
474 schedule_delayed_work(&twl->id_workaround_work, 0);
474 475
475 /*
476 * XXX When VBUS gets driven after musb goes to A mode,
477 * ID_PRES related interrupts no longer arrive, why?
478 * Register itself is updated fine though, so we must poll.
479 */
480 if (twl->linkstat == OMAP_MUSB_ID_GROUND) {
481 cancel_delayed_work(&twl->id_workaround_work);
482 schedule_delayed_work(&twl->id_workaround_work, HZ);
483 }
484 return 0; 476 return 0;
485} 477}
486 478
@@ -612,16 +604,9 @@ static void twl4030_id_workaround_work(struct work_struct *work)
612static int twl4030_phy_init(struct phy *phy) 604static int twl4030_phy_init(struct phy *phy)
613{ 605{
614 struct twl4030_usb *twl = phy_get_drvdata(phy); 606 struct twl4030_usb *twl = phy_get_drvdata(phy);
615 enum omap_musb_vbus_id_status status;
616 607
617 pm_runtime_get_sync(twl->dev); 608 pm_runtime_get_sync(twl->dev);
618 status = twl4030_usb_linkstat(twl); 609 schedule_delayed_work(&twl->id_workaround_work, 0);
619 twl->linkstat = status;
620
621 if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID)
622 omap_musb_mailbox(twl->linkstat);
623
624 sysfs_notify(&twl->dev->kobj, NULL, "vbus");
625 pm_runtime_mark_last_busy(twl->dev); 610 pm_runtime_mark_last_busy(twl->dev);
626 pm_runtime_put_autosuspend(twl->dev); 611 pm_runtime_put_autosuspend(twl->dev);
627 612
@@ -698,6 +683,7 @@ static int twl4030_usb_probe(struct platform_device *pdev)
698 twl->dev = &pdev->dev; 683 twl->dev = &pdev->dev;
699 twl->irq = platform_get_irq(pdev, 0); 684 twl->irq = platform_get_irq(pdev, 0);
700 twl->vbus_supplied = false; 685 twl->vbus_supplied = false;
686 twl->linkstat = -EINVAL;
701 twl->asleep = 1; 687 twl->asleep = 1;
702 twl->linkstat = OMAP_MUSB_UNKNOWN; 688 twl->linkstat = OMAP_MUSB_UNKNOWN;
703 689