aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2012-06-22 08:10:53 -0400
committerFelipe Balbi <balbi@ti.com>2012-06-25 07:08:42 -0400
commitc83a8542b5e3c5b30825955a68b1cc8bd24b122a (patch)
tree1cc3233f95af3c904defa6487d6f076bea0f9bdb /drivers
parentc9721438c009adf8e81d376839ed037c53b9b8d9 (diff)
usb: musb: move otg specific initializations from twl to glue
Moved otg specific state(OTG_STATE_B_IDLE, OTG_STATE_A_IDLE) initializations from twl to glue. These initializations are removed from twl4030 and twl6030 and moved to the mailbox API defined in glue. This is part of the cleanup in preparation to make use of usb2 phy driver. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/musb/omap2430.c5
-rw-r--r--drivers/usb/otg/twl4030-usb.c8
-rw-r--r--drivers/usb/otg/twl6030-usb.c6
3 files changed, 5 insertions, 14 deletions
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 063687085d1e..c4dc92bd7e85 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -249,11 +249,14 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
249 struct device *dev = musb->controller; 249 struct device *dev = musb->controller;
250 struct musb_hdrc_platform_data *pdata = dev->platform_data; 250 struct musb_hdrc_platform_data *pdata = dev->platform_data;
251 struct omap_musb_board_data *data = pdata->board_data; 251 struct omap_musb_board_data *data = pdata->board_data;
252 struct usb_otg *otg = musb->xceiv->otg;
252 253
253 switch (glue->status) { 254 switch (glue->status) {
254 case OMAP_MUSB_ID_GROUND: 255 case OMAP_MUSB_ID_GROUND:
255 dev_dbg(dev, "ID GND\n"); 256 dev_dbg(dev, "ID GND\n");
256 257
258 otg->default_a = true;
259 musb->xceiv->state = OTG_STATE_A_IDLE;
257 musb->xceiv->last_event = USB_EVENT_ID; 260 musb->xceiv->last_event = USB_EVENT_ID;
258 if (!is_otg_enabled(musb) || musb->gadget_driver) { 261 if (!is_otg_enabled(musb) || musb->gadget_driver) {
259 pm_runtime_get_sync(dev); 262 pm_runtime_get_sync(dev);
@@ -265,6 +268,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
265 case OMAP_MUSB_VBUS_VALID: 268 case OMAP_MUSB_VBUS_VALID:
266 dev_dbg(dev, "VBUS Connect\n"); 269 dev_dbg(dev, "VBUS Connect\n");
267 270
271 otg->default_a = false;
272 musb->xceiv->state = OTG_STATE_B_IDLE;
268 musb->xceiv->last_event = USB_EVENT_VBUS; 273 musb->xceiv->last_event = USB_EVENT_VBUS;
269 if (musb->gadget_driver) 274 if (musb->gadget_driver)
270 pm_runtime_get_sync(dev); 275 pm_runtime_get_sync(dev);
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index a7b809e217ea..4d0d98bc40cd 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -251,7 +251,6 @@ static enum omap_musb_vbus_id_status
251{ 251{
252 int status; 252 int status;
253 enum omap_musb_vbus_id_status linkstat = OMAP_MUSB_UNKNOWN; 253 enum omap_musb_vbus_id_status linkstat = OMAP_MUSB_UNKNOWN;
254 struct usb_otg *otg = twl->phy.otg;
255 254
256 twl->vbus_supplied = false; 255 twl->vbus_supplied = false;
257 256
@@ -291,13 +290,6 @@ static enum omap_musb_vbus_id_status
291 290
292 spin_lock_irq(&twl->lock); 291 spin_lock_irq(&twl->lock);
293 twl->linkstat = linkstat; 292 twl->linkstat = linkstat;
294 if (linkstat == OMAP_MUSB_ID_GROUND) {
295 otg->default_a = true;
296 twl->phy.state = OTG_STATE_A_IDLE;
297 } else {
298 otg->default_a = false;
299 twl->phy.state = OTG_STATE_B_IDLE;
300 }
301 spin_unlock_irq(&twl->lock); 293 spin_unlock_irq(&twl->lock);
302 294
303 return linkstat; 295 return linkstat;
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 6c758836cfb1..66cfea735557 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -256,7 +256,6 @@ static DEVICE_ATTR(vbus, 0444, twl6030_usb_vbus_show, NULL);
256static irqreturn_t twl6030_usb_irq(int irq, void *_twl) 256static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
257{ 257{
258 struct twl6030_usb *twl = _twl; 258 struct twl6030_usb *twl = _twl;
259 struct usb_otg *otg = twl->phy.otg;
260 enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN; 259 enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN;
261 u8 vbus_state, hw_state; 260 u8 vbus_state, hw_state;
262 261
@@ -269,8 +268,6 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
269 regulator_enable(twl->usb3v3); 268 regulator_enable(twl->usb3v3);
270 twl->asleep = 1; 269 twl->asleep = 1;
271 status = OMAP_MUSB_VBUS_VALID; 270 status = OMAP_MUSB_VBUS_VALID;
272 otg->default_a = false;
273 twl->phy.state = OTG_STATE_B_IDLE;
274 twl->linkstat = status; 271 twl->linkstat = status;
275 omap_musb_mailbox(status); 272 omap_musb_mailbox(status);
276 } else { 273 } else {
@@ -293,7 +290,6 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
293static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) 290static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
294{ 291{
295 struct twl6030_usb *twl = _twl; 292 struct twl6030_usb *twl = _twl;
296 struct usb_otg *otg = twl->phy.otg;
297 enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN; 293 enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN;
298 u8 hw_state; 294 u8 hw_state;
299 295
@@ -307,8 +303,6 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
307 twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, 303 twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET,
308 0x10); 304 0x10);
309 status = OMAP_MUSB_ID_GROUND; 305 status = OMAP_MUSB_ID_GROUND;
310 otg->default_a = true;
311 twl->phy.state = OTG_STATE_A_IDLE;
312 twl->linkstat = status; 306 twl->linkstat = status;
313 omap_musb_mailbox(status); 307 omap_musb_mailbox(status);
314 } else { 308 } else {