Skip to content

Commit

Permalink
usb: gadget: tegra_udc: Enable controller on driver probe
Browse files Browse the repository at this point in the history
Fixes defunct IRQ when probed with inactive VBUS.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
  • Loading branch information
digetx committed Apr 29, 2016
1 parent d55b30e commit a785109
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions drivers/usb/gadget/udc/tegra_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2427,29 +2427,33 @@ static int tegra_udc_probe(struct platform_device *pdev)
if (!udc->ahb_gizmo)
goto err_del_udc;

/* Create work for controlling clocks to the phy if otg is disabled */
INIT_WORK(&udc->irq_work, tegra_udc_irq_work);

dr_controller_run(udc);

err = usb_add_gadget_udc_release(&pdev->dev, &udc->gadget,
tegra_udc_release);
if (err)
goto err_del_udc;

/* Create work for controlling clocks to the phy if otg is disabled */
INIT_WORK(&udc->irq_work, tegra_udc_irq_work);

#ifdef CONFIG_USB_OTG_UTILS
udc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);

if (udc->transceiver) {
#else
if (!vbus_enabled(udc)) {
#endif
dr_controller_stop(udc);
dr_controller_reset(udc);
usb_phy_set_suspend(udc->phy, 1);
udc->vbus_active = 0;
udc->usb_state = USB_STATE_DEFAULT;
#ifdef CONFIG_USB_OTG_UTILS
otg_set_peripheral(udc->transceiver->otg, &udc->gadget);
#endif
}
#else
/* Power down the phy if cable is not connected */
if (!vbus_enabled(udc))
usb_phy_set_suspend(udc->phy, 1);
#ifndef CONFIG_USB_OTG_UTILS
else
wake_lock(&udc->wakelock);
#endif
Expand Down

0 comments on commit a785109

Please sign in to comment.