Merge tag 'gadget-for-v3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
[firefly-linux-kernel-4.4.55.git] / drivers / usb / gadget / fsl_udc_core.c
index 8db5a666e2abb1265bb0e1ad35f3e7e530e2be05..b30e21fdbb1bd0db7800b5789909839495073946 100644 (file)
@@ -1216,7 +1216,7 @@ static int fsl_vbus_draw(struct usb_gadget *gadget, unsigned mA)
 
        udc = container_of(gadget, struct fsl_udc, gadget);
        if (udc->transceiver)
-               return otg_set_power(udc->transceiver, mA);
+               return usb_phy_set_power(udc->transceiver, mA);
        return -ENOTSUPP;
 }
 
@@ -1429,7 +1429,7 @@ static void setup_received_irq(struct fsl_udc *udc,
                        int pipe = get_pipe_by_windex(wIndex);
                        struct fsl_ep *ep;
 
-                       if (wValue != 0 || wLength != 0 || pipe > udc->max_ep)
+                       if (wValue != 0 || wLength != 0 || pipe >= udc->max_ep)
                                break;
                        ep = get_ep_by_pipe(udc, pipe);
 
@@ -1672,7 +1672,7 @@ static void dtd_complete_irq(struct fsl_udc *udc)
        if (!bit_pos)
                return;
 
-       for (i = 0; i < udc->max_ep * 2; i++) {
+       for (i = 0; i < udc->max_ep; i++) {
                ep_num = i >> 1;
                direction = i % 2;
 
@@ -1965,7 +1965,8 @@ static int fsl_start(struct usb_gadget_driver *driver,
 
                /* connect to bus through transceiver */
                if (udc_controller->transceiver) {
-                       retval = otg_set_peripheral(udc_controller->transceiver,
+                       retval = otg_set_peripheral(
+                                       udc_controller->transceiver->otg,
                                                    &udc_controller->gadget);
                        if (retval < 0) {
                                ERR("can't bind to transceiver\n");
@@ -2005,7 +2006,7 @@ static int fsl_stop(struct usb_gadget_driver *driver)
                return -EINVAL;
 
        if (udc_controller->transceiver)
-               otg_set_peripheral(udc_controller->transceiver, NULL);
+               otg_set_peripheral(udc_controller->transceiver->otg, NULL);
 
        /* stop DR, disable intr */
        dr_controller_stop(udc_controller);
@@ -2429,7 +2430,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
 
 #ifdef CONFIG_USB_OTG
        if (pdata->operating_mode == FSL_USB2_DR_OTG) {
-               udc_controller->transceiver = otg_get_transceiver();
+               udc_controller->transceiver = usb_get_transceiver();
                if (!udc_controller->transceiver) {
                        ERR("Can't find OTG driver!\n");
                        ret = -ENODEV;