diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2012-02-13 06:24:17 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-02-27 08:41:22 -0500 |
commit | b1c711d629358576e8896a18e74cd5f4d811d7f7 (patch) | |
tree | 8b03060028db6f6aca50b20f3fdc96170002ead2 /drivers | |
parent | fcc8ebc99034bae4020a3cec030553d469e265db (diff) |
usb: otg: mv_otg: Start using struct usb_otg
Use struct usb_otg members with OTG specific functions instead
of usb_phy members.
[ balbi@ti.com : fixed a compile error on isp1704_charger.c ]
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Acked-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/isp1704_charger.c | 12 | ||||
-rw-r--r-- | drivers/usb/otg/mv_otg.c | 110 | ||||
-rw-r--r-- | drivers/usb/otg/mv_otg.h | 2 |
3 files changed, 69 insertions, 55 deletions
diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c index 58ad6e998ca0..1289a5f790a1 100644 --- a/drivers/power/isp1704_charger.c +++ b/drivers/power/isp1704_charger.c | |||
@@ -274,8 +274,8 @@ static void isp1704_charger_work(struct work_struct *data) | |||
274 | case POWER_SUPPLY_TYPE_USB: | 274 | case POWER_SUPPLY_TYPE_USB: |
275 | default: | 275 | default: |
276 | /* enable data pullups */ | 276 | /* enable data pullups */ |
277 | if (isp->phy->gadget) | 277 | if (isp->phy->otg->gadget) |
278 | usb_gadget_connect(isp->phy->gadget); | 278 | usb_gadget_connect(isp->phy->otg->gadget); |
279 | } | 279 | } |
280 | break; | 280 | break; |
281 | case USB_EVENT_NONE: | 281 | case USB_EVENT_NONE: |
@@ -293,8 +293,8 @@ static void isp1704_charger_work(struct work_struct *data) | |||
293 | * chargers. The pullups may be enabled elsewhere, so this can | 293 | * chargers. The pullups may be enabled elsewhere, so this can |
294 | * not be the final solution. | 294 | * not be the final solution. |
295 | */ | 295 | */ |
296 | if (isp->phy->gadget) | 296 | if (isp->phy->otg->gadget) |
297 | usb_gadget_disconnect(isp->phy->gadget); | 297 | usb_gadget_disconnect(isp->phy->otg->gadget); |
298 | 298 | ||
299 | isp1704_charger_set_power(isp, 0); | 299 | isp1704_charger_set_power(isp, 0); |
300 | break; | 300 | break; |
@@ -459,8 +459,8 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev) | |||
459 | * enumerated. The charger driver should be always loaded before any | 459 | * enumerated. The charger driver should be always loaded before any |
460 | * gadget is loaded. | 460 | * gadget is loaded. |
461 | */ | 461 | */ |
462 | if (isp->phy->gadget) | 462 | if (isp->phy->otg->gadget) |
463 | usb_gadget_disconnect(isp->phy->gadget); | 463 | usb_gadget_disconnect(isp->phy->otg->gadget); |
464 | 464 | ||
465 | /* Detect charger if VBUS is valid (the cable was already plugged). */ | 465 | /* Detect charger if VBUS is valid (the cable was already plugged). */ |
466 | ret = isp1704_read(isp, ULPI_USB_INT_STS); | 466 | ret = isp1704_read(isp, ULPI_USB_INT_STS); |
diff --git a/drivers/usb/otg/mv_otg.c b/drivers/usb/otg/mv_otg.c index 6e05d58effe1..6cc6c3ffbb83 100644 --- a/drivers/usb/otg/mv_otg.c +++ b/drivers/usb/otg/mv_otg.c | |||
@@ -55,16 +55,16 @@ static char *state_string[] = { | |||
55 | "a_vbus_err" | 55 | "a_vbus_err" |
56 | }; | 56 | }; |
57 | 57 | ||
58 | static int mv_otg_set_vbus(struct usb_phy *otg, bool on) | 58 | static int mv_otg_set_vbus(struct usb_otg *otg, bool on) |
59 | { | 59 | { |
60 | struct mv_otg *mvotg = container_of(otg, struct mv_otg, otg); | 60 | struct mv_otg *mvotg = container_of(otg->phy, struct mv_otg, phy); |
61 | if (mvotg->pdata->set_vbus == NULL) | 61 | if (mvotg->pdata->set_vbus == NULL) |
62 | return -ENODEV; | 62 | return -ENODEV; |
63 | 63 | ||
64 | return mvotg->pdata->set_vbus(on); | 64 | return mvotg->pdata->set_vbus(on); |
65 | } | 65 | } |
66 | 66 | ||
67 | static int mv_otg_set_host(struct usb_phy *otg, | 67 | static int mv_otg_set_host(struct usb_otg *otg, |
68 | struct usb_bus *host) | 68 | struct usb_bus *host) |
69 | { | 69 | { |
70 | otg->host = host; | 70 | otg->host = host; |
@@ -72,7 +72,7 @@ static int mv_otg_set_host(struct usb_phy *otg, | |||
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | 74 | ||
75 | static int mv_otg_set_peripheral(struct usb_phy *otg, | 75 | static int mv_otg_set_peripheral(struct usb_otg *otg, |
76 | struct usb_gadget *gadget) | 76 | struct usb_gadget *gadget) |
77 | { | 77 | { |
78 | otg->gadget = gadget; | 78 | otg->gadget = gadget; |
@@ -203,7 +203,7 @@ static void mv_otg_init_irq(struct mv_otg *mvotg) | |||
203 | static void mv_otg_start_host(struct mv_otg *mvotg, int on) | 203 | static void mv_otg_start_host(struct mv_otg *mvotg, int on) |
204 | { | 204 | { |
205 | #ifdef CONFIG_USB | 205 | #ifdef CONFIG_USB |
206 | struct usb_phy *otg = &mvotg->otg; | 206 | struct usb_otg *otg = mvotg->phy.otg; |
207 | struct usb_hcd *hcd; | 207 | struct usb_hcd *hcd; |
208 | 208 | ||
209 | if (!otg->host) | 209 | if (!otg->host) |
@@ -222,12 +222,12 @@ static void mv_otg_start_host(struct mv_otg *mvotg, int on) | |||
222 | 222 | ||
223 | static void mv_otg_start_periphrals(struct mv_otg *mvotg, int on) | 223 | static void mv_otg_start_periphrals(struct mv_otg *mvotg, int on) |
224 | { | 224 | { |
225 | struct usb_phy *otg = &mvotg->otg; | 225 | struct usb_otg *otg = mvotg->phy.otg; |
226 | 226 | ||
227 | if (!otg->gadget) | 227 | if (!otg->gadget) |
228 | return; | 228 | return; |
229 | 229 | ||
230 | dev_info(otg->dev, "gadget %s\n", on ? "on" : "off"); | 230 | dev_info(mvotg->phy.dev, "gadget %s\n", on ? "on" : "off"); |
231 | 231 | ||
232 | if (on) | 232 | if (on) |
233 | usb_gadget_vbus_connect(otg->gadget); | 233 | usb_gadget_vbus_connect(otg->gadget); |
@@ -343,69 +343,69 @@ static void mv_otg_update_inputs(struct mv_otg *mvotg) | |||
343 | static void mv_otg_update_state(struct mv_otg *mvotg) | 343 | static void mv_otg_update_state(struct mv_otg *mvotg) |
344 | { | 344 | { |
345 | struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; | 345 | struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; |
346 | struct usb_phy *otg = &mvotg->otg; | 346 | struct usb_phy *phy = &mvotg->phy; |
347 | int old_state = otg->state; | 347 | int old_state = phy->state; |
348 | 348 | ||
349 | switch (old_state) { | 349 | switch (old_state) { |
350 | case OTG_STATE_UNDEFINED: | 350 | case OTG_STATE_UNDEFINED: |
351 | otg->state = OTG_STATE_B_IDLE; | 351 | phy->state = OTG_STATE_B_IDLE; |
352 | /* FALL THROUGH */ | 352 | /* FALL THROUGH */ |
353 | case OTG_STATE_B_IDLE: | 353 | case OTG_STATE_B_IDLE: |
354 | if (otg_ctrl->id == 0) | 354 | if (otg_ctrl->id == 0) |
355 | otg->state = OTG_STATE_A_IDLE; | 355 | phy->state = OTG_STATE_A_IDLE; |
356 | else if (otg_ctrl->b_sess_vld) | 356 | else if (otg_ctrl->b_sess_vld) |
357 | otg->state = OTG_STATE_B_PERIPHERAL; | 357 | phy->state = OTG_STATE_B_PERIPHERAL; |
358 | break; | 358 | break; |
359 | case OTG_STATE_B_PERIPHERAL: | 359 | case OTG_STATE_B_PERIPHERAL: |
360 | if (!otg_ctrl->b_sess_vld || otg_ctrl->id == 0) | 360 | if (!otg_ctrl->b_sess_vld || otg_ctrl->id == 0) |
361 | otg->state = OTG_STATE_B_IDLE; | 361 | phy->state = OTG_STATE_B_IDLE; |
362 | break; | 362 | break; |
363 | case OTG_STATE_A_IDLE: | 363 | case OTG_STATE_A_IDLE: |
364 | if (otg_ctrl->id) | 364 | if (otg_ctrl->id) |
365 | otg->state = OTG_STATE_B_IDLE; | 365 | phy->state = OTG_STATE_B_IDLE; |
366 | else if (!(otg_ctrl->a_bus_drop) && | 366 | else if (!(otg_ctrl->a_bus_drop) && |
367 | (otg_ctrl->a_bus_req || otg_ctrl->a_srp_det)) | 367 | (otg_ctrl->a_bus_req || otg_ctrl->a_srp_det)) |
368 | otg->state = OTG_STATE_A_WAIT_VRISE; | 368 | phy->state = OTG_STATE_A_WAIT_VRISE; |
369 | break; | 369 | break; |
370 | case OTG_STATE_A_WAIT_VRISE: | 370 | case OTG_STATE_A_WAIT_VRISE: |
371 | if (otg_ctrl->a_vbus_vld) | 371 | if (otg_ctrl->a_vbus_vld) |
372 | otg->state = OTG_STATE_A_WAIT_BCON; | 372 | phy->state = OTG_STATE_A_WAIT_BCON; |
373 | break; | 373 | break; |
374 | case OTG_STATE_A_WAIT_BCON: | 374 | case OTG_STATE_A_WAIT_BCON: |
375 | if (otg_ctrl->id || otg_ctrl->a_bus_drop | 375 | if (otg_ctrl->id || otg_ctrl->a_bus_drop |
376 | || otg_ctrl->a_wait_bcon_timeout) { | 376 | || otg_ctrl->a_wait_bcon_timeout) { |
377 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); | 377 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); |
378 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; | 378 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; |
379 | otg->state = OTG_STATE_A_WAIT_VFALL; | 379 | phy->state = OTG_STATE_A_WAIT_VFALL; |
380 | otg_ctrl->a_bus_req = 0; | 380 | otg_ctrl->a_bus_req = 0; |
381 | } else if (!otg_ctrl->a_vbus_vld) { | 381 | } else if (!otg_ctrl->a_vbus_vld) { |
382 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); | 382 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); |
383 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; | 383 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; |
384 | otg->state = OTG_STATE_A_VBUS_ERR; | 384 | phy->state = OTG_STATE_A_VBUS_ERR; |
385 | } else if (otg_ctrl->b_conn) { | 385 | } else if (otg_ctrl->b_conn) { |
386 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); | 386 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); |
387 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; | 387 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; |
388 | otg->state = OTG_STATE_A_HOST; | 388 | phy->state = OTG_STATE_A_HOST; |
389 | } | 389 | } |
390 | break; | 390 | break; |
391 | case OTG_STATE_A_HOST: | 391 | case OTG_STATE_A_HOST: |
392 | if (otg_ctrl->id || !otg_ctrl->b_conn | 392 | if (otg_ctrl->id || !otg_ctrl->b_conn |
393 | || otg_ctrl->a_bus_drop) | 393 | || otg_ctrl->a_bus_drop) |
394 | otg->state = OTG_STATE_A_WAIT_BCON; | 394 | phy->state = OTG_STATE_A_WAIT_BCON; |
395 | else if (!otg_ctrl->a_vbus_vld) | 395 | else if (!otg_ctrl->a_vbus_vld) |
396 | otg->state = OTG_STATE_A_VBUS_ERR; | 396 | phy->state = OTG_STATE_A_VBUS_ERR; |
397 | break; | 397 | break; |
398 | case OTG_STATE_A_WAIT_VFALL: | 398 | case OTG_STATE_A_WAIT_VFALL: |
399 | if (otg_ctrl->id | 399 | if (otg_ctrl->id |
400 | || (!otg_ctrl->b_conn && otg_ctrl->a_sess_vld) | 400 | || (!otg_ctrl->b_conn && otg_ctrl->a_sess_vld) |
401 | || otg_ctrl->a_bus_req) | 401 | || otg_ctrl->a_bus_req) |
402 | otg->state = OTG_STATE_A_IDLE; | 402 | phy->state = OTG_STATE_A_IDLE; |
403 | break; | 403 | break; |
404 | case OTG_STATE_A_VBUS_ERR: | 404 | case OTG_STATE_A_VBUS_ERR: |
405 | if (otg_ctrl->id || otg_ctrl->a_clr_err | 405 | if (otg_ctrl->id || otg_ctrl->a_clr_err |
406 | || otg_ctrl->a_bus_drop) { | 406 | || otg_ctrl->a_bus_drop) { |
407 | otg_ctrl->a_clr_err = 0; | 407 | otg_ctrl->a_clr_err = 0; |
408 | otg->state = OTG_STATE_A_WAIT_VFALL; | 408 | phy->state = OTG_STATE_A_WAIT_VFALL; |
409 | } | 409 | } |
410 | break; | 410 | break; |
411 | default: | 411 | default: |
@@ -416,15 +416,17 @@ static void mv_otg_update_state(struct mv_otg *mvotg) | |||
416 | static void mv_otg_work(struct work_struct *work) | 416 | static void mv_otg_work(struct work_struct *work) |
417 | { | 417 | { |
418 | struct mv_otg *mvotg; | 418 | struct mv_otg *mvotg; |
419 | struct usb_phy *otg; | 419 | struct usb_phy *phy; |
420 | struct usb_otg *otg; | ||
420 | int old_state; | 421 | int old_state; |
421 | 422 | ||
422 | mvotg = container_of((struct delayed_work *)work, struct mv_otg, work); | 423 | mvotg = container_of((struct delayed_work *)work, struct mv_otg, work); |
423 | 424 | ||
424 | run: | 425 | run: |
425 | /* work queue is single thread, or we need spin_lock to protect */ | 426 | /* work queue is single thread, or we need spin_lock to protect */ |
426 | otg = &mvotg->otg; | 427 | phy = &mvotg->phy; |
427 | old_state = otg->state; | 428 | otg = phy->otg; |
429 | old_state = phy->state; | ||
428 | 430 | ||
429 | if (!mvotg->active) | 431 | if (!mvotg->active) |
430 | return; | 432 | return; |
@@ -432,14 +434,14 @@ run: | |||
432 | mv_otg_update_inputs(mvotg); | 434 | mv_otg_update_inputs(mvotg); |
433 | mv_otg_update_state(mvotg); | 435 | mv_otg_update_state(mvotg); |
434 | 436 | ||
435 | if (old_state != otg->state) { | 437 | if (old_state != phy->state) { |
436 | dev_info(&mvotg->pdev->dev, "change from state %s to %s\n", | 438 | dev_info(&mvotg->pdev->dev, "change from state %s to %s\n", |
437 | state_string[old_state], | 439 | state_string[old_state], |
438 | state_string[otg->state]); | 440 | state_string[phy->state]); |
439 | 441 | ||
440 | switch (otg->state) { | 442 | switch (phy->state) { |
441 | case OTG_STATE_B_IDLE: | 443 | case OTG_STATE_B_IDLE: |
442 | mvotg->otg.default_a = 0; | 444 | otg->default_a = 0; |
443 | if (old_state == OTG_STATE_B_PERIPHERAL) | 445 | if (old_state == OTG_STATE_B_PERIPHERAL) |
444 | mv_otg_start_periphrals(mvotg, 0); | 446 | mv_otg_start_periphrals(mvotg, 0); |
445 | mv_otg_reset(mvotg); | 447 | mv_otg_reset(mvotg); |
@@ -450,14 +452,14 @@ run: | |||
450 | mv_otg_start_periphrals(mvotg, 1); | 452 | mv_otg_start_periphrals(mvotg, 1); |
451 | break; | 453 | break; |
452 | case OTG_STATE_A_IDLE: | 454 | case OTG_STATE_A_IDLE: |
453 | mvotg->otg.default_a = 1; | 455 | otg->default_a = 1; |
454 | mv_otg_enable(mvotg); | 456 | mv_otg_enable(mvotg); |
455 | if (old_state == OTG_STATE_A_WAIT_VFALL) | 457 | if (old_state == OTG_STATE_A_WAIT_VFALL) |
456 | mv_otg_start_host(mvotg, 0); | 458 | mv_otg_start_host(mvotg, 0); |
457 | mv_otg_reset(mvotg); | 459 | mv_otg_reset(mvotg); |
458 | break; | 460 | break; |
459 | case OTG_STATE_A_WAIT_VRISE: | 461 | case OTG_STATE_A_WAIT_VRISE: |
460 | mv_otg_set_vbus(&mvotg->otg, 1); | 462 | mv_otg_set_vbus(otg, 1); |
461 | break; | 463 | break; |
462 | case OTG_STATE_A_WAIT_BCON: | 464 | case OTG_STATE_A_WAIT_BCON: |
463 | if (old_state != OTG_STATE_A_HOST) | 465 | if (old_state != OTG_STATE_A_HOST) |
@@ -479,7 +481,7 @@ run: | |||
479 | * here. In fact, it need host driver to notify us. | 481 | * here. In fact, it need host driver to notify us. |
480 | */ | 482 | */ |
481 | mvotg->otg_ctrl.b_conn = 0; | 483 | mvotg->otg_ctrl.b_conn = 0; |
482 | mv_otg_set_vbus(&mvotg->otg, 0); | 484 | mv_otg_set_vbus(otg, 0); |
483 | break; | 485 | break; |
484 | case OTG_STATE_A_VBUS_ERR: | 486 | case OTG_STATE_A_VBUS_ERR: |
485 | break; | 487 | break; |
@@ -548,8 +550,8 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr, | |||
548 | return -1; | 550 | return -1; |
549 | 551 | ||
550 | /* We will use this interface to change to A device */ | 552 | /* We will use this interface to change to A device */ |
551 | if (mvotg->otg.state != OTG_STATE_B_IDLE | 553 | if (mvotg->phy.state != OTG_STATE_B_IDLE |
552 | && mvotg->otg.state != OTG_STATE_A_IDLE) | 554 | && mvotg->phy.state != OTG_STATE_A_IDLE) |
553 | return -1; | 555 | return -1; |
554 | 556 | ||
555 | /* The clock may disabled and we need to set irq for ID detected */ | 557 | /* The clock may disabled and we need to set irq for ID detected */ |
@@ -579,7 +581,7 @@ set_a_clr_err(struct device *dev, struct device_attribute *attr, | |||
579 | const char *buf, size_t count) | 581 | const char *buf, size_t count) |
580 | { | 582 | { |
581 | struct mv_otg *mvotg = dev_get_drvdata(dev); | 583 | struct mv_otg *mvotg = dev_get_drvdata(dev); |
582 | if (!mvotg->otg.default_a) | 584 | if (!mvotg->phy.otg->default_a) |
583 | return -1; | 585 | return -1; |
584 | 586 | ||
585 | if (count > 2) | 587 | if (count > 2) |
@@ -615,7 +617,7 @@ set_a_bus_drop(struct device *dev, struct device_attribute *attr, | |||
615 | const char *buf, size_t count) | 617 | const char *buf, size_t count) |
616 | { | 618 | { |
617 | struct mv_otg *mvotg = dev_get_drvdata(dev); | 619 | struct mv_otg *mvotg = dev_get_drvdata(dev); |
618 | if (!mvotg->otg.default_a) | 620 | if (!mvotg->phy.otg->default_a) |
619 | return -1; | 621 | return -1; |
620 | 622 | ||
621 | if (count > 2) | 623 | if (count > 2) |
@@ -688,9 +690,10 @@ int mv_otg_remove(struct platform_device *pdev) | |||
688 | for (clk_i = 0; clk_i <= mvotg->clknum; clk_i++) | 690 | for (clk_i = 0; clk_i <= mvotg->clknum; clk_i++) |
689 | clk_put(mvotg->clk[clk_i]); | 691 | clk_put(mvotg->clk[clk_i]); |
690 | 692 | ||
691 | otg_set_transceiver(NULL); | 693 | usb_set_transceiver(NULL); |
692 | platform_set_drvdata(pdev, NULL); | 694 | platform_set_drvdata(pdev, NULL); |
693 | 695 | ||
696 | kfree(mvotg->phy.otg); | ||
694 | kfree(mvotg); | 697 | kfree(mvotg); |
695 | 698 | ||
696 | return 0; | 699 | return 0; |
@@ -700,6 +703,7 @@ static int mv_otg_probe(struct platform_device *pdev) | |||
700 | { | 703 | { |
701 | struct mv_usb_platform_data *pdata = pdev->dev.platform_data; | 704 | struct mv_usb_platform_data *pdata = pdev->dev.platform_data; |
702 | struct mv_otg *mvotg; | 705 | struct mv_otg *mvotg; |
706 | struct usb_otg *otg; | ||
703 | struct resource *r; | 707 | struct resource *r; |
704 | int retval = 0, clk_i, i; | 708 | int retval = 0, clk_i, i; |
705 | size_t size; | 709 | size_t size; |
@@ -716,6 +720,12 @@ static int mv_otg_probe(struct platform_device *pdev) | |||
716 | return -ENOMEM; | 720 | return -ENOMEM; |
717 | } | 721 | } |
718 | 722 | ||
723 | otg = kzalloc(sizeof *otg, GFP_KERNEL); | ||
724 | if (!otg) { | ||
725 | kfree(mvotg); | ||
726 | return -ENOMEM; | ||
727 | } | ||
728 | |||
719 | platform_set_drvdata(pdev, mvotg); | 729 | platform_set_drvdata(pdev, mvotg); |
720 | 730 | ||
721 | mvotg->pdev = pdev; | 731 | mvotg->pdev = pdev; |
@@ -741,12 +751,15 @@ static int mv_otg_probe(struct platform_device *pdev) | |||
741 | 751 | ||
742 | /* OTG common part */ | 752 | /* OTG common part */ |
743 | mvotg->pdev = pdev; | 753 | mvotg->pdev = pdev; |
744 | mvotg->otg.dev = &pdev->dev; | 754 | mvotg->phy.dev = &pdev->dev; |
745 | mvotg->otg.label = driver_name; | 755 | mvotg->phy.otg = otg; |
746 | mvotg->otg.set_host = mv_otg_set_host; | 756 | mvotg->phy.label = driver_name; |
747 | mvotg->otg.set_peripheral = mv_otg_set_peripheral; | 757 | mvotg->phy.state = OTG_STATE_UNDEFINED; |
748 | mvotg->otg.set_vbus = mv_otg_set_vbus; | 758 | |
749 | mvotg->otg.state = OTG_STATE_UNDEFINED; | 759 | otg->phy = &mvotg->phy; |
760 | otg->set_host = mv_otg_set_host; | ||
761 | otg->set_peripheral = mv_otg_set_peripheral; | ||
762 | otg->set_vbus = mv_otg_set_vbus; | ||
750 | 763 | ||
751 | for (i = 0; i < OTG_TIMER_NUM; i++) | 764 | for (i = 0; i < OTG_TIMER_NUM; i++) |
752 | init_timer(&mvotg->otg_ctrl.timer[i]); | 765 | init_timer(&mvotg->otg_ctrl.timer[i]); |
@@ -840,7 +853,7 @@ static int mv_otg_probe(struct platform_device *pdev) | |||
840 | goto err_disable_clk; | 853 | goto err_disable_clk; |
841 | } | 854 | } |
842 | 855 | ||
843 | retval = otg_set_transceiver(&mvotg->otg); | 856 | retval = usb_set_transceiver(&mvotg->phy); |
844 | if (retval < 0) { | 857 | if (retval < 0) { |
845 | dev_err(&pdev->dev, "can't register transceiver, %d\n", | 858 | dev_err(&pdev->dev, "can't register transceiver, %d\n", |
846 | retval); | 859 | retval); |
@@ -867,7 +880,7 @@ static int mv_otg_probe(struct platform_device *pdev) | |||
867 | return 0; | 880 | return 0; |
868 | 881 | ||
869 | err_set_transceiver: | 882 | err_set_transceiver: |
870 | otg_set_transceiver(NULL); | 883 | usb_set_transceiver(NULL); |
871 | err_free_irq: | 884 | err_free_irq: |
872 | free_irq(mvotg->irq, mvotg); | 885 | free_irq(mvotg->irq, mvotg); |
873 | err_disable_clk: | 886 | err_disable_clk: |
@@ -888,6 +901,7 @@ err_put_clk: | |||
888 | clk_put(mvotg->clk[clk_i]); | 901 | clk_put(mvotg->clk[clk_i]); |
889 | 902 | ||
890 | platform_set_drvdata(pdev, NULL); | 903 | platform_set_drvdata(pdev, NULL); |
904 | kfree(otg); | ||
891 | kfree(mvotg); | 905 | kfree(mvotg); |
892 | 906 | ||
893 | return retval; | 907 | return retval; |
@@ -898,10 +912,10 @@ static int mv_otg_suspend(struct platform_device *pdev, pm_message_t state) | |||
898 | { | 912 | { |
899 | struct mv_otg *mvotg = platform_get_drvdata(pdev); | 913 | struct mv_otg *mvotg = platform_get_drvdata(pdev); |
900 | 914 | ||
901 | if (mvotg->otg.state != OTG_STATE_B_IDLE) { | 915 | if (mvotg->phy.state != OTG_STATE_B_IDLE) { |
902 | dev_info(&pdev->dev, | 916 | dev_info(&pdev->dev, |
903 | "OTG state is not B_IDLE, it is %d!\n", | 917 | "OTG state is not B_IDLE, it is %d!\n", |
904 | mvotg->otg.state); | 918 | mvotg->phy.state); |
905 | return -EAGAIN; | 919 | return -EAGAIN; |
906 | } | 920 | } |
907 | 921 | ||
diff --git a/drivers/usb/otg/mv_otg.h b/drivers/usb/otg/mv_otg.h index a74ee07a2727..8a9e351b36ba 100644 --- a/drivers/usb/otg/mv_otg.h +++ b/drivers/usb/otg/mv_otg.h | |||
@@ -136,7 +136,7 @@ struct mv_otg_regs { | |||
136 | }; | 136 | }; |
137 | 137 | ||
138 | struct mv_otg { | 138 | struct mv_otg { |
139 | struct usb_phy otg; | 139 | struct usb_phy phy; |
140 | struct mv_otg_ctrl otg_ctrl; | 140 | struct mv_otg_ctrl otg_ctrl; |
141 | 141 | ||
142 | /* base address */ | 142 | /* base address */ |