From a8d0003fdd82dedd80e724b33605121672f5f988 Mon Sep 17 00:00:00 2001 From: Venkat Moganty Date: Wed, 5 May 2010 22:18:11 +0530 Subject: fsl udc: Fix cable connect/disconnect checking On VBUS interrupt irq acknowledges the VBUS interrupt and schedules the work thread for powering/up down the USB phy and clocks based on the VBUS status. But, in the work thread instead of checking the VBUS status directly, rechecking the interrupt status which is already disabled. This is fixed by checking the vbus status only in the work thread for controlling the power up/down sequence. Due to the disconnect problem power numbers increased when there is no USB cable connected to the system. Bug 682756 Bug 682727 Change-Id: Id1c5b3cd1f2f195c4dfadf397e1f8650bf9da12b Reviewed-on: http://git-master/r/1300 Reviewed-by: Gary King Tested-by: Gary King --- drivers/usb/gadget/fsl_udc_core.c | 44 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index cbf6313585c3..7f4149747b1a 100755 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -1883,30 +1883,28 @@ static void fsl_udc_irq_work(struct work_struct* irq_work) * mark the vbus active shadow. */ temp = fsl_readl(&usb_sys_regs->vbus_wakeup); - if (temp & USB_SYS_VBUS_WAKEUP_INT_STATUS) { - if (temp & USB_SYS_VBUS_STATUS) { - udc->vbus_active = 1; - platform_udc_clk_resume(); - /* Schedule work to wait for 100msec and check for - * charger if setup packet is not received */ - schedule_delayed_work(&udc->work, - USB_CHARGER_DETECTION_WAIT_TIME_MS); - /* printk("USB cable connected\n"); */ - } else { - /* If cable disconnected, cancel any delayed work */ - cancel_delayed_work(&udc->work); - spin_lock(&udc->lock); - reset_queues(udc); - spin_unlock(&udc->lock); - udc->vbus_active = 0; - udc->usb_state = USB_STATE_DEFAULT; - platform_udc_clk_suspend(); - if (udc->vbus_regulator) { - /* set the current limit to 0mA */ - regulator_set_current_limit(udc->vbus_regulator, 0, 0); - } - /* printk("USB cable dis-connected\n"); */ + if (temp & USB_SYS_VBUS_STATUS) { + udc->vbus_active = 1; + platform_udc_clk_resume(); + /* Schedule work to wait for 100msec and check for + * charger if setup packet is not received */ + schedule_delayed_work(&udc->work, + USB_CHARGER_DETECTION_WAIT_TIME_MS); + /* printk("USB cable connected\n"); */ + } else { + /* If cable disconnected, cancel any delayed work */ + cancel_delayed_work(&udc->work); + spin_lock(&udc->lock); + reset_queues(udc); + spin_unlock(&udc->lock); + udc->vbus_active = 0; + udc->usb_state = USB_STATE_DEFAULT; + platform_udc_clk_suspend(); + if (udc->vbus_regulator) { + /* set the current limit to 0mA */ + regulator_set_current_limit(udc->vbus_regulator, 0, 0); } + /* printk("USB cable dis-connected\n"); */ } } } -- cgit v1.2.3