aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea/udc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/chipidea/udc.c')
-rw-r--r--drivers/usb/chipidea/udc.c39
1 files changed, 1 insertions, 38 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index b157c95f7a36..2bb7d18ef2d5 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -20,7 +20,6 @@
20#include <linux/pm_runtime.h> 20#include <linux/pm_runtime.h>
21#include <linux/usb/ch9.h> 21#include <linux/usb/ch9.h>
22#include <linux/usb/gadget.h> 22#include <linux/usb/gadget.h>
23#include <linux/usb/otg.h>
24#include <linux/usb/chipidea.h> 23#include <linux/usb/chipidea.h>
25 24
26#include "ci.h" 25#include "ci.h"
@@ -1790,34 +1789,9 @@ static int udc_start(struct ci_hdrc *ci)
1790 1789
1791 ci->gadget.ep0 = &ci->ep0in->ep; 1790 ci->gadget.ep0 = &ci->ep0in->ep;
1792 1791
1793 if (ci->global_phy) {
1794 ci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
1795 if (IS_ERR(ci->transceiver))
1796 ci->transceiver = NULL;
1797 }
1798
1799 if (ci->platdata->flags & CI_HDRC_REQUIRE_TRANSCEIVER) {
1800 if (ci->transceiver == NULL) {
1801 retval = -ENODEV;
1802 goto destroy_eps;
1803 }
1804 }
1805
1806 if (ci->transceiver) {
1807 retval = otg_set_peripheral(ci->transceiver->otg,
1808 &ci->gadget);
1809 /*
1810 * If we implement all USB functions using chipidea drivers,
1811 * it doesn't need to call above API, meanwhile, if we only
1812 * use gadget function, calling above API is useless.
1813 */
1814 if (retval && retval != -ENOTSUPP)
1815 goto put_transceiver;
1816 }
1817
1818 retval = usb_add_gadget_udc(dev, &ci->gadget); 1792 retval = usb_add_gadget_udc(dev, &ci->gadget);
1819 if (retval) 1793 if (retval)
1820 goto remove_trans; 1794 goto destroy_eps;
1821 1795
1822 pm_runtime_no_callbacks(&ci->gadget.dev); 1796 pm_runtime_no_callbacks(&ci->gadget.dev);
1823 pm_runtime_enable(&ci->gadget.dev); 1797 pm_runtime_enable(&ci->gadget.dev);
@@ -1827,17 +1801,6 @@ static int udc_start(struct ci_hdrc *ci)
1827 1801
1828 return retval; 1802 return retval;
1829 1803
1830remove_trans:
1831 if (ci->transceiver) {
1832 otg_set_peripheral(ci->transceiver->otg, NULL);
1833 if (ci->global_phy)
1834 usb_put_phy(ci->transceiver);
1835 }
1836
1837 dev_err(dev, "error = %i\n", retval);
1838put_transceiver:
1839 if (ci->transceiver && ci->global_phy)
1840 usb_put_phy(ci->transceiver);
1841destroy_eps: 1804destroy_eps:
1842 destroy_eps(ci); 1805 destroy_eps(ci);
1843free_pools: 1806free_pools: