diff mbox

[v2,4/4] usb: otg: twl4030: fix cold plug on OMAP3

Message ID 1363242239-1061-5-git-send-email-kishon@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kishon Vijay Abraham I March 14, 2013, 6:23 a.m. UTC
Having twl4030_usb_phy_init() (detects if a cable is connected before
twl4030 is probed) in twl4030 probe makes cable connect events to be
missed by musb glue, since it gets loaded after twl4030. Having
twl4030_usb_phy_init as a usb_phy ops lets twl4030_usb_phy_init to be
called when glue is ready.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/usb/otg/twl4030-usb.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Felipe Balbi March 14, 2013, 3:49 p.m. UTC | #1
On Thu, Mar 14, 2013 at 11:53:59AM +0530, Kishon Vijay Abraham I wrote:
> Having twl4030_usb_phy_init() (detects if a cable is connected before
> twl4030 is probed) in twl4030 probe makes cable connect events to be
> missed by musb glue, since it gets loaded after twl4030. Having
> twl4030_usb_phy_init as a usb_phy ops lets twl4030_usb_phy_init to be
> called when glue is ready.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

likewise. The other two I have taken
diff mbox

Patch

diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 5b20bb4..4040124 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -565,8 +565,9 @@  static void twl4030_id_workaround_work(struct work_struct *work)
 	}
 }
 
-static void twl4030_usb_phy_init(struct twl4030_usb *twl)
+static int twl4030_usb_phy_init(struct usb_phy *phy)
 {
+	struct twl4030_usb *twl = phy_to_twl(phy);
 	enum omap_musb_vbus_id_status status;
 
 	/*
@@ -581,6 +582,7 @@  static void twl4030_usb_phy_init(struct twl4030_usb *twl)
 		omap_musb_mailbox(twl->linkstat);
 
 	sysfs_notify(&twl->dev->kobj, NULL, "vbus");
+	return 0;
 }
 
 static int twl4030_set_suspend(struct usb_phy *x, int suspend)
@@ -657,6 +659,7 @@  static int twl4030_usb_probe(struct platform_device *pdev)
 	twl->phy.otg		= otg;
 	twl->phy.type		= USB_PHY_TYPE_USB2;
 	twl->phy.set_suspend	= twl4030_set_suspend;
+	twl->phy.init		= twl4030_usb_phy_init;
 
 	otg->phy		= &twl->phy;
 	otg->set_host		= twl4030_set_host;
@@ -696,8 +699,6 @@  static int twl4030_usb_probe(struct platform_device *pdev)
 		return status;
 	}
 
-	twl4030_usb_phy_init(twl);
-
 	dev_info(&pdev->dev, "Initialized TWL4030 USB module\n");
 	return 0;
 }