goto out;
}
- if (udc_controller->transceiver)
- otg_set_peripheral(udc_controller->transceiver, &udc_controller->gadget);
-
/* Enable DR IRQ reg and Set usbcmd reg Run bit */
- dr_controller_run(udc_controller);
- udc_controller->usb_state = USB_STATE_ATTACHED;
- udc_controller->ep0_state = WAIT_FOR_SETUP;
- udc_controller->ep0_dir = 0;
+ if (!udc_controller->transceiver) {
+ dr_controller_run(udc_controller);
+ udc_controller->usb_state = USB_STATE_ATTACHED;
+ udc_controller->ep0_state = WAIT_FOR_SETUP;
+ udc_controller->ep0_dir = 0;
+ }
+
printk(KERN_INFO "%s: bind to driver %s\n",
udc_controller->gadget.name, driver->driver.name);
if (!driver || driver != udc_controller->driver || !driver->unbind)
return -EINVAL;
- if (udc_controller->transceiver)
- otg_set_peripheral(udc_controller->transceiver, NULL);
-
/* stop DR, disable intr */
dr_controller_stop(udc_controller);
#ifdef CONFIG_USB_OTG_UTILS
udc_controller->transceiver = otg_get_transceiver();
- if (udc_controller->transceiver)
- udc_controller->vbus_active = 1;
+ if (udc_controller->transceiver) {
+ dr_controller_stop(udc_controller);
+ fsl_udc_clk_suspend();
+ udc_controller->vbus_active = 0;
+ udc_controller->usb_state = USB_STATE_DEFAULT;
+ otg_set_peripheral(udc_controller->transceiver, &udc_controller->gadget);
+ }
#else
#ifdef CONFIG_ARCH_TEGRA
/* Power down the phy if cable is not connected */
return -ENODEV;
udc_controller->done = &done;
+ if (udc_controller->transceiver)
+ otg_set_peripheral(udc_controller->transceiver, NULL);
+
fsl_udc_clk_release();
/* DR has been stopped in usb_gadget_unregister_driver() */