Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364573
b: refs/heads/master
c: f122d33
h: refs/heads/master
i:
  364571: e1f4860
v: v3
  • Loading branch information
Felipe Balbi committed Mar 18, 2013
1 parent d608306 commit 9927c9b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4c0c6d0085337549e1b4fc97d9616eae732049d6
refs/heads/master: f122d33e4b0045a42238b9a4c3943adf7e8313c1
32 changes: 17 additions & 15 deletions trunk/drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,6 @@ static int dwc3_core_init(struct dwc3 *dwc)

dwc3_writel(dwc->regs, DWC3_GCTL, reg);

ret = dwc3_event_buffers_setup(dwc);
if (ret) {
dev_err(dwc->dev, "failed to setup event buffers\n");
goto err0;
}

return 0;

err0:
Expand All @@ -351,8 +345,6 @@ static int dwc3_core_init(struct dwc3 *dwc)

static void dwc3_core_exit(struct dwc3 *dwc)
{
dwc3_event_buffers_cleanup(dwc);

usb_phy_shutdown(dwc->usb2_phy);
usb_phy_shutdown(dwc->usb3_phy);
}
Expand Down Expand Up @@ -480,6 +472,12 @@ static int dwc3_probe(struct platform_device *pdev)
goto err0;
}

ret = dwc3_event_buffers_setup(dwc);
if (ret) {
dev_err(dwc->dev, "failed to setup event buffers\n");
goto err1;
}

mode = DWC3_MODE(dwc->hwparams.hwparams0);

switch (mode) {
Expand All @@ -488,48 +486,48 @@ static int dwc3_probe(struct platform_device *pdev)
ret = dwc3_gadget_init(dwc);
if (ret) {
dev_err(dev, "failed to initialize gadget\n");
goto err1;
goto err2;
}
break;
case DWC3_MODE_HOST:
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
ret = dwc3_host_init(dwc);
if (ret) {
dev_err(dev, "failed to initialize host\n");
goto err1;
goto err2;
}
break;
case DWC3_MODE_DRD:
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG);
ret = dwc3_host_init(dwc);
if (ret) {
dev_err(dev, "failed to initialize host\n");
goto err1;
goto err2;
}

ret = dwc3_gadget_init(dwc);
if (ret) {
dev_err(dev, "failed to initialize gadget\n");
goto err1;
goto err2;
}
break;
default:
dev_err(dev, "Unsupported mode of operation %d\n", mode);
goto err1;
goto err2;
}
dwc->mode = mode;

ret = dwc3_debugfs_init(dwc);
if (ret) {
dev_err(dev, "failed to initialize debugfs\n");
goto err2;
goto err3;
}

pm_runtime_allow(dev);

return 0;

err2:
err3:
switch (mode) {
case DWC3_MODE_DEVICE:
dwc3_gadget_exit(dwc);
Expand All @@ -546,6 +544,9 @@ static int dwc3_probe(struct platform_device *pdev)
break;
}

err2:
dwc3_event_buffers_cleanup(dwc);

err1:
dwc3_core_exit(dwc);

Expand Down Expand Up @@ -583,6 +584,7 @@ static int dwc3_remove(struct platform_device *pdev)
break;
}

dwc3_event_buffers_cleanup(dwc);
dwc3_free_event_buffers(dwc);
dwc3_core_exit(dwc);

Expand Down

0 comments on commit 9927c9b

Please sign in to comment.