diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/usb/otg/fsl_otg.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'drivers/usb/otg/fsl_otg.c')
-rw-r--r-- | drivers/usb/otg/fsl_otg.c | 150 |
1 files changed, 68 insertions, 82 deletions
diff --git a/drivers/usb/otg/fsl_otg.c b/drivers/usb/otg/fsl_otg.c index d16adb41eb2..0f420b25e9a 100644 --- a/drivers/usb/otg/fsl_otg.c +++ b/drivers/usb/otg/fsl_otg.c | |||
@@ -275,7 +275,7 @@ void b_srp_end(unsigned long foo) | |||
275 | fsl_otg_dischrg_vbus(0); | 275 | fsl_otg_dischrg_vbus(0); |
276 | srp_wait_done = 1; | 276 | srp_wait_done = 1; |
277 | 277 | ||
278 | if ((fsl_otg_dev->phy.state == OTG_STATE_B_SRP_INIT) && | 278 | if ((fsl_otg_dev->otg.state == OTG_STATE_B_SRP_INIT) && |
279 | fsl_otg_dev->fsm.b_sess_vld) | 279 | fsl_otg_dev->fsm.b_sess_vld) |
280 | fsl_otg_dev->fsm.b_srp_done = 1; | 280 | fsl_otg_dev->fsm.b_srp_done = 1; |
281 | } | 281 | } |
@@ -288,7 +288,7 @@ void b_srp_end(unsigned long foo) | |||
288 | void a_wait_enum(unsigned long foo) | 288 | void a_wait_enum(unsigned long foo) |
289 | { | 289 | { |
290 | VDBG("a_wait_enum timeout\n"); | 290 | VDBG("a_wait_enum timeout\n"); |
291 | if (!fsl_otg_dev->phy.otg->host->b_hnp_enable) | 291 | if (!fsl_otg_dev->otg.host->b_hnp_enable) |
292 | fsl_otg_add_timer(a_wait_enum_tmr); | 292 | fsl_otg_add_timer(a_wait_enum_tmr); |
293 | else | 293 | else |
294 | otg_statemachine(&fsl_otg_dev->fsm); | 294 | otg_statemachine(&fsl_otg_dev->fsm); |
@@ -452,14 +452,14 @@ void otg_reset_controller(void) | |||
452 | /* Call suspend/resume routines in host driver */ | 452 | /* Call suspend/resume routines in host driver */ |
453 | int fsl_otg_start_host(struct otg_fsm *fsm, int on) | 453 | int fsl_otg_start_host(struct otg_fsm *fsm, int on) |
454 | { | 454 | { |
455 | struct usb_otg *otg = fsm->otg; | 455 | struct otg_transceiver *xceiv = fsm->transceiver; |
456 | struct device *dev; | 456 | struct device *dev; |
457 | struct fsl_otg *otg_dev = container_of(otg->phy, struct fsl_otg, phy); | 457 | struct fsl_otg *otg_dev = container_of(xceiv, struct fsl_otg, otg); |
458 | u32 retval = 0; | 458 | u32 retval = 0; |
459 | 459 | ||
460 | if (!otg->host) | 460 | if (!xceiv->host) |
461 | return -ENODEV; | 461 | return -ENODEV; |
462 | dev = otg->host->controller; | 462 | dev = xceiv->host->controller; |
463 | 463 | ||
464 | /* | 464 | /* |
465 | * Update a_vbus_vld state as a_vbus_vld int is disabled | 465 | * Update a_vbus_vld state as a_vbus_vld int is disabled |
@@ -518,14 +518,14 @@ end: | |||
518 | */ | 518 | */ |
519 | int fsl_otg_start_gadget(struct otg_fsm *fsm, int on) | 519 | int fsl_otg_start_gadget(struct otg_fsm *fsm, int on) |
520 | { | 520 | { |
521 | struct usb_otg *otg = fsm->otg; | 521 | struct otg_transceiver *xceiv = fsm->transceiver; |
522 | struct device *dev; | 522 | struct device *dev; |
523 | 523 | ||
524 | if (!otg->gadget || !otg->gadget->dev.parent) | 524 | if (!xceiv->gadget || !xceiv->gadget->dev.parent) |
525 | return -ENODEV; | 525 | return -ENODEV; |
526 | 526 | ||
527 | VDBG("gadget %s\n", on ? "on" : "off"); | 527 | VDBG("gadget %s\n", on ? "on" : "off"); |
528 | dev = otg->gadget->dev.parent; | 528 | dev = xceiv->gadget->dev.parent; |
529 | 529 | ||
530 | if (on) { | 530 | if (on) { |
531 | if (dev->driver->resume) | 531 | if (dev->driver->resume) |
@@ -542,18 +542,14 @@ int fsl_otg_start_gadget(struct otg_fsm *fsm, int on) | |||
542 | * Called by initialization code of host driver. Register host controller | 542 | * Called by initialization code of host driver. Register host controller |
543 | * to the OTG. Suspend host for OTG role detection. | 543 | * to the OTG. Suspend host for OTG role detection. |
544 | */ | 544 | */ |
545 | static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) | 545 | static int fsl_otg_set_host(struct otg_transceiver *otg_p, struct usb_bus *host) |
546 | { | 546 | { |
547 | struct fsl_otg *otg_dev; | 547 | struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg); |
548 | 548 | ||
549 | if (!otg) | 549 | if (!otg_p || otg_dev != fsl_otg_dev) |
550 | return -ENODEV; | 550 | return -ENODEV; |
551 | 551 | ||
552 | otg_dev = container_of(otg->phy, struct fsl_otg, phy); | 552 | otg_p->host = host; |
553 | if (otg_dev != fsl_otg_dev) | ||
554 | return -ENODEV; | ||
555 | |||
556 | otg->host = host; | ||
557 | 553 | ||
558 | otg_dev->fsm.a_bus_drop = 0; | 554 | otg_dev->fsm.a_bus_drop = 0; |
559 | otg_dev->fsm.a_bus_req = 1; | 555 | otg_dev->fsm.a_bus_req = 1; |
@@ -561,8 +557,8 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
561 | if (host) { | 557 | if (host) { |
562 | VDBG("host off......\n"); | 558 | VDBG("host off......\n"); |
563 | 559 | ||
564 | otg->host->otg_port = fsl_otg_initdata.otg_port; | 560 | otg_p->host->otg_port = fsl_otg_initdata.otg_port; |
565 | otg->host->is_b_host = otg_dev->fsm.id; | 561 | otg_p->host->is_b_host = otg_dev->fsm.id; |
566 | /* | 562 | /* |
567 | * must leave time for khubd to finish its thing | 563 | * must leave time for khubd to finish its thing |
568 | * before yanking the host driver out from under it, | 564 | * before yanking the host driver out from under it, |
@@ -578,7 +574,7 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
578 | /* Mini-A cable connected */ | 574 | /* Mini-A cable connected */ |
579 | struct otg_fsm *fsm = &otg_dev->fsm; | 575 | struct otg_fsm *fsm = &otg_dev->fsm; |
580 | 576 | ||
581 | otg->phy->state = OTG_STATE_UNDEFINED; | 577 | otg_p->state = OTG_STATE_UNDEFINED; |
582 | fsm->protocol = PROTO_UNDEF; | 578 | fsm->protocol = PROTO_UNDEF; |
583 | } | 579 | } |
584 | } | 580 | } |
@@ -591,32 +587,29 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
591 | } | 587 | } |
592 | 588 | ||
593 | /* Called by initialization code of udc. Register udc to OTG. */ | 589 | /* Called by initialization code of udc. Register udc to OTG. */ |
594 | static int fsl_otg_set_peripheral(struct usb_otg *otg, | 590 | static int fsl_otg_set_peripheral(struct otg_transceiver *otg_p, |
595 | struct usb_gadget *gadget) | 591 | struct usb_gadget *gadget) |
596 | { | 592 | { |
597 | struct fsl_otg *otg_dev; | 593 | struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg); |
598 | 594 | ||
599 | if (!otg) | ||
600 | return -ENODEV; | ||
601 | |||
602 | otg_dev = container_of(otg->phy, struct fsl_otg, phy); | ||
603 | VDBG("otg_dev 0x%x\n", (int)otg_dev); | 595 | VDBG("otg_dev 0x%x\n", (int)otg_dev); |
604 | VDBG("fsl_otg_dev 0x%x\n", (int)fsl_otg_dev); | 596 | VDBG("fsl_otg_dev 0x%x\n", (int)fsl_otg_dev); |
605 | if (otg_dev != fsl_otg_dev) | 597 | |
598 | if (!otg_p || otg_dev != fsl_otg_dev) | ||
606 | return -ENODEV; | 599 | return -ENODEV; |
607 | 600 | ||
608 | if (!gadget) { | 601 | if (!gadget) { |
609 | if (!otg->default_a) | 602 | if (!otg_dev->otg.default_a) |
610 | otg->gadget->ops->vbus_draw(otg->gadget, 0); | 603 | otg_p->gadget->ops->vbus_draw(otg_p->gadget, 0); |
611 | usb_gadget_vbus_disconnect(otg->gadget); | 604 | usb_gadget_vbus_disconnect(otg_dev->otg.gadget); |
612 | otg->gadget = 0; | 605 | otg_dev->otg.gadget = 0; |
613 | otg_dev->fsm.b_bus_req = 0; | 606 | otg_dev->fsm.b_bus_req = 0; |
614 | otg_statemachine(&otg_dev->fsm); | 607 | otg_statemachine(&otg_dev->fsm); |
615 | return 0; | 608 | return 0; |
616 | } | 609 | } |
617 | 610 | ||
618 | otg->gadget = gadget; | 611 | otg_p->gadget = gadget; |
619 | otg->gadget->is_a_peripheral = !otg_dev->fsm.id; | 612 | otg_p->gadget->is_a_peripheral = !otg_dev->fsm.id; |
620 | 613 | ||
621 | otg_dev->fsm.b_bus_req = 1; | 614 | otg_dev->fsm.b_bus_req = 1; |
622 | 615 | ||
@@ -632,11 +625,11 @@ static int fsl_otg_set_peripheral(struct usb_otg *otg, | |||
632 | } | 625 | } |
633 | 626 | ||
634 | /* Set OTG port power, only for B-device */ | 627 | /* Set OTG port power, only for B-device */ |
635 | static int fsl_otg_set_power(struct usb_phy *phy, unsigned mA) | 628 | static int fsl_otg_set_power(struct otg_transceiver *otg_p, unsigned mA) |
636 | { | 629 | { |
637 | if (!fsl_otg_dev) | 630 | if (!fsl_otg_dev) |
638 | return -ENODEV; | 631 | return -ENODEV; |
639 | if (phy->state == OTG_STATE_B_PERIPHERAL) | 632 | if (otg_p->state == OTG_STATE_B_PERIPHERAL) |
640 | pr_info("FSL OTG: Draw %d mA\n", mA); | 633 | pr_info("FSL OTG: Draw %d mA\n", mA); |
641 | 634 | ||
642 | return 0; | 635 | return 0; |
@@ -646,7 +639,7 @@ static int fsl_otg_set_power(struct usb_phy *phy, unsigned mA) | |||
646 | * Delayed pin detect interrupt processing. | 639 | * Delayed pin detect interrupt processing. |
647 | * | 640 | * |
648 | * When the Mini-A cable is disconnected from the board, | 641 | * When the Mini-A cable is disconnected from the board, |
649 | * the pin-detect interrupt happens before the disconnect | 642 | * the pin-detect interrupt happens before the disconnnect |
650 | * interrupts for the connected device(s). In order to | 643 | * interrupts for the connected device(s). In order to |
651 | * process the disconnect interrupt(s) prior to switching | 644 | * process the disconnect interrupt(s) prior to switching |
652 | * roles, the pin-detect interrupts are delayed, and handled | 645 | * roles, the pin-detect interrupts are delayed, and handled |
@@ -665,15 +658,12 @@ static void fsl_otg_event(struct work_struct *work) | |||
665 | } | 658 | } |
666 | 659 | ||
667 | /* B-device start SRP */ | 660 | /* B-device start SRP */ |
668 | static int fsl_otg_start_srp(struct usb_otg *otg) | 661 | static int fsl_otg_start_srp(struct otg_transceiver *otg_p) |
669 | { | 662 | { |
670 | struct fsl_otg *otg_dev; | 663 | struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg); |
671 | 664 | ||
672 | if (!otg || otg->phy->state != OTG_STATE_B_IDLE) | 665 | if (!otg_p || otg_dev != fsl_otg_dev |
673 | return -ENODEV; | 666 | || otg_p->state != OTG_STATE_B_IDLE) |
674 | |||
675 | otg_dev = container_of(otg->phy, struct fsl_otg, phy); | ||
676 | if (otg_dev != fsl_otg_dev) | ||
677 | return -ENODEV; | 667 | return -ENODEV; |
678 | 668 | ||
679 | otg_dev->fsm.b_bus_req = 1; | 669 | otg_dev->fsm.b_bus_req = 1; |
@@ -683,15 +673,11 @@ static int fsl_otg_start_srp(struct usb_otg *otg) | |||
683 | } | 673 | } |
684 | 674 | ||
685 | /* A_host suspend will call this function to start hnp */ | 675 | /* A_host suspend will call this function to start hnp */ |
686 | static int fsl_otg_start_hnp(struct usb_otg *otg) | 676 | static int fsl_otg_start_hnp(struct otg_transceiver *otg_p) |
687 | { | 677 | { |
688 | struct fsl_otg *otg_dev; | 678 | struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg); |
689 | |||
690 | if (!otg) | ||
691 | return -ENODEV; | ||
692 | 679 | ||
693 | otg_dev = container_of(otg->phy, struct fsl_otg, phy); | 680 | if (!otg_p || otg_dev != fsl_otg_dev) |
694 | if (otg_dev != fsl_otg_dev) | ||
695 | return -ENODEV; | 681 | return -ENODEV; |
696 | 682 | ||
697 | DBG("start_hnp...n"); | 683 | DBG("start_hnp...n"); |
@@ -712,7 +698,7 @@ static int fsl_otg_start_hnp(struct usb_otg *otg) | |||
712 | irqreturn_t fsl_otg_isr(int irq, void *dev_id) | 698 | irqreturn_t fsl_otg_isr(int irq, void *dev_id) |
713 | { | 699 | { |
714 | struct otg_fsm *fsm = &((struct fsl_otg *)dev_id)->fsm; | 700 | struct otg_fsm *fsm = &((struct fsl_otg *)dev_id)->fsm; |
715 | struct usb_otg *otg = ((struct fsl_otg *)dev_id)->phy.otg; | 701 | struct otg_transceiver *otg = &((struct fsl_otg *)dev_id)->otg; |
716 | u32 otg_int_src, otg_sc; | 702 | u32 otg_int_src, otg_sc; |
717 | 703 | ||
718 | otg_sc = fsl_readl(&usb_dr_regs->otgsc); | 704 | otg_sc = fsl_readl(&usb_dr_regs->otgsc); |
@@ -788,12 +774,6 @@ static int fsl_otg_conf(struct platform_device *pdev) | |||
788 | if (!fsl_otg_tc) | 774 | if (!fsl_otg_tc) |
789 | return -ENOMEM; | 775 | return -ENOMEM; |
790 | 776 | ||
791 | fsl_otg_tc->phy.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL); | ||
792 | if (!fsl_otg_tc->phy.otg) { | ||
793 | kfree(fsl_otg_tc); | ||
794 | return -ENOMEM; | ||
795 | } | ||
796 | |||
797 | INIT_DELAYED_WORK(&fsl_otg_tc->otg_event, fsl_otg_event); | 777 | INIT_DELAYED_WORK(&fsl_otg_tc->otg_event, fsl_otg_event); |
798 | 778 | ||
799 | INIT_LIST_HEAD(&active_timers); | 779 | INIT_LIST_HEAD(&active_timers); |
@@ -808,19 +788,17 @@ static int fsl_otg_conf(struct platform_device *pdev) | |||
808 | fsl_otg_tc->fsm.ops = &fsl_otg_ops; | 788 | fsl_otg_tc->fsm.ops = &fsl_otg_ops; |
809 | 789 | ||
810 | /* initialize the otg structure */ | 790 | /* initialize the otg structure */ |
811 | fsl_otg_tc->phy.label = DRIVER_DESC; | 791 | fsl_otg_tc->otg.label = DRIVER_DESC; |
812 | fsl_otg_tc->phy.set_power = fsl_otg_set_power; | 792 | fsl_otg_tc->otg.set_host = fsl_otg_set_host; |
813 | 793 | fsl_otg_tc->otg.set_peripheral = fsl_otg_set_peripheral; | |
814 | fsl_otg_tc->phy.otg->phy = &fsl_otg_tc->phy; | 794 | fsl_otg_tc->otg.set_power = fsl_otg_set_power; |
815 | fsl_otg_tc->phy.otg->set_host = fsl_otg_set_host; | 795 | fsl_otg_tc->otg.start_hnp = fsl_otg_start_hnp; |
816 | fsl_otg_tc->phy.otg->set_peripheral = fsl_otg_set_peripheral; | 796 | fsl_otg_tc->otg.start_srp = fsl_otg_start_srp; |
817 | fsl_otg_tc->phy.otg->start_hnp = fsl_otg_start_hnp; | ||
818 | fsl_otg_tc->phy.otg->start_srp = fsl_otg_start_srp; | ||
819 | 797 | ||
820 | fsl_otg_dev = fsl_otg_tc; | 798 | fsl_otg_dev = fsl_otg_tc; |
821 | 799 | ||
822 | /* Store the otg transceiver */ | 800 | /* Store the otg transceiver */ |
823 | status = usb_add_phy(&fsl_otg_tc->phy, USB_PHY_TYPE_USB2); | 801 | status = otg_set_transceiver(&fsl_otg_tc->otg); |
824 | if (status) { | 802 | if (status) { |
825 | pr_warn(FSL_OTG_NAME ": unable to register OTG transceiver.\n"); | 803 | pr_warn(FSL_OTG_NAME ": unable to register OTG transceiver.\n"); |
826 | goto err; | 804 | goto err; |
@@ -829,7 +807,6 @@ static int fsl_otg_conf(struct platform_device *pdev) | |||
829 | return 0; | 807 | return 0; |
830 | err: | 808 | err: |
831 | fsl_otg_uninit_timers(); | 809 | fsl_otg_uninit_timers(); |
832 | kfree(fsl_otg_tc->phy.otg); | ||
833 | kfree(fsl_otg_tc); | 810 | kfree(fsl_otg_tc); |
834 | return status; | 811 | return status; |
835 | } | 812 | } |
@@ -838,19 +815,19 @@ err: | |||
838 | int usb_otg_start(struct platform_device *pdev) | 815 | int usb_otg_start(struct platform_device *pdev) |
839 | { | 816 | { |
840 | struct fsl_otg *p_otg; | 817 | struct fsl_otg *p_otg; |
841 | struct usb_phy *otg_trans = usb_get_phy(USB_PHY_TYPE_USB2); | 818 | struct otg_transceiver *otg_trans = otg_get_transceiver(); |
842 | struct otg_fsm *fsm; | 819 | struct otg_fsm *fsm; |
843 | int status; | 820 | int status; |
844 | struct resource *res; | 821 | struct resource *res; |
845 | u32 temp; | 822 | u32 temp; |
846 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; | 823 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; |
847 | 824 | ||
848 | p_otg = container_of(otg_trans, struct fsl_otg, phy); | 825 | p_otg = container_of(otg_trans, struct fsl_otg, otg); |
849 | fsm = &p_otg->fsm; | 826 | fsm = &p_otg->fsm; |
850 | 827 | ||
851 | /* Initialize the state machine structure with default values */ | 828 | /* Initialize the state machine structure with default values */ |
852 | SET_OTG_STATE(otg_trans, OTG_STATE_UNDEFINED); | 829 | SET_OTG_STATE(otg_trans, OTG_STATE_UNDEFINED); |
853 | fsm->otg = p_otg->phy.otg; | 830 | fsm->transceiver = &p_otg->otg; |
854 | 831 | ||
855 | /* We don't require predefined MEM/IRQ resource index */ | 832 | /* We don't require predefined MEM/IRQ resource index */ |
856 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 833 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -880,10 +857,9 @@ int usb_otg_start(struct platform_device *pdev) | |||
880 | status = request_irq(p_otg->irq, fsl_otg_isr, | 857 | status = request_irq(p_otg->irq, fsl_otg_isr, |
881 | IRQF_SHARED, driver_name, p_otg); | 858 | IRQF_SHARED, driver_name, p_otg); |
882 | if (status) { | 859 | if (status) { |
883 | dev_dbg(p_otg->phy.dev, "can't get IRQ %d, error %d\n", | 860 | dev_dbg(p_otg->otg.dev, "can't get IRQ %d, error %d\n", |
884 | p_otg->irq, status); | 861 | p_otg->irq, status); |
885 | iounmap(p_otg->dr_mem_map); | 862 | iounmap(p_otg->dr_mem_map); |
886 | kfree(p_otg->phy.otg); | ||
887 | kfree(p_otg); | 863 | kfree(p_otg); |
888 | return status; | 864 | return status; |
889 | } | 865 | } |
@@ -943,10 +919,10 @@ int usb_otg_start(struct platform_device *pdev) | |||
943 | * Also: record initial state of ID pin | 919 | * Also: record initial state of ID pin |
944 | */ | 920 | */ |
945 | if (fsl_readl(&p_otg->dr_mem_map->otgsc) & OTGSC_STS_USB_ID) { | 921 | if (fsl_readl(&p_otg->dr_mem_map->otgsc) & OTGSC_STS_USB_ID) { |
946 | p_otg->phy.state = OTG_STATE_UNDEFINED; | 922 | p_otg->otg.state = OTG_STATE_UNDEFINED; |
947 | p_otg->fsm.id = 1; | 923 | p_otg->fsm.id = 1; |
948 | } else { | 924 | } else { |
949 | p_otg->phy.state = OTG_STATE_A_IDLE; | 925 | p_otg->otg.state = OTG_STATE_A_IDLE; |
950 | p_otg->fsm.id = 0; | 926 | p_otg->fsm.id = 0; |
951 | } | 927 | } |
952 | 928 | ||
@@ -1002,7 +978,7 @@ static int show_fsl_usb2_otg_state(struct device *dev, | |||
1002 | /* State */ | 978 | /* State */ |
1003 | t = scnprintf(next, size, | 979 | t = scnprintf(next, size, |
1004 | "OTG state: %s\n\n", | 980 | "OTG state: %s\n\n", |
1005 | otg_state_string(fsl_otg_dev->phy.state)); | 981 | otg_state_string(fsl_otg_dev->otg.state)); |
1006 | size -= t; | 982 | size -= t; |
1007 | next += t; | 983 | next += t; |
1008 | 984 | ||
@@ -1110,7 +1086,7 @@ static const struct file_operations otg_fops = { | |||
1110 | .release = fsl_otg_release, | 1086 | .release = fsl_otg_release, |
1111 | }; | 1087 | }; |
1112 | 1088 | ||
1113 | static int fsl_otg_probe(struct platform_device *pdev) | 1089 | static int __devinit fsl_otg_probe(struct platform_device *pdev) |
1114 | { | 1090 | { |
1115 | int ret; | 1091 | int ret; |
1116 | 1092 | ||
@@ -1144,17 +1120,16 @@ static int fsl_otg_probe(struct platform_device *pdev) | |||
1144 | return ret; | 1120 | return ret; |
1145 | } | 1121 | } |
1146 | 1122 | ||
1147 | static int fsl_otg_remove(struct platform_device *pdev) | 1123 | static int __devexit fsl_otg_remove(struct platform_device *pdev) |
1148 | { | 1124 | { |
1149 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; | 1125 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; |
1150 | 1126 | ||
1151 | usb_remove_phy(&fsl_otg_dev->phy); | 1127 | otg_set_transceiver(NULL); |
1152 | free_irq(fsl_otg_dev->irq, fsl_otg_dev); | 1128 | free_irq(fsl_otg_dev->irq, fsl_otg_dev); |
1153 | 1129 | ||
1154 | iounmap((void *)usb_dr_regs); | 1130 | iounmap((void *)usb_dr_regs); |
1155 | 1131 | ||
1156 | fsl_otg_uninit_timers(); | 1132 | fsl_otg_uninit_timers(); |
1157 | kfree(fsl_otg_dev->phy.otg); | ||
1158 | kfree(fsl_otg_dev); | 1133 | kfree(fsl_otg_dev); |
1159 | 1134 | ||
1160 | device_remove_file(&pdev->dev, &dev_attr_fsl_usb2_otg_state); | 1135 | device_remove_file(&pdev->dev, &dev_attr_fsl_usb2_otg_state); |
@@ -1169,14 +1144,25 @@ static int fsl_otg_remove(struct platform_device *pdev) | |||
1169 | 1144 | ||
1170 | struct platform_driver fsl_otg_driver = { | 1145 | struct platform_driver fsl_otg_driver = { |
1171 | .probe = fsl_otg_probe, | 1146 | .probe = fsl_otg_probe, |
1172 | .remove = fsl_otg_remove, | 1147 | .remove = __devexit_p(fsl_otg_remove), |
1173 | .driver = { | 1148 | .driver = { |
1174 | .name = driver_name, | 1149 | .name = driver_name, |
1175 | .owner = THIS_MODULE, | 1150 | .owner = THIS_MODULE, |
1176 | }, | 1151 | }, |
1177 | }; | 1152 | }; |
1178 | 1153 | ||
1179 | module_platform_driver(fsl_otg_driver); | 1154 | static int __init fsl_usb_otg_init(void) |
1155 | { | ||
1156 | pr_info(DRIVER_INFO "\n"); | ||
1157 | return platform_driver_register(&fsl_otg_driver); | ||
1158 | } | ||
1159 | module_init(fsl_usb_otg_init); | ||
1160 | |||
1161 | static void __exit fsl_usb_otg_exit(void) | ||
1162 | { | ||
1163 | platform_driver_unregister(&fsl_otg_driver); | ||
1164 | } | ||
1165 | module_exit(fsl_usb_otg_exit); | ||
1180 | 1166 | ||
1181 | MODULE_DESCRIPTION(DRIVER_INFO); | 1167 | MODULE_DESCRIPTION(DRIVER_INFO); |
1182 | MODULE_AUTHOR(DRIVER_AUTHOR); | 1168 | MODULE_AUTHOR(DRIVER_AUTHOR); |