aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/omap2430.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-01 11:45:33 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-01 11:45:33 -0500
commit8062d94a545457a83d5291bd62c3bfd14200bba0 (patch)
treea6a7aaaea5dff00f7415a93189720a1164ae30dd /drivers/usb/musb/omap2430.c
parent15e68a803573974409972e761d8f08f03fce5bdb (diff)
parent6e13c6505cdff9766d5268ffb8c972c1a2f996e6 (diff)
Merge tag 'xceiv-for-v3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
USB: transceiver changes for 3.4 Here we have a big rework done by Heikki Krogerus (thanks) which splits OTG functionality away from transceivers. We have known for quite a long time that struct otg_transceiver was a bad name for the structure, considering transceiver is far from being OTG-specific (see 4e67185).
Diffstat (limited to 'drivers/usb/musb/omap2430.c')
-rw-r--r--drivers/usb/musb/omap2430.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index da430c31ebef..2ae0bb309994 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -132,6 +132,7 @@ static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
132 132
133static void omap2430_musb_set_vbus(struct musb *musb, int is_on) 133static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
134{ 134{
135 struct usb_otg *otg = musb->xceiv->otg;
135 u8 devctl; 136 u8 devctl;
136 unsigned long timeout = jiffies + msecs_to_jiffies(1000); 137 unsigned long timeout = jiffies + msecs_to_jiffies(1000);
137 int ret = 1; 138 int ret = 1;
@@ -163,11 +164,11 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
163 } 164 }
164 } 165 }
165 166
166 if (ret && musb->xceiv->set_vbus) 167 if (ret && otg->set_vbus)
167 otg_set_vbus(musb->xceiv, 1); 168 otg_set_vbus(otg, 1);
168 } else { 169 } else {
169 musb->is_active = 1; 170 musb->is_active = 1;
170 musb->xceiv->default_a = 1; 171 otg->default_a = 1;
171 musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; 172 musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
172 devctl |= MUSB_DEVCTL_SESSION; 173 devctl |= MUSB_DEVCTL_SESSION;
173 MUSB_HST_MODE(musb); 174 MUSB_HST_MODE(musb);
@@ -179,7 +180,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
179 * jumping right to B_IDLE... 180 * jumping right to B_IDLE...
180 */ 181 */
181 182
182 musb->xceiv->default_a = 0; 183 otg->default_a = 0;
183 musb->xceiv->state = OTG_STATE_B_IDLE; 184 musb->xceiv->state = OTG_STATE_B_IDLE;
184 devctl &= ~MUSB_DEVCTL_SESSION; 185 devctl &= ~MUSB_DEVCTL_SESSION;
185 186
@@ -246,7 +247,7 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
246 247
247 if (!is_otg_enabled(musb) || musb->gadget_driver) { 248 if (!is_otg_enabled(musb) || musb->gadget_driver) {
248 pm_runtime_get_sync(musb->controller); 249 pm_runtime_get_sync(musb->controller);
249 otg_init(musb->xceiv); 250 usb_phy_init(musb->xceiv);
250 omap2430_musb_set_vbus(musb, 1); 251 omap2430_musb_set_vbus(musb, 1);
251 } 252 }
252 break; 253 break;
@@ -256,7 +257,7 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
256 257
257 if (musb->gadget_driver) 258 if (musb->gadget_driver)
258 pm_runtime_get_sync(musb->controller); 259 pm_runtime_get_sync(musb->controller);
259 otg_init(musb->xceiv); 260 usb_phy_init(musb->xceiv);
260 break; 261 break;
261 262
262 case USB_EVENT_NONE: 263 case USB_EVENT_NONE:
@@ -269,10 +270,10 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
269 } 270 }
270 271
271 if (data->interface_type == MUSB_INTERFACE_UTMI) { 272 if (data->interface_type == MUSB_INTERFACE_UTMI) {
272 if (musb->xceiv->set_vbus) 273 if (musb->xceiv->otg->set_vbus)
273 otg_set_vbus(musb->xceiv, 0); 274 otg_set_vbus(musb->xceiv->otg, 0);
274 } 275 }
275 otg_shutdown(musb->xceiv); 276 usb_phy_shutdown(musb->xceiv);
276 break; 277 break;
277 default: 278 default:
278 dev_dbg(musb->controller, "ID float\n"); 279 dev_dbg(musb->controller, "ID float\n");
@@ -290,7 +291,7 @@ static int omap2430_musb_init(struct musb *musb)
290 * up through ULPI. TWL4030-family PMICs include one, 291 * up through ULPI. TWL4030-family PMICs include one,
291 * which needs a driver, drivers aren't always needed. 292 * which needs a driver, drivers aren't always needed.
292 */ 293 */
293 musb->xceiv = otg_get_transceiver(); 294 musb->xceiv = usb_get_transceiver();
294 if (!musb->xceiv) { 295 if (!musb->xceiv) {
295 pr_err("HS USB OTG: no transceiver configured\n"); 296 pr_err("HS USB OTG: no transceiver configured\n");
296 return -ENODEV; 297 return -ENODEV;
@@ -325,7 +326,7 @@ static int omap2430_musb_init(struct musb *musb)
325 musb_readl(musb->mregs, OTG_SIMENABLE)); 326 musb_readl(musb->mregs, OTG_SIMENABLE));
326 327
327 musb->nb.notifier_call = musb_otg_notifications; 328 musb->nb.notifier_call = musb_otg_notifications;
328 status = otg_register_notifier(musb->xceiv, &musb->nb); 329 status = usb_register_notifier(musb->xceiv, &musb->nb);
329 330
330 if (status) 331 if (status)
331 dev_dbg(musb->controller, "notification register failed\n"); 332 dev_dbg(musb->controller, "notification register failed\n");
@@ -349,7 +350,7 @@ static void omap2430_musb_enable(struct musb *musb)
349 switch (musb->xceiv->last_event) { 350 switch (musb->xceiv->last_event) {
350 351
351 case USB_EVENT_ID: 352 case USB_EVENT_ID:
352 otg_init(musb->xceiv); 353 usb_phy_init(musb->xceiv);
353 if (data->interface_type != MUSB_INTERFACE_UTMI) 354 if (data->interface_type != MUSB_INTERFACE_UTMI)
354 break; 355 break;
355 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); 356 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
@@ -368,7 +369,7 @@ static void omap2430_musb_enable(struct musb *musb)
368 break; 369 break;
369 370
370 case USB_EVENT_VBUS: 371 case USB_EVENT_VBUS:
371 otg_init(musb->xceiv); 372 usb_phy_init(musb->xceiv);
372 break; 373 break;
373 374
374 default: 375 default:
@@ -379,7 +380,7 @@ static void omap2430_musb_enable(struct musb *musb)
379static void omap2430_musb_disable(struct musb *musb) 380static void omap2430_musb_disable(struct musb *musb)
380{ 381{
381 if (musb->xceiv->last_event) 382 if (musb->xceiv->last_event)
382 otg_shutdown(musb->xceiv); 383 usb_phy_shutdown(musb->xceiv);
383} 384}
384 385
385static int omap2430_musb_exit(struct musb *musb) 386static int omap2430_musb_exit(struct musb *musb)
@@ -388,7 +389,7 @@ static int omap2430_musb_exit(struct musb *musb)
388 cancel_work_sync(&musb->otg_notifier_work); 389 cancel_work_sync(&musb->otg_notifier_work);
389 390
390 omap2430_low_level_exit(musb); 391 omap2430_low_level_exit(musb);
391 otg_put_transceiver(musb->xceiv); 392 usb_put_transceiver(musb->xceiv);
392 393
393 return 0; 394 return 0;
394} 395}
@@ -494,7 +495,7 @@ static int omap2430_runtime_suspend(struct device *dev)
494 OTG_INTERFSEL); 495 OTG_INTERFSEL);
495 496
496 omap2430_low_level_exit(musb); 497 omap2430_low_level_exit(musb);
497 otg_set_suspend(musb->xceiv, 1); 498 usb_phy_set_suspend(musb->xceiv, 1);
498 499
499 return 0; 500 return 0;
500} 501}
@@ -508,7 +509,7 @@ static int omap2430_runtime_resume(struct device *dev)
508 musb_writel(musb->mregs, OTG_INTERFSEL, 509 musb_writel(musb->mregs, OTG_INTERFSEL,
509 musb->context.otg_interfsel); 510 musb->context.otg_interfsel);
510 511
511 otg_set_suspend(musb->xceiv, 0); 512 usb_phy_set_suspend(musb->xceiv, 0);
512 513
513 return 0; 514 return 0;
514} 515}