]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00221217 usb: device: fix usb_state incorrect problem after pc sends resume
authorPeter Chen <peter.chen@freescale.com>
Thu, 23 Aug 2012 08:29:55 +0000 (16:29 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:35:17 +0000 (08:35 +0200)
At pc sends suspend/resume case, the udc_controller->usb_state should
keep unchange during the suspend/resume process, at former code, the
fsl_udc_resume set udc_controller->usb_state to USB_STATE_ATTACHED
unconditionally. In fact, USB_STATE_ATTACHED stands for initial state
and should be set when we try to run controller.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
drivers/usb/gadget/arcotg_udc.c

index b6b6190b4da1231f4242136f28157c315657b5d1..405dbcc05a8f9d8b981e4fb08bfaec29a407eab9 100755 (executable)
@@ -68,7 +68,6 @@
 #define cpu_to_hc32(x) cpu_to_le32((x))
 #define hc32_to_cpu(x) le32_to_cpu((x))
 #endif
-
 #define        DMA_ADDR_INVALID        (~(dma_addr_t)0)
 DEFINE_MUTEX(udc_resume_mutex);
 extern void usb_debounce_id_vbus(void);
@@ -473,6 +472,9 @@ static void dr_controller_run(struct fsl_udc *udc)
 {
        u32 temp;
 
+       udc_controller->usb_state = USB_STATE_ATTACHED;
+       udc_controller->ep0_dir = 0;
+
        fsl_platform_pullup_enable(udc->pdata);
 
        /* Enable DR irq reg */
@@ -2445,8 +2447,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
                dr_controller_run(udc_controller);
                if (udc_controller->stopped)
                        dr_clk_gate(false);
-               udc_controller->usb_state = USB_STATE_ATTACHED;
-               udc_controller->ep0_dir = 0;
        }
        printk(KERN_INFO "%s: bind to driver %s \n",
                        udc_controller->gadget.name, driver->driver.name);
@@ -3485,9 +3485,6 @@ static int fsl_udc_resume(struct platform_device *pdev)
                dr_controller_setup(udc_controller);
                dr_controller_run(udc_controller);
        }
-       udc_controller->usb_state = USB_STATE_ATTACHED;
-       udc_controller->ep0_dir = 0;
-
 end:
        /* if udc is resume by otg id change and no device
         * connecting to the otg, otg will enter low power mode*/